diff --git a/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js b/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js index 7d237b059..37d84a670 100644 --- a/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js +++ b/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js @@ -43,7 +43,7 @@ return'<% if (!hide) { %>\r\n
\ !0)},closeInsideMode:function(){this.pluginsPanel&&(this.iframePlugin&&(this.currentPluginFrame.empty(),this.iframePlugin=null),this.currentPluginPanel.toggleClass("hidden",!0),this.fireEvent("plugin:open",[this,"onboard","close"]))},openedPluginMode:function(t){var e=this.storePlugins.findWhere({guid:t});if(e){var i=e.get("button");i&&(i.toggle(!0),i.menu&&i.menu.items.length>0&&i.menu.items[0].setCaption(this.textStop))}},closedPluginMode:function(t){var e=this.storePlugins.findWhere({guid:t});if(e){var i=e.get("button");i&&(i.toggle(!1),i.menu&&i.menu.items.length>0&&i.menu.items[0].setCaption(this.textStart))}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},_onAppReady:function(t){},createPluginButton:function(t){if(!t.get("visible"))return null;var e=this,i=t.get("variations"),n=t.get("guid"),o=i[t.get("currentVariation")].get("icons"),s=t.get("baseUrl")+o[(window.devicePixelRatio>1?1:0)+(o.length>2?2:0)],a=[];_.each(t.get("variations"),function(t,i){t.get("visible")&&a.push({caption:i>0?t.get("description"):e.textStart,value:parseInt(t.get("index"))})});var l=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconImg:s,caption:t.get("name"),menu:a.length>1,split:a.length>1,value:n,hint:t.get("name")});return l.split&&(l.setMenu(new Common.UI.Menu({items:a,pluginGuid:t.get("guid")})),l.menu.on("item:click",function(t,i,n){e.fireEvent("plugin:select",[t.options.pluginGuid,i.value])})),l.on("click",function(t,i){e.fireEvent("plugin:select",[t.options.value,0])}),t.set("button",l),e.lockedControls.push(l),l},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},strPlugins:"Plugins",textLoading:"Loading",textStart:"Start",textStop:"Stop",groupCaption:"Plugins"},Common.Views.Plugins||{})),Common.Views.PluginDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{header:!0,enableKeyEvents:!1},t);var i=e.buttons&&_.size(e.buttons)>0?85:34;e.header||(i-=34),this.bordersOffset=40,e.width=Common.Utils.innerWidth()-2*this.bordersOffset-e.width<0?Common.Utils.innerWidth()-2*this.bordersOffset:e.width,e.height+=i,e.height=Common.Utils.innerHeight()-2*this.bordersOffset-e.height<0?Common.Utils.innerHeight()-2*this.bordersOffset:e.height,e.cls+=" advanced-settings-dlg",this.template=['
','
',"
",'<% if ((typeof buttons !== "undefined") && _.size(buttons) > 0) { %>','
','","<% } %>"].join(""),e.tpl=_.template(this.template)(e),this.url=t.url||"",this.frameId=t.frameId||"plugin_iframe",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"}),this.boxEl=this.$window.find(".body > .box"),this._headerFooterHeight=this.options.buttons&&_.size(this.options.buttons)>0?85:34,this.options.header||(this._headerFooterHeight-=34),this._headerFooterHeight+=parseInt(this.$window.css("border-top-width"))+parseInt(this.$window.css("border-bottom-width"));var t=document.createElement("iframe");t.id=this.frameId,t.name="pluginFrameEditor",t.width="100%",t.height="100%",t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this);var e=this;setTimeout(function(){e.isLoaded||(e.loadMask=new Common.UI.LoadMask({owner:$("#id-plugin-placeholder")}),e.loadMask.setTitle(e.textLoading),e.loadMask.show(),e.isLoaded&&e.loadMask.hide())},500),t.src=this.url,$("#id-plugin-placeholder").append(t),this.on("resizing",function(t){e.boxEl.css("height",parseInt(e.$window.css("height"))-e._headerFooterHeight)});var i=function(){e.onWindowResize()};$(window).on("resize",i),this.on("close",function(){$(window).off("resize",i)})},_onLoad:function(){this.isLoaded=!0,this.loadMask&&this.loadMask.hide()},setInnerSize:function(t,e){var i=Common.Utils.innerHeight(),n=Common.Utils.innerWidth(),o=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width")),s=2*this.bordersOffset;i-se-o&&this.$window.css("top",e-o-n),st-o&&this.$window.css("left",t-o-i)}else n>e-2*o&&(this.setHeight(Math.max(e-2*o,this.initConfig.minheight)),this.boxEl.css("height",Math.max(e-2*o,this.initConfig.minheight)-this._headerFooterHeight),this.$window.css("top",o)),i>t-2*o&&(this.setWidth(Math.max(t-2*o,this.initConfig.minwidth)),this.$window.css("left",o))},textLoading:"Loading"},Common.Views.PluginDlg||{}))}),define("common/main/lib/view/SearchDialog",["common/main/lib/component/Window"],function(){"use strict";Common.UI.SearchDialog=Common.UI.Window.extend(_.extend({options:{width:550,title:"Search & Replace",modal:!1,cls:"search",toolclose:"hide",alias:"SearchDialog"},initialize:function(t){_.extend(this.options,t||{}),this.template=['
','
','','',"
",'
','',"
",'
','","
","
",'
','"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){return Common.UI.Window.prototype.render.call(this),this.miMatchCase=new Common.UI.MenuItem({caption:this.textMatchCase,checkable:!0}),this.miMatchWord=new Common.UI.MenuItem({caption:this.options.matchwordstr||this.textWholeWords,checkable:!0}),this.miHighlight=new Common.UI.MenuItem({caption:this.textHighlight,checkable:!0}),this.btnOptions=new Common.UI.Button({id:"search-btn-options",cls:"btn-toolbar",iconCls:"btn-settings",menu:new Common.UI.Menu({items:[this.miMatchCase,this.miMatchWord,this.miHighlight]})}),this.options.extraoptions&&(this.btnOptions.menu.addItem({caption:"--"}),this.options.extraoptions.forEach(function(t){this.btnOptions.menu.addItem(t)},this)),this.btnOptions.render(this.$window.find("#search-placeholder-btn-options")),this.options.matchcase||this.miMatchCase.hide(),this.options.matchword||this.miMatchWord.hide(),this.options.markresult?this.options.markresult.applied&&this.miHighlight.setChecked(!0,!0):this.miHighlight.hide(),"search"===this.options.mode&&$(this.$window.find(".input-row").get(2)).hide(),this.txtSearch=this.$window.find("#sd-text-search"),this.txtReplace=this.$window.find("#sd-text-replace"),this.lblReplace=this.$window.find("#search-label-replace"),this.miHighlight.on("toggle",_.bind(this.onHighlight,this)),this.$window.find(".btn[result=back]").on("click",_.bind(this.onBtnClick,this,"back")),this.$window.find(".btn[result=next]").on("click",_.bind(this.onBtnClick,this,"next")),this.$window.find(".btn[result=replace]").on("click",_.bind(this.onBtnClick,this,"replace")),this.$window.find(".btn[result=replaceall]").on("click",_.bind(this.onBtnClick,this,"replaceall")),this.$window.find("label[result=replaceshow]").on("click",_.bind(this.onShowReplace,this)),this.txtSearch.on("keydown",null,"search",_.bind(this.onKeyPress,this)),this.txtReplace.on("keydown",null,"replace",_.bind(this.onKeyPress,this)),this.on("animate:before",_.bind(this.focus,this)),this},show:function(t,e){Common.UI.Window.prototype.show.call(this),!this.mode&&!t&&(t="search"),t&&this.mode!=t&&this.setMode(t),e&&this.setSearchText(e),this.options.markresult&&this.miHighlight.checked&&this.fireEvent("search:highlight",[this,!0]),this.focus()},focus:function(){var t=this;setTimeout(function(){t.txtSearch.focus(),t.txtSearch.select()},10)},onKeyPress:function(t){this.isLocked()||(t.keyCode==Common.UI.Keys.RETURN?("search"==t.data?this.onBtnClick("next",t):"replace"==t.data&&"replace"==this.mode&&this.onBtnClick("replace",t),t.preventDefault(),t.stopPropagation()):t.keyCode==Common.UI.Keys.ESC&&$(".asc-loadmask").length<1&&(this.hide(),t.preventDefault(),t.stopPropagation()))},onBtnClick:function(t,e){if(!$(".asc-loadmask").length){var i={textsearch:this.txtSearch.val(),textreplace:this.txtReplace.val(),matchcase:this.miMatchCase.checked,matchword:this.miMatchWord.checked,highlight:this.miHighlight.checked};this.fireEvent("search:"+t,[this,i])}},setMode:function(t){this.mode=t;var e=this.$window.find(".input-row");"no-replace"===t?(this.setTitle(this.textTitle2),e.eq(1).hide(),e.eq(2).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.options.matchcase||this.options.matchword||this.options.markresult||(this.txtSearch.addClass("clear"),this.btnOptions.hide()),this.menuLookin&&this.menuLookin.menu.items[1].setDisabled(!1),this.setHeight(170)):(this.txtSearch.removeClass("clear"),this.setTitle(this.textTitle),"search"===t?(e.eq(2).show(),this.lblReplace.text(this.txtBtnReplace),e.eq(1).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.menuLookin&&this.menuLookin.menu.items[1].setDisabled(!1),this.setHeight(200)):(e.eq(2).show(),this.lblReplace.text(this.txtBtnHideReplace),e.eq(1).show(),this.$window.find(".btn[result=replace]").show(),this.$window.find(".btn[result=replaceall]").show(),this.menuLookin&&(this.menuLookin.menu.items[0].setChecked(!0),this.menuLookin.menu.items[1].setDisabled(!0)),this.setHeight(230)))},setSearchText:function(t){this.txtSearch&&this.txtSearch.val(t)},onShowReplace:function(t){this.setMode("replace"==this.mode?"search":"replace");var e=this;_.defer(function(){"replace"==e.mode?e.txtReplace.focus():e.txtSearch.focus()},300)},onHighlight:function(t,e){this.fireEvent("search:highlight",[this,e])},getSettings:function(){return{textsearch:this.txtSearch.val(),matchcase:this.miMatchCase.checked,matchword:this.miMatchWord.checked}},textTitle:"Search & Replace",textTitle2:"Search",txtBtnReplace:"Replace",txtBtnReplaceAll:"Replace All",textMatchCase:"Case sensitive",textWholeWords:"Whole words only",textHighlight:"Highlight results",textReplaceDef:"Enter the replacement text",textSearchStart:"Enter text for search",txtBtnHideReplace:"Hide Replace"},Common.UI.SearchDialog||{}))}),define("text!presentationeditor/main/app/template/FileMenu.template",[],function(){return'
\r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
  • \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/FileMenu",["text!presentationeditor/main/app/template/FileMenu.template","underscore","common/main/lib/component/BaseView"],function(t,e){"use strict";PE.Views.FileMenu=Common.UI.BaseView.extend(e.extend({el:"#file-menu-panel",options:{alias:"FileMenu"},template:e.template(t),events:function(){return{"click .fm-btn":e.bind(function(t){var i=$(t.currentTarget);if(!i.hasClass("disabled")){i.hasClass("active")||($(".fm-btn",this.el).removeClass("active"),i.addClass("active"));var n=e.findWhere(this.items,{el:t.currentTarget});if(n){var o=this.panels[n.options.action];this.fireEvent("item:click",[this,n.options.action,!!o]),o&&(this.$el.find(".content-box:visible").hide(),this.active=n.options.action,o.show())}}},this)}},initialize:function(){},render:function(){this.$el=$(this.el),this.$el.html(this.template()),this.miSave=new Common.UI.MenuItem({el:$("#fm-btn-save",this.el),action:"save",caption:this.btnSaveCaption,canFocused:!1,disabled:!0}),this.miEdit=new Common.UI.MenuItem({el:$("#fm-btn-edit",this.el),action:"edit",caption:this.btnToEditCaption,canFocused:!1}),this.miDownload=new Common.UI.MenuItem({el:$("#fm-btn-download",this.el),action:"saveas",caption:this.btnDownloadCaption,canFocused:!1}),this.miSaveCopyAs=new Common.UI.MenuItem({el:$("#fm-btn-save-copy",this.el),action:"save-copy",caption:this.btnSaveCopyAsCaption,canFocused:!1}),this.miSaveAs=new Common.UI.MenuItem({el:$("#fm-btn-save-desktop",this.el),action:"save-desktop",caption:this.btnSaveAsCaption,canFocused:!1}),this.miPrint=new Common.UI.MenuItem({el:$("#fm-btn-print",this.el),action:"print",caption:this.btnPrintCaption,canFocused:!1}),this.miRename=new Common.UI.MenuItem({el:$("#fm-btn-rename",this.el),action:"rename",caption:this.btnRenameCaption,canFocused:!1}),this.miProtect=new Common.UI.MenuItem({el:$("#fm-btn-protect",this.el),action:"protect",caption:this.btnProtectCaption,canFocused:!1}),this.miRecent=new Common.UI.MenuItem({el:$("#fm-btn-recent",this.el),action:"recent",caption:this.btnRecentFilesCaption,canFocused:!1}),this.miNew=new Common.UI.MenuItem({el:$("#fm-btn-create",this.el),action:"new",caption:this.btnCreateNewCaption,canFocused:!1}),this.miAccess=new Common.UI.MenuItem({el:$("#fm-btn-rights",this.el),action:"rights",caption:this.btnRightsCaption,canFocused:!1}),this.miHelp=new Common.UI.MenuItem({el:$("#fm-btn-help",this.el),action:"help",caption:this.btnHelpCaption,canFocused:!1}),this.items=[],this.items.push(new Common.UI.MenuItem({el:$("#fm-btn-return",this.el),action:"back",caption:this.btnCloseMenuCaption,canFocused:!1}),this.miSave,this.miEdit,this.miDownload,this.miSaveCopyAs,this.miSaveAs,this.miPrint,this.miRename,this.miProtect,this.miRecent,this.miNew,new Common.UI.MenuItem({el:$("#fm-btn-info",this.el),action:"info",caption:this.btnInfoCaption,canFocused:!1}),this.miAccess,new Common.UI.MenuItem({el:$("#fm-btn-settings",this.el),action:"opts",caption:this.btnSettingsCaption,canFocused:!1}),this.miHelp,new Common.UI.MenuItem({el:$("#fm-btn-back",this.el),action:"exit",caption:this.btnBackCaption,canFocused:!1}));var t=this;return t.panels={opts:new PE.Views.FileMenuPanels.Settings({menu:t}).render(),info:new PE.Views.FileMenuPanels.DocumentInfo({menu:t}).render(),rights:new PE.Views.FileMenuPanels.DocumentRights({menu:t}).render()},t.$el.find(".content-box").hide(),this},show:function(t){if((!this.isVisible()||void 0!==t)&&this.mode){var e=!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline?"info":"saveas";t||(t=this.active||e),this.$el.show(),this.selectMenu(t,e),this.api&&this.api.asc_enableKeyEvents(!1),this.fireEvent("menu:show",[this])}},hide:function(){this.$el.hide(),this.fireEvent("menu:hide",[this]),this.api&&this.api.asc_enableKeyEvents(!0)},applyMode:function(){this.miDownload[!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline?"hide":"show"]();var t=!!window.AscDesktopEditor&&window.AscDesktopEditor.isBlockchainSupport();this.miSaveCopyAs[!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline||!this.mode.canRequestSaveAs&&!this.mode.saveAsUrl||t?"hide":"show"](),this.miSaveAs[this.mode.canDownload&&this.mode.isDesktopApp&&this.mode.isOffline?"show":"hide"](),this.miSave[this.mode.isEdit?"show":"hide"](),this.miEdit[!this.mode.isEdit&&this.mode.canEdit&&this.mode.canRequestEditRights?"show":"hide"](),this.miPrint[this.mode.canPrint?"show":"hide"](),this.miRename[this.mode.canRename&&!this.mode.isDesktopApp?"show":"hide"](),this.miProtect[this.mode.canProtect?"show":"hide"]();var e=this.mode.canDownload||this.mode.isEdit||this.mode.canPrint||this.mode.canProtect||!this.mode.isEdit&&this.mode.canEdit&&this.mode.canRequestEditRights||this.mode.canRename&&!this.mode.isDesktopApp;this.miProtect.$el.find("+.devider")[e&&!this.mode.isDisconnected?"show":"hide"](),this.miRecent[this.mode.canOpenRecent?"show":"hide"](),this.miNew[this.mode.canCreateNew?"show":"hide"](),this.miNew.$el.find("+.devider")[this.mode.canCreateNew?"show":"hide"](),this.miAccess[!this.mode.isOffline&&this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0||this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length)?"show":"hide"](),this.mode.canBack?this.$el.find("#fm-btn-back").show().prev().show():this.$el.find("#fm-btn-back").hide().prev().hide(),this.miHelp[this.mode.canHelp?"show":"hide"](),this.miHelp.$el.prev()[this.mode.canHelp?"show":"hide"](),this.panels.opts.setMode(this.mode),this.panels.info.setMode(this.mode),!this.mode.isDisconnected&&this.panels.info.updateInfo(this.document),this.panels.rights.setMode(this.mode),!this.mode.isDisconnected&&this.panels.rights.updateInfo(this.document),this.mode.canCreateNew&&this.mode.templates&&this.mode.templates.length&&($("a",this.miNew.$el).text(this.btnCreateNewCaption+"..."),this.panels.new=new PE.Views.FileMenuPanels.CreateNew({menu:this,docs:this.mode.templates}).render()),this.mode.canOpenRecent&&this.mode.recent&&(this.panels.recent=new PE.Views.FileMenuPanels.RecentFiles({menu:this,recent:this.mode.recent}).render()),this.mode.canProtect&&(this.panels.protect=new PE.Views.FileMenuPanels.ProtectDoc({menu:this}).render(),this.panels.protect.setMode(this.mode)),this.mode.canDownload&&(this.panels.saveas=new PE.Views.FileMenuPanels.ViewSaveAs({menu:this}).render()),this.mode.canDownload&&(this.mode.canRequestSaveAs||this.mode.saveAsUrl)&&(this.panels["save-copy"]=new PE.Views.FileMenuPanels.ViewSaveCopy({menu:this}).render()),this.mode.canHelp&&(this.panels.help=new PE.Views.FileMenuPanels.Help({menu:this}).render(),this.panels.help.setLangConfig(this.mode.lang))},setMode:function(t,e){t.isDisconnected?(this.mode.canEdit=this.mode.isEdit=!1,this.mode.canOpenRecent=this.mode.canCreateNew=!1,this.mode.isDisconnected=t.isDisconnected,this.mode.canRename=!1,t.enableDownload||(this.mode.canPrint=this.mode.canDownload=!1)):this.mode=t,e||this.applyMode()},setApi:function(t){this.api=t,this.panels.info.setApi(t),this.panels.protect&&this.panels.protect.setApi(t),this.api.asc_registerCallback("asc_onDocumentName",e.bind(this.onDocumentName,this))},loadDocument:function(t){this.document=t.doc},selectMenu:function(t,e){if(t){var i=this._getMenuItem(t),n=this.panels[t];!i.isDisabled()&&i.isVisible()||(i=this._getMenuItem(e),n=this.panels[e]),i&&n&&($(".fm-btn",this.el).removeClass("active"),i.$el.addClass("active"),this.$el.find(".content-box:visible").hide(),n.show(),this.active=t)}},disableMenu:function(t,e){if(t){var i=this._getMenuItem(t);i&&i.setDisabled(e)}},_getMenuItem:function(t){return e.find(this.items,function(e){return e.options.action==t})},onDocumentName:function(t){this.document.title=t,this.panels.info.updateInfo(this.document)},isVisible:function(){return!this.$el.is(":hidden")},getButton:function(t){if("save"==t)return this.miSave},btnSaveCaption:"Save",btnDownloadCaption:"Download as...",btnInfoCaption:"Document Info...",btnRightsCaption:"Access Rights...",btnCreateNewCaption:"Create New",btnRecentFilesCaption:"Open Recent...",btnPrintCaption:"Print",btnHelpCaption:"Help...",btnReturnCaption:"Back to Document",btnToEditCaption:"Edit Document",btnBackCaption:"Go to Documents",btnSettingsCaption:"Advanced Settings...",btnSaveAsCaption:"Save as",btnRenameCaption:"Rename...",btnCloseMenuCaption:"Close Menu",btnProtectCaption:"Protect",btnSaveCopyAsCaption:"Save Copy as..."},PE.Views.FileMenu||{}))}),define("presentationeditor/main/app/view/LeftMenu",["text!presentationeditor/main/app/template/LeftMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/view/About","common/main/lib/view/About","common/main/lib/view/Comments","common/main/lib/view/Chat","common/main/lib/view/Plugins","common/main/lib/view/SearchDialog","presentationeditor/main/app/view/FileMenu"],function(t,e,i,n){"use strict";PE.Views.LeftMenu=n.View.extend(i.extend({el:"#left-menu",template:i.template(t),events:function(){return{"click #left-btn-comments":i.bind(this.onCoauthOptions,this),"click #left-btn-chat":i.bind(this.onCoauthOptions,this),"click #left-btn-plugins":i.bind(this.onCoauthOptions,this),"click #left-btn-support":function(){var t=this.mode.customization;t&&t.feedback&&t.feedback.url?window.open(t.feedback.url):window.open("https://support.onlyoffice.com")}}},initialize:function(){this.minimizedMode=!0,this._state={}},render:function(){return e(this.el).html(this.template({})),this.btnSearch=new Common.UI.Button({action:"search",el:e("#left-btn-search"),hint:this.tipSearch+Common.Utils.String.platformKey("Ctrl+F"),disabled:!0,enableToggle:!0}),this.btnThumbs=new Common.UI.Button({action:"thumbs",el:e("#left-btn-thumbs"),hint:this.tipSlides,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnAbout=new Common.UI.Button({action:"about",el:e("#left-btn-about"),hint:this.tipAbout,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSupport=new Common.UI.Button({action:"support",el:e("#left-btn-support"),hint:this.tipSupport,disabled:!0}),this.btnComments=new Common.UI.Button({el:e("#left-btn-comments"),hint:this.tipComments+Common.Utils.String.platformKey("Ctrl+Shift+H"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnChat=new Common.UI.Button({el:e("#left-btn-chat"),hint:this.tipChat+Common.Utils.String.platformKey("Alt+Q"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnComments.hide(),this.btnChat.hide(),this.btnComments.on("click",i.bind(this.onBtnMenuClick,this)),this.btnChat.on("click",i.bind(this.onBtnMenuClick,this)),this.btnPlugins=new Common.UI.Button({el:e("#left-btn-plugins"),hint:this.tipPlugins,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnPlugins.hide(),this.btnPlugins.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSearch.on("click",i.bind(this.onBtnMenuClick,this)),this.btnThumbs.on("click",i.bind(this.onBtnMenuClick,this)),this.btnAbout.on("toggle",i.bind(this.onBtnMenuToggle,this)),this.btnAbout.on("click",i.bind(this.onFullMenuClick,this)),this.menuFile=new PE.Views.FileMenu({}),this.menuFile.render(),this.btnAbout.panel=new Common.Views.About({el:e("#about-menu-panel"),appName:"Presentation Editor"}).render(),this},onBtnMenuToggle:function(t,e){e?(t.panel.show(),this._state.pluginIsRunning||this.$el.width(40),this.btnSearch.isActive()&&this.btnSearch.toggle(!1)):t.panel.hide(),PE.getController("Toolbar").DisableToolbar(1==e),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onBtnMenuClick:function(t,e){var i=this.btnAbout.pressed;if(this.btnAbout.pressed&&this.btnAbout.toggle(!1),"search"==t.options.action)return void(i&&this.fireEvent("panel:show",[this.btnAbout,"files",!1]));"thumbs"==t.options.action?!t.pressed&&this._state.pluginIsRunning?this.$el.width(Common.localStorage.getItem("pe-mainmenu-width")||300):(this.$el.width()>40&&(Common.localStorage.setItem("pe-mainmenu-width",this.$el.width()),this.$el.width(40)),this._state.pluginIsRunning&&this.onCoauthOptions()):t.pressed?this.$el.width()>40||this.$el.width(Common.localStorage.getItem("pe-mainmenu-width")||300):this._state.pluginIsRunning||(Common.localStorage.setItem("pe-mainmenu-width",this.$el.width()),this.$el.width(40)),this.fireEvent("panel:show",[this,t.options.action,t.pressed]),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onFullMenuClick:function(t,e){!t.pressed&&this.fireEvent("panel:show",[this,t.options.action,t.pressed])},onCoauthOptions:function(t){this.mode.canCoAuthoring&&(this.mode.canViewComments&&(this.btnComments.pressed&&this.btnComments.$el.hasClass("notify")&&this.btnComments.$el.removeClass("notify"),this.panelComments[this.btnComments.pressed?"show":"hide"](),this.fireEvent(this.btnComments.pressed?"comments:show":"comments:hide",this)),this.mode.canChat&&(this.btnChat.pressed?(this.btnChat.$el.hasClass("notify")&&this.btnChat.$el.removeClass("notify"),this.panelChat.show(),this.panelChat.focus()):this.panelChat.hide()))},setOptionsPanel:function(t,e){"chat"==t?this.panelChat=e.render("#left-panel-chat"):"comment"==t?this.panelComments=e:"plugins"!=t||this.panelPlugins||(this.panelPlugins=e.render("#left-panel-plugins"))},markCoauthOptions:function(t,e){"chat"!=t||!this.btnChat.isVisible()||this.btnChat.isDisabled()||this.btnChat.pressed||this.btnChat.$el.addClass("notify"),"comments"!=t||!this.btnComments.isVisible()||this.btnComments.pressed||this.btnComments.isDisabled()&&!e||this.btnComments.$el.addClass("notify")},close:function(t){this.btnAbout.toggle(!1),this.btnThumbs.toggle(!1),this._state.pluginIsRunning||this.$el.width(40),this.mode.canCoAuthoring&&(this.mode.canViewComments&&(this.panelComments.hide(),this.btnComments.pressed&&this.fireEvent("comments:hide",this),this.btnComments.toggle(!1,!0)),this.mode.canChat&&(this.panelChat.hide(),this.btnChat.toggle(!1))),this.mode.canPlugins&&this.panelPlugins&&!this._state.pluginIsRunning&&(this.panelPlugins.hide(),this.btnPlugins.toggle(!1,!0)),this.fireEvent("panel:show",[this,"",!1])},isOpened:function(){var t=this.btnSearch.pressed;return!t&&(t=this.btnComments.pressed||this.btnChat.pressed),t},disableMenu:function(t,e){this.btnThumbs.setDisabled(e),this.btnAbout.setDisabled(e),this.btnSupport.setDisabled(e),this.btnChat.setDisabled(e),this.btnPlugins.setDisabled(e)},showMenu:function(t){var e=/^(\w+):?(\w*)$/.exec(t);"file"==e[1]?this.menuFile.show(e[2].length?e[2]:void 0):"chat"==t?!this.btnChat.isVisible()||this.btnChat.isDisabled()||this.btnChat.pressed||(this.btnChat.toggle(!0),this.onBtnMenuClick(this.btnChat),this.onCoauthOptions(),this.panelChat.focus()):"comments"==t&&(!this.btnComments.isVisible()||this.btnComments.isDisabled()||this.btnComments.pressed||(this.btnComments.toggle(!0),this.onBtnMenuClick(this.btnComments),this.onCoauthOptions()))},getMenu:function(t){switch(t){default:return null;case"file":return this.menuFile;case"about":return this.btnAbout.panel}},setMode:function(t){return this.mode=t,this.btnAbout.panel.setMode(t),this},setDeveloperMode:function(t){if(this.$el.is(":visible")){this.developerHint||(this.developerHint=e('
    '+(t==Asc.c_oLicenseMode.Trial?this.txtTrial:this.txtDeveloper)+"
    ").appendTo(this.$el),this.devHeight=this.developerHint.outerHeight(),e(window).on("resize",i.bind(this.onWindowResize,this))),this.developerHint.toggleClass("hidden",!t);var n=this.$el.find("button.btn-category:visible"),o=n.length>0?e(n[n.length-1]):null;this.minDevPosition=o?o.offset().top-o.offsetParent().offset().top+o.height()+20:20,this.onWindowResize()}},onWindowResize:function(){this.developerHint.css("top",Math.max((this.$el.height()-this.devHeight)/2,this.minDevPosition))},tipComments:"Comments",tipChat:"Chat",tipAbout:"About",tipSupport:"Feedback & Support",tipSearch:"Search",tipSlides:"Slides",tipPlugins:"Plugins",txtDeveloper:"DEVELOPER MODE",txtTrial:"TRIAL MODE"},PE.Views.LeftMenu||{}))}),define("presentationeditor/main/app/controller/LeftMenu",["core","common/main/lib/util/Shortcuts","common/main/lib/view/SaveAsDlg","presentationeditor/main/app/view/LeftMenu","presentationeditor/main/app/view/FileMenu"],function(){"use strict";PE.Controllers.LeftMenu=Backbone.Controller.extend(_.extend({views:["LeftMenu","FileMenu"],initialize:function(){this._state={no_slides:void 0},this.addListeners({"Common.Views.Chat":{hide:_.bind(this.onHideChat,this)},"Common.Views.Header":{"file:settings":_.bind(this.clickToolbarSettings,this),"click:users":_.bind(this.clickStatusbarUsers,this)},"Common.Views.Plugins":{"plugin:open":_.bind(this.onPluginOpen,this),hide:_.bind(this.onHidePlugins,this)},"Common.Views.About":{show:_.bind(this.aboutShowHide,this,!1),hide:_.bind(this.aboutShowHide,this,!0)},LeftMenu:{"panel:show":_.bind(this.menuExpand,this),"comments:show":_.bind(this.commentsShowHide,this,"show"),"comments:hide":_.bind(this.commentsShowHide,this,"hide")},FileMenu:{"menu:hide":_.bind(this.menuFilesShowHide,this,"hide"),"menu:show":_.bind(this.menuFilesShowHide,this,"show"),"filemenu:hide":_.bind(this.menuFilesHide,this),"item:click":_.bind(this.clickMenuFileItem,this),"saveas:format":_.bind(this.clickSaveAsFormat,this),"savecopy:format":_.bind(this.clickSaveCopyAsFormat,this),"settings:apply":_.bind(this.applySettings,this),"create:new":_.bind(this.onCreateNew,this),"recent:open":_.bind(this.onOpenRecent,this)},Toolbar:{"file:settings":_.bind(this.clickToolbarSettings,this),"file:open":this.clickToolbarTab.bind(this,"file"),"file:close":this.clickToolbarTab.bind(this,"other"),"save:disabled":this.changeToolbarSaveState.bind(this)},SearchDialog:{hide:_.bind(this.onSearchDlgHide,this),"search:back":_.bind(this.onQuerySearch,this,"back"),"search:next":_.bind(this.onQuerySearch,this,"next"),"search:replace":_.bind(this.onQueryReplace,this),"search:replaceall":_.bind(this.onQueryReplaceAll,this)},"Common.Views.ReviewChanges":{"collaboration:chat":_.bind(this.onShowHideChat,this)}}),Common.NotificationCenter.on("leftmenu:change",_.bind(this.onMenuChange,this))},onLaunch:function(){this.leftMenu=this.createView("LeftMenu").render(),this.leftMenu.btnSearch.on("toggle",_.bind(this.onMenuSearch,this)),this.leftMenu.btnThumbs.on("toggle",_.bind(this.onShowTumbnails,this)),this.isThumbsShown=!0,Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+shift+s,ctrl+shift+s":_.bind(this.onShortcut,this,"save"),"command+f,ctrl+f":_.bind(this.onShortcut,this,"search"),"ctrl+h":_.bind(this.onShortcut,this,"replace"),"alt+f":_.bind(this.onShortcut,this,"file"), esc:_.bind(this.onShortcut,this,"escape"),"alt+q":_.bind(this.onShortcut,this,"chat"),"command+shift+h,ctrl+shift+h":_.bind(this.onShortcut,this,"comments"),f1:_.bind(this.onShortcut,this,"help")}}),Common.util.Shortcuts.suspendEvents()},setApi:function(t){if(this.api=t,this.api.asc_registerCallback("asc_onThumbnailsShow",_.bind(this.onThumbnailsShow,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiServerDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiServerDisconnect,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onReplaceAll",_.bind(this.onApiTextReplaced,this)),this.mode.canCoAuthoring&&(this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onApiChatMessage,this)),this.mode.canComments)){this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this));for(var e=this.getApplication().getCollection("Common.Collections.Comments"),i=0;i0&&(i=i.substring(0,n)+this.isFromFileDownloadAs)}e.mode.canRequestSaveAs?Common.Gateway.requestSaveAs(t,i):(e._saveCopyDlg=new Common.Views.SaveAsDlg({saveFolderUrl:e.mode.saveAsUrl,saveFileUrl:t,defFileName:i}),e._saveCopyDlg.on("saveaserror",function(t,i){var n={closable:!1,title:e.notcriticalErrorTitle,msg:i,iconCls:"warn",buttons:["ok"],callback:function(t){Common.NotificationCenter.trigger("edit:complete",e)}};Common.UI.alert(n)}).on("close",function(t){e._saveCopyDlg=void 0}),e._saveCopyDlg.show())}this.isFromFileDownloadAs=!1},applySettings:function(t){var e=Common.localStorage.getBool("pe-settings-inputmode");Common.Utils.InternalSettings.set("pe-settings-inputmode",e),this.api.SetTextBoxInputMode(e),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&(e=Common.localStorage.getBool("pe-settings-coauthmode",!0),Common.Utils.InternalSettings.set("pe-settings-coauthmode",e),this.api.asc_SetFastCollaborative(e)),e=Common.localStorage.getItem("pe-settings-fontrender"),Common.Utils.InternalSettings.set("pe-settings-fontrender",e),this.api.SetFontRenderingMode(parseInt(e)),this.mode.isEdit&&(e=parseInt(Common.localStorage.getItem("pe-settings-autosave")),Common.Utils.InternalSettings.set("pe-settings-autosave",e),this.api.asc_setAutoSaveGap(e),e=Common.localStorage.getBool("pe-settings-spellcheck",!0),Common.Utils.InternalSettings.set("pe-settings-spellcheck",e),this.api.asc_setSpellCheck(e)),this.api.put_ShowSnapLines(Common.Utils.InternalSettings.get("pe-settings-showsnaplines")),t.hide()},onCreateNew:function(t,e){if(!Common.Controllers.Desktop.process("create:new")){var i=window.open("blank"==e?this.mode.createUrl:e,"_blank");i&&i.focus()}t&&t.hide()},onOpenRecent:function(t,e){t&&t.hide();var i=window.open(e);i&&i.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(t){this.leftMenu.showMenu("file:opts")},clickToolbarTab:function(t,e){"file"==t?this.leftMenu.menuFile.show():this.leftMenu.menuFile.hide()},changeToolbarSaveState:function(t){var e=this.leftMenu.menuFile.getButton("save");e&&e.setDisabled(t)},clickStatusbarUsers:function(){this.leftMenu.menuFile.panels.rights.changeAccessRights()},onHideChat:function(){$(this.leftMenu.btnChat.el).blur(),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onHidePlugins:function(){Common.NotificationCenter.trigger("layout:changed","leftmenu")},onQuerySearch:function(t,e,i){if(i.textsearch&&i.textsearch.length&&!this.api.findText(i.textsearch,"back"!=t,i.matchcase)){var n=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){n.dlgSearch.focus()}})}},onQueryReplace:function(t,e){if(!_.isEmpty(e.textsearch)&&!this.api.asc_replaceText(e.textsearch,e.textreplace,!1,e.matchcase)){var i=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){i.dlgSearch.focus()}})}},onQueryReplaceAll:function(t,e){_.isEmpty(e.textsearch)||this.api.asc_replaceText(e.textsearch,e.textreplace,!0,e.matchcase)},showSearchDlg:function(t,e){if(this.dlgSearch||(this.dlgSearch=new Common.UI.SearchDialog({matchcase:!0})),t){var i=this.mode.isEdit&&!this.viewmode?e||void 0:"no-replace";this.dlgSearch.isVisible()?(this.dlgSearch.setMode(i),this.dlgSearch.focus()):this.dlgSearch.show(i)}else this.dlgSearch.hide()},onMenuSearch:function(t,e){this.showSearchDlg(e)},onShowTumbnails:function(t,e){this.api.ShowThumbnails(e)},onThumbnailsShow:function(t){t&&!this.isThumbsShown?this.leftMenu.btnThumbs.toggle(!0,!1):!t&&this.isThumbsShown&&this.leftMenu.btnThumbs.toggle(!1,!1),this.isThumbsShown=t},onSearchDlgHide:function(){this.leftMenu.btnSearch.toggle(!1,!0),$(this.leftMenu.btnSearch.el).blur(),this.api.asc_enableKeyEvents(!0)},onApiTextReplaced:function(t,e){t?t-e>0?Common.UI.warning({msg:Common.Utils.String.format(this.textReplaceSkipped,t-e)}):Common.UI.info({msg:Common.Utils.String.format(this.textReplaceSuccess,e)}):Common.UI.info({msg:this.textNoTextFound})},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,this.dlgSearch&&this.dlgSearch.setMode(this.viewmode?"no-replace":"search"))},onApiServerDisconnect:function(t){this.mode.isEdit=!1,this.leftMenu.close(),this.leftMenu.btnComments.setDisabled(!0),this.leftMenu.btnChat.setDisabled(!0),this.leftMenu.btnPlugins.setDisabled(!0),this.leftMenu.getMenu("file").setMode({isDisconnected:!0,enableDownload:!!t}),this.dlgSearch&&(this.leftMenu.btnSearch.toggle(!1,!0),this.dlgSearch.hide())},onApiCountPages:function(t){this._state.no_slides!==t<=0&&(this._state.no_slides=t<=0,this.leftMenu.btnComments&&this.leftMenu.btnComments.setDisabled(this._state.no_slides),this.leftMenu.btnSearch&&this.leftMenu.btnSearch.setDisabled(this._state.no_slides))},menuExpand:function(t,e,i){"thumbs"==e?this.isThumbsShown=i:i||!this.isThumbsShown||this.leftMenu._state.pluginIsRunning||this.leftMenu.btnThumbs.toggle(!0,!1)},menuFilesHide:function(t){},onApiChatMessage:function(){this.leftMenu.markCoauthOptions("chat")},onApiAddComment:function(t,e){e&&e.asc_getUserId()!==this.mode.user.id&&this.leftMenu.markCoauthOptions("comments")},onApiAddComments:function(t){for(var e=0;e [data-toggle="dropdown"]');if(s.length)return $.fn.dropdown.Constructor.prototype.keydown.call(s[0],e),!1;if(this.mode.canPlugins&&this.leftMenu.panelPlugins&&(s=this.leftMenu.panelPlugins.$el.find('#menu-plugin-container.open > [data-toggle="dropdown"]'),s.length))return $.fn.dropdown.Constructor.prototype.keydown.call(s[0],e),!1;if(this.leftMenu.btnAbout.pressed||this.leftMenu.btnPlugins.pressed||$(e.target).parents("#left-menu").length)return this.leftMenu.close(),Common.NotificationCenter.trigger("layout:changed","leftmenu"),!1;break;case"chat":return!this.mode.canCoAuthoring||!this.mode.canChat||this.mode.isLightVersion||i&&i.isVisible()||(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")),!1;case"comments":return!this.mode.canCoAuthoring||!this.mode.canViewComments||this.mode.isLightVersion||i&&i.isVisible()||this._state.no_slides||(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("comments"),this.getApplication().getController("Common.Controllers.Comments").onAfterShow()),!1}}},onPluginOpen:function(t,e,i){"onboard"==e&&("open"==i?(this.leftMenu.close(),this.leftMenu.btnThumbs.toggle(!1,!1),this.leftMenu.panelPlugins.show(),this.leftMenu.onBtnMenuClick({pressed:!0,options:{action:"plugins"}}),this.leftMenu._state.pluginIsRunning=!0):(this.leftMenu._state.pluginIsRunning=!1,this.leftMenu.close()))},onMenuChange:function(t){"hide"===t&&this.leftMenu.btnComments.isActive()&&this.api&&(this.leftMenu.btnComments.toggle(!1),this.leftMenu.onBtnMenuClick(this.leftMenu.btnComments),this.leftMenu._state.pluginIsRunning&&this.leftMenu.onCoauthOptions(),this.api.asc_enableKeyEvents(!0))},onShowHideChat:function(t){this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(t?(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")):(this.leftMenu.btnChat.toggle(!1,!0),this.leftMenu.onBtnMenuClick(this.leftMenu.btnChat)))},textNoTextFound:"Text not found",newDocumentTitle:"Unnamed document",requestEditRightsText:"Requesting editing rights...",notcriticalErrorTitle:"Warning",txtUntitled:"Untitled",textReplaceSuccess:"Search has been done. {0} occurrences have been replaced",textReplaceSkipped:"The replacement has been made. {0} occurrences were skipped."},PE.Controllers.LeftMenu||{}))}),void 0===Common)var Common={};if(Common.IrregularStack=function(t){var e=[],i=function(t,e){return"object"==typeof t&&"object"==typeof e&&window.JSON?window.JSON.stringify(t)===window.JSON.stringify(e):t===e};t=t||{};var n=t.strongCompare||i,o=t.weakCompare||i,s=function(t,i){for(var n=e.length-1;n>=0;n--)if(i(e[n],t))return n;return-1};return{push:function(t){e.push(t)},pop:function(t){var i=s(t,n);if(-1!=i)return e.splice(i,1)[0]},get:function(t){var i=s(t,o);if(-1!=i)return e[i]},exist:function(t){return!(s(t,n)<0)}}},define("irregularstack",function(){}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Fonts",["core","common/main/lib/collection/Fonts"],function(){"use strict";Common.Controllers.Fonts=Backbone.Controller.extend(function(){function t(t,e){for(var i,n=e.get("type")==o,s=-1,a=t.length,l=e.get("name");!n&&++s','
    ',"<% if (type == Common.Utils.importTextType.DRM) { %>","<% if (warning) { %>","
    ",'
    ','
    '+n.txtProtected+"
    ",'",'
    ',"
    ","<% } else { %>","
    ",'",'
    ',"
    ","<% } %>","<% } else { %>","<% if (codepages && codepages.length>0) { %>",'
    ','","
    ",'
    ',"
    ","
    ","<% } %>","<% if (type == Common.Utils.importTextType.CSV || type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns) { %>",'
    ','","
    ",'
    ','
    ',"
    ","
    ","<% } %>","<% if (!!preview) { %>",'
    ','",'
    ','
    ','
    ',"
    ",'
    ',"
    ","
    ","
    ","
    ","
    ","<% } %>","<% } %>","
    ","
    ",'"].join(""),this.handler=o.handler,this.type=o.type,this.preview=o.preview,this.previewData=o.previewData,this.warning=o.warning||!1,this.closable=o.closable,this.codepages=o.codepages,this.settings=o.settings,this.api=o.api,this.validatePwd=o.validatePwd||!1,o.tpl=_.template(this.template)(o),Common.UI.Window.prototype.initialize.call(this,o)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.closable||this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.previewPanel=this.$window.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=this.$window.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.type==Common.Utils.importTextType.DRM?(this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"text",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}}),this.$window.find("input").on("input",function(){""!==$(this).val()?"password"!==$(this).attr("type")&&$(this).attr("type","password"):$(this).attr("type","text")})):(this.initCodePages(),this.preview&&(this.previewData?this.previewCallback(this.previewData):this.updatePreview())),this.onPrimary=function(){return t._handleInput("ok"),!1}}},show:function(){if(Common.UI.Window.prototype.show.apply(this,arguments),this.type==Common.Utils.importTextType.DRM){var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus(),t.validatePwd&&t.inputPwd.checkValidate()},500)}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onToolClose:function(){this._handleInput("cancel")},_handleInput:function(t){if(this.handler)if(this.type==Common.Utils.importTextType.DRM)this.handler.call(this,t,this.inputPwd.getValue());else{var e=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,i=this.cmbDelimiter?this.cmbDelimiter.getValue():null,n=-1==i?this.inputDelimiter.getValue():null;-1==i&&(i=null),this.handler.call(this,t,e,i,n)}this.close()},initCodePages:function(){var t,e,i,n=[],o=[],s=0,a=0;if(this.codepages){for(n=[],t=0;t",'
  • ','
    <%= item.displayValue %>
    ','',"
  • ","<% }); %>"].join(""));this.cmbEncoding=new Common.UI.ComboBox({el:$("#id-codepages-combo",this.$window),style:"width: 100%;",menuStyle:"min-width: 100%; max-height: 200px;",cls:"input-group-nr",menuCls:"scrollable-menu",data:o,editable:!1,disabled:!0,itemsTemplate:l}),this.cmbEncoding.setDisabled(!1),this.cmbEncoding.setValue(this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():n[0][0]),this.preview&&this.cmbEncoding.on("selected",_.bind(this.onCmbEncodingSelect,this));var r=this.cmbEncoding.cmpEl.find("ul"),c=r.find("li:nth(0) a"),h=r.width()-parseInt(c.css("padding-left"))-parseInt(c.css("padding-right"))-50;r.find("li div").width(h)}this.type!=Common.Utils.importTextType.CSV&&this.type!=Common.Utils.importTextType.Paste&&this.type!=Common.Utils.importTextType.Columns||(this.cmbDelimiter=new Common.UI.ComboBox({el:$("#id-delimiters-combo",this.$window),style:"width: 100px;",menuStyle:"min-width: 100px;",cls:"input-group-nr",data:[{value:4,displayValue:this.txtComma},{value:2,displayValue:this.txtSemicolon},{value:3,displayValue:this.txtColon},{value:1,displayValue:this.txtTab},{value:5,displayValue:this.txtSpace},{value:-1,displayValue:this.txtOther}],editable:!1}),this.cmbDelimiter.setValue(this.settings&&this.settings.asc_getDelimiter()?this.settings.asc_getDelimiter():4),this.cmbDelimiter.on("selected",_.bind(this.onCmbDelimiterSelect,this)),this.inputDelimiter=new Common.UI.InputField({el:$("#id-delimiter-other"),style:"width: 30px;",maxLength:1,validateOnChange:!0,validateOnBlur:!1,value:this.settings&&this.settings.asc_getDelimiterChar()?this.settings.asc_getDelimiterChar():""}),this.inputDelimiter.setVisible(!1),this.preview&&this.inputDelimiter.on("changing",_.bind(this.updatePreview,this)))},updatePreview:function(){var t=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,e=this.cmbDelimiter?this.cmbDelimiter.getValue():null,i=-1==e?this.inputDelimiter.getValue():null;switch(-1==e&&(e=null),this.type){case Common.Utils.importTextType.CSV:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t,e,i),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.TXT:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.Paste:case Common.Utils.importTextType.Columns:this.api.asc_TextImport(new Asc.asc_CTextOptions(t,e,i),_.bind(this.previewCallback,this),this.type==Common.Utils.importTextType.Paste)}},previewCallback:function(t){t&&t.length&&(this.data=t,this.previewInner.height(17*t.length),this.scrollerY||(this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:20,alwaysVisibleY:!0,alwaysVisibleX:!0,onChange:_.bind(function(){if(this.scrollerY){var t=this.scrollerY.getScrollTop(),e=Math.floor(t/17+.5),i=e+Math.min(6,this.data.length);i>this.data.length&&(i=this.data.length,e=this.data.length-6,t=17*e),this.previewParent.height(108),this.previewParent.css({top:t}),this.previewDataBlock(this.data.slice(e,i))}},this)})),this.scrollerY.update(),this.scrollerY.scrollTop(0))},previewDataBlock:function(t){if(_.isUndefined(this.scrollerX)||(this.scrollerX.destroy(),delete this.scrollerX),this.type==Common.Utils.importTextType.CSV||this.type==Common.Utils.importTextType.Paste||this.type==Common.Utils.importTextType.Columns){for(var e=0,i=0;ie&&(e=t[i].length);for(var n="",i=0;i';for(var o=0;o"+Common.Utils.String.htmlEncode(t[i][o])+"";for(o=t[i].length;o";n+=""}n+="
    "}else{for(var n="",i=0;i";n+="
    '+Common.Utils.String.htmlEncode(t[i])+"
    "}this.previewPanel.html(n),this.scrollerX=new Common.UI.Scroller({el:this.previewPanel,suppressScrollY:!0,alwaysVisibleX:!0,minScrollbarLength:20})},onCmbDelimiterSelect:function(t,e){this.inputDelimiter.setVisible(-1==e.value),-1==e.value&&this.inputDelimiter.cmpEl.find("input").focus(),this.preview&&this.updatePreview()},onCmbEncodingSelect:function(t,e){this.updatePreview()},okButtonText:"OK",cancelButtonText:"Cancel",txtDelimiter:"Delimiter",txtEncoding:"Encoding ",txtSpace:"Space",txtTab:"Tab",txtTitle:"Choose %1 options",txtPassword:"Password",txtTitleProtected:"Protected File",txtOther:"Other",txtIncorrectPwd:"Password is incorrect.",closeButtonText:"Close File",txtPreview:"Preview",txtComma:"Comma",txtColon:"Colon",txtSemicolon:"Semicolon",txtProtected:"Once you enter the password and open the file, the current password to the file will be reset."},Common.Views.OpenDialog||{}))}),define("common/main/lib/util/LocalStorage",["gateway"],function(){Common.localStorage=new function(){var t,e,i={},n=function(t){"localstorage"==t.type&&(i=t.keys)};Common.Gateway.on("internalcommand",n);var o=function(){d||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:e})},s=function(){d||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:i})},a=function(t,e,n){if(d)try{localStorage.setItem(t,e)}catch(t){}else i[t]=e,!0===n&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:e}})},l=function(t,e,i){a(t,e?1:0,i)},r=function(t){return d?localStorage.getItem(t):void 0===i[t]?null:i[t]},c=function(t,e){var i=r(t);return e=e||!1,null!==i?0!=parseInt(i):e},h=function(t){return null!==r(t)};try{var d=!!window.localStorage}catch(t){d=!1}return{getId:function(){return t},setId:function(e){t=e},getItem:r,getBool:c,setBool:l,setItem:a,setKeysFilter:function(t){e=t},getKeysFilter:function(){return e},itemExists:h,sync:o,save:s}}}),define("presentationeditor/main/app/model/ShapeGroup",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.ShapeModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),PE.Models.ShapeGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/ShapeGroups",["backbone","presentationeditor/main/app/model/ShapeGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},PE.Collections.ShapeGroups=t.Collection.extend({model:PE.Models.ShapeGroup})}),define("presentationeditor/main/app/model/SlideLayout",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.SlideLayout=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,title:null,data:null}}})}),define("presentationeditor/main/app/collection/SlideLayouts",["backbone","presentationeditor/main/app/model/SlideLayout"],function(t){"use strict";PE.Collections=PE.Collections||{},PE.Collections.SlideLayouts=t.Collection.extend({model:PE.Models.SlideLayout,findLayoutByIndex:function(t){return this.find(function(e){return e.get("data").idx==t})}})}),define("presentationeditor/main/app/model/EquationGroup",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.EquationModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),PE.Models.EquationGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/EquationGroups",["backbone","presentationeditor/main/app/model/EquationGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},PE.Collections.EquationGroups=t.Collection.extend({model:PE.Models.EquationGroup})}),define("presentationeditor/main/app/controller/Main",["core","irregularstack","common/main/lib/component/Window","common/main/lib/component/LoadMask","common/main/lib/component/Tooltip","common/main/lib/controller/Fonts","common/main/lib/collection/TextArt","common/main/lib/view/OpenDialog","common/main/lib/util/LocalStorage","presentationeditor/main/app/collection/ShapeGroups","presentationeditor/main/app/collection/SlideLayouts","presentationeditor/main/app/collection/EquationGroups"],function(){"use strict";PE.Controllers.Main=Backbone.Controller.extend(_.extend(function(){var t,e={about:"button#left-btn-about",feedback:"button#left-btn-support",goback:"#fm-btn-back > a, #header-back > div"},i={toolbar:"#viewport #toolbar",leftMenu:"#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings",rightMenu:"#viewport #right-menu",statusBar:"#statusbar"};return Common.localStorage.setId("presentation"),Common.localStorage.setKeysFilter("pe-,asc.presentation"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","SlideLayouts","EquationGroups","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)},"Common.Views.ReviewChanges":{"settings:apply":_.bind(this.applySettings,this)}})},onLaunch:function(){var t=this;if(this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseType:!1},this.languages=null,this.translationTable=[],this.isModalShowed=0,window.storagename="presentation",this.stackLongActions=new Common.IrregularStack({strongCompare:function(t,e){return t.id===e.id&&t.type===e.type},weakCompare:function(t,e){return t.type===e.type}}),!Common.Utils.isBrowserSupported())return Common.Utils.showBrowserRestriction(),void Common.Gateway.reportError(void 0,this.unsupportedBrowserErrorText);var e=Common.localStorage.getItem("pe-settings-fontrender");null===e&&(e=window.devicePixelRatio>1?"1":"3"),Common.Utils.InternalSettings.set("pe-settings-fontrender",e),window.flat_desine=!0,this.api=new Asc.asc_docs_api({"id-view":"editor_sdk",translate:{Series:this.txtSeries,"Diagram Title":this.txtDiagramTitle,"X Axis":this.txtXAxis,"Y Axis":this.txtYAxis,"Your text here":this.txtArt,"Slide text":this.txtSlideText,Chart:this.txtSldLtTChart,ClipArt:this.txtClipArt,Diagram:this.txtDiagram,"Date and time":this.txtDateTime,Footer:this.txtFooter,Header:this.txtHeader,Media:this.txtMedia,Picture:this.txtPicture,Image:this.txtImage,"Slide number":this.txtSlideNumber,"Slide subtitle":this.txtSlideSubtitle,Table:this.txtSldLtTTbl,"Slide title":this.txtSlideTitle,Loading:this.txtLoading,"Click to add notes":this.txtAddNotes,"Click to add first slide":this.txtAddFirstSlide}}), ["blank","pixel","classic","official","green","lines","office","safari","dotted","corner","turtle"].forEach(function(e){t.translationTable[e]=t["txtTheme_"+e.replace(/ /g,"_")]||e}),this.api&&(this.api.SetDrawingFreeze(!0),this.api.SetThemesPath("../../../../sdkjs/slide/themes/"),this.api.SetFontRenderingMode(parseInt(e)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onDocumentContentReady",_.bind(this.onDocumentContentReady,this)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onThumbnailsShow",_.bind(this.onThumbnailsShow,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,this)),this.api.asc_registerCallback("asc_onSpellCheckInit",_.bind(this.loadLanguages,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),this.isShowOpenDialog=!1,this.editorConfig={},this.appOptions={},Common.Gateway.on("init",_.bind(this.loadConfig,this)),Common.Gateway.on("showmessage",_.bind(this.onExternalMessage,this)),Common.Gateway.on("opendocument",_.bind(this.loadDocument,this)),Common.Gateway.appReady(),this.getApplication().getController("Viewport").setApi(this.api),this.getApplication().getController("Statusbar").setApi(t.api),$(document.body).on("focus","input, textarea",function(e){/area_id/.test(e.target.id)||(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/chat-msg-text/.test(e.target.id)?t.dontCloseChat=!0:!t.isModalShowed&&/form-control/.test(e.target.className)&&(t.inFormControl=!0))}),$(document.body).on("blur","input, textarea",function(e){if(!t.isModalShowed){if(/form-control/.test(e.target.className)&&(t.inFormControl=!1),t.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file").isVisible())return;if(!e.relatedTarget||!/area_id/.test(e.target.id)&&!("input"==e.target.localName&&$(e.target).parent().find(e.relatedTarget).length>0)&&!("textarea"==e.target.localName&&$(e.target).closest(".asc-window").find(".dropdown-menu").find(e.relatedTarget).length>0)&&("input"!=e.relatedTarget.localName||!/form-control/.test(e.relatedTarget.className))&&("textarea"!=e.relatedTarget.localName||/area_id/.test(e.relatedTarget.id))){if(Common.Utils.isIE&&e.originalEvent&&e.originalEvent.target&&/area_id/.test(e.originalEvent.target.id)&&e.originalEvent.target===e.originalEvent.srcElement)return;t.api.asc_enableKeyEvents(!0),/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!1:/chat-msg-text/.test(e.target.id)&&(t.dontCloseChat=!1)}}}).on("dragover",function(t){var e=t.originalEvent;if(e.target&&$(e.target).closest("#editor_sdk").length<1)return e.preventDefault(),e.dataTransfer.dropEffect="none",!1}).on("dragstart",function(t){var e=t.originalEvent;if(e.target){var i=$(e.target);(i.closest(".combobox").length>0||i.closest(".dropdown-menu").length>0||i.closest(".ribtab").length>0||i.closest(".combo-dataview").length>0)&&e.preventDefault()}}),Common.NotificationCenter.on({"modal:show":function(e){t.isModalShowed++,t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){--t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"modal:hide":function(e){--t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"settings:unitschanged":_.bind(this.unitsChanged,this),"dataview:focus":function(t){},"dataview:blur":function(e){t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"menu:show":function(t){},"menu:hide":function(e,i){t.isModalShowed||i||t.api.asc_enableKeyEvents(!0)},"edit:complete":_.bind(t.onEditComplete,t)}),this.initNames(),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+s,ctrl+s,command+p,ctrl+p,command+k,ctrl+k,command+d,ctrl+d":_.bind(function(t){t.preventDefault(),t.stopPropagation()},this)}})),t.defaultTitleText="ONLYOFFICE",t.textNoLicenseTitle=t.textNoLicenseTitle.replace("%1","ONLYOFFICE"),t.warnNoLicense=t.warnNoLicense.replace("%1","ONLYOFFICE"),t.warnNoLicenseUsers=t.warnNoLicenseUsers.replace("%1","ONLYOFFICE")},loadConfig:function(e){this.editorConfig=$.extend(this.editorConfig,e.config),this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(e.config.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.isDesktopApp="desktop"==this.editorConfig.targetApp,this.appOptions.canCreateNew=!_.isEmpty(this.editorConfig.createUrl),this.appOptions.canOpenRecent=void 0!==this.editorConfig.recent&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location="string"==typeof this.editorConfig.location?this.editorConfig.location.toLowerCase():"",this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.saveAsUrl=this.editorConfig.saveAsUrl,this.appOptions.fileChoiceUrl=this.editorConfig.fileChoiceUrl,this.appOptions.canAnalytics=!1,this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=!1!==this.editorConfig.canBackToFolder&&"object"==typeof this.editorConfig.customization&&"object"==typeof this.editorConfig.customization.goback&&!_.isEmpty(this.editorConfig.customization.goback.url),this.appOptions.canBack=!0===this.appOptions.canBackToFolder,this.appOptions.canPlugins=!1,this.appOptions.canRequestUsers=this.editorConfig.canRequestUsers,this.appOptions.canRequestSendNotify=this.editorConfig.canRequestSendNotify,this.appOptions.canRequestSaveAs=this.editorConfig.canRequestSaveAs,this.appOptions.canRequestInsertImage=this.editorConfig.canRequestInsertImage,t=this.getApplication().getController("Viewport").getView("Common.Views.Header"),t.setCanBack(!0===this.appOptions.canBackToFolder,this.appOptions.canBackToFolder?this.editorConfig.customization.goback.text:"").setUserName(this.appOptions.user.fullname),this.editorConfig.lang&&this.api.asc_setLocale(this.editorConfig.lang),"us"!=this.appOptions.location&&"ca"!=this.appOptions.location||Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch),Common.Controllers.Desktop.init(this.appOptions)},loadDocument:function(e){this.permissions={},this.document=e.doc;var i={};if(e.doc){this.permissions=$.extend(this.permissions,e.doc.permissions);var n=$.extend({},e.doc.permissions),o=$.extend({},e.doc.options,this.editorConfig.actionLink||{}),s=new Asc.asc_CUserInfo;s.put_Id(this.appOptions.user.id),s.put_FullName(this.appOptions.user.fullname),i=new Asc.asc_CDocInfo,i.put_Id(e.doc.key),i.put_Url(e.doc.url),i.put_Title(e.doc.title),i.put_Format(e.doc.fileType),i.put_VKey(e.doc.vkey),i.put_Options(o),i.put_UserInfo(s),i.put_CallbackUrl(this.editorConfig.callbackUrl),i.put_Token(e.doc.token),i.put_Permissions(n)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_registerCallback("asc_onLicenseChanged",_.bind(this.onLicenseChanged,this)),this.api.asc_setDocInfo(i),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId),e.doc&&t.setDocumentCaption(e.doc.title)},onProcessSaveResult:function(t){this.api.asc_OnSaveEnd(t.result),t&&!1===t.result&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(t.message)?this.errorProcessSaveResult:t.message})},onProcessRightsChange:function(t){if(t&&!1===t.enabled){var e=this,i=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("collaboration:sharingdeny"),Common.NotificationCenter.trigger("api:disconnect"),i||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(t.message)?this.warnProcessRightsChange:t.message,callback:function(){e._state.lostEditingRights=!1,e.onEditComplete()}})}},onDownloadAs:function(t){if(!this.appOptions.canDownload)return void Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny,this.errorAccessDeny);this._state.isFromGatewayDownloadAs=!0;var e=t&&"string"==typeof t?Asc.c_oAscFileType[t.toUpperCase()]:null,i=[Asc.c_oAscFileType.PPTX,Asc.c_oAscFileType.ODP,Asc.c_oAscFileType.PDF,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.POTX,Asc.c_oAscFileType.OTP];(!e||i.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PPTX),this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e,!0))},onProcessMouse:function(t){if("mouseup"==t.type){var e=document.getElementById("editor_sdk");if(e){var i=e.getBoundingClientRect();this.api.OnMouseUp(t.x-i.left,t.y-i.top)}}},goBack:function(t){var e=this;if(!Common.Controllers.Desktop.process("goback")){var i=e.appOptions.customization.goback.url;t||!1===e.appOptions.customization.goback.blank?parent.location.href=i:window.open(i,"_blank")}},onEditComplete:function(t){var e=this.getApplication(),i=e.getController("Toolbar").getView("Toolbar");if(e.getController("DocumentHolder").getView("DocumentHolder").focus(),this.api&&this.appOptions.isEdit&&this.api.asc_isDocumentCanSave){var n=this.api.asc_isDocumentCanSave(),o=this.appOptions.forcesave,s=!!i.btnCollabChanges.rendered&&i.btnCollabChanges.$icon.hasClass("btn-synch"),a=!n&&!s&&!o||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!o;i.btnSave.setDisabled(a)}},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(e,i){var n={id:i,type:e};if(this.stackLongActions.pop(n),t&&t.setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(!0),n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}))this.setLongActionView(n);else{var o=this;i!=Asc.c_oAscAsyncAction.Save&&i!=Asc.c_oAscAsyncAction.ForceSaveButton||this.appOptions.isOffline?o.getApplication().getController("Statusbar").setStatusCaption(""):this._state.fastCoauth&&this._state.usersCount>1?o._state.timerSave=setTimeout(function(){o.getApplication().getController("Statusbar").setStatusCaption(o.textChangesSaved,!1,3e3)},500):o.getApplication().getController("Statusbar").setStatusCaption(o.textChangesSaved,!1,3e3)}n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),n?this.setLongActionView(n):this.loadMask&&this.loadMask.hide(),!this.appOptions.isEdit||i!=Asc.c_oAscAsyncAction.Save&&i!=Asc.c_oAscAsyncAction.ForceSaveButton||this._state.fastCoauth&&!(this._state.usersCount<2)||this.synchronizeChanges(),e!=Asc.c_oAscAsyncActionType.BlockInteraction||(i==Asc.c_oAscAsyncAction.LoadDocumentFonts||i==Asc.c_oAscAsyncAction.ApplyChanges)&&(this.dontCloseDummyComment||this.dontCloseChat||this.isModalShowed||this.inFormControl)||(this.onEditComplete(this.loadMask),this.api.asc_enableKeyEvents(!0))},setLongActionView:function(t){var e="",i="",n=!1;switch(t.id){case Asc.c_oAscAsyncAction.Open:e=this.openTitleText,i=this.openTextText;break;case Asc.c_oAscAsyncAction.Save:case Asc.c_oAscAsyncAction.ForceSaveButton:clearTimeout(this._state.timerSave),n=!0,e=this.saveTitleText,i=this.appOptions.isOffline?"":this.saveTextText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:e=this.loadFontsTitleText,i=this.loadFontsTextText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:e=this.loadImagesTitleText,i=this.loadImagesTextText;break;case Asc.c_oAscAsyncAction.LoadFont:e=this.loadFontTitleText,i=this.loadFontTextText;break;case Asc.c_oAscAsyncAction.LoadImage:e=this.loadImageTitleText,i=this.loadImageTextText;break;case Asc.c_oAscAsyncAction.DownloadAs:e=this.downloadTitleText,i=this.downloadTextText;break;case Asc.c_oAscAsyncAction.Print:e=this.printTitleText,i=this.printTextText;break;case Asc.c_oAscAsyncAction.UploadImage:e=this.uploadImageTitleText,i=this.uploadImageTextText;break;case Asc.c_oAscAsyncAction.LoadTheme:e=this.loadThemeTitleText,i=this.loadThemeTextText;break;case Asc.c_oAscAsyncAction.ApplyChanges:e=this.applyChangesTitleText,i=this.applyChangesTextText;break;case Asc.c_oAscAsyncAction.PrepareToSave:e=this.savePreparingText,i=this.savePreparingTitle;break;case Asc.c_oAscAsyncAction.Waiting:e=this.waitText,i=this.waitText;break;case-255:e=this.txtEditingMode,i=this.txtEditingMode;break;case-256:e=this.loadingDocumentTitleText,i=this.loadingDocumentTextText;break;default:"string"==typeof t.id&&(e=t.id,i=t.id)}t.type==Asc.c_oAscAsyncActionType.BlockInteraction?(this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(e),this.isShowOpenDialog||this.loadMask.show()):this.getApplication().getController("Statusbar").setStatusCaption(i,n)},onApplyEditRights:function(t){this.getApplication().getController("Statusbar").setStatusCaption(""),t&&!t.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:t.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function e(){if(!window.AscDesktopEditor){var t=[];Common.Utils.isIE9m&&t.push(n.warnBrowserIE9),t.length&&n.showTips(t)}document.removeEventListener("visibilitychange",e)}if(!this._isDocReady){this._state.openDlg&&this._state.openDlg.close();var i,n=this;n._isDocReady=!0,Common.NotificationCenter.trigger("app:ready",n.appOptions),n.api.SetDrawingFreeze(!1),n.hidePreloader(),n.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.Utils.InternalSettings.set("pe-settings-datetime-default",Common.localStorage.getItem("pe-settings-datetime-default")),i=Common.localStorage.getItem("pe-settings-zoom"),Common.Utils.InternalSettings.set("pe-settings-zoom",i);var o=null!==i?parseInt(i):this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom):-1;-1==o?this.api.zoomFitToPage():-2==o?this.api.zoomFitToWidth():this.api.zoom(o>0?o:100),i=Common.localStorage.getBool("pe-settings-spellcheck",!0),Common.Utils.InternalSettings.set("pe-settings-spellcheck",i),n.api.asc_setSpellCheck(i),void 0!==document.hidden&&document.hidden?document.addEventListener("visibilitychange",e):e(),n.api.asc_registerCallback("asc_onStartAction",_.bind(n.onLongActionBegin,n)),n.api.asc_registerCallback("asc_onEndAction",_.bind(n.onLongActionEnd,n)),n.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(n.onCoAuthoringDisconnect,n)),n.api.asc_registerCallback("asc_onPrint",_.bind(n.onPrint,n)),t.setDocumentCaption(n.api.asc_getDocumentName()),n.updateWindowTitle(!0),i=Common.localStorage.getBool("pe-settings-inputmode"),Common.Utils.InternalSettings.set("pe-settings-inputmode",i),n.api.SetTextBoxInputMode(i),n.appOptions.isEdit&&!n.appOptions.isOffline&&n.appOptions.canCoAuthoring?(i=Common.localStorage.getItem("pe-settings-coauthmode"),null===i&&!Common.localStorage.itemExists("pe-settings-autosave")&&n.appOptions.customization&&!1===n.appOptions.customization.autosave&&(i=0),n._state.fastCoauth=null===i||1==parseInt(i)):(n._state.fastCoauth=!n.appOptions.isEdit&&n.appOptions.isRestrictedEdit,n._state.fastCoauth&&(n.api.asc_setAutoSaveGap(1),Common.Utils.InternalSettings.set("pe-settings-autosave",1))),n.api.asc_SetFastCollaborative(n._state.fastCoauth),Common.Utils.InternalSettings.set("pe-settings-coauthmode",n._state.fastCoauth),Common.Utils.InternalSettings.set("pe-settings-showsnaplines",n.api.get_ShowSnapLines());var s=n.getApplication(),a=s.getController("Toolbar"),l=s.getController("Statusbar"),r=s.getController("DocumentHolder"),c=(s.getController("Common.Controllers.Fonts"),s.getController("RightMenu")),h=s.getController("LeftMenu"),d=s.getController("Common.Controllers.Chat"),p=s.getController("Common.Controllers.Plugins");if(h.getView("LeftMenu").getMenu("file").loadDocument({doc:n.document}),h.setMode(n.appOptions).setApi(n.api).createDelayedElements(),d.setApi(this.api).setMode(this.appOptions),s.getController("Common.Controllers.ExternalDiagramEditor").setApi(this.api).loadConfig({config:this.editorConfig,customization:this.editorConfig.customization}),p.setApi(n.api),r.setApi(n.api),r.createDelayedElements(),l.createDelayedElements(),h.getView("LeftMenu").disableMenu("all",!1),n.appOptions.canBranding&&n.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(n.editorConfig.customization),r.getView("DocumentHolder").setApi(n.api).on("editcomplete",_.bind(n.onEditComplete,n)),s.getController("Viewport").getView("DocumentPreview").setApi(n.api).setMode(n.appOptions).on("editcomplete",_.bind(n.onEditComplete,n)),n.appOptions.isEdit){i=Common.localStorage.getItem("pe-settings-autosave"),null===i&&n.appOptions.customization&&!1===n.appOptions.customization.autosave&&(i=0),i=n._state.fastCoauth||null===i?n.appOptions.canCoAuthoring?1:0:parseInt(i),n.api.asc_setAutoSaveGap(i),Common.Utils.InternalSettings.set("pe-settings-autosave",i),n.appOptions.canForcesave&&(n.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",n.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",n.appOptions.forcesave),n.api.asc_setIsForceSaveOnUserSave(n.appOptions.forcesave)),n.needToUpdateVersion&&Common.NotificationCenter.trigger("api:disconnect");var u=setInterval(function(){if(window.styles_loaded){clearInterval(u),a.createDelayedElements(),r.getView("DocumentHolder").createDelayedElements(),n.setLanguages(),n.api.asc_registerCallback("asc_onUpdateLayout",_.bind(n.fillLayoutsStore,n)),n.updateThemeColors();var t=n.api.asc_getPropertyEditorShapes();t&&n.fillAutoShapes(t[0],t[1]),c.createDelayedElements(),n.api.asc_registerCallback("asc_onFocusObject",_.bind(n.onFocusObject,n)),n.fillTextArt(n.api.asc_getTextArtPreviews()),a.activateControls(),n.needToUpdateVersion&&a.onApiCoAuthoringDisconnect(),n.api.UpdateInterfaceState(),Common.NotificationCenter.trigger("document:ready","main"),n.applyLicense()}},50)}else r.getView("DocumentHolder").createDelayedElementsViewer(),Common.NotificationCenter.trigger("document:ready","main");this.appOptions.canAnalytics,1,Common.Gateway.on("applyeditrights",_.bind(n.onApplyEditRights,n)),Common.Gateway.on("processsaveresult",_.bind(n.onProcessSaveResult,n)),Common.Gateway.on("processrightschange",_.bind(n.onProcessRightsChange,n)),Common.Gateway.on("processmouse",_.bind(n.onProcessMouse,n)),Common.Gateway.on("downloadas",_.bind(n.onDownloadAs,n)),Common.Gateway.sendInfo({mode:n.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(n.onContextMenu,n)),Common.Gateway.documentReady()}},onLicenseChanged:function(t){var e=t.asc_getLicenseType();void 0===e||!this.appOptions.canEdit||"view"===this.editorConfig.mode||e!==Asc.c_oLicenseResult.Connections&&e!==Asc.c_oLicenseResult.UsersCount&&e!==Asc.c_oLicenseResult.ConnectionsOS&&e!==Asc.c_oLicenseResult.UsersCountOS||(this._state.licenseType=e),this._isDocReady&&this.applyLicense()},applyLicense:function(){},disableEditing:function(t){var e=this.getApplication();this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t),e.getController("Statusbar").getView("Statusbar").SetDisabled(t))},onOpenDocument:function(t){var e=document.getElementById("loadmask-text"),i=(t.asc_getCurrentFont()+t.asc_getCurrentImage())/(t.asc_getFontsCount()+t.asc_getImagesCount());i=this.textLoadingDocument+": "+Math.min(Math.round(100*i),100)+"%",e?e.innerHTML=i:this.loadMask&&this.loadMask.setTitle(i)},onEditorPermissions:function(e){var i=e.asc_getLicenseType();this.onServerVersion(e.asc_getBuildVersion())||(e.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.canLicense=i===Asc.c_oLicenseResult.Success||i===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=e.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canRequestClose=this.editorConfig.canRequestClose,this.appOptions.canEdit=!1!==this.permissions.edit&&(this.editorConfig.canRequestEditRights||"view"!==this.editorConfig.mode),this.appOptions.isEdit=this.appOptions.canLicense&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode,this.appOptions.canDownload=!1!==this.permissions.download,this.appOptions.canAnalytics=e.asc_getIsAnalyticsEnable(),this.appOptions.canComments=this.appOptions.canLicense&&(void 0===this.permissions.comment?this.appOptions.isEdit:this.permissions.comment)&&"view"!==this.editorConfig.mode,this.appOptions.canComments=this.appOptions.canComments&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canViewComments=this.appOptions.canComments||!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canChat=this.appOptions.canLicense&&!this.appOptions.isOffline&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.chat),this.appOptions.canPrint=!1!==this.permissions.print,this.appOptions.canRename=this.editorConfig.canRename&&!!this.permissions.rename,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&"object"==typeof this.editorConfig.customization&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||!("object"==typeof this.editorConfig.customization&&this.editorConfig.customization.commentAuthorOnly),this.appOptions.trialMode=e.asc_getLicenseMode(),this.appOptions.isSignatureSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isSignaturesSupport(),this.appOptions.isPasswordSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isProtectionSupport(),this.appOptions.canProtect=this.appOptions.isSignatureSupport||this.appOptions.isPasswordSupport,this.appOptions.canHelp=!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.help),this.appOptions.isRestrictedEdit=!this.appOptions.isEdit&&this.appOptions.canComments,this.appOptions.canBranding=e.asc_getCustomization(),this.appOptions.canBranding&&t.setBranding(this.editorConfig.customization),this.appOptions.canRename&&t.setCanRename(!0),this.appOptions.canBrandingExt=e.asc_getCanBranding()&&("object"==typeof this.editorConfig.customization||this.editorConfig.plugins),this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions),this.applyModeCommonElements(),this.applyModeEditorElements(),this.appOptions.isEdit||(Common.NotificationCenter.trigger("app:face",this.appOptions),this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),this.api.asc_setViewMode(!this.appOptions.isEdit&&!this.appOptions.isRestrictedEdit),this.appOptions.isRestrictedEdit&&this.appOptions.canComments&&this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments),this.api.asc_LoadDocument())},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var t=this.getApplication(),e=t.getController("Viewport").getView("Viewport"),i=t.getController("Statusbar").getView("Statusbar"),n=t.getController("DocumentHolder").getView("DocumentHolder"),o=t.getController("Toolbar");e&&e.setMode(this.appOptions,!0),i&&i.setMode(this.appOptions),o.setMode(this.appOptions),n.setMode(this.appOptions),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(this.onDocumentModifiedChanged,this))},applyModeEditorElements:function(t){var e=this.getApplication().getController("Common.Controllers.Comments");if(e&&(e.setMode(this.appOptions),e.setConfig({config:this.editorConfig,sdkviewname:"#id_main_parent"},this.api)),this.appOptions.isEdit){var i=this,n=this.getApplication(),o=n.getController("Toolbar"),s=n.getController("RightMenu"),a=n.getController("Common.Controllers.Fonts"),l=n.getController("Common.Controllers.ReviewChanges");a&&a.setApi(i.api),o&&o.setApi(i.api),s&&s.setApi(i.api),l.setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),i.appOptions.canProtect&&n.getController("Common.Controllers.Protection").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api);this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode();var r=s.getView("RightMenu");r&&(r.setApi(i.api),r.on("editcomplete",_.bind(i.onEditComplete,i)),r.setMode(i.appOptions));var c=o?o.getView("Toolbar"):null;c&&(c.setApi(i.api),c.on("editcomplete",_.bind(i.onEditComplete,i)),c.on("insertimage",_.bind(i.onInsertImage,i)),c.on("inserttable",_.bind(i.onInsertTable,i)),c.on("insertshape",_.bind(i.onInsertShape,i)),c.on("insertchart",_.bind(i.onInsertChart,i)),c.on("inserttextart",_.bind(i.onInsertTextArt,i)));var h=Common.localStorage.getItem("pe-settings-unit");h=null!==h?parseInt(h):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(h),Common.Utils.InternalSettings.set("pe-settings-unit",h),i.api.asc_SetDocumentUnits(h==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:h==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),i.api.asc_SetViewRulers&&i.api.asc_SetViewRulers(!Common.localStorage.getBool("pe-hidden-rulers",!0)),i.api.asc_registerCallback("asc_onChangeObjectLock",_.bind(i._onChangeObjectLock,i)),i.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(i.onDocumentCanSaveChanged,i)),i.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(i.onCollaborativeChanges,i)),i.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(i.onTryUndoInFastCollaborative,i)),i.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.stackLongActions.exist({id:-255,type:Asc.c_oAscAsyncActionType.BlockInteraction})?i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-255):this._isDocReady||(Common.NotificationCenter.trigger("app:face",i.appOptions),i.hidePreloader(),i.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),window.onbeforeunload=_.bind(i.onBeforeUnload,i),window.onunload=_.bind(i.onUnload,i)}},onExternalMessage:function(t){t&&t.msg&&(t.msg=t.msg.toString(),this.showTips([t.msg.charAt(0).toUpperCase()+t.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error"))},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.LoadingScriptError)return this.showTips([this.scriptLoadError]),void(this.tooltip&&this.tooltip.getBSTip().$tip.css("z-index",1e4));this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256);var n={closable:!0};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.SplitCellMaxRows:n.msg=this.splitMaxRowsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellMaxCols:n.msg=this.splitMaxColsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellRowsDivider:n.msg=this.splitDividerErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop,Common.NotificationCenter.trigger("collaboration:sharingdeny");break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer.replace("%1","https://api.onlyoffice.com/editors/callback"),n.closable=!1;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.ForceSaveButton:n.msg=this.errorForceSave;break;case Asc.c_oAscError.ID.ForceSaveTimeout:n.msg=this.errorForceSave,console.warn(n.msg);break;case Asc.c_oAscError.ID.DataEncrypted:n.msg=this.errorDataEncrypted;break;case Asc.c_oAscError.ID.EditingError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.errorEditingSaveas:this.errorEditingDownloadas;break;case Asc.c_oAscError.ID.MailToClientMissing:n.msg=this.errorEmailClient;break;default:n.msg="string"==typeof t?t:this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",n.closable=!1,this.appOptions.canBackToFolder&&!this.appOptions.isDesktopApp&&"string"!=typeof t&&(n.msg+="

    "+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback",!0)}),t==Asc.c_oAscError.ID.DataEncrypted&&(this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect"))):(Common.Gateway.reportWarning(t,n.msg),n.title=this.notcriticalErrorTitle,n.iconCls="warn",n.buttons=["ok"],n.callback=_.bind(function(e){if(t==Asc.c_oAscError.ID.Warning&&"ok"==e&&this.appOptions.canDownload)Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas");else if(t==Asc.c_oAscError.ID.SplitCellMaxRows||t==Asc.c_oAscError.ID.SplitCellMaxCols||t==Asc.c_oAscError.ID.SplitCellRowsDivider){var i=this;setTimeout(function(){new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&i.api&&i.api.SplitCell(e.columns,e.rows),i.onEditComplete()}}).show()},10)}else t==Asc.c_oAscError.ID.EditingError&&(this.disableEditing(!0),Common.NotificationCenter.trigger("api:disconnect",!0));this._state.lostEditingRights=!1,this.onEditComplete()},this)),t!==Asc.c_oAscError.ID.ForceSaveTimeout&&Common.UI.alert(n),Common.component.Analytics.trackEvent("Internal Error",t.toString())},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),t.setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0 -},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(e){var i=this.api.isDocumentModified();if(this._state.isDocModified!==i||e){var n=this.defaultTitleText;t&&!_.isEmpty(t.getDocumentCaption())&&(n=t.getDocumentCaption()+" - "+n),i&&(clearTimeout(this._state.timerCaption),_.isUndefined(n)||(n="* "+n)),window.document.title!=n&&(window.document.title=n),Common.Gateway.setDocumentModified(i),i&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.getApplication().getController("Statusbar").setStatusCaption("",!0),this._state.isDocModified=i}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(){var t=this.api.asc_isDocumentCanSave();this._state.isDocModified!==t&&Common.Gateway.setDocumentModified(this.api.isDocumentModified()),this.updateWindowTitle();var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e&&e.btnCollabChanges){var i=e.btnCollabChanges.$icon.hasClass("btn-synch"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e){var i=e.btnCollabChanges.$icon.hasClass("btn-synch"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onBeforeUnload:function(){if(Common.localStorage.save(),this.api.isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var t;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,e),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,i),t=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),Common.NotificationCenter.trigger("layout:changed","main"),(t||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},fillUserStore:function(t){if(!_.isEmpty(t)){var e=this.getCommonStoreUsersStore();e&&e.add(t)}},onCollaborativeChanges:function(){this._state.hasCollaborativeChanges||(this._state.hasCollaborativeChanges=!0,this.appOptions.isEdit&&this.getApplication().getController("Statusbar").setStatusCaption(this.txtNeedSynchronize,!0))},synchronizeChanges:function(){this.getApplication().getController("Statusbar").setStatusCaption(""),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").hideTips(),this.getApplication().getController("Toolbar").getView("Toolbar").synchronizeChanges(),this._state.hasCollaborativeChanges=!1},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines],this.layoutNames=[this.txtSldLtTBlank,this.txtSldLtTChart,this.txtSldLtTChartAndTx,this.txtSldLtTClipArtAndTx,this.txtSldLtTClipArtAndVertTx,this.txtSldLtTCust,this.txtSldLtTDgm,this.txtSldLtTFourObj,this.txtSldLtTMediaAndTx,this.txtSldLtTObj,this.txtSldLtTObjAndTwoObj,this.txtSldLtTObjAndTx,this.txtSldLtTObjOnly,this.txtSldLtTObjOverTx,this.txtSldLtTObjTx,this.txtSldLtTPicTx,this.txtSldLtTSecHead,this.txtSldLtTTbl,this.txtSldLtTTitle,this.txtSldLtTTitleOnly,this.txtSldLtTTwoColTx,this.txtSldLtTTwoObj,this.txtSldLtTTwoObjAndObj,this.txtSldLtTTwoObjAndTx,this.txtSldLtTTwoObjOverTx,this.txtSldLtTTwoTxTwoObj,this.txtSldLtTTx,this.txtSldLtTTxAndChart,this.txtSldLtTTxAndClipArt,this.txtSldLtTTxAndMedia,this.txtSldLtTTxAndObj,this.txtSldLtTTxAndTwoObj,this.txtSldLtTTxOverObj,this.txtSldLtTVertTitleAndTx,this.txtSldLtTVertTitleAndTxOverChart,this.txtSldLtTVertTx]},onInsertTable:function(){this.getApplication().getController("RightMenu").onInsertTable()},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},unitsChanged:function(t){var e=Common.localStorage.getItem("pe-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("pe-settings-unit",e),this.api.asc_SetDocumentUnits(e==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:e==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit()},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt(i.api.asc_getTextArtPreviews())},1)}},onFocusObject:function(t){var e=this.getApplication().getController("RightMenu");e&&e.onFocusObject.call(e,t)},_onChangeObjectLock:function(){var t=this.api.getSelectedElements();this.onFocusObject(t),this.getApplication().getController("Toolbar")._onFocusObject(t)},onThumbnailsShow:function(t){this.isThumbnailsShow=t},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[];_.each(t,function(t,o){var s=new Backbone.Collection([],{model:PE.Models.ShapeModel}),a=e[o].length>18?7:6,l=35*Math.ceil(e[o].length/a)+3,r=30*a;_.each(e[o],function(t,e){s.add({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:r,groupHeight:l})}),this.getCollection("ShapeGroups").reset(n)}},fillLayoutsStore:function(t){var e=this;if(!_.isEmpty(t)){var i=this.getCollection("SlideLayouts");if(i){var n=[];_.each(t,function(t){var i=t.get_Name();n.push({imageUrl:t.get_Image(),title:""!==i?i:e.layoutNames[t.getType()],itemWidth:t.get_Width(),itemHeight:t.get_Height(),data:{type:t.getType(),idx:t.getIndex()},allowSelected:!0,selected:!1})}),i.reset(n)}}},fillTextArt:function(t){if(!_.isEmpty(t)){var e=this,i=[],n=this.getCollection("Common.Collections.TextArt");_.each(t,function(t,e){i.push({imageUrl:t,data:e,allowSelected:!0,selected:!1})}),n.reset(i),setTimeout(function(){e.getApplication().getController("RightMenu").fillTextArt()},50)}},loadLanguages:function(t){var e,i=[],n=Common.util.LanguageInfo.getLanguages();for(var o in n)n.hasOwnProperty(o)&&(e=n[o],e[2]&&i.push({displayValue:e[1],value:e[0],code:parseInt(o),spellcheck:_.indexOf(t,o)>-1}));i.sort(function(t,e){return t.valuee.value?1:0}),this.languages=i,window.styles_loaded&&this.setLanguages()},setLanguages:function(){(!this.languages||this.languages.length<1)&&this.loadLanguages([]),this.languages&&this.languages.length>0&&(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").setLanguages(this.languages),this.getApplication().getController("Statusbar").setLanguages(this.languages),this.getApplication().getController("Common.Controllers.ReviewChanges").setLanguages(this.languages))},onTryUndoInFastCollaborative:function(){window.localStorage.getBool("pe-hide-try-undoredo")||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&window.localStorage.setItem("pe-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("pe-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("pe-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=this._state.fastCoauth;this._state.fastCoauth=Common.localStorage.getBool("pe-settings-coauthmode",!0),this._state.fastCoauth&&!t&&this.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(e){t.setDocumentCaption(e),this.updateWindowTitle(!0)},onMeta:function(e){t.setDocumentCaption(e.title),this.updateWindowTitle(!0),this.document.title=e.title;var i=this.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file");i.loadDocument({doc:this.document}),i.panels.info.updateInfo(this.document),Common.Gateway.metaChange(e)},onPrint:function(){this.appOptions.canPrint&&!this.isModalShowed&&(this.api&&this.api.asc_Print(new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera)),Common.component.Analytics.trackEvent("Print"))},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(t){e.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF))}}}t&&(this.iframePrint.src=t)},onAdvancedOptions:function(t,e){if(!this._state.openDlg){var i=this;t==Asc.c_oAscAdvancedOptionsID.DRM&&(i._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:i.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(i.appOptions.isDesktopApp&&i.appOptions.isOffline),validatePwd:!!i._state.isDRM,handler:function(e,n){i.isShowOpenDialog=!1,"ok"==e?i.api&&(i.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(n)),i.loadMask&&i.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),i._state.openDlg=null}}),i._state.isDRM=!0),i._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),i._state.openDlg.show())}},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",splitMaxRowsErrorText:"The number of rows must be less than %1",splitMaxColsErrorText:"The number of columns must be less than %1",splitDividerErrorText:"The number of rows must be a divisor of %1",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",txtSldLtTBlank:"Blank",txtSldLtTChart:"Chart",txtSldLtTChartAndTx:"Chart and Text",txtSldLtTClipArtAndTx:"Clip Art and Text",txtSldLtTClipArtAndVertTx:"Clip Art and Vertical Text",txtSldLtTCust:"Custom",txtSldLtTDgm:"Diagram",txtSldLtTFourObj:"Four Objects",txtSldLtTMediaAndTx:"Media and Text",txtSldLtTObj:"Title and Object",txtSldLtTObjAndTwoObj:"Object and Two Object",txtSldLtTObjAndTx:"Object and Text",txtSldLtTObjOnly:"Object",txtSldLtTObjOverTx:"Object over Text",txtSldLtTObjTx:"Title, Object, and Caption",txtSldLtTPicTx:"Picture and Caption",txtSldLtTSecHead:"Section Header",txtSldLtTTbl:"Table",txtSldLtTTitle:"Title",txtSldLtTTitleOnly:"Title Only",txtSldLtTTwoColTx:"Two Column Text",txtSldLtTTwoObj:"Two Objects",txtSldLtTTwoObjAndObj:"Two Objects and Object",txtSldLtTTwoObjAndTx:"Two Objects and Text",txtSldLtTTwoObjOverTx:"Two Objects over Text",txtSldLtTTwoTxTwoObj:"Two Text and Two Objects",txtSldLtTTx:"Text",txtSldLtTTxAndChart:"Text and Chart",txtSldLtTTxAndClipArt:"Text and Clip Art",txtSldLtTTxAndMedia:"Text and Media",txtSldLtTTxAndObj:"Text and Object",txtSldLtTTxAndTwoObj:"Text and Two Objects",txtSldLtTTxOverObj:"Text over Object",txtSldLtTVertTitleAndTx:"Vertical Title and Text",txtSldLtTVertTitleAndTxOverChart:"Vertical Title and Text Over Chart",txtSldLtTVertTx:"Vertical Text",textLoadingDocument:"Loading presentation",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",loadThemeTitleText:"Loading Theme",loadThemeTextText:"Loading theme...",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",txtEditingMode:"Set editing mode...",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",textAnonymous:"Anonymous",txtNeedSynchronize:"You have an updates",applyChangesTitleText:"Loading Data",applyChangesTextText:"Loading data...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading presentation",loadingDocumentTextText:"Loading presentation...",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:
    opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorDatabaseConnection:"External error.
    Database connection error. Please, contact support.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",txtArt:"Your text here",errorConnectToServer:' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    Find more information about connecting Document Server here',textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",textBuyNow:"Visit website",textNoLicenseTitle:"%1 open source version",textContactUs:"Contact sales",errorViewerDisconnect:"Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored.",warnLicenseExp:"Your license has expired.
    Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorToken:"The document security token is not correctly formed.
    Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.
    Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.
    Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes.",errorBadImageUrl:"Image url is incorrect",txtSlideText:"Slide text",txtClipArt:"Clip Art",txtDiagram:"SmartArt",txtDateTime:"Date and time",txtFooter:"Footer",txtHeader:"Header",txtMedia:"Media",txtPicture:"Picture",txtImage:"Image",txtSlideNumber:"Slide number",txtSlideSubtitle:"Slide subtitle",txtSlideTitle:"Slide title",textChangesSaved:"All changes saved",saveTitleText:"Saving Document",saveTextText:"Saving document...",txtLoading:"Loading...",txtAddNotes:"Click to add notes",errorForceSave:"An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",txtAddFirstSlide:"Click to add first slide",txtTheme_blank:"Blank",txtTheme_pixel:"Pixel",txtTheme_classic:"Classic",txtTheme_official:"Official",txtTheme_green:"Green",txtTheme_lines:"Lines",txtTheme_office:"Office",txtTheme_safari:"Safari",txtTheme_dotted:"Dotted",txtTheme_corner:"Corner",txtTheme_turtle:"Turtle",warnNoLicense:"This version of %1 editors has certain limitations for concurrent connections to the document server.
    If you need more please consider purchasing a commercial license.",warnNoLicenseUsers:"This version of %1 editors has certain limitations for concurrent users.
    If you need more please consider purchasing a commercial license.",warnLicenseExceeded:"The number of concurrent connections to the document server has been exceeded and the document will be opened for viewing only.
    Please contact your administrator for more information.",warnLicenseUsersExceeded:"The number of concurrent users has been exceeded and the document will be opened for viewing only.
    Please contact your administrator for more information.",errorDataEncrypted:"Encrypted changes have been received, they cannot be deciphered.",textClose:"Close",textPaidFeature:"Paid feature",scriptLoadError:"The connection is too slow, some of the components could not be loaded. Please reload the page.",errorEditingSaveas:"An error occurred during the work with the document.
    Use the 'Save as...' option to save the file backup copy to your computer hard drive.",errorEditingDownloadas:"An error occurred during the work with the document.
    Use the 'Download as...' option to save the file backup copy to your computer hard drive.",txtShape_textRect:"Text Box",txtShape_rect:"Rectangle",txtShape_ellipse:"Ellipse",txtShape_triangle:"Triangle",txtShape_rtTriangle:"Right Triangle",txtShape_parallelogram:"Parallelogram",txtShape_trapezoid:"Trapezoid",txtShape_diamond:"Diamond",txtShape_pentagon:"Pentagon",txtShape_hexagon:"Hexagon",txtShape_heptagon:"Heptagon",txtShape_octagon:"Octagon",txtShape_decagon:"Decagon",txtShape_dodecagon:"Dodecagon",txtShape_pie:"Pie",txtShape_chord:"Chord",txtShape_teardrop:"Teardrop",txtShape_frame:"Frame",txtShape_halfFrame:"Half Frame",txtShape_corner:"Corner",txtShape_diagStripe:"Diagonal Stripe",txtShape_plus:"Plus",txtShape_plaque:"Sign",txtShape_can:"Can",txtShape_cube:"Cube",txtShape_bevel:"Bevel",txtShape_donut:"Donut",txtShape_noSmoking:'"No" Symbol',txtShape_blockArc:"Block Arc",txtShape_foldedCorner:"Folded Corner",txtShape_smileyFace:"Smiley Face",txtShape_heart:"Heart",txtShape_lightningBolt:"Lightning Bolt",txtShape_sun:"Sun",txtShape_moon:"Moon",txtShape_cloud:"Cloud",txtShape_arc:"Arc",txtShape_bracePair:"Double Brace",txtShape_leftBracket:"Left Bracket",txtShape_rightBracket:"Right Bracket",txtShape_leftBrace:"Left Brace",txtShape_rightBrace:"Right Brace",txtShape_rightArrow:"Right Arrow",txtShape_leftArrow:"Left Arrow",txtShape_upArrow:"Up Arrow",txtShape_downArrow:"Down Arrow",txtShape_leftRightArrow:"Left Right Arrow",txtShape_upDownArrow:"Up Down Arrow",txtShape_quadArrow:"Quad Arrow",txtShape_leftRightUpArrow:"Left Right Up Arrow",txtShape_bentArrow:"Bent Arrow",txtShape_uturnArrow:"U-Turn Arrow",txtShape_leftUpArrow:"Left Up Arrow",txtShape_bentUpArrow:"Bent Up Arrow",txtShape_curvedRightArrow:"Curved Right Arrow",txtShape_curvedLeftArrow:"Curved Left Arrow",txtShape_curvedUpArrow:"Curved Up Arrow",txtShape_curvedDownArrow:"Curved Down Arrow",txtShape_stripedRightArrow:"Striped Right Arrow",txtShape_notchedRightArrow:"Notched Right Arrow",txtShape_homePlate:"Pentagon",txtShape_chevron:"Chevron",txtShape_rightArrowCallout:"Right Arrow Callout",txtShape_downArrowCallout:"Down Arrow Callout",txtShape_leftArrowCallout:"Left Arrow Callout",txtShape_upArrowCallout:"Up Arrow Callout",txtShape_leftRightArrowCallout:"Left Right Arrow Callout",txtShape_quadArrowCallout:"Quad Arrow Callout",txtShape_circularArrow:"Circular Arrow",txtShape_mathPlus:"Plus",txtShape_mathMinus:"Minus",txtShape_mathMultiply:"Multiply",txtShape_mathDivide:"Division",txtShape_mathEqual:"Equal",txtShape_mathNotEqual:"Not Equal",txtShape_flowChartProcess:"Flowchart: Process",txtShape_flowChartAlternateProcess:"Flowchart: Alternate Process",txtShape_flowChartDecision:"Flowchart: Decision",txtShape_flowChartInputOutput:"Flowchart: Data",txtShape_flowChartPredefinedProcess:"Flowchart: Predefined Process",txtShape_flowChartInternalStorage:"Flowchart: Internal Storage",txtShape_flowChartDocument:"Flowchart: Document",txtShape_flowChartMultidocument:"Flowchart: Multidocument ",txtShape_flowChartTerminator:"Flowchart: Terminator",txtShape_flowChartPreparation:"Flowchart: Preparation",txtShape_flowChartManualInput:"Flowchart: Manual Input",txtShape_flowChartManualOperation:"Flowchart: Manual Operation",txtShape_flowChartConnector:"Flowchart: Connector",txtShape_flowChartOffpageConnector:"Flowchart: Off-page Connector",txtShape_flowChartPunchedCard:"Flowchart: Card",txtShape_flowChartPunchedTape:"Flowchart: Punched Tape",txtShape_flowChartSummingJunction:"Flowchart: Summing Junction",txtShape_flowChartOr:"Flowchart: Or",txtShape_flowChartCollate:"Flowchart: Collate",txtShape_flowChartSort:"Flowchart: Sort",txtShape_flowChartExtract:"Flowchart: Extract",txtShape_flowChartMerge:"Flowchart: Merge",txtShape_flowChartOnlineStorage:"Flowchart: Stored Data",txtShape_flowChartDelay:"Flowchart: Delay",txtShape_flowChartMagneticTape:"Flowchart: Sequential Access Storage",txtShape_flowChartMagneticDisk:"Flowchart: Magnetic Disk",txtShape_flowChartMagneticDrum:"Flowchart: Direct Access Storage",txtShape_flowChartDisplay:"Flowchart: Display",txtShape_irregularSeal1:"Explosion 1",txtShape_irregularSeal2:"Explosion 2",txtShape_star4:"4-Point Star",txtShape_star5:"5-Point Star",txtShape_star6:"6-Point Star",txtShape_star7:"7-Point Star",txtShape_star8:"8-Point Star",txtShape_star10:"10-Point Star",txtShape_star12:"12-Point Star",txtShape_star16:"16-Point Star",txtShape_star24:"24-Point Star",txtShape_star32:"32-Point Star",txtShape_ribbon2:"Up Ribbon",txtShape_ribbon:"Down Ribbon",txtShape_ellipseRibbon2:"Curved Up Ribbon",txtShape_ellipseRibbon:"Curved Down Ribbon",txtShape_verticalScroll:"Vertical Scroll",txtShape_horizontalScroll:"Horizontal Scroll",txtShape_wave:"Wave",txtShape_doubleWave:"Double Wave",txtShape_wedgeRectCallout:"Rectangular Callout",txtShape_wedgeRoundRectCallout:"Rounded Rectangular Callout",txtShape_wedgeEllipseCallout:"Oval Callout",txtShape_cloudCallout:"Cloud Callout",txtShape_borderCallout1:"Line Callout 1",txtShape_borderCallout2:"Line Callout 2",txtShape_borderCallout3:"Line Callout 3",txtShape_accentCallout1:"Line Callout 1 (Accent Bar)",txtShape_accentCallout2:"Line Callout 2 (Accent Bar)",txtShape_accentCallout3:"Line Callout 3 (Accent Bar)",txtShape_callout1:"Line Callout 1 (No Border)",txtShape_callout2:"Line Callout 2 (No Border)",txtShape_callout3:"Line Callout 3 (No Border)",txtShape_accentBorderCallout1:"Line Callout 1 (Border and Accent Bar)",txtShape_accentBorderCallout2:"Line Callout 2 (Border and Accent Bar)",txtShape_accentBorderCallout3:"Line Callout 3 (Border and Accent Bar)",txtShape_actionButtonBackPrevious:"Back or Previous Button",txtShape_actionButtonForwardNext:"Forward or Next Button",txtShape_actionButtonBeginning:"Beginning Button",txtShape_actionButtonEnd:"End Button",txtShape_actionButtonHome:"Home Button",txtShape_actionButtonInformation:"Information Button",txtShape_actionButtonReturn:"Return Button",txtShape_actionButtonMovie:"Movie Button",txtShape_actionButtonDocument:"Document Button",txtShape_actionButtonSound:"Sound Button",txtShape_actionButtonHelp:"Help Button",txtShape_actionButtonBlank:"Blank Button",txtShape_roundRect:"Round Corner Rectangle",txtShape_snip1Rect:"Snip Single Corner Rectangle",txtShape_snip2SameRect:"Snip Same Side Corner Rectangle",txtShape_snip2DiagRect:"Snip Diagonal Corner Rectangle",txtShape_snipRoundRect:"Snip and Round Single Corner Rectangle",txtShape_round1Rect:"Round Single Corner Rectangle",txtShape_round2SameRect:"Round Same Side Corner Rectangle",txtShape_round2DiagRect:"Round Diagonal Corner Rectangle",txtShape_line:"Line",txtShape_lineWithArrow:"Arrow",txtShape_lineWithTwoArrows:"Double Arrow",txtShape_bentConnector5:"Elbow Connector",txtShape_bentConnector5WithArrow:"Elbow Arrow Connector",txtShape_bentConnector5WithTwoArrows:"Elbow Double-Arrow Connector",txtShape_curvedConnector3:"Curved Connector",txtShape_curvedConnector3WithArrow:"Curved Arrow Connector",txtShape_curvedConnector3WithTwoArrows:"Curved Double-Arrow Connector",txtShape_spline:"Curve",txtShape_polyline1:"Scribble",txtShape_polyline2:"Freeform",errorEmailClient:"No email client could be found",textCustomLoader:"Please note that according to the terms of the license you are not entitled to change the loader.
    Please contact our Sales Department to get a quote.",waitText:"Please, wait..."}}(),PE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:600,height:536,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.settingsurl=t.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=500,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.settingsurl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(t.needUpdate&&this.trigger("accessrights",this,t.sharingSettings),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("presentationeditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog","common/main/lib/component/CheckBox"],function(){"use strict";!PE.Views.FileMenuPanels&&(PE.Views.FileMenuPanels={}),PE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:void 0,formats:[[{name:"PPTX",imgCls:"pptx",type:Asc.c_oAscFileType.PPTX},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"ODP",imgCls:"odp",type:Asc.c_oAscFileType.ODP}],[{name:"POTX",imgCls:"potx",type:Asc.c_oAscFileType.POTX},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA},{name:"OTP",imgCls:"otp",type:Asc.c_oAscFileType.OTP}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({ +},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(e){var i=this.api.isDocumentModified();if(this._state.isDocModified!==i||e){var n=this.defaultTitleText;t&&!_.isEmpty(t.getDocumentCaption())&&(n=t.getDocumentCaption()+" - "+n),i&&(clearTimeout(this._state.timerCaption),_.isUndefined(n)||(n="* "+n)),window.document.title!=n&&(window.document.title=n),Common.Gateway.setDocumentModified(i),i&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.getApplication().getController("Statusbar").setStatusCaption("",!0),this._state.isDocModified=i}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(){var t=this.api.asc_isDocumentCanSave();this._state.isDocModified!==t&&Common.Gateway.setDocumentModified(this.api.isDocumentModified()),this.updateWindowTitle();var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e&&e.btnCollabChanges){var i=e.btnCollabChanges.$icon.hasClass("btn-synch"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e){var i=e.btnCollabChanges.$icon.hasClass("btn-synch"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onBeforeUnload:function(){if(Common.localStorage.save(),this.api.isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var t;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,e),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,i),t=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),Common.NotificationCenter.trigger("layout:changed","main"),(t||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},fillUserStore:function(t){if(!_.isEmpty(t)){var e=this.getCommonStoreUsersStore();e&&e.add(t)}},onCollaborativeChanges:function(){this._state.hasCollaborativeChanges||(this._state.hasCollaborativeChanges=!0,this.appOptions.isEdit&&this.getApplication().getController("Statusbar").setStatusCaption(this.txtNeedSynchronize,!0))},synchronizeChanges:function(){this.getApplication().getController("Statusbar").setStatusCaption(""),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").hideTips(),this.getApplication().getController("Toolbar").getView("Toolbar").synchronizeChanges(),this._state.hasCollaborativeChanges=!1},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines],this.layoutNames=[this.txtSldLtTBlank,this.txtSldLtTChart,this.txtSldLtTChartAndTx,this.txtSldLtTClipArtAndTx,this.txtSldLtTClipArtAndVertTx,this.txtSldLtTCust,this.txtSldLtTDgm,this.txtSldLtTFourObj,this.txtSldLtTMediaAndTx,this.txtSldLtTObj,this.txtSldLtTObjAndTwoObj,this.txtSldLtTObjAndTx,this.txtSldLtTObjOnly,this.txtSldLtTObjOverTx,this.txtSldLtTObjTx,this.txtSldLtTPicTx,this.txtSldLtTSecHead,this.txtSldLtTTbl,this.txtSldLtTTitle,this.txtSldLtTTitleOnly,this.txtSldLtTTwoColTx,this.txtSldLtTTwoObj,this.txtSldLtTTwoObjAndObj,this.txtSldLtTTwoObjAndTx,this.txtSldLtTTwoObjOverTx,this.txtSldLtTTwoTxTwoObj,this.txtSldLtTTx,this.txtSldLtTTxAndChart,this.txtSldLtTTxAndClipArt,this.txtSldLtTTxAndMedia,this.txtSldLtTTxAndObj,this.txtSldLtTTxAndTwoObj,this.txtSldLtTTxOverObj,this.txtSldLtTVertTitleAndTx,this.txtSldLtTVertTitleAndTxOverChart,this.txtSldLtTVertTx]},onInsertTable:function(){this.getApplication().getController("RightMenu").onInsertTable()},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},unitsChanged:function(t){var e=Common.localStorage.getItem("pe-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("pe-settings-unit",e),this.api.asc_SetDocumentUnits(e==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:e==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit()},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt(i.api.asc_getTextArtPreviews())},1)}},onFocusObject:function(t){var e=this.getApplication().getController("RightMenu");e&&e.onFocusObject.call(e,t)},_onChangeObjectLock:function(){var t=this.api.getSelectedElements();this.onFocusObject(t),this.getApplication().getController("Toolbar")._onFocusObject(t)},onThumbnailsShow:function(t){this.isThumbnailsShow=t},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[];_.each(t,function(t,o){var s=new Backbone.Collection([],{model:PE.Models.ShapeModel}),a=e[o].length>18?7:6,l=35*Math.ceil(e[o].length/a)+3,r=30*a;_.each(e[o],function(t,e){s.add({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:r,groupHeight:l})}),this.getCollection("ShapeGroups").reset(n)}},fillLayoutsStore:function(t){var e=this;if(!_.isEmpty(t)){var i=this.getCollection("SlideLayouts");if(i){var n=[];_.each(t,function(t){var i=t.get_Name();n.push({imageUrl:t.get_Image(),title:""!==i?i:e.layoutNames[t.getType()],itemWidth:t.get_Width(),itemHeight:t.get_Height(),data:{type:t.getType(),idx:t.getIndex()},allowSelected:!0,selected:!1})}),i.reset(n)}}},fillTextArt:function(t){if(!_.isEmpty(t)){var e=this,i=[],n=this.getCollection("Common.Collections.TextArt");_.each(t,function(t,e){i.push({imageUrl:t,data:e,allowSelected:!0,selected:!1})}),n.reset(i),setTimeout(function(){e.getApplication().getController("RightMenu").fillTextArt()},50)}},loadLanguages:function(t){var e,i=[],n=Common.util.LanguageInfo.getLanguages();for(var o in n)n.hasOwnProperty(o)&&(e=n[o],e[2]&&i.push({displayValue:e[1],value:e[0],code:parseInt(o),spellcheck:_.indexOf(t,o)>-1}));i.sort(function(t,e){return t.valuee.value?1:0}),this.languages=i,window.styles_loaded&&this.setLanguages()},setLanguages:function(){(!this.languages||this.languages.length<1)&&this.loadLanguages([]),this.languages&&this.languages.length>0&&(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").setLanguages(this.languages),this.getApplication().getController("Statusbar").setLanguages(this.languages),this.getApplication().getController("Common.Controllers.ReviewChanges").setLanguages(this.languages))},onTryUndoInFastCollaborative:function(){Common.localStorage.getBool("pe-hide-try-undoredo")||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&Common.localStorage.setItem("pe-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("pe-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("pe-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=this._state.fastCoauth;this._state.fastCoauth=Common.localStorage.getBool("pe-settings-coauthmode",!0),this._state.fastCoauth&&!t&&this.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(e){t.setDocumentCaption(e),this.updateWindowTitle(!0)},onMeta:function(e){t.setDocumentCaption(e.title),this.updateWindowTitle(!0),this.document.title=e.title;var i=this.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file");i.loadDocument({doc:this.document}),i.panels.info.updateInfo(this.document),Common.Gateway.metaChange(e)},onPrint:function(){this.appOptions.canPrint&&!this.isModalShowed&&(this.api&&this.api.asc_Print(new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera)),Common.component.Analytics.trackEvent("Print"))},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(t){e.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF))}}}t&&(this.iframePrint.src=t)},onAdvancedOptions:function(t,e){if(!this._state.openDlg){var i=this;t==Asc.c_oAscAdvancedOptionsID.DRM&&(i._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:i.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(i.appOptions.isDesktopApp&&i.appOptions.isOffline),validatePwd:!!i._state.isDRM,handler:function(e,n){i.isShowOpenDialog=!1,"ok"==e?i.api&&(i.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(n)),i.loadMask&&i.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),i._state.openDlg=null}}),i._state.isDRM=!0),i._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),i._state.openDlg.show())}},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",splitMaxRowsErrorText:"The number of rows must be less than %1",splitMaxColsErrorText:"The number of columns must be less than %1",splitDividerErrorText:"The number of rows must be a divisor of %1",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",txtSldLtTBlank:"Blank",txtSldLtTChart:"Chart",txtSldLtTChartAndTx:"Chart and Text",txtSldLtTClipArtAndTx:"Clip Art and Text",txtSldLtTClipArtAndVertTx:"Clip Art and Vertical Text",txtSldLtTCust:"Custom",txtSldLtTDgm:"Diagram",txtSldLtTFourObj:"Four Objects",txtSldLtTMediaAndTx:"Media and Text",txtSldLtTObj:"Title and Object",txtSldLtTObjAndTwoObj:"Object and Two Object",txtSldLtTObjAndTx:"Object and Text",txtSldLtTObjOnly:"Object",txtSldLtTObjOverTx:"Object over Text",txtSldLtTObjTx:"Title, Object, and Caption",txtSldLtTPicTx:"Picture and Caption",txtSldLtTSecHead:"Section Header",txtSldLtTTbl:"Table",txtSldLtTTitle:"Title",txtSldLtTTitleOnly:"Title Only",txtSldLtTTwoColTx:"Two Column Text",txtSldLtTTwoObj:"Two Objects",txtSldLtTTwoObjAndObj:"Two Objects and Object",txtSldLtTTwoObjAndTx:"Two Objects and Text",txtSldLtTTwoObjOverTx:"Two Objects over Text",txtSldLtTTwoTxTwoObj:"Two Text and Two Objects",txtSldLtTTx:"Text",txtSldLtTTxAndChart:"Text and Chart",txtSldLtTTxAndClipArt:"Text and Clip Art",txtSldLtTTxAndMedia:"Text and Media",txtSldLtTTxAndObj:"Text and Object",txtSldLtTTxAndTwoObj:"Text and Two Objects",txtSldLtTTxOverObj:"Text over Object",txtSldLtTVertTitleAndTx:"Vertical Title and Text",txtSldLtTVertTitleAndTxOverChart:"Vertical Title and Text Over Chart",txtSldLtTVertTx:"Vertical Text",textLoadingDocument:"Loading presentation",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",loadThemeTitleText:"Loading Theme",loadThemeTextText:"Loading theme...",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",txtEditingMode:"Set editing mode...",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",textAnonymous:"Anonymous",txtNeedSynchronize:"You have an updates",applyChangesTitleText:"Loading Data",applyChangesTextText:"Loading data...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading presentation",loadingDocumentTextText:"Loading presentation...",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:
    opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorDatabaseConnection:"External error.
    Database connection error. Please, contact support.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",txtArt:"Your text here",errorConnectToServer:' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    Find more information about connecting Document Server here',textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",textBuyNow:"Visit website",textNoLicenseTitle:"%1 open source version",textContactUs:"Contact sales",errorViewerDisconnect:"Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored.",warnLicenseExp:"Your license has expired.
    Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorToken:"The document security token is not correctly formed.
    Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.
    Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.
    Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes.",errorBadImageUrl:"Image url is incorrect",txtSlideText:"Slide text",txtClipArt:"Clip Art",txtDiagram:"SmartArt",txtDateTime:"Date and time",txtFooter:"Footer",txtHeader:"Header",txtMedia:"Media",txtPicture:"Picture",txtImage:"Image",txtSlideNumber:"Slide number",txtSlideSubtitle:"Slide subtitle",txtSlideTitle:"Slide title",textChangesSaved:"All changes saved",saveTitleText:"Saving Document",saveTextText:"Saving document...",txtLoading:"Loading...",txtAddNotes:"Click to add notes",errorForceSave:"An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",txtAddFirstSlide:"Click to add first slide",txtTheme_blank:"Blank",txtTheme_pixel:"Pixel",txtTheme_classic:"Classic",txtTheme_official:"Official",txtTheme_green:"Green",txtTheme_lines:"Lines",txtTheme_office:"Office",txtTheme_safari:"Safari",txtTheme_dotted:"Dotted",txtTheme_corner:"Corner",txtTheme_turtle:"Turtle",warnNoLicense:"This version of %1 editors has certain limitations for concurrent connections to the document server.
    If you need more please consider purchasing a commercial license.",warnNoLicenseUsers:"This version of %1 editors has certain limitations for concurrent users.
    If you need more please consider purchasing a commercial license.",warnLicenseExceeded:"The number of concurrent connections to the document server has been exceeded and the document will be opened for viewing only.
    Please contact your administrator for more information.",warnLicenseUsersExceeded:"The number of concurrent users has been exceeded and the document will be opened for viewing only.
    Please contact your administrator for more information.",errorDataEncrypted:"Encrypted changes have been received, they cannot be deciphered.",textClose:"Close",textPaidFeature:"Paid feature",scriptLoadError:"The connection is too slow, some of the components could not be loaded. Please reload the page.",errorEditingSaveas:"An error occurred during the work with the document.
    Use the 'Save as...' option to save the file backup copy to your computer hard drive.",errorEditingDownloadas:"An error occurred during the work with the document.
    Use the 'Download as...' option to save the file backup copy to your computer hard drive.",txtShape_textRect:"Text Box",txtShape_rect:"Rectangle",txtShape_ellipse:"Ellipse",txtShape_triangle:"Triangle",txtShape_rtTriangle:"Right Triangle",txtShape_parallelogram:"Parallelogram",txtShape_trapezoid:"Trapezoid",txtShape_diamond:"Diamond",txtShape_pentagon:"Pentagon",txtShape_hexagon:"Hexagon",txtShape_heptagon:"Heptagon",txtShape_octagon:"Octagon",txtShape_decagon:"Decagon",txtShape_dodecagon:"Dodecagon",txtShape_pie:"Pie",txtShape_chord:"Chord",txtShape_teardrop:"Teardrop",txtShape_frame:"Frame",txtShape_halfFrame:"Half Frame",txtShape_corner:"Corner",txtShape_diagStripe:"Diagonal Stripe",txtShape_plus:"Plus",txtShape_plaque:"Sign",txtShape_can:"Can",txtShape_cube:"Cube",txtShape_bevel:"Bevel",txtShape_donut:"Donut",txtShape_noSmoking:'"No" Symbol',txtShape_blockArc:"Block Arc",txtShape_foldedCorner:"Folded Corner",txtShape_smileyFace:"Smiley Face",txtShape_heart:"Heart",txtShape_lightningBolt:"Lightning Bolt",txtShape_sun:"Sun",txtShape_moon:"Moon",txtShape_cloud:"Cloud",txtShape_arc:"Arc",txtShape_bracePair:"Double Brace",txtShape_leftBracket:"Left Bracket",txtShape_rightBracket:"Right Bracket",txtShape_leftBrace:"Left Brace",txtShape_rightBrace:"Right Brace",txtShape_rightArrow:"Right Arrow",txtShape_leftArrow:"Left Arrow",txtShape_upArrow:"Up Arrow",txtShape_downArrow:"Down Arrow",txtShape_leftRightArrow:"Left Right Arrow",txtShape_upDownArrow:"Up Down Arrow",txtShape_quadArrow:"Quad Arrow",txtShape_leftRightUpArrow:"Left Right Up Arrow",txtShape_bentArrow:"Bent Arrow",txtShape_uturnArrow:"U-Turn Arrow",txtShape_leftUpArrow:"Left Up Arrow",txtShape_bentUpArrow:"Bent Up Arrow",txtShape_curvedRightArrow:"Curved Right Arrow",txtShape_curvedLeftArrow:"Curved Left Arrow",txtShape_curvedUpArrow:"Curved Up Arrow",txtShape_curvedDownArrow:"Curved Down Arrow",txtShape_stripedRightArrow:"Striped Right Arrow",txtShape_notchedRightArrow:"Notched Right Arrow",txtShape_homePlate:"Pentagon",txtShape_chevron:"Chevron",txtShape_rightArrowCallout:"Right Arrow Callout",txtShape_downArrowCallout:"Down Arrow Callout",txtShape_leftArrowCallout:"Left Arrow Callout",txtShape_upArrowCallout:"Up Arrow Callout",txtShape_leftRightArrowCallout:"Left Right Arrow Callout",txtShape_quadArrowCallout:"Quad Arrow Callout",txtShape_circularArrow:"Circular Arrow",txtShape_mathPlus:"Plus",txtShape_mathMinus:"Minus",txtShape_mathMultiply:"Multiply",txtShape_mathDivide:"Division",txtShape_mathEqual:"Equal",txtShape_mathNotEqual:"Not Equal",txtShape_flowChartProcess:"Flowchart: Process",txtShape_flowChartAlternateProcess:"Flowchart: Alternate Process",txtShape_flowChartDecision:"Flowchart: Decision",txtShape_flowChartInputOutput:"Flowchart: Data",txtShape_flowChartPredefinedProcess:"Flowchart: Predefined Process",txtShape_flowChartInternalStorage:"Flowchart: Internal Storage",txtShape_flowChartDocument:"Flowchart: Document",txtShape_flowChartMultidocument:"Flowchart: Multidocument ",txtShape_flowChartTerminator:"Flowchart: Terminator",txtShape_flowChartPreparation:"Flowchart: Preparation",txtShape_flowChartManualInput:"Flowchart: Manual Input",txtShape_flowChartManualOperation:"Flowchart: Manual Operation",txtShape_flowChartConnector:"Flowchart: Connector",txtShape_flowChartOffpageConnector:"Flowchart: Off-page Connector",txtShape_flowChartPunchedCard:"Flowchart: Card",txtShape_flowChartPunchedTape:"Flowchart: Punched Tape",txtShape_flowChartSummingJunction:"Flowchart: Summing Junction",txtShape_flowChartOr:"Flowchart: Or",txtShape_flowChartCollate:"Flowchart: Collate",txtShape_flowChartSort:"Flowchart: Sort",txtShape_flowChartExtract:"Flowchart: Extract",txtShape_flowChartMerge:"Flowchart: Merge",txtShape_flowChartOnlineStorage:"Flowchart: Stored Data",txtShape_flowChartDelay:"Flowchart: Delay",txtShape_flowChartMagneticTape:"Flowchart: Sequential Access Storage",txtShape_flowChartMagneticDisk:"Flowchart: Magnetic Disk",txtShape_flowChartMagneticDrum:"Flowchart: Direct Access Storage",txtShape_flowChartDisplay:"Flowchart: Display",txtShape_irregularSeal1:"Explosion 1",txtShape_irregularSeal2:"Explosion 2",txtShape_star4:"4-Point Star",txtShape_star5:"5-Point Star",txtShape_star6:"6-Point Star",txtShape_star7:"7-Point Star",txtShape_star8:"8-Point Star",txtShape_star10:"10-Point Star",txtShape_star12:"12-Point Star",txtShape_star16:"16-Point Star",txtShape_star24:"24-Point Star",txtShape_star32:"32-Point Star",txtShape_ribbon2:"Up Ribbon",txtShape_ribbon:"Down Ribbon",txtShape_ellipseRibbon2:"Curved Up Ribbon",txtShape_ellipseRibbon:"Curved Down Ribbon",txtShape_verticalScroll:"Vertical Scroll",txtShape_horizontalScroll:"Horizontal Scroll",txtShape_wave:"Wave",txtShape_doubleWave:"Double Wave",txtShape_wedgeRectCallout:"Rectangular Callout",txtShape_wedgeRoundRectCallout:"Rounded Rectangular Callout",txtShape_wedgeEllipseCallout:"Oval Callout",txtShape_cloudCallout:"Cloud Callout",txtShape_borderCallout1:"Line Callout 1",txtShape_borderCallout2:"Line Callout 2",txtShape_borderCallout3:"Line Callout 3",txtShape_accentCallout1:"Line Callout 1 (Accent Bar)",txtShape_accentCallout2:"Line Callout 2 (Accent Bar)",txtShape_accentCallout3:"Line Callout 3 (Accent Bar)",txtShape_callout1:"Line Callout 1 (No Border)",txtShape_callout2:"Line Callout 2 (No Border)",txtShape_callout3:"Line Callout 3 (No Border)",txtShape_accentBorderCallout1:"Line Callout 1 (Border and Accent Bar)",txtShape_accentBorderCallout2:"Line Callout 2 (Border and Accent Bar)",txtShape_accentBorderCallout3:"Line Callout 3 (Border and Accent Bar)",txtShape_actionButtonBackPrevious:"Back or Previous Button",txtShape_actionButtonForwardNext:"Forward or Next Button",txtShape_actionButtonBeginning:"Beginning Button",txtShape_actionButtonEnd:"End Button",txtShape_actionButtonHome:"Home Button",txtShape_actionButtonInformation:"Information Button",txtShape_actionButtonReturn:"Return Button",txtShape_actionButtonMovie:"Movie Button",txtShape_actionButtonDocument:"Document Button",txtShape_actionButtonSound:"Sound Button",txtShape_actionButtonHelp:"Help Button",txtShape_actionButtonBlank:"Blank Button",txtShape_roundRect:"Round Corner Rectangle",txtShape_snip1Rect:"Snip Single Corner Rectangle",txtShape_snip2SameRect:"Snip Same Side Corner Rectangle",txtShape_snip2DiagRect:"Snip Diagonal Corner Rectangle",txtShape_snipRoundRect:"Snip and Round Single Corner Rectangle",txtShape_round1Rect:"Round Single Corner Rectangle",txtShape_round2SameRect:"Round Same Side Corner Rectangle",txtShape_round2DiagRect:"Round Diagonal Corner Rectangle",txtShape_line:"Line",txtShape_lineWithArrow:"Arrow",txtShape_lineWithTwoArrows:"Double Arrow",txtShape_bentConnector5:"Elbow Connector",txtShape_bentConnector5WithArrow:"Elbow Arrow Connector",txtShape_bentConnector5WithTwoArrows:"Elbow Double-Arrow Connector",txtShape_curvedConnector3:"Curved Connector",txtShape_curvedConnector3WithArrow:"Curved Arrow Connector",txtShape_curvedConnector3WithTwoArrows:"Curved Double-Arrow Connector",txtShape_spline:"Curve",txtShape_polyline1:"Scribble",txtShape_polyline2:"Freeform",errorEmailClient:"No email client could be found",textCustomLoader:"Please note that according to the terms of the license you are not entitled to change the loader.
    Please contact our Sales Department to get a quote.",waitText:"Please, wait..."}}(),PE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:600,height:536,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.settingsurl=t.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=500,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.settingsurl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(t.needUpdate&&this.trigger("accessrights",this,t.sharingSettings),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("presentationeditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog","common/main/lib/component/CheckBox"],function(){"use strict";!PE.Views.FileMenuPanels&&(PE.Views.FileMenuPanels={}),PE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:void 0,formats:[[{name:"PPTX",imgCls:"pptx",type:Asc.c_oAscFileType.PPTX},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"ODP",imgCls:"odp",type:Asc.c_oAscFileType.ODP}],[{name:"POTX",imgCls:"potx",type:Asc.c_oAscFileType.POTX},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA},{name:"OTP",imgCls:"otp",type:Asc.c_oAscFileType.OTP}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({ rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onFormatClick:function(t){var e=t.currentTarget.attributes.format;!_.isUndefined(e)&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,parseInt(e.value)])}}),PE.Views.FileMenuPanels.ViewSaveCopy=Common.UI.BaseView.extend({el:"#panel-savecopy",menu:void 0,formats:[[{name:"PPTX",imgCls:"pptx",type:Asc.c_oAscFileType.PPTX,ext:".pptx"},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF,ext:".pdf"},{name:"ODP",imgCls:"odp",type:Asc.c_oAscFileType.ODP,ext:".odp"}],[{name:"POTX",imgCls:"potx",type:Asc.c_oAscFileType.POTX,ext:".potx"},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA,ext:".pdf"},{name:"OTP",imgCls:"otp",type:Asc.c_oAscFileType.OTP,ext:".otp"}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onFormatClick:function(t){var e=t.currentTarget.attributes.format,i=t.currentTarget.attributes["format-ext"];_.isUndefined(e)||_.isUndefined(i)||!this.menu||this.menu.fireEvent("savecopy:format",[this.menu,parseInt(e.value),i.value])}}),PE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:void 0,template:_.template(["",'','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'',"",'','',"",'',"",'','',"",'','','','',"",'',"",'','',"","
    ','
    ','
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({scope:this})),this.chSpell=new Common.UI.CheckBox({el:$("#fms-chb-spell-check"),labelText:this.strSpellCheckMode}),this.chInputMode=new Common.UI.CheckBox({el:$("#fms-chb-input-mode"),labelText:this.strInputMode}),this.cmbZoom=new Common.UI.ComboBox({el:$("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 210px;",data:[{value:-1,displayValue:this.txtFitSlide},{value:-2,displayValue:this.txtFitWidth},{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90,displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbCoAuthMode=new Common.UI.ComboBox({el:$("#fms-cmb-coauth-mode"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:1,displayValue:this.strFast,descValue:this.strCoAuthModeDescFast},{value:0,displayValue:this.strStrict,descValue:this.strCoAuthModeDescStrict}]}).on("selected",_.bind(function(t,e){1==e.value&&"checked"!==this.chAutosave.getValue()&&this.chAutosave.setValue(1),this.lblCoAuthMode.text(e.descValue)},this)),this.lblCoAuthMode=$("#fms-lbl-coauth-mode"),this.chAutosave=new Common.UI.CheckBox({el:$("#fms-chb-autosave"),labelText:this.strAutosave}).on("change",_.bind(function(t,e,i,n){"checked"!==t.getValue()&&this.cmbCoAuthMode.getValue()&&(this.cmbCoAuthMode.setValue(0),this.lblCoAuthMode.text(this.strCoAuthModeDescStrict))},this)),this.lblAutosave=$("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:$("#fms-chb-forcesave"),labelText:this.strForcesave}),this.chAlignGuides=new Common.UI.CheckBox({el:$("#fms-chb-align-guides"),labelText:this.strAlignGuides}),this.cmbFontRender=new Common.UI.ComboBox({el:$("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling,displayValue:this.txtWin},{value:Asc.c_oAscFontRenderingModeType.noHinting,displayValue:this.txtMac},{value:Asc.c_oAscFontRenderingModeType.hinting,displayValue:this.txtNative}]}),this.cmbUnit=new Common.UI.ComboBox({el:$("#fms-cmb-unit"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.btnApply=new Common.UI.Button({el:"#fms-btn-apply"}),this.btnApply.on("click",_.bind(this.applySettings,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings()},setMode:function(t){this.mode=t,$("tr.edit",this.el)[t.isEdit?"show":"hide"](),$("tr.autosave",this.el)[t.isEdit?"show":"hide"](),this.mode.isDesktopApp&&this.mode.isOffline&&(this.chAutosave.setCaption(this.strAutoRecover),this.lblAutosave.text(this.textAutoRecover)),$("tr.forcesave",this.el)[t.canForcesave?"show":"hide"](),$("tr.coauth.changes",this.el)[t.isEdit&&!t.isOffline&&t.canCoAuthoring?"show":"hide"]()},updateSettings:function(){this.chSpell.setValue(Common.Utils.InternalSettings.get("pe-settings-spellcheck")),this.chInputMode.setValue(Common.Utils.InternalSettings.get("pe-settings-inputmode"));var t=Common.Utils.InternalSettings.get("pe-settings-zoom");t=null!==t?parseInt(t):this.mode.customization&&this.mode.customization.zoom?parseInt(this.mode.customization.zoom):-1;var e=this.cmbZoom.store.findWhere({value:t});this.cmbZoom.setValue(e?parseInt(e.get("value")):t>0?t+"%":100);var i=Common.Utils.InternalSettings.get("pe-settings-coauthmode");e=this.cmbCoAuthMode.store.findWhere({value:i?1:0}),this.cmbCoAuthMode.setValue(e?e.get("value"):1),this.lblCoAuthMode.text(e?e.get("descValue"):this.strCoAuthModeDescFast),t=Common.Utils.InternalSettings.get("pe-settings-fontrender"),e=this.cmbFontRender.store.findWhere({value:parseInt(t)}),this.cmbFontRender.setValue(e?e.get("value"):window.devicePixelRatio>1?Asc.c_oAscFontRenderingModeType.noHinting:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling),t=Common.Utils.InternalSettings.get("pe-settings-unit"),e=this.cmbUnit.store.findWhere({value:t}),this.cmbUnit.setValue(e?parseInt(e.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),t=Common.Utils.InternalSettings.get("pe-settings-autosave"),this.chAutosave.setValue(1==t),this.mode.canForcesave&&this.chForcesave.setValue(Common.Utils.InternalSettings.get("pe-settings-forcesave")),this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("pe-settings-showsnaplines"))},applySettings:function(){Common.localStorage.setItem("pe-settings-spellcheck",this.chSpell.isChecked()?1:0),Common.localStorage.setItem("pe-settings-inputmode",this.chInputMode.isChecked()?1:0),Common.localStorage.setItem("pe-settings-zoom",this.cmbZoom.getValue()),Common.Utils.InternalSettings.set("pe-settings-zoom",Common.localStorage.getItem("pe-settings-zoom")),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("pe-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("pe-settings-fontrender",this.cmbFontRender.getValue()),Common.localStorage.setItem("pe-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("pe-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("pe-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.Utils.InternalSettings.set("pe-settings-showsnaplines",this.chAlignGuides.isChecked()),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},strInputMode:"Turn on hieroglyphs",strZoom:"Default Zoom Value",okButtonText:"Apply",txtFitSlide:"Fit to Slide",txtInput:"Alternate Input",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",textAutoSave:"Autosave",strAutosave:"Turn on autosave",strShowChanges:"Realtime Collaboration Changes",txtAll:"View All",txtLast:"View Last",textAlignGuides:"Alignment Guides",strAlignGuides:"Turn on alignment guides",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",txtFitWidth:"Fit to Width",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)",txtSpellCheck:"Spell Checking",strSpellCheckMode:"Turn on spell checking option"},PE.Views.FileMenuPanels.Settings||{})),PE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:void 0,template:_.template(['
    '].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.recent=t.recent},render:function(){return $(this.el).html(this.template()),this.viewRecentPicker=new Common.UI.DataView({el:$("#id-recent-view"),store:new Common.UI.DataViewStore(this.recent),itemTemplate:_.template(['
    ','
    ','
    <%= Common.Utils.String.htmlEncode(title) %>
    ','
    <%= Common.Utils.String.htmlEncode(folder) %>
    ',"
    "].join(""))}),this.viewRecentPicker.on("item:click",_.bind(this.onRecentFileClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onRecentFileClick:function(t,e,i){this.menu&&this.menu.fireEvent("recent:open",[this.menu,i.get("url")])}}),PE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:void 0,events:function(){return{"click .blank-document-btn":_.bind(this._onBlankDocument,this),"click .thumb-list .thumb-wrap":_.bind(this._onDocumentTemplate,this)}},template:_.template(['

    <%= scope.fromBlankText %>


    ','
    ','
    ','','',"","
    ",'
    ',"

    <%= scope.newDocumentText %>

    ","<%= scope.newDescriptionText %>","
    ","
    ","

    <%= scope.fromTemplateText %>


    ",'
    ',"<% _.each(docs, function(item) { %>",'
    ','
    \") } else { print(\">\") } %>","
    ",'
    <%= item.name %>
    ',"
    ","<% }) %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({scope:this,docs:this.options[0].docs})),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},_onBlankDocument:function(){this.menu&&this.menu.fireEvent("create:new",[this.menu,"blank"])},_onDocumentTemplate:function(t){this.menu&&this.menu.fireEvent("create:new",[this.menu,t.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Presentation",newDescriptionText:"Create a new blank presentation which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template",noTemplatesText:"There are no templates"},PE.Views.FileMenuPanels.CreateNew||{})),PE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'","","
    ',"","",'',"","
    ","
    "].join("")),this.menu=t.menu,this.coreProps=null,this.authors=[],this._locked=!1},render:function(){$(this.el).html(this.template());var t=this;this.lblPlacement=$("#id-info-placement"),this.lblOwner=$("#id-info-owner"),this.lblUploaded=$("#id-info-uploaded");var e=function(t,e){if(e.keyCode===Common.UI.Keys.ESC){var i=t._input.val(),n=t.getValue();i!==n&&(t.setValue(n),e.stopPropagation())}};return this.inputTitle=new Common.UI.InputField({el:$("#id-info-title"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putTitle(t.inputTitle.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.inputSubject=new Common.UI.InputField({el:$("#id-info-subject"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putSubject(t.inputSubject.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.inputComment=new Common.UI.InputField({el:$("#id-info-comment"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putDescription(t.inputComment.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.lblModifyDate=$("#id-info-modify-date"),this.lblModifyBy=$("#id-info-modify-by"),this.lblDate=$("#id-info-date"),this.lblApplication=$("#id-info-appname"),this.tblAuthor=$("#id-info-author table"),this.trAuthor=$("#id-info-add-author").closest("tr"),this.authorTpl='
    ',this.tblAuthor.on("click",function(e){var i=$(e.target);if(i.hasClass("close")&&!i.hasClass("disabled")){var n=i.closest("tr"),o=t.tblAuthor.find("tr").index(n);n.remove(),t.authors.splice(o,1),t.coreProps&&t.api&&(t.coreProps.asc_putCreator(t.authors.join(";")),t.api.asc_setCoreProps(t.coreProps))}}),this.inputAuthor=new Common.UI.InputField({el:$("#id-info-add-author"),style:"width: 200px;",validateOnBlur:!1,placeHolder:this.txtAddAuthor}).on("changed:after",function(e,i,n){if(i!=n){var o=i.trim();o&&o!==n.trim()&&(o.split(/\s*[,;]\s*/).forEach(function(e){var i=e.trim();if(i){var n=$(Common.Utils.String.format(t.authorTpl,Common.Utils.String.htmlEncode(i)));t.trAuthor.before(n),t.authors.push(e)}}),t.inputAuthor.setValue(""),t.coreProps&&t.api&&(t.coreProps.asc_putCreator(t.authors.join(";")),t.api.asc_setCoreProps(t.coreProps)))}}).on("keydown:before",e),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateFileInfo()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){if(!this.doc&&t&&t.info&&(t.info.author&&console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead."),t.info.created&&console.log("Obsolete: The 'created' parameter of the document 'info' section is deprecated. Please use 'uploaded' instead.")),this.doc=t,this.rendered){var e=!1;if(t=t||{},t.info){t.info.folder&&this.lblPlacement.text(t.info.folder),e=this._ShowHideInfoItem(this.lblPlacement,void 0!==t.info.folder&&null!==t.info.folder)||e;var i=t.info.owner||t.info.author;i&&this.lblOwner.text(i),e=this._ShowHideInfoItem(this.lblOwner,!!i)||e,i=t.info.uploaded||t.info.created,i&&this.lblUploaded.text(i),e=this._ShowHideInfoItem(this.lblUploaded,!!i)||e}else this._ShowHideDocInfo(!1);$("tr.divider.general",this.el)[e?"show":"hide"]();var n=this.api?this.api.asc_getAppProps():null;if(n&&(n=(n.asc_getApplication()||"")+" "+(n.asc_getAppVersion()||""),this.lblApplication.text(n)),this._ShowHideInfoItem(this.lblApplication,!!n),this.coreProps=this.api?this.api.asc_getCoreProps():null,this.coreProps){var i=this.coreProps.asc_getCreated();i&&this.lblDate.text(i.toLocaleString()),this._ShowHideInfoItem(this.lblDate,!!i)}}},updateFileInfo:function(){if(this.rendered){var t,e=this,i=this.api?this.api.asc_getCoreProps():null;if(this.coreProps=i,i){var n=!1;t=i.asc_getModified(),t&&this.lblModifyDate.text(t.toLocaleString()),n=this._ShowHideInfoItem(this.lblModifyDate,!!t)||n,t=i.asc_getLastModifiedBy(),t&&this.lblModifyBy.text(t),n=this._ShowHideInfoItem(this.lblModifyBy,!!t)||n,$("tr.divider.modify",this.el)[n?"show":"hide"](),t=i.asc_getTitle(),this.inputTitle.setValue(t||""),t=i.asc_getSubject(),this.inputSubject.setValue(t||""),t=i.asc_getDescription(),this.inputComment.setValue(t||""),this.tblAuthor.find("tr:not(:last-of-type)").remove(),this.authors=[],t=i.asc_getCreator(),t&&t.split(/\s*[,;]\s*/).forEach(function(t){var i=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(t)));e.trAuthor.before(i),e.authors.push(t)}),this.tblAuthor.find(".close").toggleClass("hidden",!this.mode.isEdit)}this.SetDisabled()}},_ShowHideInfoItem:function(t,e){return t.closest("tr")[e?"show":"hide"](),e},_ShowHideDocInfo:function(t){this._ShowHideInfoItem(this.lblPlacement,t),this._ShowHideInfoItem(this.lblOwner,t),this._ShowHideInfoItem(this.lblUploaded,t)},setMode:function(t){return this.mode=t,this.inputAuthor.setVisible(t.isEdit),this.tblAuthor.find(".close").toggleClass("hidden",!t.isEdit),this.SetDisabled(),this},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onLockCore",_.bind(this.onLockCore,this)),this.updateInfo(this.doc),this},onLockCore:function(t){this._locked=t,this.updateFileInfo()},SetDisabled:function(){var t=!this.mode.isEdit||this._locked;this.inputTitle.setDisabled(t),this.inputSubject.setDisabled(t),this.inputComment.setDisabled(t),this.inputAuthor.setDisabled(t),this.tblAuthor.find(".close").toggleClass("disabled",this._locked),this.tblAuthor.toggleClass("disabled",t)},txtPlacement:"Location",txtOwner:"Owner",txtUploaded:"Uploaded",txtAppName:"Application",txtEditTime:"Total Editing time",txtTitle:"Title",txtSubject:"Subject",txtComment:"Comment",txtModifyDate:"Last Modified",txtModifyBy:"Last Modified By",txtCreated:"Created",txtAuthor:"Author",txtAddAuthor:"Add Author",txtAddText:"Add Text",txtMinutes:"min"},PE.Views.FileMenuPanels.DocumentInfo||{})),PE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['','','",'',"",'','","","
    "].join("")),this.templateRights=_.template(["","<% _.each(users, function(item) { %>","",'',"","","<% }); %>","
    <%= Common.Utils.String.htmlEncode(item.user) %><%= Common.Utils.String.htmlEncode(item.permissions) %>
    "].join("")),this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.cntRights=$("#id-info-rights"),this.btnEditRights=new Common.UI.Button({el:"#id-info-btn-edit"}),this.btnEditRights.on("click",_.bind(this.changeAccessRights,this)),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),Common.NotificationCenter.on("collaboration:sharing",_.bind(this.changeAccessRights,this)),Common.NotificationCenter.on("collaboration:sharingdeny",_.bind(this.onLostEditRights,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},t.info?(t.info.sharingSettings&&this.cntRights.html(this.templateRights({users:t.info.sharingSettings})),this._ShowHideInfoItem("rights",void 0!==t.info.sharingSettings&&null!==t.info.sharingSettings&&t.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&!0!==this._readonlyRights)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("rights",t),this._ShowHideInfoItem("edit-rights",t)},setMode:function(t){return this.sharingSettingsUrl=t.sharingSettingsUrl,!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&Common.Gateway.on("showsharingsettings",_.bind(this.changeAccessRights,this)),!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&Common.Gateway.on("setsharingsettings",_.bind(this.setSharingSettings,this)),this},changeAccessRights:function(t,e,i){if(!this._docAccessDlg&&!this._readonlyRights){var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.updateSharingSettings(e)}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},setSharingSettings:function(t){t&&this.updateSharingSettings(t.sharingSettings)},updateSharingSettings:function(t){this.doc.info.sharingSettings=t,this._ShowHideInfoItem("rights",void 0!==this.doc.info.sharingSettings&&null!==this.doc.info.sharingSettings&&this.doc.info.sharingSettings.length>0),this.cntRights.html(this.templateRights({users:this.doc.info.sharingSettings})),Common.NotificationCenter.trigger("mentions:clearusers",this)},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},PE.Views.FileMenuPanels.DocumentRights||{})),PE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:void 0,template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"ProgramInterface/ProgramInterface.htm",name:"Introducing Presentation Editor user interface",headername:"Program Interface"},{src:"ProgramInterface/FileTab.htm",name:"File tab"},{src:"ProgramInterface/HomeTab.htm",name:"Home Tab"},{src:"ProgramInterface/InsertTab.htm",name:"Insert tab"},{src:"ProgramInterface/PluginsTab.htm",name:"Plugins tab"},{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new presentation or open an existing one",headername:"Basic operations"},{src:"UsageInstructions/CopyPasteUndoRedo.htm",name:"Copy/paste data, undo/redo your actions"},{src:"UsageInstructions/ManageSlides.htm",name:"Manage slides",headername:"Working with slides"},{src:"UsageInstructions/SetSlideParameters.htm",name:"Set slide parameters"},{src:"UsageInstructions/ApplyTransitions.htm",name:"Apply transitions"},{src:"UsageInstructions/PreviewPresentation.htm",name:"Preview your presentation"},{src:"UsageInstructions/InsertText.htm",name:"Insert and format your text",headername:"Text formatting"},{src:"UsageInstructions/AddHyperlinks.htm",name:"Add hyperlinks"},{src:"UsageInstructions/CreateLists.htm",name:"Create lists"},{src:"UsageInstructions/CopyClearFormatting.htm",name:"Copy/clear formatting"},{src:"UsageInstructions/InsertAutoshapes.htm",name:"Insert and format autoshapes",headername:"Operations on objects"},{src:"UsageInstructions/InsertImages.htm",name:"Insert and adjust images"},{src:"UsageInstructions/InsertCharts.htm",name:"Insert and edit charts"},{src:"UsageInstructions/InsertTables.htm",name:"Insert and format tables"},{src:"UsageInstructions/FillObjectsSelectColor.htm",name:"Fill objects and select colors"},{src:"UsageInstructions/ManipulateObjects.htm",name:"Manipulate objects on a slide"},{src:"UsageInstructions/AlignArrangeObjects.htm",name:"Align and arrange objects on a slide"},{src:"UsageInstructions/InsertEquation.htm",name:"Insert equations",headername:"Math equations"},{src:"HelpfulHints/CollaborativeEditing.htm",name:"Collaborative presentation editing",headername:"Presentation co-editing"},{src:"UsageInstructions/ViewPresentationInfo.htm",name:"View presentation information",headername:"Tools and settings"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your presentation"},{src:"HelpfulHints/AdvancedSettings.htm",name:"Advanced settings of Presentation Editor"},{src:"HelpfulHints/Navigation.htm",name:"View settings and navigation tools"},{src:"HelpfulHints/Search.htm",name:"Search function"},{src:"HelpfulHints/SpellChecking.htm",name:"Spell-checking"},{src:"HelpfulHints/About.htm",name:"About Presentation Editor",headername:"Helpful hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported formats of electronic presentations"},{src:"HelpfulHints/KeyboardShortcuts.htm",name:"Keyboard shortcuts"}],Common.Utils.isIE&&(window.onhelp=function(){return!1})},render:function(){var t=this;return $(this.el).html(this.template()),this.viewHelpPicker=new Common.UI.DataView({el:$("#id-help-contents"),store:new Common.UI.DataViewStore([]),keyMoveDirection:"vertical",itemTemplate:_.template(['
    ','
    <%= name %>
    ',"
    "].join(""))}),this.viewHelpPicker.on("item:add",function(t,e,i){i.has("headername")&&$(e.el).before('
    '+i.get("headername")+"
    ")}),this.viewHelpPicker.on("item:select",function(e,i,n){t.iFrame.src=t.urlPref+n.get("src")}),this.iFrame=document.createElement("iframe"),this.iFrame.src="",this.iFrame.align="top",this.iFrame.frameBorder="0",this.iFrame.width="100%",this.iFrame.height="100%",Common.Gateway.on("internalcommand",function(e){if("help:hyperlink"==e.type){var i=e.data,n=t.viewHelpPicker.store.find(function(t){return i.indexOf(t.get("src"))>0});n&&(t.viewHelpPicker.selectRecord(n,!0),t.viewHelpPicker.scrollToRecord(n))}}),$("#id-help-frame").append(this.iFrame),this},setLangConfig:function(t){var e=this,i=this.viewHelpPicker.store;if(t){t=t.split(/[\-\_]/)[0];var n={dataType:"json",error:function(){e.urlPref.indexOf("resources/help/en/")<0?(e.urlPref="resources/help/en/",i.url="resources/help/en/Contents.json",i.fetch(n)):(e.urlPref="resources/help/en/",i.reset(e.en_data))},success:function(){var t=i.at(0);e.viewHelpPicker.selectRecord(t),e.iFrame.src=e.urlPref+t.get("src")}};i.url="resources/help/"+t+"/Contents.json",i.fetch(n),this.urlPref="resources/help/"+t+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}}),PE.Views.FileMenuPanels.ProtectDoc=Common.UI.BaseView.extend(_.extend({el:"#panel-protect",menu:void 0, template:_.template(['','
    ','','
    ','',"",'',"","",'','',"","
    ","
    ",'
    ','','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu;var e=this;this.templateSignature=_.template(['',"",'',"","",'",'","","
    "].join(""))},render:function(){$(this.el).html(this.template({scope:this}));var t=PE.getController("Common.Controllers.Protection").getView();return this.btnAddPwd=t.getButton("add-password"),this.btnAddPwd.render(this.$el.find("#fms-btn-add-pwd")),this.btnAddPwd.on("click",_.bind(this.closeMenu,this)),this.btnChangePwd=t.getButton("change-password"),this.btnChangePwd.render(this.$el.find("#fms-btn-change-pwd")),this.btnChangePwd.on("click",_.bind(this.closeMenu,this)),this.btnDeletePwd=t.getButton("del-password"),this.btnDeletePwd.render(this.$el.find("#fms-btn-delete-pwd")),this.btnDeletePwd.on("click",_.bind(this.closeMenu,this)),this.cntPassword=$("#id-fms-password"),this.cntPasswordView=$("#id-fms-view-pwd"),this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#fms-btn-invisible-sign")),this.btnAddInvisibleSign.on("click",_.bind(this.closeMenu,this)),this.cntSignature=$("#id-fms-signature"),this.cntSignatureView=$("#id-fms-signature-view"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.$el.on("click",".signature-edit-link",_.bind(this.onEdit,this)),this.$el.on("click",".signature-view-link",_.bind(this.onView,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSignatures(),this.updateEncrypt()},setMode:function(t){this.mode=t,this.cntSignature.toggleClass("hidden",!this.mode.isSignatureSupport),this.cntPassword.toggleClass("hidden",!this.mode.isPasswordSupport)},setApi:function(t){return this.api=t,this},closeMenu:function(){this.menu&&this.menu.hide()},onEdit:function(){this.menu&&this.menu.hide();var t=this;Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(e){"ok"==e&&t.api.asc_RemoveAllSignatures()}})},onView:function(){this.menu&&this.menu.hide(),PE.getController("RightMenu").rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature,!0)},updateSignatures:function(){var t=this.api.asc_getSignatures(),e=!1,i=!1;_.each(t,function(t,n){0==t.asc_getValid()?e=!0:i=!0});var n=i?this.txtSignedInvalid:e?this.txtSigned:"";this.cntSignatureView.html(this.templateSignature({tipText:n,hasSigned:e||i}))},updateEncrypt:function(){this.cntPasswordView.toggleClass("hidden",this.btnAddPwd.isVisible())},strProtect:"Protect Presentation",strSignature:"With Signature",txtView:"View signatures",txtEdit:"Edit presentation",txtSigned:"Valid signatures has been added to the presentation. The presentation is protected from editing.",txtSignedInvalid:"Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the presentation.
    Are you sure you want to continue?",strEncrypt:"With Password",txtEncrypted:"This presentation has been protected by password"},PE.Views.FileMenuPanels.ProtectDoc||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Comment",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.Comment=e.Model.extend({defaults:{uid:0,guid:"",userid:0,username:"Guest",usercolor:null,date:void 0,quote:"",comment:"",resolved:!1,lock:!1,lockuserid:"",unattached:!1,id:Common.UI.getId(),time:0,showReply:!1,showReplyInPopover:!1,editText:!1,editTextInPopover:!1,last:void 0,replys:[],hideAddReply:!1,scope:null,hide:!1,hint:!1,dummy:void 0,editable:!0}}),Common.Models.Reply=e.Model.extend({defaults:{time:0,userid:0,username:"Guest",usercolor:null,reply:"",date:void 0,id:Common.UI.getId(),editText:!1,editTextInPopover:!1,scope:null,editable:!0}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Comments",["underscore","backbone","common/main/lib/model/Comment"],function(t,e){"use strict";Common.Collections.Comments=e.Collection.extend({model:Common.Models.Comment,groups:null,clearEditing:function(){this.each(function(t){t.set("editText",!1),t.set("editTextInPopover",!1),t.set("showReply",!1),t.set("showReplyInPopover",!1),t.set("hideAddReply",!1)})},getCommentsReplysCount:function(t){var e=0;return this.each(function(i){i.get("userid")==t&&e++;var n=i.get("replys");n&&n.length>0&&n.forEach(function(i){i.get("userid")==t&&e++})}),e}})}),define("text!common/main/lib/template/CommentsPopover.template",[],function(){return'
    \r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n <% if (!editTextInPopover || hint) { %>\r\n
    <%=scope.pickLink(comment)%>
    \r\n <% } else { %>\r\n
    \r\n \r\n <% if (hideAddReply) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n
    \r\n <% _.each(replys, function (item) { %>\r\n
    \r\n
    \r\n
    <%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(item.get("username")) %>\r\n
    \r\n
    <%=item.get("date")%>
    \r\n <% if (!item.get("editTextInPopover")) { %>\r\n
    <%=scope.pickLink(item.get("reply"))%>
    \r\n <% if (!hint) { %>\r\n
    \r\n <% if (item.get("editable")) { %>\r\n
    ">
    \r\n
    ">
    \r\n <%}%>\r\n
    \r\n <%}%>\r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n
    \r\n <% }); %>\r\n\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReplyInPopover && !hideAddReply && !hint) { %>\r\n <% if (replys.length) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editTextInPopover && !lock && !hint) { %>\r\n
    \r\n <% if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% if (resolved) { %>\r\n
    \r\n <% } else { %>\r\n
    \r\n <% } %>\r\n
    \r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReplyInPopover) { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- locked user --\x3e\r\n\r\n <% if (lock) { %>\r\n
    \r\n
    <%=lockuserid%>
    \r\n <% } %>\r\n\r\n
    '}),define("text!common/main/lib/template/ReviewChangesPopover.template",[],function(){return'
    \r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n
    <%=changetext%>
    \r\n
    \r\n <% if (goto) { %>\r\n
    \r\n <% } %>\r\n <% if (!hint) { %>\r\n <% if (scope.appConfig.isReviewOnly) { %>\r\n <% if (editable) { %>\r\n
    \r\n <% } %>\r\n <% } else { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% } %>\r\n
    \r\n <% if (!hint && lock) { %>\r\n
    \r\n
    <%=lockuser%>
    \r\n <% } %>\r\n
    '}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewPopover",["text!common/main/lib/template/CommentsPopover.template","text!common/main/lib/template/ReviewChangesPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o}Common.Views.ReviewPopover=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};return _.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1,alias:"Common.Views.ReviewPopover"},t),this.template=t.template||['
    ','
    ','
    ','
    ',"
    ",'
    ',"
    "].join(""),this.commentsStore=t.commentsStore,this.reviewStore=t.reviewStore,this.canRequestUsers=t.canRequestUsers,this.canRequestSendNotify=t.canRequestSendNotify,this.externalUsers=[],this._state={commentsVisible:!1,reviewVisible:!1},e.tpl=_.template(this.template)(e),this.arrow={margin:20,width:10,height:30},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e),this.canRequestUsers&&(Common.Gateway.on("setusers",_.bind(this.setUsers,this)),Common.NotificationCenter.on("mentions:clearusers",_.bind(this.clearUsers,this))),this},render:function(n,o){Common.UI.Window.prototype.render.call(this);var s=this,a=this.$window;a.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var l=a.find(".body");l&&l.css("position","relative");var r=Common.UI.DataView.extend(function(){var t=s;return{options:{handleSelect:!1,allowScrollbar:!1,template:_.template('
    ')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(t){var e=$(this.el).find("textarea");if(t)e.blur();else if(e&&e.length){var i=e.val();e.focus(),e.val(""),e.val(i)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function e(){l=t.scroller.getScrollTop(),n.scrollHeight>n.clientHeight?(i.css({height:n.scrollHeight+a+"px"}),t.calculateSizeOfContent()):(r=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(c=Math.max(n.scrollHeight+a,o),i.css({height:c+"px"})),t.calculateSizeOfContent(),t.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),t.calculateSizeOfContent()),t.scroller.scrollTop(l),t.autoScrollToEditButtons()}var i=this.$el.find("textarea"),n=null,o=50,a=0,l=0,r=0,c=0;i&&i.length&&(n=i.get(0))&&(a=.25*parseInt(i.css("lineHeight"),10),e(),i.bind("input propertychange",e)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)}}}());if(r)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new r({el:$("#id-comments-popover"),store:s.commentsStore,itemTemplate:_.template(i(t,{textAddReply:s.textAddReply,textAdd:s.textAdd,textCancel:s.textCancel,textEdit:s.textEdit,textReply:s.textReply,textClose:s.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength,textMention:s.canRequestSendNotify?s.textMention:""}))});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-resolve");o.tooltip({title:s.textResolve,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),o=$(e.el).find(".btn-resolve-check"),o.tooltip({title:s.textOpenAgain,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n,this.autoHeightTextBox()},h=function(){s._isMouseOver=!0},d=function(){s._isMouseOver=!1};this.commentsView.on("item:add",c),this.commentsView.on("item:remove",c),this.commentsView.on("item:change",c),this.commentsView.cmpEl.on("mouseover",h).on("mouseout",d),this.commentsView.on("item:click",function(t,e,i,n){function o(){s.update()}var a,l,r,c,h,d;if(a=$(n.target)){if(l=i.get("editTextInPopover"),r=i.get("showReplyInPopover"),d=i.get("hideAddReply"),c=i.get("uid"),h=a.attr("data-value"),i.get("hint"))return void s.fireEvent("comment:disableHint",[i]);if(a.hasClass("btn-edit"))_.isUndefined(h)?l||(s.fireEvent("comment:closeEditing"),i.set("editTextInPopover",!0),s.fireEvent("comment:show",[c]),this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox()):(s.fireEvent("comment:closeEditing",[c]),s.fireEvent("comment:editReply",[c,h,!0]),this.replyId=h,this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox());else if(a.hasClass("btn-delete"))_.isUndefined(h)?s.fireEvent("comment:remove",[c]):(s.fireEvent("comment:removeReply",[c,h]),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent()),s.fireEvent("comment:closeEditing"),o();else if(a.hasClass("user-reply"))s.fireEvent("comment:closeEditing"),i.set("showReplyInPopover",!0),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),this.autoHeightTextBox(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox();else if(a.hasClass("btn-reply",!1))r&&(this.clearTextBoxBind(),s.fireEvent("comment:addReply",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent(),o());else if(a.hasClass("btn-close",!1))s.fireEvent("comment:closeEditing",[c]),s.calculateSizeOfContent(),s.fireEvent("comment:show",[c]),o();else if(a.hasClass("btn-inner-edit",!1)){if(i.get("dummy")){var p=this.getActiveTextBoxVal();if(s.clearDummyText(),p.length>0)s.fireEvent("comment:addDummyComment",[p]);else{var u=s.$window.find("textarea:not(.user-message)");u&&u.length&&setTimeout(function(){u.focus()},10)}return}this.clearTextBoxBind(),_.isUndefined(this.replyId)?l&&(s.fireEvent("comment:change",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent()):(s.fireEvent("comment:changeReply",[c,this.replyId,this.getActiveTextBoxVal()]),this.replyId=void 0,s.fireEvent("comment:closeEditing")),o()}else if(a.hasClass("btn-inner-close",!1)){if(i.get("dummy"))return s.clearDummyText(),void s.hide();d&&this.getActiveTextBoxVal().length>0?(s.saveText(),i.set("hideAddReply",!1),this.getTextBox().val(s.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),s.fireEvent("comment:closeEditing",[c])),this.replyId=void 0,s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o()}else if(a.hasClass("btn-resolve",!1)){var m=a.data("bs.tooltip");m&&(m.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}else if(a.hasClass("btn-resolve-check",!1)){var m=a.data("bs.tooltip");m&&(m.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}}}),this.emailMenu=new Common.UI.Menu({maxHeight:190,cyclic:!1,items:[]}).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0}),s.$window.css({zIndex:"1001"})}).on("hide:after",function(){s.$window.css({zIndex:"990"})}),s.on({show:function(){s.commentsView.autoHeightTextBox(),s.$window.find("textarea").keydown(function(t){t.keyCode==Common.UI.Keys.ESC&&s.hide(!0)})},"animate:before":function(){var t=s.$window.find("textarea");t&&t.length&&t.focus()}})}var p=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,template:_.template('
    ')}}}());if(p)if(this.reviewChangesView)this.reviewChangesView.render($("#id-review-popover")),this.reviewChangesView.onResetItems();else{this.reviewChangesView=new p({el:$("#id-review-popover"),store:s.reviewStore,itemTemplate:_.template(e)});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-goto");o.tooltip({title:s.textFollowMove,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n};this.reviewChangesView.on("item:add",c),this.reviewChangesView.on("item:remove",c),this.reviewChangesView.on("item:change",c),this.reviewChangesView.on("item:click",function(t,e,i,n){var o=$(n.target);if(o)if(o.hasClass("btn-accept"))s.fireEvent("reviewchange:accept",[i.get("changedata")]);else if(o.hasClass("btn-reject"))s.fireEvent("reviewchange:reject",[i.get("changedata")]);else if(o.hasClass("btn-delete"))s.fireEvent("reviewchange:delete",[i.get("changedata")]);else if(o.hasClass("btn-goto")){var a=o.data("bs.tooltip");a&&(a.dontShow=!0),s.fireEvent("reviewchange:goto",[i.get("changedata")])}})}_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:a.find("#id-popover"),minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:!0}))},showComments:function(t,e,i,n){this.options.animate=t;var o=this.commentsView.getTextBox();e&&this.textVal&&o&&o.val(this.textVal),n&&n.length&&o&&o.val(n),this.show(t),this.hookTextBox(),this._state.commentsVisible=!0},showReview:function(t,e,i){this.show(t),this._state.reviewVisible=!0},show:function(t,e,i,n){this.options.animate=t,Common.UI.Window.prototype.show.call(this),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},hideComments:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.commentsVisible=!1,this._state.reviewVisible?this.calculateSizeOfContent():this.hide()},hideReview:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.reviewVisible=!1,this._state.commentsVisible?this.calculateSizeOfContent():this.hide()},hide:function(){this.handlerHide&&this.handlerHide.apply(this,arguments),this.hideTips(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(t){this.commentsView&&t&&this.commentsView.onResetItems(),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n,o){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var s=$("#id-popover"),a=$("#id-comments-arrow"),l=$("#editor_sdk"),r=null,c=0,h="",d=0,p="",u=0,m="",g=0,f="",b=0,C=0,v=0,y=0,w=0,x=0;s&&a&&l&&l.get(0)&&(r=l.get(0).getBoundingClientRect())&&(c=r.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:c+"px"}),this.sdkBounds.width=r.width,this.sdkBounds.height=r.height,_.isUndefined(t)||(h=$("#id_vertical_scroll"),h.length?d="none"!==h.css("display")?h.width():0:(h=$("#ws-v-scrollbar"),h.length&&(d="none"!==h.css("display")?h.width():0)),this.sdkBounds.width-=d,p=$("#id_panel_left"),p.length&&(u="none"!==p.css("display")?p.width():0),m=$("#id_panel_thumbnails"),m.length&&(g="none"!==m.css("display")?m.width():0,this.sdkBounds.width-=g),C=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()-25),C=Math.max(0+u+this.arrow.width,C),a.removeClass("right").addClass("left"),_.isUndefined(i)||(v=this.$window.outerWidth())&&(t+v>this.sdkBounds.width-this.arrow.width+5&&this.leftX>v?(C=this.leftX-v+0-this.arrow.width,a.removeClass("left").addClass("right")):C=0+t+this.arrow.width),this.$window.css("left",C+"px")),_.isUndefined(e)||(f=$("#id_panel_top"),x=0,f.length?(b="none"!==f.css("display")?f.height():0,x+=this.sdkBounds.paddingTop):(f=$("#ws-h-scrollbar"),f.length&&(b="none"!==f.css("display")?f.height():0)),this.sdkBounds.height-=b,y=this.$window.outerHeight(),w=Math.min(0+c-y,this.arrowPosY+0-this.arrow.height),w=Math.max(w,x),parseInt(a.css("top"))+this.arrow.height>y&&a.css({top:y-this.arrow.height+"px"}),this.$window.css("top",w+"px"))),o||this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-comments-arrow"),i=$("#id-popover"),n=null,o=null,s=null,a=0,l="",r=0,c=0,h=0,d=0,p=0,u=0;if(i&&e&&i.get(0)){var m=this.scroller.getScrollTop();i.css({height:"100%"}),n=i.get(0).getBoundingClientRect(),n&&(o=$("#editor_sdk"))&&o.get(0)&&(s=o.get(0).getBoundingClientRect())&&(a=s.height-2*this.sdkBounds.padding,u=0,h=this.$window.outerHeight(),l=$("#id_panel_top"),l.length?(r="none"!==l.css("display")?l.height():0,u+=this.sdkBounds.paddingTop):(l=$("#ws-h-scrollbar"),l.length&&(r="none"!==l.css("display")?l.height():0)),d=Math.max(i.outerHeight(),this.$window.outerHeight()),a<=d?(this.$window.css({maxHeight:a-r+"px",top:0+r+"px"}),i.css({height:a-r-3+"px"}),c=Math.min(c,a-(r+this.arrow.margin+this.arrow.height)),e.css({top:c+"px"}),this.scroller.scrollTop(m)):(d=h,d>0&&(n.top+d>a+0||0===n.height)&&(p=Math.min(0+a-d,this.arrowPosY+0-this.arrow.height),p=Math.max(p,u),this.$window.css({top:p+"px"})),c=Math.max(this.arrow.margin,this.arrowPosY-(a-d)-this.arrow.height),c=Math.min(c,d-this.arrow.margin-this.arrow.height),e.css({top:c+"px"})))}this.$window.css({overflow:""}),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},getEditText:function(){if(this.commentsView)return this.commentsView.getActiveTextBoxVal()},saveDummyText:function(){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textDummyVal=this.commentsView.getActiveTextBoxVal())},clearDummyText:function(){if(this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1){this.textDummyVal=void 0;var t=this.commentsView.getTextBox();t&&t.val(""),this.commentsView.clearTextBoxBind()}},getDummyText:function(){return this.textDummyVal||""},hookTextBox:function(){var t=this,e=this.commentsView.getTextBox();e&&e.keydown(function(e){if(!e.ctrlKey&&!e.metaKey||e.altKey||e.keyCode!==Common.UI.Keys.RETURN){if(e.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,e.stopImmediatePropagation(),e.preventDefault()}}else{var s=$("#id-comments-change-popover");s&&s.length&&s.click(),e.stopImmediatePropagation()}t.e=e}),this.canRequestUsers&&(e&&e.keydown(function(e){e.keyCode==Common.UI.Keys.SPACE||e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.RIGHT||e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.UP?t.onEmailListMenu():e.keyCode==Common.UI.Keys.DOWN&&t.emailMenu&&t.emailMenu.rendered&&t.emailMenu.isVisible()&&_.delay(function(){var e=t.emailMenu.cmpEl.find("li:not(.divider):first");e=e.find("a"),e.focus()},10),t.e=e}),e&&e.on("input",function(e){for(var i=$(this),n=this.selectionStart,o=i.val().replace(/[\n]$/,""),s=0,a=o.length-1,l=n-1;l>=0;l--)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){s=l+1;break}for(var l=n;l<=a;l++)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){a=l-1;break}var r=o.substring(s,a+1),c=r.match(/^(?:[@]|[+](?!1))(\S*)/);c&&c.length>1&&(r=c[1],t.onEmailListMenu(r,s,a))}))},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this),this.reviewChangesView&&_.each(this.reviewChangesView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this)},isCommentsViewMouseOver:function(){return this._isMouseOver},setReviewStore:function(t){this.reviewStore=t,this.reviewChangesView&&this.reviewChangesView.setStore(this.reviewStore)},setCommentsStore:function(t){this.commentsStore=t,this.commentsView&&this.commentsView.setStore(this.commentsStore)},setUsers:function(t){this.externalUsers=t.users||[],this.isUsersLoading=!1,this._state.emailSearch&&this.onEmailListMenu(this._state.emailSearch.str,this._state.emailSearch.left,this._state.emailSearch.right),this._state.emailSearch=null},clearUsers:function(){this.externalUsers=[]},getPopover:function(t){return this.popover||(this.popover=new Common.Views.ReviewPopover(t)),this.popover},autoScrollToEditButtons:function(){var t=$("#id-comments-change-popover"),e=null,i=this.$window[0].getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)},onEmailListMenu:function(t,e,i,n){var o=this,s=o.externalUsers,a=o.emailMenu;if(s.length<1){if(this._state.emailSearch={str:t,left:e,right:i},this.isUsersLoading)return;return this.isUsersLoading=!0,void Common.Gateway.requestUsers()}if("string"==typeof t){var l=o.$window.find(Common.Utils.String.format("#menu-container-{0}",a.id)),r=this.commentsView.getTextBox(),c=r?r[0]:null,h=c?[c.offsetLeft,c.offsetTop+c.clientHeight+3]:[0,0];a.rendered||(l.length<1&&(l=$(Common.Utils.String.format('',a.id)),o.$window.append(l)),a.render(l),a.cmpEl.css("min-width",c?c.clientWidth:220),a.cmpEl.attr({tabindex:"-1"}),a.on("hide:after",function(){setTimeout(function(){var t=o.commentsView.getTextBox();t&&t.focus()},10)}));for(var d=0;d0){t=t.toLowerCase(),t.length>0&&(s=_.filter(s,function(e){return e.email&&0===e.email.toLowerCase().indexOf(t)||e.name&&0===e.name.toLowerCase().indexOf(t)}));var p=_.template('
    <%= Common.Utils.String.htmlEncode(caption) %>
    <%= Common.Utils.String.htmlEncode(options.value) %>
    '),u=!1;_.each(s,function(t,n){if(u&&!t.hasAccess&&(u=!1,a.addItem(new Common.UI.MenuItem({caption:"--"}))),t.email&&t.name){var s=new Common.UI.MenuItem({caption:t.name,value:t.email,template:p}).on("click",function(t,n){o.insertEmailToTextbox(t.options.value,e,i)});a.addItem(s),t.hasAccess&&(u=!0)}})}a.items.length>0?(l.css({left:h[0],top:h[1]}),a.menuAlignEl=r,a.show(),a.cmpEl.css("display",""),a.alignPosition("bl-tl",-5),a.scroller.update({alwaysVisibleY:!0})):a.rendered&&a.cmpEl.css("display","none")}else a.rendered&&a.cmpEl.css("display","none")},insertEmailToTextbox:function(t,e,i){var n=this.commentsView.getTextBox(),o=n.val();n.val(o.substring(0,e)+"+"+t+o.substring(i+1,o.length)),setTimeout(function(){n[0].selectionStart=n[0].selectionEnd=e+t.length+1},10)},textAddReply:"Add Reply",textAdd:"Add",textCancel:"Cancel",textEdit:"Edit",textReply:"Reply",textClose:"Close",textResolve:"Resolve",textOpenAgain:"Open Again",textFollowMove:"Follow Move",textMention:"+mention will provide access to the document and send an email"},Common.Views.ReviewPopover||{}))}),void 0===Common)var Common={} ;if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Comments",["core","common/main/lib/model/Comment","common/main/lib/collection/Comments","common/main/lib/view/Comments","common/main/lib/view/ReviewPopover"],function(){"use strict";function t(){return void 0!==Asc.asc_CCommentDataWord?new Asc.asc_CCommentDataWord(null):new Asc.asc_CCommentData(null)}Common.Controllers.Comments=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Comments"],views:["Common.Views.Comments","Common.Views.ReviewPopover"],sdkViewName:"#id_main",subEditStrings:{},filter:void 0,hintmode:!1,viewmode:!1,isSelectedComment:!1,uids:[],oldUids:[],isDummyComment:!1,initialize:function(){this.addListeners({"Common.Views.Comments":{"comment:add":_.bind(this.onCreateComment,this),"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this)},"Common.Views.ReviewPopover":{"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this),"comment:disableHint":_.bind(this.disableHint,this),"comment:addDummyComment":_.bind(this.onAddDummyComment,this)}}),Common.NotificationCenter.on("comments:updatefilter",_.bind(this.onUpdateFilter,this)),Common.NotificationCenter.on("app:comment:add",_.bind(this.onAppAddComment,this)),Common.NotificationCenter.on("layout:changed",function(t){Common.Utils.asyncCall(function(t){"toolbar"!=t&&"status"!=t||!this.view.$el.is(":visible")||this.onAfterShow()},this,t)}.bind(this))},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.Comments"),this.collection&&(this.collection.comparator=function(t){return-t.get("time")}),this.popoverComments=new Common.Collections.Comments,this.popoverComments&&(this.popoverComments.comparator=function(t){return t.get("time")}),this.groupCollection=[],this.view=this.createView("Common.Views.Comments",{store:this.collection}),this.view.render(),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this)),this.bindViewEvents(this.view,this.events)},setConfig:function(t,e){this.setApi(e),t&&(this.currentUserId=t.config.user.id,this.currentUserName=t.config.user.fullname,this.sdkViewName=t.sdkviewname||this.sdkViewName,this.hintmode=t.hintmode||!1,this.viewmode=t.viewmode||!1)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this)),this.api.asc_registerCallback("asc_onRemoveComment",_.bind(this.onApiRemoveComment,this)),this.api.asc_registerCallback("asc_onChangeComments",_.bind(this.onChangeComments,this)),this.api.asc_registerCallback("asc_onRemoveComments",_.bind(this.onRemoveComments,this)),this.api.asc_registerCallback("asc_onChangeCommentData",_.bind(this.onApiChangeCommentData,this)),this.api.asc_registerCallback("asc_onLockComment",_.bind(this.onApiLockComment,this)),this.api.asc_registerCallback("asc_onUnLockComment",_.bind(this.onApiUnLockComment,this)),this.api.asc_registerCallback("asc_onShowComment",_.bind(this.onApiShowComment,this)),this.api.asc_registerCallback("asc_onHideComment",_.bind(this.onApiHideComment,this)),this.api.asc_registerCallback("asc_onUpdateCommentPosition",_.bind(this.onApiUpdateCommentPosition,this)),this.api.asc_registerCallback("asc_onDocumentPlaceChanged",_.bind(this.onDocumentPlaceChanged,this)))},setMode:function(t){return this.mode=t,this.isModeChanged=!0,this.view.viewmode=!this.mode.canComments,this.view.changeLayout(t),this},onCreateComment:function(e,i,n,o,s){if(this.api&&i&&i.length>0){var a=t();a&&(this.showPopover=!0,this.editPopover=!!n,this.hidereply=o,this.isSelectedComment=!1,this.uids=[],a.asc_putText(i),a.asc_putTime(this.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),a.asc_putUserId(this.currentUserId),a.asc_putUserName(this.currentUserName),a.asc_putSolved(!1),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(s),this.api.asc_addComment(a),this.view.showEditContainer(!1))}this.view.txtComment.focus()},onRemoveComment:function(t){this.api&&t&&this.api.asc_removeComment(t)},onResolveComment:function(e){var i=this,n=null,o=null,s=t(),a=i.findComment(e);return _.isUndefined(e)&&(e=a.get("uid")),!(!s||!a)&&(s.asc_putText(a.get("comment")),s.asc_putQuoteText(a.get("quote")),s.asc_putTime(i.utcDateToString(new Date(a.get("time")))),s.asc_putOnlyOfficeTime(i.ooDateToString(new Date(a.get("time")))),s.asc_putUserId(a.get("userid")),s.asc_putUserName(a.get("username")),s.asc_putSolved(!a.get("resolved")),s.asc_putGuid(a.get("guid")),_.isUndefined(s.asc_putDocumentFlag)||s.asc_putDocumentFlag(a.get("unattached")),n=a.get("replys"),n&&n.length&&n.forEach(function(e){(o=t())&&(o.asc_putText(e.get("reply")),o.asc_putTime(i.utcDateToString(new Date(e.get("time")))),o.asc_putOnlyOfficeTime(i.ooDateToString(new Date(e.get("time")))),o.asc_putUserId(e.get("userid")),o.asc_putUserName(e.get("username")),s.asc_addReply(o))}),i.api.asc_changeComment(e,s),!0)},onShowComment:function(t,e){var i=this.findComment(t);if(i)if(null!==i.get("quote")){if(this.api){if(this.hintmode){if(this.animate=!0,i.get("unattached")&&this.getPopover())return void this.getPopover().hideComments()}else{var n=this.popoverComments.findWhere({uid:t});if(n&&!this.getPopover().isVisible())return this.getPopover().showComments(!0),void this.api.asc_selectComment(t)}!_.isUndefined(e)&&this.hintmode&&(this.isSelectedComment=e),this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!1)}}else this.hintmode&&this.api.asc_selectComment(t),this.getPopover()&&this.getPopover().hideComments(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(e,i){if(i&&i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(r&&l)return l.asc_putText(i),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(n.currentUserId),l.asc_putUserName(n.currentUserName),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),r.set("editTextInPopover",!1),o=n.findPopupComment(e),o&&o.set("editTextInPopover",!1),n.subEditStrings[e]&&delete n.subEditStrings[e],n.subEditStrings[e+"-R"]&&delete n.subEditStrings[e+"-R"],s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),l.asc_addReply(a))}),n.api.asc_changeComment(e,l),!0}return!1},onChangeReplyComment:function(e,i,n){if(n&&n.length>0){var o=this,s=null,a=null,l=t(),r=o.findComment(e);if(l&&r)return l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(o.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(o.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(e.get("id")!==i||_.isUndefined(n)?(a.asc_putText(e.get("reply")),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username"))):(a.asc_putText(n),a.asc_putUserId(o.currentUserId),a.asc_putUserName(o.currentUserName)),a.asc_putTime(o.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(o.ooDateToString(new Date(e.get("time")))),l.asc_addReply(a))}),o.api.asc_changeComment(e,l),!0}return!1},onAddReplyComment:function(e,i){if(i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(l&&r&&(o=r.get("uid"),o&&(n.subEditStrings[o]&&delete n.subEditStrings[o],n.subEditStrings[o+"-R"]&&delete n.subEditStrings[o+"-R"],r.set("showReplyInPopover",!1)),l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),l.asc_addReply(a))}),a=t()))return a.asc_putText(i),a.asc_putTime(n.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date)),a.asc_putUserId(n.currentUserId),a.asc_putUserName(n.currentUserName),l.asc_addReply(a),n.api.asc_changeComment(e,l),n.mode&&n.mode.canRequestUsers&&n.view.pickEMail(l.asc_getGuid(),i),!0}return!1},onRemoveReplyComment:function(e,i){if(!_.isUndefined(e)&&!_.isUndefined(i)){var n=this,o=null,s=null,a=t(),l=n.findComment(e);if(a&&l)return a.asc_putText(l.get("comment")),a.asc_putQuoteText(l.get("quote")),a.asc_putTime(n.utcDateToString(new Date(l.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(l.get("time")))),a.asc_putUserId(l.get("userid")),a.asc_putUserName(l.get("username")),a.asc_putSolved(l.get("resolved")),a.asc_putGuid(l.get("guid")),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(l.get("unattached")),o=l.get("replys"),o&&o.length&&o.forEach(function(e){e.get("id")!==i&&(s=t())&&(s.asc_putText(e.get("reply")),s.asc_putTime(n.utcDateToString(new Date(e.get("time")))),s.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),s.asc_putUserId(e.get("userid")),s.asc_putUserName(e.get("username")),a.asc_addReply(s))}),n.api.asc_changeComment(e,a),!0}return!1},onShowEditReplyComment:function(t,e,i){var n,o,s,a;if(!_.isUndefined(t)&&!_.isUndefined(e))if(i){if((o=this.popoverComments.findWhere({uid:t}))&&(s=o.get("replys"),a=_.clone(o.get("replys"))))for(n=0;n=0;--s)o?this.collection.at(s).set("last",!0,{silent:!0}):this.collection.at(s).get("last")&&this.collection.at(s).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.update()}}},onAppAddComment:function(t,e){this.api.can_AddQuotedComment&&!1===this.api.can_AddQuotedComment()||e||this.addDummyComment()},addCommentToGroupCollection:function(t){var e=t.get("groupName");this.groupCollection[e]||(this.groupCollection[e]=new Backbone.Collection([],{model:Common.Models.Comment})),this.groupCollection[e].push(t)},onApiAddComment:function(t,e){var i=this.readSDKComment(t,e);i&&(i.get("groupName")?(this.addCommentToGroupCollection(i),_.indexOf(this.collection.groups,i.get("groupName"))>-1&&this.collection.push(i)):this.collection.push(i),this.updateComments(!0),this.showPopover&&(null!==e.asc_getQuoteText()&&(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)),this.showPopover=void 0,this.editPopover=!1))},onApiAddComments:function(t){for(var e=0;e100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=void 0,n.updateCommentsView(t,e,i))},25))},updateCommentsView:function(t,e,i){if(t&&!this.view.isVisible())return this.view.needRender=t,void this.onUpdateFilter(this.filter,!0);var n,o=!0;if(_.isUndefined(e)&&this.collection.sort(),t){for(this.onUpdateFilter(this.filter,!0),n=this.collection.length-1;n>=0;--n)o?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.needRender=!1}this.view.update(),i&&this.view.loadText()},findComment:function(t){return this.collection.findWhere({uid:t})},findPopupComment:function(t){return this.popoverComments.findWhere({id:t})},findCommentInGroup:function(t){for(var e in this.groupCollection){var i=this.groupCollection[e],n=i.findWhere({uid:t});if(n)return n}},closeEditing:function(t){if(!_.isUndefined(t)){var e=this.findPopupComment(t);e&&(e.set("editTextInPopover",!1),e.set("showReplyInPopover",!1)),this.subEditStrings[t]&&delete this.subEditStrings[t],this.subEditStrings[t+"-R"]&&delete this.subEditStrings[t+"-R"]}this.collection.clearEditing(),this.collection.each(function(t){var e=_.clone(t.get("replys"));t.get("replys").length=0,e.forEach(function(t){t.get("editText")&&t.set("editText",!1),t.get("editTextInPopover")&&t.set("editTextInPopover",!1)}),t.set("replys",e)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(t){t&&this.mode.canComments&&(t.set("hint",!1),this.api.asc_showComment(t.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(t){this.isSelectedComment=t,t&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return _.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({commentsStore:this.popoverComments,renderTo:this.sdkViewName,canRequestUsers:this.mode?this.mode.canRequestUsers:void 0,canRequestSendNotify:this.mode?this.mode.canRequestSendNotify:void 0}),this.popover.setCommentsStore(this.popoverComments)),this.popover},onUpdateUsers:function(){var t=this.userCollection,e=!1;for(var i in this.groupCollection)e=!0,this.groupCollection[i].each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")});!e&&this.collection.each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")})},readSDKComment:function(t,e){var i=e.asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getOnlyOfficeTime())):""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),n=this.userCollection.findOriginalUser(e.asc_getUserId()),o=t.substr(0,t.lastIndexOf("_")+1).match(/^(doc|sheet[0-9_]+)_/),s=new Common.Models.Comment({uid:t,guid:e.asc_getGuid(),userid:e.asc_getUserId(),username:e.asc_getUserName(),usercolor:n?n.get("color"):null,date:this.dateToLocaleTimeString(i),quote:e.asc_getQuoteText(),comment:e.asc_getText(),resolved:e.asc_getSolved(),unattached:!_.isUndefined(e.asc_getDocumentFlag)&&e.asc_getDocumentFlag(),id:Common.UI.getId(),time:i.getTime(),showReply:!1,editText:!1,last:void 0,editTextInPopover:!!this.editPopover,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?!!this.showPopover:this.hidereply,scope:this.view,editable:this.mode.canEditComments||e.asc_getUserId()==this.currentUserId,hint:!this.mode.canComments,groupName:o&&o.length>1?o[1]:null});if(s){var a=this.readSDKReplies(e);a.length&&s.set("replys",a)}return s},readSDKReplies:function(t){var e=0,i=[],n=null,o=t.asc_getRepliesCount();if(o)for(e=0;e0){var i=t();i&&(this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hideComments(),this.isDummyComment=!1,i.asc_putText(e),i.asc_putTime(this.utcDateToString(new Date)),i.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),i.asc_putUserId(this.currentUserId),i.asc_putUserName(this.currentUserName),i.asc_putSolved(!1),_.isUndefined(i.asc_putDocumentFlag)||i.asc_putDocumentFlag(!1),this.api.asc_addComment(i),this.view.showEditContainer(!1),this.mode&&this.mode.canRequestUsers&&this.view.pickEMail(i.asc_getGuid(),e),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(t){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var e=this.getPopover();e&&(t&&e.clearDummyText(),e.saveDummyText(),e.handlerHide=function(){},e.isVisible()&&e.hideComments()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1),Common.NotificationCenter.trigger("comments:cleardummy")}},onEditComments:function(t){if(this.api){var e=0,i=this,n=null,o=this.api.asc_getAnchorPosition();if(o){for(this.isSelectedComment=!0,this.popoverComments.reset(),e=0;e0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(o.asc_getX()+o.asc_getWidth(),o.asc_getY(),this.hintmode?o.asc_getX():void 0),this.getPopover().showComments(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var t=$(".new-comment-ct",this.view.el);t&&t.length&&"none"!==t.css("display")&&this.view.txtComment.focus(),this.view.needRender?this.updateComments(!0):this.view.needUpdateFilter&&this.onUpdateFilter(this.view.needUpdateFilter),this.view.update()}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:6e4*(new Date).getTimezoneOffset(),stringOOToLocalDate:function(t){return"string"==typeof t?parseInt(t):0},ooDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?t.getTime().toString():""},stringUtcToLocalDate:function(t){return"string"==typeof t?parseInt(t)+this.timeZoneOffsetInMs:0},utcDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?(t.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,t&&(this.prevcanComments=this.mode.canComments),this.mode.canComments=!t&&this.prevcanComments,this.closeEditing(),this.setMode(this.mode),this.updateComments(!0),this.getPopover()&&(t?this.getPopover().hide():this.getPopover().update(!0)))},clearCollections:function(){this.collection.reset(),this.groupCollection=[]}},Common.Controllers.Comments||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/User",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.User=e.Model.extend({defaults:function(){return{iid:Common.UI.getId(),id:void 0,idOriginal:void 0,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(t){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=t.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var t=0;return this.each(function(e){e.get("online")&&++t}),t},getEditingCount:function(){return this.filter(function(t){return t.get("online")&&!t.get("view")}).length},getEditingOriginalCount:function(){return this.chain().filter(function(t){return t.get("online")&&!t.get("view")}).groupBy(function(t){return t.get("idOriginal")}).size().value()},findUser:function(t){return this.find(function(e){return e.get("id")==t})},findOriginalUser:function(t){return this.find(function(e){return e.get("idOriginal")==t})}}),Common.Collections.HistoryUsers=t.Collection.extend({model:Common.Models.User,findUser:function(t){return this.find(function(e){return e.get("id")==t})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(t){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=t.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(t){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=t.Collection.extend({model:Common.Models.ChatMessage})}),define("common/main/lib/controller/Chat",["core","common/main/lib/collection/Users","common/main/lib/collection/ChatMessages","common/main/lib/view/Chat"],function(){"use strict";Common.Controllers.Chat=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Users","Common.Collections.ChatMessages"],views:["Common.Views.Chat"],initialize:function(){this.addListeners({"Common.Views.Chat":{"message:add":_.bind(this.onSendMessage,this)}});var t=this;Common.NotificationCenter.on("layout:changed",function(e){Common.Utils.asyncCall(function(e){"toolbar"!=e&&"status"!=e||!t.panelChat.$el.is(":visible")||(t.panelChat.updateLayout(!0),t.panelChat.setupAutoSizingTextBox())},this,e)})},events:{},onLaunch:function(){this.panelChat=this.createView("Common.Views.Chat",{storeUsers:this.getApplication().getCollection("Common.Collections.Users"),storeMessages:this.getApplication().getCollection("Common.Collections.ChatMessages")})},setMode:function(t){return this.mode=t,this.api&&(this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onReceiveMessage,this)),this.mode.isEditDiagram||this.mode.isEditMailMerge||(this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onUsersChanged,this)),this.api.asc_registerCallback("asc_onConnectionStateChanged",_.bind(this.onUserConnection,this)),this.api.asc_coAuthoringGetUsers()),this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_coAuthoringChatGetMessages()),this},setApi:function(t){return this.api=t,this},onUsersChanged:function(t,e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){ diff --git a/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js b/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js index 5ec434ede..794b9e696 100644 --- a/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js +++ b/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js @@ -54,7 +54,7 @@ textsearch:this.txtSearch.val(),textreplace:this.txtReplace.val(),matchcase:this f1:_.bind(this.onShortcut,this,"help")}}),Common.util.Shortcuts.suspendEvents();var t=this;this.leftMenu.$el.find("button").each(function(){$(this).on("keydown",function(e){Common.UI.Keys.RETURN!==e.keyCode&&Common.UI.Keys.SPACE!==e.keyCode||(t.leftMenu.btnAbout.toggle(!1),this.blur(),e.preventDefault(),t.api.asc_enableKeyEvents(!0))})})},setApi:function(t){if(this.api=t,this.api.asc_registerCallback("asc_onRenameCellTextEnd",_.bind(this.onRenameText,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiServerDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiServerDisconnect,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),Common.NotificationCenter.on("download:cancel",_.bind(this.onDownloadCancel,this)),this.mode.canCoAuthoring&&(this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onApiChatMessage,this)),this.mode.canComments)){this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this));var e=this.getApplication().getController("Common.Controllers.Comments").groupCollection;for(var i in e)for(var n=e[i],o=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment"),s=0;s0&&(i=i.substring(0,n)+this.isFromFileDownloadAs)}e.mode.canRequestSaveAs?Common.Gateway.requestSaveAs(t,i):(e._saveCopyDlg=new Common.Views.SaveAsDlg({saveFolderUrl:e.mode.saveAsUrl,saveFileUrl:t,defFileName:i}),e._saveCopyDlg.on("saveaserror",function(t,i){var n={closable:!1,title:e.textWarning,msg:i,iconCls:"warn",buttons:["ok"],callback:function(t){Common.NotificationCenter.trigger("edit:complete",e)}};Common.UI.alert(n)}).on("close",function(t){e._saveCopyDlg=void 0}),e._saveCopyDlg.show())}this.isFromFileDownloadAs=!1},onDownloadCancel:function(){this.isFromFileDownloadAs=!1},applySettings:function(t){var e=Common.localStorage.getItem("sse-settings-fontrender");Common.Utils.InternalSettings.set("sse-settings-fontrender",e),this.api.asc_setFontRenderingMode(parseInt(e)),e=Common.localStorage.getBool("sse-settings-livecomment",!0),Common.Utils.InternalSettings.set("sse-settings-livecomment",e);var i=Common.localStorage.getBool("sse-settings-resolvedcomment");Common.Utils.InternalSettings.set("sse-settings-resolvedcomment",i),this.mode.canViewComments&&this.leftMenu.panelComments.isVisible()&&(e=i=!0),e?this.api.asc_showComments(i):this.api.asc_hideComments(),e=Common.localStorage.getBool("sse-settings-r1c1"),Common.Utils.InternalSettings.set("sse-settings-r1c1",e),this.api.asc_setR1C1Mode(e),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&(e=Common.localStorage.getBool("sse-settings-coauthmode",!0),Common.Utils.InternalSettings.set("sse-settings-coauthmode",e),this.api.asc_SetFastCollaborative(e)),this.mode.isEdit&&(e=parseInt(Common.localStorage.getItem("sse-settings-autosave")),Common.Utils.InternalSettings.set("sse-settings-autosave",e),this.api.asc_setAutoSaveGap(e)),e=Common.localStorage.getItem("sse-settings-reg-settings"),null!==e&&this.api.asc_setLocale(parseInt(e)),t.hide(),this.leftMenu.fireEvent("settings:apply")},onCreateNew:function(t,e){if(!Common.Controllers.Desktop.process("create:new")){var i=window.open("blank"==e?this.mode.createUrl:e,"_blank");i&&i.focus()}t&&t.hide()},onOpenRecent:function(t,e){t&&t.hide();var i=window.open(e);i&&i.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(t){this.leftMenu.showMenu("file:opts")},clickToolbarTab:function(t,e){"file"==t?this.leftMenu.showMenu("file"):this.leftMenu.menuFile.hide()},changeToolbarSaveState:function(t){var e=this.leftMenu.menuFile.getButton("save");e&&e.setDisabled(t)},clickStatusbarUsers:function(){this.leftMenu.menuFile.panels.rights.changeAccessRights()},onHideChat:function(){$(this.leftMenu.btnChat.el).blur(),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onHidePlugins:function(){Common.NotificationCenter.trigger("layout:changed","leftmenu")},onQuerySearch:function(t,e,i){if(i.textsearch&&i.textsearch.length){var n=this.dlgSearch.findOptions;if(n.asc_setFindWhat(i.textsearch),n.asc_setScanForward("back"!=t),n.asc_setIsMatchCase(i.matchcase),n.asc_setIsWholeCell(i.matchword),n.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),n.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),n.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),!this.api.asc_findText(n)){var o=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){o.dlgSearch.focus()}})}}},onQueryReplace:function(t,e){if(!_.isEmpty(e.textsearch)){this.api.isReplaceAll=!1;var i=this.dlgSearch.findOptions;i.asc_setFindWhat(e.textsearch),i.asc_setReplaceWith(e.textreplace),i.asc_setIsMatchCase(e.matchcase),i.asc_setIsWholeCell(e.matchword),i.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),i.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),i.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),i.asc_setIsReplaceAll(!1),this.api.asc_replaceText(i)}},onQueryReplaceAll:function(t,e){if(!_.isEmpty(e.textsearch)){this.api.isReplaceAll=!0;var i=this.dlgSearch.findOptions;i.asc_setFindWhat(e.textsearch),i.asc_setReplaceWith(e.textreplace),i.asc_setIsMatchCase(e.matchcase),i.asc_setIsWholeCell(e.matchword),i.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),i.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),i.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),i.asc_setIsReplaceAll(!0),this.api.asc_replaceText(i)}},onSearchHighlight:function(t,e){this.api.asc_selectSearchingResults(e)},showSearchDlg:function(t,e){if(!this.dlgSearch){var i=new Common.UI.MenuItem({caption:this.textWithin,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textSheet,toggleGroup:"searchWithih",checkable:!0,checked:!0},{caption:this.textWorkbook,toggleGroup:"searchWithih",checkable:!0,checked:!1}]})}),n=new Common.UI.MenuItem({caption:this.textSearch,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textByRows,toggleGroup:"searchByrows",checkable:!0,checked:!0},{caption:this.textByColumns,toggleGroup:"searchByrows",checkable:!0,checked:!1}]})}),o=new Common.UI.MenuItem({caption:this.textLookin,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textFormulas,toggleGroup:"searchLookin",checkable:!0,checked:!0},{caption:this.textValues,toggleGroup:"searchLookin",checkable:!0,checked:!1}]})});this.dlgSearch=new Common.UI.SearchDialog({matchcase:!0,matchword:!0,matchwordstr:this.textItemEntireCell,markresult:{applied:!0},extraoptions:[i,n,o]}),this.dlgSearch.menuWithin=i,this.dlgSearch.menuSearch=n,this.dlgSearch.menuLookin=o,this.dlgSearch.findOptions=new Asc.asc_CFindOptions}if(t){var s=this.mode.isEdit&&!this.viewmode?e||void 0:"no-replace";this.dlgSearch.isVisible()?(this.dlgSearch.setMode(s),this.dlgSearch.focus()):this.dlgSearch.show(s),this.api.asc_closeCellEditor()}else this.dlgSearch.hide()},onMenuSearch:function(t,e){this.showSearchDlg(e)},onSearchDlgHide:function(){this.leftMenu.btnSearch.toggle(!1,!0),this.api.asc_selectSearchingResults(!1),$(this.leftMenu.btnSearch.el).blur(),this.api.asc_enableKeyEvents(!0)},onRenameText:function(t,e){var i=this;if(this.api.isReplaceAll)Common.UI.info({msg:t?!t-e?Common.Utils.String.format(this.textReplaceSuccess,e):Common.Utils.String.format(this.textReplaceSkipped,t-e):this.textNoTextFound,callback:function(){i.dlgSearch.focus()}});else{var n=this.dlgSearch.getSettings(),o=this.dlgSearch.findOptions;o.asc_setFindWhat(n.textsearch),o.asc_setScanForward(!0),o.asc_setIsMatchCase(n.matchcase),o.asc_setIsWholeCell(n.matchword),o.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),o.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),o.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),i.api.asc_findText(o)||Common.UI.info({msg:this.textNoTextFound,callback:function(){i.dlgSearch.focus()}})}},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,this.dlgSearch&&this.dlgSearch.setMode(this.viewmode?"no-replace":"search"))},onApiServerDisconnect:function(t){this.mode.isEdit=!1,this.leftMenu.close(),this.leftMenu.btnComments.setDisabled(!0),this.leftMenu.btnChat.setDisabled(!0),this.leftMenu.btnPlugins.setDisabled(!0),this.leftMenu.btnSpellcheck.setDisabled(!0),this.leftMenu.getMenu("file").setMode({isDisconnected:!0,enableDownload:!!t}),this.dlgSearch&&(this.leftMenu.btnSearch.toggle(!1,!0),this.dlgSearch.hide())},onApiChatMessage:function(){this.leftMenu.markCoauthOptions("chat")},onApiAddComment:function(t,e){var i=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment");!e||e.asc_getUserId()===this.mode.user.id||!i&&e.asc_getSolved()||this.leftMenu.markCoauthOptions("comments")},onApiAddComments:function(t){for(var e=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment"),i=0;i [data-toggle="dropdown"]');if(n.length)return $.fn.dropdown.Constructor.prototype.keydown.call(n[0],e),!1;if(this.mode.canPlugins&&this.leftMenu.panelPlugins&&!0!==this.api.isCellEdited&&(n=this.leftMenu.panelPlugins.$el.find('#menu-plugin-container.open > [data-toggle="dropdown"]'),n.length))return $.fn.dropdown.Constructor.prototype.keydown.call(n[0],e),!1;if(this.leftMenu.btnAbout.pressed||($(e.target).parents("#left-menu").length||this.leftMenu.btnPlugins.pressed||this.leftMenu.btnComments.pressed)&&!0!==this.api.isCellEdited)return this.leftMenu.close(),Common.NotificationCenter.trigger("layout:changed","leftmenu"),!1;if((this.mode.isEditDiagram||this.mode.isEditMailMerge)&&(n=$(document.body).find(".open > .dropdown-menu"),!this.api.isCellEdited&&!n.length))return Common.Gateway.internalMessage("shortcut",{key:"escape"}),!1;break;case"chat":return this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")),!1;case"comments":return this.mode.canCoAuthoring&&this.mode.canViewComments&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("comments"),this.getApplication().getController("Common.Controllers.Comments").onAfterShow()),!1}}},onCellsRange:function(t){var e=t!=Asc.c_oAscSelectionDialogType.None;this.leftMenu.btnAbout.setDisabled(e),this.leftMenu.btnSearch.setDisabled(e),this.leftMenu.btnSpellcheck.setDisabled(e),this.mode.canPlugins&&this.leftMenu.panelPlugins&&(this.leftMenu.panelPlugins.setLocked(e),this.leftMenu.panelPlugins.disableControls(e))},onApiEditCell:function(t){var e=t==Asc.c_oAscCellEditorState.editFormula;this.leftMenu.btnAbout.setDisabled(e),this.leftMenu.btnSearch.setDisabled(e),this.leftMenu.btnSpellcheck.setDisabled(e),this.mode.canPlugins&&this.leftMenu.panelPlugins&&(this.leftMenu.panelPlugins.setLocked(e),this.leftMenu.panelPlugins.disableControls(e))},onPluginOpen:function(t,e,i){"onboard"==e&&("open"==i?(this.leftMenu.close(),this.leftMenu.panelPlugins.show(),this.leftMenu.onBtnMenuClick({pressed:!0,options:{action:"plugins"}}),this.leftMenu._state.pluginIsRunning=!0):(this.leftMenu._state.pluginIsRunning=!1,this.leftMenu.close()))},onShowHideChat:function(t){this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(t?(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")):(this.leftMenu.btnChat.toggle(!1,!0),this.leftMenu.onBtnMenuClick(this.leftMenu.btnChat)))},textNoTextFound:"Text not found",newDocumentTitle:"Unnamed document",textItemEntireCell:"Entire cell contents",requestEditRightsText:"Requesting editing rights...",textReplaceSuccess:"Search has been done. {0} occurrences have been replaced",textReplaceSkipped:"The replacement has been made. {0} occurrences were skipped.",warnDownloadAs:"If you continue saving in this format all features except the text will be lost.
    Are you sure you want to continue?",textWarning:"Warning",textSheet:"Sheet",textWorkbook:"Workbook",textByColumns:"By columns",textByRows:"By rows",textFormulas:"Formulas",textValues:"Values",textWithin:"Within",textSearch:"Search",textLookin:"Look in",txtUntitled:"Untitled"},SSE.Controllers.LeftMenu||{}))}),void 0===Common)var Common={};if(Common.IrregularStack=function(t){var e=[],i=function(t,e){return"object"==typeof t&&"object"==typeof e&&window.JSON?window.JSON.stringify(t)===window.JSON.stringify(e):t===e};t=t||{};var n=t.strongCompare||i,o=t.weakCompare||i,s=function(t,i){for(var n=e.length-1;n>=0;n--)if(i(e[n],t))return n;return-1};return{push:function(t){e.push(t)},pop:function(t){var i=s(t,n);if(-1!=i)return e.splice(i,1)[0]},get:function(t){var i=s(t,o);if(-1!=i)return e[i]},exist:function(t){return!(s(t,n)<0)}}},define("irregularstack",function(){}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Fonts",["core","common/main/lib/collection/Fonts"],function(){"use strict";Common.Controllers.Fonts=Backbone.Controller.extend(function(){function t(t,e){for(var i,n=e.get("type")==o,s=-1,a=t.length,l=e.get("name");!n&&++s','
    ','",'
    ','",'
    ','','',"
    ","
    ",'
    ','"].join(""),this.api=t.api,this.formulasGroups=t.formulasGroups,this.handler=t.handler,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.syntaxLabel=$("#formula-dlg-args"),this.descLabel=$("#formula-dlg-desc"),this.fillFormulasGroups()},show:function(t){if(this.$window){var e,i,n,o,s=this.initConfig.height;void 0===window.innerHeight?(e=document.documentElement.offsetWidth,i=document.documentElement.offsetHeight):(e=Common.Utils.innerWidth(),i=Common.Utils.innerHeight()),n=(parseInt(i,10)-parseInt(s,10))/2,o=(parseInt(e,10)-parseInt(this.initConfig.width,10))/2,this.$window.css("left",Math.floor(o)),this.$window.css("top",Math.floor(n))}Common.UI.Window.prototype.show.call(this),this.mask=$(".modals-mask"),this.mask.on("mousedown",_.bind(this.onUpdateFocus,this)),this.$window.on("mousedown",_.bind(this.onUpdateFocus,this)),t&&this.cmbFuncGroup.setValue(t),(t||"Last10"==this.cmbFuncGroup.getValue())&&this.fillFunctions(this.cmbFuncGroup.getValue()),this.cmbListFunctions&&_.delay(function(t){t.cmbListFunctions.$el.find(".listview").focus()},100,this)},hide:function(){this.mask.off("mousedown",_.bind(this.onUpdateFocus,this)),this.$window.off("mousedown",_.bind(this.onUpdateFocus,this)),Common.UI.Window.prototype.hide.call(this)},onBtnClick:function(t){"ok"===t.currentTarget.attributes.result.value&&this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onDblClickFunction:function(){this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onSelectGroup:function(t,e){_.isUndefined(e)||_.isUndefined(e.value)||e.value&&this.fillFunctions(e.value),this.onUpdateFocus()},onSelectFunction:function(t,e,i){this.formulasGroups&&(this.applyFunction={name:i.get("value"),origin:i.get("origin")},this.syntaxLabel.text(this.applyFunction.name+i.get("args")),this.descLabel.text(i.get("desc")))},onPrimary:function(t,e,i){this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onUpdateFocus:function(){_.delay(function(t){t.cmbListFunctions.$el.find(".listview").focus()},100,this)},fillFormulasGroups:function(){if(this.formulasGroups){var t=Common.Utils.InternalSettings.get("sse-settings-func-locale");_.isEmpty(t)&&(t="en");var e,i=[],n=this.formulasGroups.length;for(e=0;e<%= value %>
    ')}),this.cmbListFunctions.on("item:select",_.bind(this.onSelectFunction,this)),this.cmbListFunctions.on("item:dblclick",_.bind(this.onDblClickFunction,this)),this.cmbListFunctions.on("entervalue",_.bind(this.onPrimary,this)),this.cmbListFunctions.onKeyDown=_.bind(this.onKeyDown,this.cmbListFunctions),this.cmbListFunctions.$el.find(".listview").focus(),this.cmbListFunctions.scrollToRecord=_.bind(this.onScrollToRecordCustom,this.cmbListFunctions)),this.functions)){this.functions.reset();var e=0,i=0,n=null,o=this.formulasGroups.findWhere({name:t});if(o&&(n=o.get("functions"))&&n.length){for(i=n.length,e=0;e64&&t.keyCode<91&&a&&a.length){for(a=a.toLocaleLowerCase(),d=this.store.findWhere({selected:!0}),d&&(l=d.get("value"),h=l&&l.length&&l[0].toLocaleLowerCase()===a),n=0;ni+e.height())&&(this.scroller?this.scroller.scrollTop(e.scrollTop()+o-i,0):e.scrollTop(e.scrollTop()+o-i))},cancelButtonText:"Cancel",okButtonText:"Ok",textGroupDescription:"Select Function Group",textListDescription:"Select Function",sDescription:"Description",txtTitle:"Insert Function"},SSE.Views.FormulaDialog||{}))}),define("spreadsheeteditor/main/app/view/FormulaTab",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(){"use strict";SSE.Views.FormulaTab=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.btnAutosum.on("click",function(){t.fireEvent("function:apply",[{name:t.api.asc_getFormulaLocaleName("SUM"),origin:"SUM"},!0])}),t.btnAutosum.menu.on("item:click",function(e,i,n){t.fireEvent("function:apply",[{name:i.caption,origin:i.value},!0])}),t.btnFormula.on("click",function(){t.fireEvent("function:apply",[{name:"more",origin:"more"}])})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this),this.toolbar=t.toolbar,this.formulasGroups=t.formulasGroups,this.lockedControls=[];var e=this,i=e.toolbar.$el,n=SSE.enumLock,o=SSE.getController("FormulaDialog");this.btnFinancial=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-finance",caption:o.sCategoryFinancial,hint:o.sCategoryFinancial,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-financial"),this.btnFinancial),this.lockedControls.push(this.btnFinancial),this.btnLogical=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-logic",caption:o.sCategoryLogical,hint:o.sCategoryLogical,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-logical"),this.btnLogical),this.lockedControls.push(this.btnLogical),this.btnTextData=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-func-text",caption:o.sCategoryTextAndData,hint:o.sCategoryTextAndData,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-text"),this.btnTextData),this.lockedControls.push(this.btnTextData),this.btnDateTime=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-datetime",caption:o.sCategoryDateAndTime,hint:o.sCategoryDateAndTime,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-datetime"),this.btnDateTime),this.lockedControls.push(this.btnDateTime),this.btnReference=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-lookup",caption:o.sCategoryLookupAndReference,hint:o.sCategoryLookupAndReference,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-lookup"),this.btnReference),this.lockedControls.push(this.btnReference),this.btnMath=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-func-math",caption:o.sCategoryMathematic,hint:o.sCategoryMathematic,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-math"),this.btnMath),this.lockedControls.push(this.btnMath),this.btnRecent=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-recent",caption:this.txtRecent,hint:this.txtRecent,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-recent"),this.btnRecent),this.lockedControls.push(this.btnRecent),this.btnAutosum=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-autosum",caption:this.txtAutosum,hint:this.txtAutosumTip,split:!0,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth],menu:new Common.UI.Menu({items:[{caption:"SUM",value:"SUM"},{caption:"MIN",value:"MIN"},{caption:"MAX",value:"MAX"},{caption:"COUNT",value:"COUNT"},{caption:"--"},{caption:e.txtAdditional,value:"more"}]})}),Common.Utils.injectComponent(i.find("#slot-btn-autosum"),this.btnAutosum),this.lockedControls.push(this.btnAutosum),this.btnFormula=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ins-formula",caption:this.txtFormula,hint:this.txtFormulaTip,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-additional-formula"),this.btnFormula),this.lockedControls.push(this.btnFormula),this.btnMore=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-more",caption:this.txtMore,hint:this.txtMore,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-more"),this.btnMore),this.lockedControls.push(this.btnMore),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){t.call(i)})},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButtons:function(t){return this.lockedControls},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},focusInner:function(t,e){e.keyCode==Common.UI.Keys.UP?t.items[t.items.length-1].cmpEl.find("> a").focus():t.items[0].cmpEl.find("> a").focus()},focusOuter:function(t,e){t.items[2].cmpEl.find("> a").focus()},onBeforeKeyDown:function(t,e){if(e.keyCode==Common.UI.Keys.RETURN){e.preventDefault(),e.stopPropagation();var i=$(e.target).closest("li");i.length>0&&i.click(),Common.UI.Menu.Manager.hideAll()}else if("after.bs.dropdown"!==e.namespace&&(e.keyCode==Common.UI.Keys.DOWN||e.keyCode==Common.UI.Keys.UP)){var n=$("> [role=menu] > li:not(.divider):not(.disabled):visible",t.$el).find("> a");if(!n.length)return;var o=n.index(n.filter(":focus")),s=this;(t._outerMenu&&(e.keyCode==Common.UI.Keys.UP&&0==o||e.keyCode==Common.UI.Keys.DOWN&&o==n.length-1)||t._innerMenu&&(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN)&&-1!==o)&&(e.preventDefault(),e.stopPropagation(),_.delay(function(){t._outerMenu?s.focusOuter(t._outerMenu,e):s.focusInner(t._innerMenu,e)},10))}},setButtonMenu:function(t,e){var i=this,n=[],o=i.formulasGroups.findWhere({name:e});if(o){var s=o.get("functions");s&&s.forEach(function(t){n.push(new Common.UI.MenuItem({caption:t.get("name"),value:t.get("origin")}))})}if(n.length)if(t.menu&&t.menu.rendered){var a=t.menu._innerMenu;a&&(a.removeAll(),n.forEach(function(t){a.addItem(t)}))}else{t.setMenu(new Common.UI.Menu({items:[{template:_.template('
    ')},{caption:"--"},{caption:i.txtAdditional,value:"more"}]})),t.menu.items[2].on("click",function(t,n){i.fireEvent("function:apply",[{name:t.caption,origin:t.value},!1,e])}),t.menu.on("show:after",function(t,e){t._innerMenu.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t._innerMenu&&t._innerMenu.cmpEl.focus()},10)}).on("keydown:before",_.bind(i.onBeforeKeyDown,this));var a=new Common.UI.Menu({maxHeight:300,cls:"internal-menu",items:n});a.render(t.menu.items[0].cmpEl.children(":first")),a.cmpEl.css({display:"block",position:"relative",left:0,top:0}),a.cmpEl.attr({tabindex:"-1"}),a.on("item:click",function(t,n,o){i.fireEvent("function:apply",[{name:n.caption,origin:n.value},!1,e])}).on("keydown:before",_.bind(i.onBeforeKeyDown,this)),t.menu._innerMenu=a,a._outerMenu=t.menu}t.setDisabled(n.length<1)},setMenuItemMenu:function(t){var e=this,i=[],n=SSE.getController("FormulaDialog"),o=e.formulasGroups.findWhere({name:t});if(o){var s=o.get("functions");if(s&&s.forEach(function(t){i.push(new Common.UI.MenuItem({caption:t.get("name"),value:t.get("origin")}))}),i.length){var a=new Common.UI.MenuItem({caption:n["sCategory"+t]||t,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('
    ')},{caption:"--"},{caption:e.txtAdditional,value:"more"}]})});a.menu.items[2].on("click",function(i,n){e.fireEvent("function:apply",[{name:i.caption,origin:i.value},!1,t])}),a.menu.on("show:after",function(t,e){t._innerMenu.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t._innerMenu&&t._innerMenu.items[0].cmpEl.find("> a").focus()},10)}).on("keydown:before",_.bind(e.onBeforeKeyDown,this)).on("keydown:before",function(t,e){if(e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.ESC){var i=t.cmpEl.parent();i.hasClass("dropdown-submenu")&&i.hasClass("over")&&(i.removeClass("over"),i.find("> a").focus())}});var l=new Common.UI.Menu({maxHeight:300,cls:"internal-menu",items:i});return l.on("item:click",function(i,n,o){e.fireEvent("function:apply",[{name:n.caption,origin:n.value},!1,t])}).on("keydown:before",_.bind(e.onBeforeKeyDown,this)),a.menu._innerMenu=l,l._outerMenu=a.menu,a}}},fillFunctions:function(){if(this.formulasGroups){this.setButtonMenu(this.btnFinancial,"Financial"),this.setButtonMenu(this.btnLogical,"Logical"),this.setButtonMenu(this.btnTextData,"TextAndData"),this.setButtonMenu(this.btnDateTime,"DateAndTime"),this.setButtonMenu(this.btnReference,"LookupAndReference"),this.setButtonMenu(this.btnMath,"Mathematic"),this.setButtonMenu(this.btnRecent,"Last10");for(var t=this.btnAutosum.menu.items,e=0;e a, #header-back > div"},e={toolbar:"#viewport #toolbar",leftMenu:"#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings",rightMenu:"#viewport #right-menu",statusBar:"#statusbar"};return Common.localStorage.setId("table"),Common.localStorage.setKeysFilter("sse-,asc.table"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","EquationGroups","TableTemplates","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)},"Common.Views.ReviewChanges":{"settings:apply":_.bind(this.applySettings,this)}})},onLaunch:function(){var t=this;if(this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseType:!1},this.translationTable=[],this.isModalShowed=0,!Common.Utils.isBrowserSupported())return Common.Utils.showBrowserRestriction(),void Common.Gateway.reportError(void 0,this.unsupportedBrowserErrorText);var e=Common.localStorage.getItem("sse-settings-fontrender");null===e&&(e=window.devicePixelRatio>1?"1":"3"),Common.Utils.InternalSettings.set("sse-settings-fontrender",e);var i=["Normal","Neutral","Bad","Good","Input","Output","Calculation","Check Cell","Explanatory Text","Note","Linked Cell","Warning Text","Heading 1","Heading 2","Heading 3","Heading 4","Title","Total","Currency","Percent","Comma"],n={Series:this.txtSeries,"Diagram Title":this.txtDiagramTitle,"X Axis":this.txtXAxis,"Y Axis":this.txtYAxis,"Your text here":this.txtArt,Table:this.txtTable,Print_Area:this.txtPrintArea,Confidential:this.txtConfidential,"Prepared by ":this.txtPreparedBy+" ",Page:this.txtPage,"Page %1 of %2":this.txtPageOf,Pages:this.txtPages,Date:this.txtDate,Time:this.txtTime,Tab:this.txtTab,File:this.txtFile};i.forEach(function(e){n[e]=t.translationTable[e]=t["txtStyle_"+e.replace(/ /g,"_")]||e}),n["Currency [0]"]=t.translationTable["Currency [0]"]=t.txtStyle_Currency+" [0]",n["Comma [0]"]=t.translationTable["Comma [0]"]=t.txtStyle_Comma+" [0]";for(var o=1;o<7;o++)n["Accent"+o]=t.translationTable["Accent"+o]=t.txtAccent+o,n["20% - Accent"+o]=t.translationTable["20% - Accent"+o]="20% - "+t.txtAccent+o,n["40% - Accent"+o]=t.translationTable["40% - Accent"+o]="40% - "+t.txtAccent+o,n["60% - Accent"+o]=t.translationTable["60% - Accent"+o]="60% - "+t.txtAccent+o;this.api=new Asc.spreadsheet_api({"id-view":"editor_sdk","id-input":"ce-cell-content",translate:n}),this.api.asc_setFontRenderingMode(parseInt(e)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onEndAction",_.bind(this.onLongActionEnd,this)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),this.api.asc_registerCallback("asc_onSpellCheckInit",_.bind(this.loadLanguages,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),Common.NotificationCenter.on("namedrange:locked",_.bind(this.onNamedRangeLocked,this)),Common.NotificationCenter.on("download:cancel",_.bind(this.onDownloadCancel,this)),Common.NotificationCenter.on("download:advanced",_.bind(this.onAdvancedOptions,this)),this.stackLongActions=new Common.IrregularStack({strongCompare:this._compareActionStrong,weakCompare:this._compareActionWeak}),this.stackLongActions.push({id:-254,type:Asc.c_oAscAsyncActionType.BlockInteraction}),this.isShowOpenDialog=!1,this.editorConfig={},Common.Gateway.on("init",_.bind(this.loadConfig,this)),Common.Gateway.on("showmessage",_.bind(this.onExternalMessage,this)),Common.Gateway.on("opendocument",_.bind(this.loadDocument,this)),Common.Gateway.on("internalcommand",_.bind(this.onInternalCommand,this)),Common.Gateway.appReady(),this.getApplication().getController("Viewport").setApi(this.api),$(document.body).on("focus","input, textarea:not(#ce-cell-content)",function(e){!0!==t.isAppDisabled&&e&&e.target&&!/area_id/.test(e.target.id)&&(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/chat-msg-text/.test(e.target.id)?t.dontCloseChat=!0:!t.isModalShowed&&/form-control/.test(e.target.className)&&(t.inFormControl=!0))}),$(document.body).on("blur","input, textarea",function(e){if(!0!==t.isAppDisabled&&!t.isFrameClosed&&!(t.isModalShowed&&!($(".asc-window.enable-key-events:visible").length>0)||t.loadMask&&t.loadMask.isVisible())){if(/form-control/.test(e.target.className)&&(t.inFormControl=!1),t.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file").isVisible())return;if(!e.relatedTarget||!/area_id/.test(e.target.id)&&!("input"==e.target.localName&&$(e.target).parent().find(e.relatedTarget).length>0)&&!("textarea"==e.target.localName&&$(e.target).closest(".asc-window").find(".dropdown-menu").find(e.relatedTarget).length>0)&&("input"!=e.relatedTarget.localName||!/form-control/.test(e.relatedTarget.className))&&("textarea"!=e.relatedTarget.localName||/area_id/.test(e.relatedTarget.id))){if(Common.Utils.isIE&&e.originalEvent&&e.originalEvent.target&&/area_id/.test(e.originalEvent.target.id)&&e.originalEvent.target===e.originalEvent.srcElement)return;t.api.asc_enableKeyEvents(!0),/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!1:/chat-msg-text/.test(e.target.id)&&(t.dontCloseChat=!1)}}}).on("dragover",function(t){var e=t.originalEvent;if(e.target&&$(e.target).closest("#editor_sdk").length<1)return e.preventDefault(),e.dataTransfer.dropEffect="none",!1}).on("dragstart",function(t){var e=t.originalEvent;if(e.target){var i=$(e.target);(i.closest(".combobox").length>0||i.closest(".dropdown-menu").length>0||i.closest(".ribtab").length>0||i.closest(".combo-dataview").length>0)&&e.preventDefault()}}),Common.NotificationCenter.on({"modal:show":function(e){t.isModalShowed++,t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){--t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"modal:hide":function(e){--t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"dataview:focus":function(t){},"dataview:blur":function(e){t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"menu:show":function(t){},"menu:hide":function(e,i){t.isModalShowed||e&&e.cmpEl.hasClass("from-cell-edit")||i||(t.api.asc_InputClearKeyboardElement(),t.api.asc_enableKeyEvents(!0))},"edit:complete":_.bind(this.onEditComplete,this),"settings:unitschanged":_.bind(this.unitsChanged,this)}),this.initNames(),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+s,ctrl+s,command+p,ctrl+p,command+k,ctrl+k,command+d,ctrl+d":_.bind(function(t){t.preventDefault(),t.stopPropagation()},this)}}),t.defaultTitleText="ONLYOFFICE",t.warnNoLicense=t.warnNoLicense.replace("%1","ONLYOFFICE"),t.warnNoLicenseUsers=t.warnNoLicenseUsers.replace("%1","ONLYOFFICE"),t.textNoLicenseTitle=t.textNoLicenseTitle.replace("%1","ONLYOFFICE")},loadConfig:function(t){this.editorConfig=$.extend(this.editorConfig,t.config),this.appOptions={},this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(this.editorConfig.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.isDesktopApp="desktop"==this.editorConfig.targetApp,this.appOptions.canCreateNew=!_.isEmpty(this.editorConfig.createUrl),this.appOptions.canOpenRecent=void 0!==this.editorConfig.recent&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location="string"==typeof this.editorConfig.location?this.editorConfig.location.toLowerCase():"",this.appOptions.region="string"==typeof this.editorConfig.region?this.editorConfig.region.toLowerCase():this.editorConfig.region,this.appOptions.canAutosave=!1,this.appOptions.canAnalytics=!1,this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.saveAsUrl=this.editorConfig.saveAsUrl,this.appOptions.fileChoiceUrl=this.editorConfig.fileChoiceUrl,this.appOptions.isEditDiagram="editdiagram"==this.editorConfig.mode,this.appOptions.isEditMailMerge="editmerge"==this.editorConfig.mode,this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=!1!==this.editorConfig.canBackToFolder&&"object"==typeof this.editorConfig.customization&&"object"==typeof this.editorConfig.customization.goback&&!_.isEmpty(this.editorConfig.customization.goback.url),this.appOptions.canBack=!0===this.appOptions.canBackToFolder,this.appOptions.canPlugins=!1,this.appOptions.canRequestUsers=this.editorConfig.canRequestUsers,this.appOptions.canRequestSendNotify=this.editorConfig.canRequestSendNotify,this.appOptions.canRequestSaveAs=this.editorConfig.canRequestSaveAs,this.appOptions.canRequestInsertImage=this.editorConfig.canRequestInsertImage,this.headerView=this.getApplication().getController("Viewport").getView("Common.Views.Header"),this.headerView.setCanBack(!0===this.appOptions.canBackToFolder,this.appOptions.canBackToFolder?this.editorConfig.customization.goback.text:"").setUserName(this.appOptions.user.fullname);var e=Common.localStorage.getItem("sse-settings-reg-settings");null!==e?this.api.asc_setLocale(parseInt(e)):(e=this.appOptions.region,e=Common.util.LanguageInfo.getLanguages().hasOwnProperty(e)?e:Common.util.LanguageInfo.getLocalLanguageCode(e),e=null!==e?parseInt(e):this.editorConfig.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.editorConfig.lang)):1033,this.api.asc_setLocale(e)),e=Common.localStorage.getBool("sse-settings-r1c1"),Common.Utils.InternalSettings.set("sse-settings-r1c1",e),this.api.asc_setR1C1Mode(e),"us"!=this.appOptions.location&&"ca"!=this.appOptions.location||Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch),this.isFrameClosed=this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge,Common.Controllers.Desktop.init(this.appOptions)},loadDocument:function(t){this.appOptions.spreadsheet=t.doc,this.permissions={};var e={};if(t.doc){this.permissions=_.extend(this.permissions,t.doc.permissions);var i=$.extend({},t.doc.permissions),n=$.extend({},t.doc.options,this.editorConfig.actionLink||{}),o=new Asc.asc_CUserInfo;o.put_Id(this.appOptions.user.id),o.put_FullName(this.appOptions.user.fullname),e=new Asc.asc_CDocInfo,e.put_Id(t.doc.key),e.put_Url(t.doc.url),e.put_Title(t.doc.title),e.put_Format(t.doc.fileType),e.put_VKey(t.doc.vkey),e.put_Options(n),e.put_UserInfo(o),e.put_CallbackUrl(this.editorConfig.callbackUrl),e.put_Token(t.doc.token),e.put_Permissions(i),this.headerView&&this.headerView.setDocumentCaption(t.doc.title)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_registerCallback("asc_onLicenseChanged",_.bind(this.onLicenseChanged,this)),this.api.asc_setDocInfo(e),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId)},onProcessSaveResult:function(t){this.api.asc_OnSaveEnd(t.result),t&&!1===t.result&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(t.message)?this.errorProcessSaveResult:t.message})},onProcessRightsChange:function(t){if(t&&!1===t.enabled){var e=this,i=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("collaboration:sharingdeny"),Common.NotificationCenter.trigger("api:disconnect"),i||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(t.message)?this.warnProcessRightsChange:t.message,callback:function(){e._state.lostEditingRights=!1,e.onEditComplete()}})}},onDownloadAs:function(t){if(!this.appOptions.canDownload)return void Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny,this.errorAccessDeny);this._state.isFromGatewayDownloadAs=!0;var e=t&&"string"==typeof t?Asc.c_oAscFileType[t.toUpperCase()]:null,i=[Asc.c_oAscFileType.XLSX,Asc.c_oAscFileType.ODS,Asc.c_oAscFileType.CSV,Asc.c_oAscFileType.PDF,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.XLTX,Asc.c_oAscFileType.OTS];(!e||i.indexOf(e)<0)&&(e=Asc.c_oAscFileType.XLSX),e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?Common.NotificationCenter.trigger("download:settings",this,e,!0):this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e,!0))},onProcessMouse:function(t){if("mouseup"==t.type){var e=document.getElementById("editor_sdk");if(e){var i=e.getBoundingClientRect(),n=t.event||{};this.api.asc_onMouseUp(n,t.x-i.left,t.y-i.top)}}},goBack:function(t){var e=this;if(!Common.Controllers.Desktop.process("goback")){var i=e.appOptions.customization.goback.url;t||!1===e.appOptions.customization.goback.blank?parent.location.href=i:window.open(i,"_blank")}},onEditComplete:function(t,e){e&&e.restorefocus&&this.api.isCEditorFocused?(this.formulaInput.blur(),this.formulaInput.focus()):(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").focus(),this.api.isCEditorFocused=!1)},onSelectionChanged:function(t){this._isChartDataReady||t.asc_getFlags().asc_getSelectionType()!=Asc.c_oAscSelectionType.RangeChart||(this._isChartDataReady=!0,Common.Gateway.internalMessage("chartDataReady"))},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(t,e){var i={id:e,type:t};this.stackLongActions.pop(i),this.headerView&&this.headerView.setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),t===Asc.c_oAscAsyncActionType.BlockInteraction&&e==Asc.c_oAscAsyncAction.Open&&(Common.Gateway.internalMessage("documentReady",{}),this.onDocumentContentReady()),i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}),i&&this.setLongActionView(i),e==Asc.c_oAscAsyncAction.Save&&this.toolbarView&&this.toolbarView.synchronizeChanges(),i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),i?this.setLongActionView(i):(this.loadMask&&(!this.loadMask.isVisible()||this.dontCloseDummyComment||this.dontCloseChat||this.isModalShowed||this.inFormControl||this.api.asc_enableKeyEvents(!0),this.loadMask.hide()),t!=Asc.c_oAscAsyncActionType.BlockInteraction||(e==Asc.c_oAscAsyncAction.LoadDocumentFonts||e==Asc.c_oAscAsyncAction.ApplyChanges)&&(this.dontCloseDummyComment||this.dontCloseChat||this.isModalShowed||this.inFormControl)||this.onEditComplete(this.loadMask,{restorefocus:!0}))},setLongActionView:function(t){var e="";switch(t.id){case Asc.c_oAscAsyncAction.Open:e=this.openTitleText;break;case Asc.c_oAscAsyncAction.Save:e=this.saveTitleText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:case Asc.c_oAscAsyncAction.ForceSaveButton:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:e=this.loadFontsTitleText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:e=this.loadImagesTitleText;break;case Asc.c_oAscAsyncAction.LoadFont:e=this.loadFontTitleText;break;case Asc.c_oAscAsyncAction.LoadImage:e=this.loadImageTitleText;break;case Asc.c_oAscAsyncAction.DownloadAs:e=this.downloadTitleText;break;case Asc.c_oAscAsyncAction.Print:e=this.printTitleText;break;case Asc.c_oAscAsyncAction.UploadImage:e=this.uploadImageTitleText;break;case Asc.c_oAscAsyncAction.Recalc:e=this.titleRecalcFormulas;break;case Asc.c_oAscAsyncAction.SlowOperation:e=this.textPleaseWait;break;case Asc.c_oAscAsyncAction.PrepareToSave:e=this.savePreparingText;break;case Asc.c_oAscAsyncAction.Waiting:e=this.waitText;break;case-255:e=this.txtEditingMode;break;case-256:e=this.loadingDocumentTitleText;break;default:"string"==typeof t.id&&(e=t.id)}t.type==Asc.c_oAscAsyncActionType.BlockInteraction&&(!this.loadMask&&(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(e),this.isShowOpenDialog||(this.api.asc_enableKeyEvents(!1),this.loadMask.show()))},onApplyEditRights:function(t){t&&!t.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:t.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function t(){if(!window.AscDesktopEditor){var e=[];Common.Utils.isIE9m&&e.push(i.warnBrowserIE9),e.length&&i.showTips(e)}document.removeEventListener("visibilitychange",t)}if(!this._isDocReady){this._state.openDlg&&this._state.openDlg.close();var e,i=this;i._isDocReady=!0,Common.NotificationCenter.trigger("app:ready",this.appOptions),i.hidePreloader(),i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),e=this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram?100:Common.localStorage.getItem("sse-settings-zoom"),Common.Utils.InternalSettings.set("sse-settings-zoom",e);var n=null!==e?parseInt(e)/100:this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom)/100:1;this.api.asc_setZoom(n>0?n:1),this.isLiveCommenting=Common.localStorage.getBool("sse-settings-livecomment",!0),Common.Utils.InternalSettings.set("sse-settings-livecomment",this.isLiveCommenting),e=Common.localStorage.getBool("sse-settings-resolvedcomment"),Common.Utils.InternalSettings.set("sse-settings-resolvedcomment",e),this.isLiveCommenting?this.api.asc_showComments(e):this.api.asc_hideComments(),this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring?(e=Common.localStorage.getItem("sse-settings-coauthmode"),null===e&&null===Common.localStorage.getItem("sse-settings-autosave")&&this.appOptions.customization&&!1===this.appOptions.customization.autosave&&(e=0),this._state.fastCoauth=null===e||1==parseInt(e)):(this._state.fastCoauth=!this.appOptions.isEdit&&this.appOptions.isRestrictedEdit,this._state.fastCoauth&&(this.api.asc_setAutoSaveGap(1),Common.Utils.InternalSettings.set("sse-settings-autosave",1))),this.api.asc_SetFastCollaborative(this._state.fastCoauth),Common.Utils.InternalSettings.set("sse-settings-coauthmode",i._state.fastCoauth),i.api.asc_registerCallback("asc_onStartAction",_.bind(i.onLongActionBegin,i)),i.api.asc_registerCallback("asc_onConfirmAction",_.bind(i.onConfirmAction,i)),i.api.asc_registerCallback("asc_onActiveSheetChanged",_.bind(i.onActiveSheetChanged,i)),i.api.asc_registerCallback("asc_onPrint",_.bind(i.onPrint,i));var o=i.getApplication();i.headerView.setDocumentCaption(i.api.asc_getDocumentName()),i.updateWindowTitle(i.api.asc_isDocumentModified(),!0);var s=o.getController("Toolbar"),a=o.getController("Statusbar"),l=o.getController("DocumentHolder"),r=o.getController("RightMenu"),c=o.getController("LeftMenu"),h=o.getController("CellEditor"),d=a.getView("Statusbar"),p=c.getView("LeftMenu"),m=l.getView("DocumentHolder"),u=o.getController("Common.Controllers.Chat"),g=o.getController("Common.Controllers.Plugins"),b=o.getController("Spellcheck");if(p.getMenu("file").loadDocument({doc:i.appOptions.spreadsheet}),c.setMode(i.appOptions).createDelayedElements().setApi(i.api),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||g.setApi(i.api),p.disableMenu("all",!1),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||!i.appOptions.canBranding||i.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(i.editorConfig.customization),l.setApi(i.api).loadConfig({config:i.editorConfig}),u.setApi(this.api).setMode(this.appOptions),a.createDelayedElements(),a.setApi(i.api),m.setApi(i.api),d.update(),this.formulaInput=h.getView("CellEditor").$el.find("textarea"),i.appOptions.isEdit){b.setApi(i.api).setMode(i.appOptions),i.appOptions.canAutosave?(e=Common.localStorage.getItem("sse-settings-autosave"),null===e&&i.appOptions.customization&&!1===i.appOptions.customization.autosave&&(e=0),e=i._state.fastCoauth||null===e?i.appOptions.canCoAuthoring?1:0:parseInt(e)):e=0,i.api.asc_setAutoSaveGap(e),Common.Utils.InternalSettings.set("sse-settings-autosave",e),i.appOptions.canForcesave&&(i.appOptions.forcesave=Common.localStorage.getBool("sse-settings-forcesave",i.appOptions.canForcesave),Common.Utils.InternalSettings.set("sse-settings-forcesave",i.appOptions.forcesave),i.api.asc_setIsForceSaveOnUserSave(i.appOptions.forcesave)),i.needToUpdateVersion&&(Common.NotificationCenter.trigger("api:disconnect"),s.onApiCoAuthoringDisconnect());var f=setInterval(function(){if(window.styles_loaded||i.appOptions.isEditDiagram||i.appOptions.isEditMailMerge){if(clearInterval(f),Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+i.api.asc_getActiveWorksheetId()]),m.createDelayedElements(),s.createDelayedElements(),i.setLanguages(),!i.appOptions.isEditMailMerge&&!i.appOptions.isEditDiagram){var t=i.api.asc_getPropertyEditorShapes();t&&i.fillAutoShapes(t[0],t[1]),i.fillTextArt(i.api.asc_getTextArtPreviews()),i.updateThemeColors(),s.activateControls()}r.createDelayedElements(),i.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(i.onDocumentCanSaveChanged,i)),i.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(i.onTryUndoInFastCollaborative,i)),i.onDocumentModifiedChanged(i.api.asc_isDocumentModified());var e=o.getController("FormulaDialog");e&&e.setMode(i.appOptions).setApi(i.api),i.needToUpdateVersion&&s.onApiCoAuthoringDisconnect(),Common.NotificationCenter.trigger("document:ready","main"),i.applyLicense()}},50)}else m.createDelayedElementsViewer(),Common.NotificationCenter.trigger("document:ready","main");i.appOptions.canAnalytics,1,Common.Gateway.on("applyeditrights",_.bind(i.onApplyEditRights,i)),Common.Gateway.on("processsaveresult",_.bind(i.onProcessSaveResult,i)),Common.Gateway.on("processrightschange",_.bind(i.onProcessRightsChange,i)),Common.Gateway.on("processmouse",_.bind(i.onProcessMouse,i)),Common.Gateway.on("downloadas",_.bind(i.onDownloadAs,i)),Common.Gateway.sendInfo({mode:i.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(i.onContextMenu,i)),void 0!==document.hidden&&document.hidden?document.addEventListener("visibilitychange",t):t(),Common.Gateway.documentReady()}},onLicenseChanged:function(t){if(!this.appOptions.isEditDiagram&&!this.appOptions.isEditMailMerge){var e=t.asc_getLicenseType();void 0===e||!this.appOptions.canEdit||"view"===this.editorConfig.mode||e!==Asc.c_oLicenseResult.Connections&&e!==Asc.c_oLicenseResult.UsersCount&&e!==Asc.c_oLicenseResult.ConnectionsOS&&e!==Asc.c_oLicenseResult.UsersCountOS||(this._state.licenseType=e),this._isDocReady&&this.applyLicense()}},applyLicense:function(){},disableEditing:function(t){var e=this.getApplication();this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t))},onOpenDocument:function(t){var e=document.getElementById("loadmask-text"),i=(t.asc_getCurrentFont()+t.asc_getCurrentImage())/(t.asc_getFontsCount()+t.asc_getImagesCount());i=this.textLoadingDocument+": "+Math.min(Math.round(100*i),100)+"%",e?e.innerHTML=i:this.loadMask&&this.loadMask.setTitle(i)},onEditorPermissions:function(t){var e=t?t.asc_getLicenseType():Asc.c_oLicenseResult.Error;if(!t||this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)this.appOptions.canModifyFilter=!0;else{if(this.onServerVersion(t.asc_getBuildVersion()))return;t.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.canAutosave=!0,this.appOptions.canAnalytics=t.asc_getIsAnalyticsEnable(),this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.canLicense=e===Asc.c_oLicenseResult.Success||e===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=t.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canComments=this.appOptions.canLicense&&(void 0===this.permissions.comment?!1!==this.permissions.edit:this.permissions.comment)&&"view"!==this.editorConfig.mode,this.appOptions.canComments=this.appOptions.canComments&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canViewComments=this.appOptions.canComments||!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canChat=this.appOptions.canLicense&&!this.appOptions.isOffline&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.chat),this.appOptions.canRename=this.editorConfig.canRename&&!!this.permissions.rename,this.appOptions.trialMode=t.asc_getLicenseMode(),this.appOptions.canModifyFilter=!1!==this.permissions.modifyFilter,this.appOptions.canBranding=t.asc_getCustomization(),this.appOptions.canBranding&&this.headerView.setBranding(this.editorConfig.customization),this.appOptions.canRename&&this.headerView.setCanRename(!0)}this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canRequestClose=this.editorConfig.canRequestClose,this.appOptions.canEdit=!1!==this.permissions.edit&&(this.editorConfig.canRequestEditRights||"view"!==this.editorConfig.mode),this.appOptions.isEdit=(this.appOptions.canLicense||this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)&&!1!==this.permissions.edit&&"view"!==this.editorConfig.mode,this.appOptions.canDownload=!1!==this.permissions.download,this.appOptions.canPrint=!1!==this.permissions.print,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&!(this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)&&"object"==typeof this.editorConfig.customization&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||!("object"==typeof this.editorConfig.customization&&this.editorConfig.customization.commentAuthorOnly),this.appOptions.isSignatureSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isSignaturesSupport()&&!(this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge),this.appOptions.isPasswordSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isProtectionSupport()&&!(this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge),this.appOptions.canProtect=this.appOptions.isSignatureSupport||this.appOptions.isPasswordSupport,this.appOptions.canHelp=!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.help),this.appOptions.isRestrictedEdit=!this.appOptions.isEdit&&this.appOptions.canComments,this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge||(this.appOptions.canBrandingExt=t.asc_getCanBranding()&&("object"==typeof this.editorConfig.customization||this.editorConfig.plugins),this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions)),this.applyModeCommonElements(),this.applyModeEditorElements(),this.appOptions.isEdit||(Common.NotificationCenter.trigger("app:face",this.appOptions),this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),this.api.asc_setViewMode(!this.appOptions.isEdit&&!this.appOptions.isRestrictedEdit),this.appOptions.isRestrictedEdit&&this.appOptions.canComments&&this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments),this.api.asc_LoadDocument()},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var t=this.getApplication(),e=t.getController("Viewport").getView("Viewport"),i=t.getController("Statusbar").getView("Statusbar");if(this.headerView&&this.headerView.setVisible(!this.appOptions.isEditMailMerge&&!this.appOptions.isDesktopApp&&!this.appOptions.isEditDiagram),e&&e.setMode(this.appOptions,!0),i&&i.setMode(this.appOptions),t.getController("Toolbar").setMode(this.appOptions),t.getController("DocumentHolder").setMode(this.appOptions), -(this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram)&&(i.hide(),t.getController("LeftMenu").getView("LeftMenu").hide(),$(window).mouseup(function(t){Common.Gateway.internalMessage("processMouse",{event:"mouse:up"})}).mousemove($.proxy(function(t){this.isDiagramDrag&&Common.Gateway.internalMessage("processMouse",{event:"mouse:move",pagex:t.pageX*Common.Utils.zoom(),pagey:t.pageY*Common.Utils.zoom()})},this))),!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(this.onDocumentModifiedChanged,this));var n=t.getController("Print");n&&this.api&&n.setApi(this.api)}var o=this.getApplication().getController("CellEditor");o&&o.setApi(this.api).setMode(this.appOptions)},applyModeEditorElements:function(t){var e=this.getApplication().getController("Common.Controllers.Comments");if(e&&(e.setMode(this.appOptions),e.setConfig({config:this.editorConfig,sdkviewname:"#ws-canvas-outer",hintmode:!0},this.api)),this.appOptions.isEdit){var i=this,n=this.getApplication(),o=n.getController("Toolbar"),s=n.getController("Statusbar"),a=n.getController("RightMenu"),l=n.getController("Common.Controllers.Fonts"),r=n.getController("Common.Controllers.ReviewChanges");l&&l.setApi(i.api),o&&o.setApi(i.api),a&&a.setApi(i.api),r.setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),i.appOptions.canProtect&&n.getController("Common.Controllers.Protection").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),s&&s.getView("Statusbar").changeViewMode(!0),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||i.appOptions.isOffline||n.getController("PivotTable").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api);this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode(),a.getView("RightMenu").setMode(i.appOptions).setApi(i.api),this.toolbarView=o.getView("Toolbar");var c=Common.localStorage.getItem("sse-settings-unit");if(c=null!==c?parseInt(c):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(c),Common.Utils.InternalSettings.set("sse-settings-unit",c),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram)a.getView("RightMenu").hide();else{var h={};JSON.parse(Common.localStorage.getItem("sse-hidden-formula"))&&(h.formula=!0),n.getController("Toolbar").hideElements(h)}i.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.appOptions.isEditDiagram&&i.api.asc_registerCallback("asc_onSelectionChanged",_.bind(i.onSelectionChanged,i)),i.api.asc_setFilteringMode&&i.api.asc_setFilteringMode(i.appOptions.canModifyFilter),i.stackLongActions.exist({id:-255,type:Asc.c_oAscAsyncActionType.BlockInteraction})?i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-255):this._isDocReady||(Common.NotificationCenter.trigger("app:face",this.appOptions),i.hidePreloader(),i.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),window.onbeforeunload=_.bind(i.onBeforeUnload,i),window.onunload=_.bind(i.onUnload,i)}},onExternalMessage:function(t){t&&t.msg&&(t.msg=t.msg.toString(),this.showTips([t.msg.charAt(0).toUpperCase()+t.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error"))},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.LoadingScriptError)return this.showTips([this.scriptLoadError]),void(this.tooltip&&this.tooltip.getBSTip().$tip.css("z-index",1e4));this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256);var n={closable:!0};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.PastInMergeAreaError:n.msg=this.pastInMergeAreaError;break;case Asc.c_oAscError.ID.FrmlWrongCountParentheses:n.msg=this.errorWrongBracketsCount;break;case Asc.c_oAscError.ID.FrmlWrongOperator:n.msg=this.errorWrongOperator;break;case Asc.c_oAscError.ID.FrmlWrongMaxArgument:n.msg=this.errorCountArgExceed;break;case Asc.c_oAscError.ID.FrmlWrongCountArgument:n.msg=this.errorCountArg;break;case Asc.c_oAscError.ID.FrmlWrongFunctionName:n.msg=this.errorFormulaName;break;case Asc.c_oAscError.ID.FrmlAnotherParsingError:n.msg=this.errorFormulaParsing;break;case Asc.c_oAscError.ID.FrmlWrongArgumentRange:n.msg=this.errorArgsRange;break;case Asc.c_oAscError.ID.FrmlOperandExpected:n.msg=this.errorOperandExpected;break;case Asc.c_oAscError.ID.FrmlWrongReferences:n.msg=this.errorFrmlWrongReferences;break;case Asc.c_oAscError.ID.UnexpectedGuid:n.msg=this.errorUnexpectedGuid;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.FileRequest:n.msg=this.errorFileRequest;break;case Asc.c_oAscError.ID.FileVKey:n.msg=this.errorFileVKey;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.MaxDataPointsError:n.msg=this.errorMaxPoints;break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CannotMoveRange:n.msg=this.errorMoveRange;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.AutoFilterDataRangeError:n.msg=this.errorAutoFilterDataRange;break;case Asc.c_oAscError.ID.AutoFilterChangeFormatTableError:n.msg=this.errorAutoFilterChangeFormatTable;break;case Asc.c_oAscError.ID.AutoFilterChangeError:n.msg=this.errorAutoFilterChange;break;case Asc.c_oAscError.ID.AutoFilterMoveToHiddenRangeError:n.msg=this.errorAutoFilterHiddenRange;break;case Asc.c_oAscError.ID.CannotFillRange:n.msg=this.errorFillRange;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop,Common.NotificationCenter.trigger("collaboration:sharingdeny");break;case Asc.c_oAscError.ID.InvalidReferenceOrName:n.msg=this.errorInvalidRef;break;case Asc.c_oAscError.ID.LockCreateDefName:n.msg=this.errorCreateDefName;break;case Asc.c_oAscError.ID.PasteMaxRangeError:n.msg=this.errorPasteMaxRange;break;case Asc.c_oAscError.ID.LockedAllError:n.msg=this.errorLockedAll;break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer.replace("%1","https://api.onlyoffice.com/editors/callback"),n.closable=!1;break;case Asc.c_oAscError.ID.LockedWorksheetRename:n.msg=this.errorLockedWorksheetRename;break;case Asc.c_oAscError.ID.OpenWarning:n.msg=this.errorOpenWarning;break;case Asc.c_oAscError.ID.CopyMultiselectAreaError:n.msg=this.errorCopyMultiselectArea;break;case Asc.c_oAscError.ID.PrintMaxPagesCount:n.msg=this.errorPrintMaxPagesCount;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.LockedCellPivot:n.msg=this.errorLockedCellPivot;break;case Asc.c_oAscError.ID.ForceSaveButton:n.msg=this.errorForceSave;break;case Asc.c_oAscError.ID.ForceSaveTimeout:n.msg=this.errorForceSave,console.warn(n.msg);break;case Asc.c_oAscError.ID.DataEncrypted:n.msg=this.errorDataEncrypted;break;case Asc.c_oAscError.ID.EditingError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.errorEditingSaveas:this.errorEditingDownloadas;break;case Asc.c_oAscError.ID.CannotChangeFormulaArray:n.msg=this.errorChangeArray;break;case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:n.msg=this.errorMultiCellFormula;break;case Asc.c_oAscError.ID.MailToClientMissing:n.msg=this.errorEmailClient;break;case Asc.c_oAscError.ID.NoDataToParse:n.msg=this.errorNoDataToParse;break;case Asc.c_oAscError.ID.CannotUngroupError:n.msg=this.errorCannotUngroup;break;case Asc.c_oAscError.ID.FrmlMaxTextLength:n.msg=this.errorFrmlMaxTextLength;break;case Asc.c_oAscError.ID.DataValidate:var o=i?i.asc_getErrorStyle():void 0;void 0!==o&&(n.iconCls=o==Asc.c_oAscEDataValidationErrorStyle.Stop?"error":o==Asc.c_oAscEDataValidationErrorStyle.Information?"info":"warn"),i&&i.asc_getErrorTitle()&&(n.title=i.asc_getErrorTitle()),n.buttons=["ok","cancel"],n.msg=i&&i.asc_getError()?i.asc_getError():this.errorDataValidate,n.maxwidth=600;break;default:n.msg="string"==typeof t?t:this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",n.closable=!1,this.appOptions.canBackToFolder&&!this.appOptions.isDesktopApp&&"string"!=typeof t&&(n.msg+="

    "+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback",!0)}),t==Asc.c_oAscError.ID.DataEncrypted&&(this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect"))):(Common.Gateway.reportWarning(t,n.msg),n.title=n.title||this.notcriticalErrorTitle,n.iconCls=n.iconCls||"warn",n.buttons=n.buttons||["ok"],n.callback=_.bind(function(e){t==Asc.c_oAscError.ID.Warning&&"ok"==e&&this.appOptions.canDownload?(Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas")):t==Asc.c_oAscError.ID.EditingError?(this.disableEditing(!0),Common.NotificationCenter.trigger("api:disconnect",!0)):t==Asc.c_oAscError.ID.DataValidate&&"ok"!==e&&this.api.asc_closeCellEditor(!0),this._state.lostEditingRights=!1,this.onEditComplete()},this)),$(".asc-window.modal.alert:visible").length<1&&t!==Asc.c_oAscError.ID.ForceSaveTimeout&&(Common.UI.alert(n),Common.component.Analytics.trackEvent("Internal Error",t.toString()))},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(t,e){if(this._state.isDocModified!==t||e){if(this.headerView){var i=this.defaultTitleText;if(_.isEmpty(this.headerView.getDocumentCaption())||(i=this.headerView.getDocumentCaption()+" - "+i),t)clearTimeout(this._state.timerCaption),_.isUndefined(i)||(i="* "+i,this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!0));else if(this._state.fastCoauth&&this._state.usersCount>1){var n=this;this._state.timerCaption=setTimeout(function(){n.headerView.setDocumentCaption(n.headerView.getDocumentCaption(),!1)},500)}else this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!1);window.document.title!=i&&(window.document.title=i)}Common.Gateway.setDocumentModified(t),this._state.isDocModified=t}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(t){if(this.updateWindowTitle(t),Common.Gateway.setDocumentModified(t),this.toolbarView&&this.toolbarView.btnCollabChanges&&this.api){var e=this.toolbarView.btnCollabChanges.$icon.hasClass("btn-synch"),i=this.appOptions.forcesave,n=this.api.asc_isDocumentCanSave(),o=!n&&!e&&!i||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!i;this.toolbarView.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){if(this.toolbarView&&this.toolbarView.btnCollabChanges){var e=this.toolbarView.btnCollabChanges.$icon.hasClass("btn-synch"),i=this.appOptions.forcesave,n=!t&&!e&&!i||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!i;this.toolbarView.btnSave.setDisabled(n)}},onBeforeUnload:function(){if(Common.localStorage.save(),!1!==this.permissions.edit&&"view"!==this.editorConfig.mode&&"editdiagram"!==this.editorConfig.mode&&"editmerge"!==this.editorConfig.mode&&this.api.asc_isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var i;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,t),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,e),i=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),this.stackLongActions.pop({id:-254,type:Asc.c_oAscAsyncActionType.BlockInteraction}),Common.NotificationCenter.trigger("layout:changed","main"),(i||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onDownloadCancel:function(){this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},onAdvancedOptions:function(t,e,i,n){if(!this._state.openDlg){var o=this;t==Asc.c_oAscAdvancedOptionsID.CSV?o._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitle.replace("%1","CSV"),closable:2==i,type:Common.Utils.importTextType.CSV,preview:e.asc_getData(),codepages:e.asc_getCodePages(),settings:e.asc_getRecommendedSettings(),api:o.api,handler:function(e,s,a,l){o.isShowOpenDialog=!1,"ok"==e&&o&&o.api&&(2==i?(n&&n.asc_setAdvancedOptions(new Asc.asc_CTextOptions(s,a,l)),o.api.asc_DownloadAs(n)):o.api.asc_setAdvancedOptions(t,new Asc.asc_CTextOptions(s,a,l)),o.loadMask&&o.loadMask.show()),o._state.openDlg=null}}):t==Asc.c_oAscAdvancedOptionsID.DRM&&(o._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:o.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(o.appOptions.isDesktopApp&&o.appOptions.isOffline),validatePwd:!!o._state.isDRM,handler:function(e,i){o.isShowOpenDialog=!1,"ok"==e?o&&o.api&&(o.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(i)),o.loadMask&&o.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),o._state.openDlg=null}}),o._state.isDRM=!0),o._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),o._state.openDlg.show())}},onActiveSheetChanged:function(t){this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram||!window.editor_elements_prepared||(this.application.getController("Statusbar").selectTab(t),this.appOptions.canViewComments&&!this.dontCloseDummyComment&&Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+this.api.asc_getWorksheetId(t)],!1))},onConfirmAction:function(t,e){var i=this;t==Asc.c_oAscConfirm.ConfirmReplaceRange?Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.confirmMoveCellRange,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){e&&e("yes"===t),"yes"==t&&i.onEditComplete(i.application.getController("DocumentHolder").getView("DocumentHolder"))},this)}):t==Asc.c_oAscConfirm.ConfirmPutMergeRange&&Common.UI.warning({closable:!1,title:this.notcriticalErrorTitle,msg:this.confirmPutMergeRange,buttons:["ok"],primary:"ok",callback:_.bind(function(t){e&&e(),i.onEditComplete(i.application.getController("DocumentHolder").getView("DocumentHolder"))},this)})},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines]},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[],o=this.getCollection("ShapeGroups");o.reset();t.length;_.each(t,function(t,o){var s=new Backbone.Collection([],{model:SSE.Models.ShapeModel}),a=e[o].length>18?7:6,l=35*Math.ceil(e[o].length/a)+3,r=30*a;_.each(e[o],function(t,e){s.add({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:r,groupHeight:l})}),o.add(n),setTimeout(function(){i.getApplication().getController("Toolbar").fillAutoShapes()},50)}},fillTextArt:function(t){if(!_.isEmpty(t)){var e=this,i=[],n=this.getCollection("Common.Collections.TextArt");_.each(t,function(t,e){i.push({imageUrl:t,data:e,allowSelected:!0,selected:!1})}),n.reset(i),setTimeout(function(){e.getApplication().getController("Toolbar").fillTextArt()},50),setTimeout(function(){e.getApplication().getController("RightMenu").fillTextArt()},50)}},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Statusbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded&&!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt(i.api.asc_getTextArtPreviews())},1)}},loadLanguages:function(t){this.languages=t,window.styles_loaded&&this.setLanguages()},setLanguages:function(){this.getApplication().getController("Spellcheck").setLanguages(this.languages)},onInternalCommand:function(t){if(t)switch(t.command){case"setChartData":this.setChartData(t.data);break;case"getChartData":this.getChartData();break;case"clearChartData":this.clearChartData();break;case"setMergeData":this.setMergeData(t.data);break;case"getMergeData":this.getMergeData();break;case"setAppDisabled":void 0!==this.isAppDisabled||t.data||(Common.NotificationCenter.trigger("layout:changed","main"),this.loadMask&&this.loadMask.isVisible()&&this.loadMask.updatePosition()),this.isAppDisabled=t.data;break;case"queryClose":0===$("body .asc-window:visible").length?(this.isFrameClosed=!0,this.api.asc_closeCellEditor(),Common.UI.Menu.Manager.hideAll(),Common.Gateway.internalMessage("canClose",{mr:t.data.mr,answer:!0})):Common.Gateway.internalMessage("canClose",{answer:!1});break;case"window:drag":this.isDiagramDrag=t.data;break;case"processmouse":this.onProcessMouse(t.data)}},setChartData:function(t){"object"==typeof t&&this.api&&(this.api.asc_addChartDrawingObject(t),this.isFrameClosed=!1)},getChartData:function(){if(this.api){var t=this.api.asc_getWordChartObject();"object"==typeof t&&Common.Gateway.internalMessage("chartData",{data:t})}},clearChartData:function(){this.api&&this.api.asc_closeCellEditor()},setMergeData:function(t){"object"==typeof t&&this.api&&(this.api.asc_setData(t),this.isFrameClosed=!1)},getMergeData:function(){if(this.api){var t=this.api.asc_getData();"object"==typeof t&&Common.Gateway.internalMessage("mergeData",{data:t})}},unitsChanged:function(t){var e=Common.localStorage.getItem("sse-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("sse-settings-unit",e),this.getApplication().getController("RightMenu").updateMetricUnit(),this.getApplication().getController("Print").getView("MainSettingsPrint").updateMetricUnit(),this.getApplication().getController("Toolbar").getView("Toolbar").updateMetricUnit()},_compareActionStrong:function(t,e){return t.id===e.id&&t.type===e.type},_compareActionWeak:function(t,e){return t.type===e.type},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onNamedRangeLocked:function(){$(".asc-window.modal.alert:visible").length<1&&Common.UI.alert({msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.onEditComplete()},this)})},onTryUndoInFastCollaborative:function(){var t=window.localStorage.getItem("sse-hide-try-undoredo");t&&1==parseInt(t)||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&window.localStorage.setItem("sse-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("sse-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("sse-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=Common.localStorage.getItem("sse-settings-coauthmode"),e=this._state.fastCoauth;this._state.fastCoauth=null===t||1==parseInt(t),this._state.fastCoauth&&!e&&this.toolbarView.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("sse-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("sse-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(t){this.headerView.setDocumentCaption(t),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0)},onMeta:function(t){var e=this.getApplication(),i=e.getController("LeftMenu").getView("LeftMenu").getMenu("file");e.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t.title),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),this.appOptions.spreadsheet.title=t.title,i.loadDocument({doc:this.appOptions.spreadsheet}),i.panels.info.updateInfo(this.appOptions.spreadsheet),Common.Gateway.metaChange(t)},onPrint:function(){this.appOptions.canPrint&&!this.isModalShowed&&Common.NotificationCenter.trigger("print",this)},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(i){var t=new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);t.asc_setAdvancedOptions(e.getApplication().getController("Print").getPrintParams()),e.api.asc_DownloadAs(t)}}}t&&(this.iframePrint.src=t)},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",saveTitleText:"Saving Document",saveTextText:"Saving document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading spreadsheet",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",pastInMergeAreaError:"Cannot change part of a merged cell",titleRecalcFormulas:"Calculating formulas...",textRecalcFormulas:"Calculating formulas...",textPleaseWait:"It's working hard. Please wait...",errorWrongBracketsCount:"Found an error in the formula entered.
    Wrong cout of brackets.",errorWrongOperator:"An error in the entered formula. Wrong operator is used.
    Please correct the error or use the Esc button to cancel the formula editing.",errorCountArgExceed:"Found an error in the formula entered.
    Count of arguments exceeded.",errorCountArg:"Found an error in the formula entered.
    Invalid number of arguments.",errorFormulaName:"Found an error in the formula entered.
    Incorrect formula name.",errorFormulaParsing:"Internal error while the formula parsing.",errorArgsRange:"Found an error in the formula entered.
    Incorrect arguments range.",errorUnexpectedGuid:"External error.
    Unexpected Guid. Please, contact support.",errorDatabaseConnection:"External error.
    Database connection error. Please, contact support.",errorFileRequest:"External error.
    File Request. Please, contact support.",errorFileVKey:"External error.
    Incorrect securety key. Please, contact support.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:
    opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorOperandExpected:"The entered function syntax is not correct. Please check if you are missing one of the parentheses - '(' or ')'.",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",errorMoveRange:"Cann't change a part of merged cell",errorBadImageUrl:"Image url is incorrect",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",errorLockedAll:"The operation could not be done as the sheet has been locked by another user.",txtEditingMode:"Set editing mode...",textLoadingDocument:"Loading spreadsheet",textConfirm:"Confirmation",confirmMoveCellRange:"The destination cell's range can contain data. Continue the operation?",textYes:"Yes",textNo:"No",textAnonymous:"Anonymous",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",errorAutoFilterDataRange:"The operation could not be done for the selected range of cells.
    Select a uniform data range inside or outside the table and try again.",errorAutoFilterChangeFormatTable:"The operation could not be done for the selected cells as you cannot move a part of the table.
    Select another data range so that the whole table was shifted and try again.",errorAutoFilterHiddenRange:"The operation cannot be performed because the area contains filtered cells.
    Please unhide the filtered elements and try again.",errorAutoFilterChange:"The operation is not allowed, as it is attempting to shift cells in a table on your worksheet.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorFillRange:"Could not fill the selected range of cells.
    All the merged cells need to be the same size.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtArt:"Your text here",errorInvalidRef:"Enter a correct name for the selection or a valid reference to go to.",errorCreateDefName:"The existing named ranges cannot be edited and the new ones cannot be created
    at the moment as some of them are being edited.",errorPasteMaxRange:"The copy and paste area does not match. Please select an area with the same size or click the first cell in a row to paste the copied cells.",errorConnectToServer:' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    Find more information about connecting Document Server here',errorLockedWorksheetRename:"The sheet cannot be renamed at the moment as it is being renamed by another user",textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",errorOpenWarning:"The length of one of the formulas in the file exceeded
    the allowed number of characters and it was removed.",errorFrmlWrongReferences:"The function refers to a sheet that does not exist.
    Please check the data and try again.",textBuyNow:"Visit website",textNoLicenseTitle:"%1 open source version",textContactUs:"Contact sales", +(this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram)&&(i.hide(),t.getController("LeftMenu").getView("LeftMenu").hide(),$(window).mouseup(function(t){Common.Gateway.internalMessage("processMouse",{event:"mouse:up"})}).mousemove($.proxy(function(t){this.isDiagramDrag&&Common.Gateway.internalMessage("processMouse",{event:"mouse:move",pagex:t.pageX*Common.Utils.zoom(),pagey:t.pageY*Common.Utils.zoom()})},this))),!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(this.onDocumentModifiedChanged,this));var n=t.getController("Print");n&&this.api&&n.setApi(this.api)}var o=this.getApplication().getController("CellEditor");o&&o.setApi(this.api).setMode(this.appOptions)},applyModeEditorElements:function(t){var e=this.getApplication().getController("Common.Controllers.Comments");if(e&&(e.setMode(this.appOptions),e.setConfig({config:this.editorConfig,sdkviewname:"#ws-canvas-outer",hintmode:!0},this.api)),this.appOptions.isEdit){var i=this,n=this.getApplication(),o=n.getController("Toolbar"),s=n.getController("Statusbar"),a=n.getController("RightMenu"),l=n.getController("Common.Controllers.Fonts"),r=n.getController("Common.Controllers.ReviewChanges");l&&l.setApi(i.api),o&&o.setApi(i.api),a&&a.setApi(i.api),r.setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),i.appOptions.canProtect&&n.getController("Common.Controllers.Protection").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),s&&s.getView("Statusbar").changeViewMode(!0),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||i.appOptions.isOffline||n.getController("PivotTable").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api);this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode(),a.getView("RightMenu").setMode(i.appOptions).setApi(i.api),this.toolbarView=o.getView("Toolbar");var c=Common.localStorage.getItem("sse-settings-unit");if(c=null!==c?parseInt(c):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(c),Common.Utils.InternalSettings.set("sse-settings-unit",c),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram)a.getView("RightMenu").hide();else{var h={};JSON.parse(Common.localStorage.getItem("sse-hidden-formula"))&&(h.formula=!0),n.getController("Toolbar").hideElements(h)}i.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.appOptions.isEditDiagram&&i.api.asc_registerCallback("asc_onSelectionChanged",_.bind(i.onSelectionChanged,i)),i.api.asc_setFilteringMode&&i.api.asc_setFilteringMode(i.appOptions.canModifyFilter),i.stackLongActions.exist({id:-255,type:Asc.c_oAscAsyncActionType.BlockInteraction})?i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-255):this._isDocReady||(Common.NotificationCenter.trigger("app:face",this.appOptions),i.hidePreloader(),i.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),window.onbeforeunload=_.bind(i.onBeforeUnload,i),window.onunload=_.bind(i.onUnload,i)}},onExternalMessage:function(t){t&&t.msg&&(t.msg=t.msg.toString(),this.showTips([t.msg.charAt(0).toUpperCase()+t.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error"))},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.LoadingScriptError)return this.showTips([this.scriptLoadError]),void(this.tooltip&&this.tooltip.getBSTip().$tip.css("z-index",1e4));this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256);var n={closable:!0};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.PastInMergeAreaError:n.msg=this.pastInMergeAreaError;break;case Asc.c_oAscError.ID.FrmlWrongCountParentheses:n.msg=this.errorWrongBracketsCount;break;case Asc.c_oAscError.ID.FrmlWrongOperator:n.msg=this.errorWrongOperator;break;case Asc.c_oAscError.ID.FrmlWrongMaxArgument:n.msg=this.errorCountArgExceed;break;case Asc.c_oAscError.ID.FrmlWrongCountArgument:n.msg=this.errorCountArg;break;case Asc.c_oAscError.ID.FrmlWrongFunctionName:n.msg=this.errorFormulaName;break;case Asc.c_oAscError.ID.FrmlAnotherParsingError:n.msg=this.errorFormulaParsing;break;case Asc.c_oAscError.ID.FrmlWrongArgumentRange:n.msg=this.errorArgsRange;break;case Asc.c_oAscError.ID.FrmlOperandExpected:n.msg=this.errorOperandExpected;break;case Asc.c_oAscError.ID.FrmlWrongReferences:n.msg=this.errorFrmlWrongReferences;break;case Asc.c_oAscError.ID.UnexpectedGuid:n.msg=this.errorUnexpectedGuid;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.FileRequest:n.msg=this.errorFileRequest;break;case Asc.c_oAscError.ID.FileVKey:n.msg=this.errorFileVKey;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.MaxDataPointsError:n.msg=this.errorMaxPoints;break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CannotMoveRange:n.msg=this.errorMoveRange;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.AutoFilterDataRangeError:n.msg=this.errorAutoFilterDataRange;break;case Asc.c_oAscError.ID.AutoFilterChangeFormatTableError:n.msg=this.errorAutoFilterChangeFormatTable;break;case Asc.c_oAscError.ID.AutoFilterChangeError:n.msg=this.errorAutoFilterChange;break;case Asc.c_oAscError.ID.AutoFilterMoveToHiddenRangeError:n.msg=this.errorAutoFilterHiddenRange;break;case Asc.c_oAscError.ID.CannotFillRange:n.msg=this.errorFillRange;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop,Common.NotificationCenter.trigger("collaboration:sharingdeny");break;case Asc.c_oAscError.ID.InvalidReferenceOrName:n.msg=this.errorInvalidRef;break;case Asc.c_oAscError.ID.LockCreateDefName:n.msg=this.errorCreateDefName;break;case Asc.c_oAscError.ID.PasteMaxRangeError:n.msg=this.errorPasteMaxRange;break;case Asc.c_oAscError.ID.LockedAllError:n.msg=this.errorLockedAll;break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer.replace("%1","https://api.onlyoffice.com/editors/callback"),n.closable=!1;break;case Asc.c_oAscError.ID.LockedWorksheetRename:n.msg=this.errorLockedWorksheetRename;break;case Asc.c_oAscError.ID.OpenWarning:n.msg=this.errorOpenWarning;break;case Asc.c_oAscError.ID.CopyMultiselectAreaError:n.msg=this.errorCopyMultiselectArea;break;case Asc.c_oAscError.ID.PrintMaxPagesCount:n.msg=this.errorPrintMaxPagesCount;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.LockedCellPivot:n.msg=this.errorLockedCellPivot;break;case Asc.c_oAscError.ID.ForceSaveButton:n.msg=this.errorForceSave;break;case Asc.c_oAscError.ID.ForceSaveTimeout:n.msg=this.errorForceSave,console.warn(n.msg);break;case Asc.c_oAscError.ID.DataEncrypted:n.msg=this.errorDataEncrypted;break;case Asc.c_oAscError.ID.EditingError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.errorEditingSaveas:this.errorEditingDownloadas;break;case Asc.c_oAscError.ID.CannotChangeFormulaArray:n.msg=this.errorChangeArray;break;case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:n.msg=this.errorMultiCellFormula;break;case Asc.c_oAscError.ID.MailToClientMissing:n.msg=this.errorEmailClient;break;case Asc.c_oAscError.ID.NoDataToParse:n.msg=this.errorNoDataToParse;break;case Asc.c_oAscError.ID.CannotUngroupError:n.msg=this.errorCannotUngroup;break;case Asc.c_oAscError.ID.FrmlMaxTextLength:n.msg=this.errorFrmlMaxTextLength;break;case Asc.c_oAscError.ID.DataValidate:var o=i?i.asc_getErrorStyle():void 0;void 0!==o&&(n.iconCls=o==Asc.c_oAscEDataValidationErrorStyle.Stop?"error":o==Asc.c_oAscEDataValidationErrorStyle.Information?"info":"warn"),i&&i.asc_getErrorTitle()&&(n.title=i.asc_getErrorTitle()),n.buttons=["ok","cancel"],n.msg=i&&i.asc_getError()?i.asc_getError():this.errorDataValidate,n.maxwidth=600;break;default:n.msg="string"==typeof t?t:this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",n.closable=!1,this.appOptions.canBackToFolder&&!this.appOptions.isDesktopApp&&"string"!=typeof t&&(n.msg+="

    "+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback",!0)}),t==Asc.c_oAscError.ID.DataEncrypted&&(this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect"))):(Common.Gateway.reportWarning(t,n.msg),n.title=n.title||this.notcriticalErrorTitle,n.iconCls=n.iconCls||"warn",n.buttons=n.buttons||["ok"],n.callback=_.bind(function(e){t==Asc.c_oAscError.ID.Warning&&"ok"==e&&this.appOptions.canDownload?(Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas")):t==Asc.c_oAscError.ID.EditingError?(this.disableEditing(!0),Common.NotificationCenter.trigger("api:disconnect",!0)):t==Asc.c_oAscError.ID.DataValidate&&"ok"!==e&&this.api.asc_closeCellEditor(!0),this._state.lostEditingRights=!1,this.onEditComplete()},this)),$(".asc-window.modal.alert:visible").length<1&&t!==Asc.c_oAscError.ID.ForceSaveTimeout&&(Common.UI.alert(n),Common.component.Analytics.trackEvent("Internal Error",t.toString()))},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(t,e){if(this._state.isDocModified!==t||e){if(this.headerView){var i=this.defaultTitleText;if(_.isEmpty(this.headerView.getDocumentCaption())||(i=this.headerView.getDocumentCaption()+" - "+i),t)clearTimeout(this._state.timerCaption),_.isUndefined(i)||(i="* "+i,this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!0));else if(this._state.fastCoauth&&this._state.usersCount>1){var n=this;this._state.timerCaption=setTimeout(function(){n.headerView.setDocumentCaption(n.headerView.getDocumentCaption(),!1)},500)}else this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!1);window.document.title!=i&&(window.document.title=i)}Common.Gateway.setDocumentModified(t),this._state.isDocModified=t}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(t){if(this.updateWindowTitle(t),Common.Gateway.setDocumentModified(t),this.toolbarView&&this.toolbarView.btnCollabChanges&&this.api){var e=this.toolbarView.btnCollabChanges.$icon.hasClass("btn-synch"),i=this.appOptions.forcesave,n=this.api.asc_isDocumentCanSave(),o=!n&&!e&&!i||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!i;this.toolbarView.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){if(this.toolbarView&&this.toolbarView.btnCollabChanges){var e=this.toolbarView.btnCollabChanges.$icon.hasClass("btn-synch"),i=this.appOptions.forcesave,n=!t&&!e&&!i||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!i;this.toolbarView.btnSave.setDisabled(n)}},onBeforeUnload:function(){if(Common.localStorage.save(),!1!==this.permissions.edit&&"view"!==this.editorConfig.mode&&"editdiagram"!==this.editorConfig.mode&&"editmerge"!==this.editorConfig.mode&&this.api.asc_isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var i;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,t),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,e),i=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),this.stackLongActions.pop({id:-254,type:Asc.c_oAscAsyncActionType.BlockInteraction}),Common.NotificationCenter.trigger("layout:changed","main"),(i||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onDownloadCancel:function(){this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},onAdvancedOptions:function(t,e,i,n){if(!this._state.openDlg){var o=this;t==Asc.c_oAscAdvancedOptionsID.CSV?o._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitle.replace("%1","CSV"),closable:2==i,type:Common.Utils.importTextType.CSV,preview:e.asc_getData(),codepages:e.asc_getCodePages(),settings:e.asc_getRecommendedSettings(),api:o.api,handler:function(e,s,a,l){o.isShowOpenDialog=!1,"ok"==e&&o&&o.api&&(2==i?(n&&n.asc_setAdvancedOptions(new Asc.asc_CTextOptions(s,a,l)),o.api.asc_DownloadAs(n)):o.api.asc_setAdvancedOptions(t,new Asc.asc_CTextOptions(s,a,l)),o.loadMask&&o.loadMask.show()),o._state.openDlg=null}}):t==Asc.c_oAscAdvancedOptionsID.DRM&&(o._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:o.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(o.appOptions.isDesktopApp&&o.appOptions.isOffline),validatePwd:!!o._state.isDRM,handler:function(e,i){o.isShowOpenDialog=!1,"ok"==e?o&&o.api&&(o.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(i)),o.loadMask&&o.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),o._state.openDlg=null}}),o._state.isDRM=!0),o._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),o._state.openDlg.show())}},onActiveSheetChanged:function(t){this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram||!window.editor_elements_prepared||(this.application.getController("Statusbar").selectTab(t),this.appOptions.canViewComments&&!this.dontCloseDummyComment&&Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+this.api.asc_getWorksheetId(t)],!1))},onConfirmAction:function(t,e){var i=this;t==Asc.c_oAscConfirm.ConfirmReplaceRange?Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.confirmMoveCellRange,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){e&&e("yes"===t),"yes"==t&&i.onEditComplete(i.application.getController("DocumentHolder").getView("DocumentHolder"))},this)}):t==Asc.c_oAscConfirm.ConfirmPutMergeRange&&Common.UI.warning({closable:!1,title:this.notcriticalErrorTitle,msg:this.confirmPutMergeRange,buttons:["ok"],primary:"ok",callback:_.bind(function(t){e&&e(),i.onEditComplete(i.application.getController("DocumentHolder").getView("DocumentHolder"))},this)})},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines]},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[],o=this.getCollection("ShapeGroups");o.reset();t.length;_.each(t,function(t,o){var s=new Backbone.Collection([],{model:SSE.Models.ShapeModel}),a=e[o].length>18?7:6,l=35*Math.ceil(e[o].length/a)+3,r=30*a;_.each(e[o],function(t,e){s.add({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:r,groupHeight:l})}),o.add(n),setTimeout(function(){i.getApplication().getController("Toolbar").fillAutoShapes()},50)}},fillTextArt:function(t){if(!_.isEmpty(t)){var e=this,i=[],n=this.getCollection("Common.Collections.TextArt");_.each(t,function(t,e){i.push({imageUrl:t,data:e,allowSelected:!0,selected:!1})}),n.reset(i),setTimeout(function(){e.getApplication().getController("Toolbar").fillTextArt()},50),setTimeout(function(){e.getApplication().getController("RightMenu").fillTextArt()},50)}},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Statusbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded&&!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt(i.api.asc_getTextArtPreviews())},1)}},loadLanguages:function(t){this.languages=t,window.styles_loaded&&this.setLanguages()},setLanguages:function(){this.getApplication().getController("Spellcheck").setLanguages(this.languages)},onInternalCommand:function(t){if(t)switch(t.command){case"setChartData":this.setChartData(t.data);break;case"getChartData":this.getChartData();break;case"clearChartData":this.clearChartData();break;case"setMergeData":this.setMergeData(t.data);break;case"getMergeData":this.getMergeData();break;case"setAppDisabled":void 0!==this.isAppDisabled||t.data||(Common.NotificationCenter.trigger("layout:changed","main"),this.loadMask&&this.loadMask.isVisible()&&this.loadMask.updatePosition()),this.isAppDisabled=t.data;break;case"queryClose":0===$("body .asc-window:visible").length?(this.isFrameClosed=!0,this.api.asc_closeCellEditor(),Common.UI.Menu.Manager.hideAll(),Common.Gateway.internalMessage("canClose",{mr:t.data.mr,answer:!0})):Common.Gateway.internalMessage("canClose",{answer:!1});break;case"window:drag":this.isDiagramDrag=t.data;break;case"processmouse":this.onProcessMouse(t.data)}},setChartData:function(t){"object"==typeof t&&this.api&&(this.api.asc_addChartDrawingObject(t),this.isFrameClosed=!1)},getChartData:function(){if(this.api){var t=this.api.asc_getWordChartObject();"object"==typeof t&&Common.Gateway.internalMessage("chartData",{data:t})}},clearChartData:function(){this.api&&this.api.asc_closeCellEditor()},setMergeData:function(t){"object"==typeof t&&this.api&&(this.api.asc_setData(t),this.isFrameClosed=!1)},getMergeData:function(){if(this.api){var t=this.api.asc_getData();"object"==typeof t&&Common.Gateway.internalMessage("mergeData",{data:t})}},unitsChanged:function(t){var e=Common.localStorage.getItem("sse-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("sse-settings-unit",e),this.getApplication().getController("RightMenu").updateMetricUnit(),this.getApplication().getController("Print").getView("MainSettingsPrint").updateMetricUnit(),this.getApplication().getController("Toolbar").getView("Toolbar").updateMetricUnit()},_compareActionStrong:function(t,e){return t.id===e.id&&t.type===e.type},_compareActionWeak:function(t,e){return t.type===e.type},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onNamedRangeLocked:function(){$(".asc-window.modal.alert:visible").length<1&&Common.UI.alert({msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.onEditComplete()},this)})},onTryUndoInFastCollaborative:function(){var t=Common.localStorage.getItem("sse-hide-try-undoredo");t&&1==parseInt(t)||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&Common.localStorage.setItem("sse-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("sse-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("sse-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=Common.localStorage.getItem("sse-settings-coauthmode"),e=this._state.fastCoauth;this._state.fastCoauth=null===t||1==parseInt(t),this._state.fastCoauth&&!e&&this.toolbarView.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("sse-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("sse-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(t){this.headerView.setDocumentCaption(t),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0)},onMeta:function(t){var e=this.getApplication(),i=e.getController("LeftMenu").getView("LeftMenu").getMenu("file");e.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t.title),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),this.appOptions.spreadsheet.title=t.title,i.loadDocument({doc:this.appOptions.spreadsheet}),i.panels.info.updateInfo(this.appOptions.spreadsheet),Common.Gateway.metaChange(t)},onPrint:function(){this.appOptions.canPrint&&!this.isModalShowed&&Common.NotificationCenter.trigger("print",this)},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(i){var t=new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);t.asc_setAdvancedOptions(e.getApplication().getController("Print").getPrintParams()),e.api.asc_DownloadAs(t)}}}t&&(this.iframePrint.src=t)},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",saveTitleText:"Saving Document",saveTextText:"Saving document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading spreadsheet",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",pastInMergeAreaError:"Cannot change part of a merged cell",titleRecalcFormulas:"Calculating formulas...",textRecalcFormulas:"Calculating formulas...",textPleaseWait:"It's working hard. Please wait...",errorWrongBracketsCount:"Found an error in the formula entered.
    Wrong cout of brackets.",errorWrongOperator:"An error in the entered formula. Wrong operator is used.
    Please correct the error or use the Esc button to cancel the formula editing.",errorCountArgExceed:"Found an error in the formula entered.
    Count of arguments exceeded.",errorCountArg:"Found an error in the formula entered.
    Invalid number of arguments.",errorFormulaName:"Found an error in the formula entered.
    Incorrect formula name.",errorFormulaParsing:"Internal error while the formula parsing.",errorArgsRange:"Found an error in the formula entered.
    Incorrect arguments range.",errorUnexpectedGuid:"External error.
    Unexpected Guid. Please, contact support.",errorDatabaseConnection:"External error.
    Database connection error. Please, contact support.",errorFileRequest:"External error.
    File Request. Please, contact support.",errorFileVKey:"External error.
    Incorrect securety key. Please, contact support.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:
    opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorOperandExpected:"The entered function syntax is not correct. Please check if you are missing one of the parentheses - '(' or ')'.",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",errorMoveRange:"Cann't change a part of merged cell",errorBadImageUrl:"Image url is incorrect",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",errorLockedAll:"The operation could not be done as the sheet has been locked by another user.",txtEditingMode:"Set editing mode...",textLoadingDocument:"Loading spreadsheet",textConfirm:"Confirmation",confirmMoveCellRange:"The destination cell's range can contain data. Continue the operation?",textYes:"Yes",textNo:"No",textAnonymous:"Anonymous",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",errorAutoFilterDataRange:"The operation could not be done for the selected range of cells.
    Select a uniform data range inside or outside the table and try again.",errorAutoFilterChangeFormatTable:"The operation could not be done for the selected cells as you cannot move a part of the table.
    Select another data range so that the whole table was shifted and try again.",errorAutoFilterHiddenRange:"The operation cannot be performed because the area contains filtered cells.
    Please unhide the filtered elements and try again.",errorAutoFilterChange:"The operation is not allowed, as it is attempting to shift cells in a table on your worksheet.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorFillRange:"Could not fill the selected range of cells.
    All the merged cells need to be the same size.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtArt:"Your text here",errorInvalidRef:"Enter a correct name for the selection or a valid reference to go to.",errorCreateDefName:"The existing named ranges cannot be edited and the new ones cannot be created
    at the moment as some of them are being edited.",errorPasteMaxRange:"The copy and paste area does not match. Please select an area with the same size or click the first cell in a row to paste the copied cells.",errorConnectToServer:' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    Find more information about connecting Document Server here',errorLockedWorksheetRename:"The sheet cannot be renamed at the moment as it is being renamed by another user",textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",errorOpenWarning:"The length of one of the formulas in the file exceeded
    the allowed number of characters and it was removed.",errorFrmlWrongReferences:"The function refers to a sheet that does not exist.
    Please check the data and try again.",textBuyNow:"Visit website",textNoLicenseTitle:"%1 open source version",textContactUs:"Contact sales", confirmPutMergeRange:"The source data contains merged cells.
    They will be unmerged before they are pasted into the table.",errorViewerDisconnect:"Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored.",warnLicenseExp:"Your license has expired.
    Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorCopyMultiselectArea:"This command cannot be used with multiple selections.
    Select a single range and try again.",errorPrintMaxPagesCount:"Unfortunately, it’s not possible to print more than 1500 pages at once in the current version of the program.
    This restriction will be eliminated in upcoming releases.",errorToken:"The document security token is not correctly formed.
    Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.
    Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.
    Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes.",errorLockedCellPivot:"You cannot change data inside a pivot table.",txtAccent:"Accent",txtStyle_Normal:"Normal",txtStyle_Heading_1:"Heading 1",txtStyle_Heading_2:"Heading 2",txtStyle_Heading_3:"Heading 3",txtStyle_Heading_4:"Heading 4",txtStyle_Title:"Title",txtStyle_Neutral:"Neutral",txtStyle_Bad:"Bad",txtStyle_Good:"Good",txtStyle_Input:"Input",txtStyle_Output:"Output",txtStyle_Calculation:"Calculation",txtStyle_Check_Cell:"Check Cell",txtStyle_Explanatory_Text:"Explanatory Text",txtStyle_Note:"Note",txtStyle_Linked_Cell:"Linked Cell",txtStyle_Warning_Text:"Warning Text",txtStyle_Total:"Total",txtStyle_Currency:"Currency",txtStyle_Percent:"Percent",txtStyle_Comma:"Comma",errorForceSave:"An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",errorMaxPoints:"The maximum number of points in series per chart is 4096.",warnNoLicense:"This version of %1 editors has certain limitations for concurrent connections to the document server.
    If you need more please consider purchasing a commercial license.",warnNoLicenseUsers:"This version of %1 Editors has certain limitations for concurrent users.
    If you need more please consider purchasing a commercial license.",warnLicenseExceeded:"The number of concurrent connections to the document server has been exceeded and the document will be opened for viewing only.
    Please contact your administrator for more information.",warnLicenseUsersExceeded:"The number of concurrent users has been exceeded and the document will be opened for viewing only.
    Please contact your administrator for more information.",errorDataEncrypted:"Encrypted changes have been received, they cannot be deciphered.",textClose:"Close",textPaidFeature:"Paid feature",scriptLoadError:"The connection is too slow, some of the components could not be loaded. Please reload the page.",errorEditingSaveas:"An error occurred during the work with the document.
    Use the 'Save as...' option to save the file backup copy to your computer hard drive.",errorEditingDownloadas:"An error occurred during the work with the document.
    Use the 'Download as...' option to save the file backup copy to your computer hard drive.",txtShape_textRect:"Text Box",txtShape_rect:"Rectangle",txtShape_ellipse:"Ellipse",txtShape_triangle:"Triangle",txtShape_rtTriangle:"Right Triangle",txtShape_parallelogram:"Parallelogram",txtShape_trapezoid:"Trapezoid",txtShape_diamond:"Diamond",txtShape_pentagon:"Pentagon",txtShape_hexagon:"Hexagon",txtShape_heptagon:"Heptagon",txtShape_octagon:"Octagon",txtShape_decagon:"Decagon",txtShape_dodecagon:"Dodecagon",txtShape_pie:"Pie",txtShape_chord:"Chord",txtShape_teardrop:"Teardrop",txtShape_frame:"Frame",txtShape_halfFrame:"Half Frame",txtShape_corner:"Corner",txtShape_diagStripe:"Diagonal Stripe",txtShape_plus:"Plus",txtShape_plaque:"Sign",txtShape_can:"Can",txtShape_cube:"Cube",txtShape_bevel:"Bevel",txtShape_donut:"Donut",txtShape_noSmoking:'"No" Symbol',txtShape_blockArc:"Block Arc",txtShape_foldedCorner:"Folded Corner",txtShape_smileyFace:"Smiley Face",txtShape_heart:"Heart",txtShape_lightningBolt:"Lightning Bolt",txtShape_sun:"Sun",txtShape_moon:"Moon",txtShape_cloud:"Cloud",txtShape_arc:"Arc",txtShape_bracePair:"Double Brace",txtShape_leftBracket:"Left Bracket",txtShape_rightBracket:"Right Bracket",txtShape_leftBrace:"Left Brace",txtShape_rightBrace:"Right Brace",txtShape_rightArrow:"Right Arrow",txtShape_leftArrow:"Left Arrow",txtShape_upArrow:"Up Arrow",txtShape_downArrow:"Down Arrow",txtShape_leftRightArrow:"Left Right Arrow",txtShape_upDownArrow:"Up Down Arrow",txtShape_quadArrow:"Quad Arrow",txtShape_leftRightUpArrow:"Left Right Up Arrow",txtShape_bentArrow:"Bent Arrow",txtShape_uturnArrow:"U-Turn Arrow",txtShape_leftUpArrow:"Left Up Arrow",txtShape_bentUpArrow:"Bent Up Arrow",txtShape_curvedRightArrow:"Curved Right Arrow",txtShape_curvedLeftArrow:"Curved Left Arrow",txtShape_curvedUpArrow:"Curved Up Arrow",txtShape_curvedDownArrow:"Curved Down Arrow",txtShape_stripedRightArrow:"Striped Right Arrow",txtShape_notchedRightArrow:"Notched Right Arrow",txtShape_homePlate:"Pentagon",txtShape_chevron:"Chevron",txtShape_rightArrowCallout:"Right Arrow Callout",txtShape_downArrowCallout:"Down Arrow Callout",txtShape_leftArrowCallout:"Left Arrow Callout",txtShape_upArrowCallout:"Up Arrow Callout",txtShape_leftRightArrowCallout:"Left Right Arrow Callout",txtShape_quadArrowCallout:"Quad Arrow Callout",txtShape_circularArrow:"Circular Arrow",txtShape_mathPlus:"Plus",txtShape_mathMinus:"Minus",txtShape_mathMultiply:"Multiply",txtShape_mathDivide:"Division",txtShape_mathEqual:"Equal",txtShape_mathNotEqual:"Not Equal",txtShape_flowChartProcess:"Flowchart: Process",txtShape_flowChartAlternateProcess:"Flowchart: Alternate Process",txtShape_flowChartDecision:"Flowchart: Decision",txtShape_flowChartInputOutput:"Flowchart: Data",txtShape_flowChartPredefinedProcess:"Flowchart: Predefined Process",txtShape_flowChartInternalStorage:"Flowchart: Internal Storage",txtShape_flowChartDocument:"Flowchart: Document",txtShape_flowChartMultidocument:"Flowchart: Multidocument ",txtShape_flowChartTerminator:"Flowchart: Terminator",txtShape_flowChartPreparation:"Flowchart: Preparation",txtShape_flowChartManualInput:"Flowchart: Manual Input",txtShape_flowChartManualOperation:"Flowchart: Manual Operation",txtShape_flowChartConnector:"Flowchart: Connector",txtShape_flowChartOffpageConnector:"Flowchart: Off-page Connector",txtShape_flowChartPunchedCard:"Flowchart: Card",txtShape_flowChartPunchedTape:"Flowchart: Punched Tape",txtShape_flowChartSummingJunction:"Flowchart: Summing Junction",txtShape_flowChartOr:"Flowchart: Or",txtShape_flowChartCollate:"Flowchart: Collate",txtShape_flowChartSort:"Flowchart: Sort",txtShape_flowChartExtract:"Flowchart: Extract",txtShape_flowChartMerge:"Flowchart: Merge",txtShape_flowChartOnlineStorage:"Flowchart: Stored Data",txtShape_flowChartDelay:"Flowchart: Delay",txtShape_flowChartMagneticTape:"Flowchart: Sequential Access Storage",txtShape_flowChartMagneticDisk:"Flowchart: Magnetic Disk",txtShape_flowChartMagneticDrum:"Flowchart: Direct Access Storage",txtShape_flowChartDisplay:"Flowchart: Display",txtShape_irregularSeal1:"Explosion 1",txtShape_irregularSeal2:"Explosion 2",txtShape_star4:"4-Point Star",txtShape_star5:"5-Point Star",txtShape_star6:"6-Point Star",txtShape_star7:"7-Point Star",txtShape_star8:"8-Point Star",txtShape_star10:"10-Point Star",txtShape_star12:"12-Point Star",txtShape_star16:"16-Point Star",txtShape_star24:"24-Point Star",txtShape_star32:"32-Point Star",txtShape_ribbon2:"Up Ribbon",txtShape_ribbon:"Down Ribbon",txtShape_ellipseRibbon2:"Curved Up Ribbon",txtShape_ellipseRibbon:"Curved Down Ribbon",txtShape_verticalScroll:"Vertical Scroll",txtShape_horizontalScroll:"Horizontal Scroll",txtShape_wave:"Wave",txtShape_doubleWave:"Double Wave",txtShape_wedgeRectCallout:"Rectangular Callout",txtShape_wedgeRoundRectCallout:"Rounded Rectangular Callout",txtShape_wedgeEllipseCallout:"Oval Callout",txtShape_cloudCallout:"Cloud Callout",txtShape_borderCallout1:"Line Callout 1",txtShape_borderCallout2:"Line Callout 2",txtShape_borderCallout3:"Line Callout 3",txtShape_accentCallout1:"Line Callout 1 (Accent Bar)",txtShape_accentCallout2:"Line Callout 2 (Accent Bar)",txtShape_accentCallout3:"Line Callout 3 (Accent Bar)",txtShape_callout1:"Line Callout 1 (No Border)",txtShape_callout2:"Line Callout 2 (No Border)",txtShape_callout3:"Line Callout 3 (No Border)",txtShape_accentBorderCallout1:"Line Callout 1 (Border and Accent Bar)",txtShape_accentBorderCallout2:"Line Callout 2 (Border and Accent Bar)",txtShape_accentBorderCallout3:"Line Callout 3 (Border and Accent Bar)",txtShape_actionButtonBackPrevious:"Back or Previous Button",txtShape_actionButtonForwardNext:"Forward or Next Button",txtShape_actionButtonBeginning:"Beginning Button",txtShape_actionButtonEnd:"End Button",txtShape_actionButtonHome:"Home Button",txtShape_actionButtonInformation:"Information Button",txtShape_actionButtonReturn:"Return Button",txtShape_actionButtonMovie:"Movie Button",txtShape_actionButtonDocument:"Document Button",txtShape_actionButtonSound:"Sound Button",txtShape_actionButtonHelp:"Help Button",txtShape_actionButtonBlank:"Blank Button",txtShape_roundRect:"Round Corner Rectangle",txtShape_snip1Rect:"Snip Single Corner Rectangle",txtShape_snip2SameRect:"Snip Same Side Corner Rectangle",txtShape_snip2DiagRect:"Snip Diagonal Corner Rectangle",txtShape_snipRoundRect:"Snip and Round Single Corner Rectangle",txtShape_round1Rect:"Round Single Corner Rectangle",txtShape_round2SameRect:"Round Same Side Corner Rectangle",txtShape_round2DiagRect:"Round Diagonal Corner Rectangle",txtShape_line:"Line",txtShape_lineWithArrow:"Arrow",txtShape_lineWithTwoArrows:"Double Arrow",txtShape_bentConnector5:"Elbow Connector",txtShape_bentConnector5WithArrow:"Elbow Arrow Connector",txtShape_bentConnector5WithTwoArrows:"Elbow Double-Arrow Connector",txtShape_curvedConnector3:"Curved Connector",txtShape_curvedConnector3WithArrow:"Curved Arrow Connector",txtShape_curvedConnector3WithTwoArrows:"Curved Double-Arrow Connector",txtShape_spline:"Curve",txtShape_polyline1:"Scribble",txtShape_polyline2:"Freeform",errorChangeArray:"You cannot change part of an array.",errorMultiCellFormula:"Multi-cell array formulas are not allowed in tables.",errorEmailClient:"No email client could be found",txtPrintArea:"Print_Area",txtTable:"Table",textCustomLoader:"Please note that according to the terms of the license you are not entitled to change the loader.
    Please contact our Sales Department to get a quote.",errorNoDataToParse:"No data was selected to parse.",errorCannotUngroup:"Cannot ungroup. To start an outline, select the detail rows or columns and group them.",errorFrmlMaxTextLength:"Text values in formulas are limited to 255 characters.
    Use the CONCATENATE function or concatenation operator (&)",waitText:"Please, wait...",errorDataValidate:"The value you entered is not valid.
    A user has restricted values that can be entered into this cell.",txtConfidential:"Confidential",txtPreparedBy:"Prepared by",txtPage:"Page",txtPageOf:"Page %1 of %2",txtPages:"Pages",txtDate:"Date",txtTime:"Time",txtTab:"Tab",txtFile:"File"}}(),SSE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:600,height:536,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.settingsurl=t.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=500,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.settingsurl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(t.needUpdate&&this.trigger("accessrights",this,t.sharingSettings),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("spreadsheeteditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog"],function(){"use strict";!SSE.Views.FileMenuPanels&&(SSE.Views.FileMenuPanels={}),SSE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:void 0,formats:[[{name:"XLSX",imgCls:"xlsx",type:Asc.c_oAscFileType.XLSX},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"ODS",imgCls:"ods",type:Asc.c_oAscFileType.ODS},{name:"CSV",imgCls:"csv",type:Asc.c_oAscFileType.CSV}],[{name:"XLTX",imgCls:"xltx",type:Asc.c_oAscFileType.XLTX},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA},{name:"OTS",imgCls:"ots",type:Asc.c_oAscFileType.OTS}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onFormatClick:function(t){var e=t.currentTarget.attributes.format;!_.isUndefined(e)&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,parseInt(e.value)])}}),SSE.Views.FileMenuPanels.ViewSaveCopy=Common.UI.BaseView.extend({el:"#panel-savecopy",menu:void 0,formats:[[{name:"XLSX",imgCls:"xlsx",type:Asc.c_oAscFileType.XLSX,ext:".xlsx"},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF,ext:".pdf"},{name:"ODS",imgCls:"ods",type:Asc.c_oAscFileType.ODS,ext:".ods"},{name:"CSV",imgCls:"csv",type:Asc.c_oAscFileType.CSV,ext:".csv"}],[{name:"XLTX",imgCls:"xltx",type:Asc.c_oAscFileType.XLTX,ext:".xltx"},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA,ext:".pdf"},{name:"OTS",imgCls:"ots",type:Asc.c_oAscFileType.OTS,ext:".ots"}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onFormatClick:function(t){var e=t.currentTarget.attributes.format,i=t.currentTarget.attributes["format-ext"];_.isUndefined(e)||_.isUndefined(i)||!this.menu||this.menu.fireEvent("savecopy:format",[this.menu,parseInt(e.value),i.value])}}),SSE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:void 0,template:_.template(['
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.generalSettings=new SSE.Views.FileMenuPanels.MainSettingsGeneral({menu:this.menu}),this.generalSettings.options={alias:"MainSettingsGeneral"},this.generalSettings.render(),this.printSettings=SSE.getController("Print").getView("MainSettingsPrint"),this.printSettings.menu=this.menu,this.printSettings.render($("#panel-settings-print")),this.viewSettingsPicker=new Common.UI.DataView({el:$("#id-settings-menu"),store:new Common.UI.DataViewStore([{name:this.txtGeneral,panel:this.generalSettings,iconCls:"mnu-settings-general",selected:!0},{name:this.txtPageSettings,panel:this.printSettings,iconCls:"mnu-print"}]),itemTemplate:_.template(['
    ','
    ',"
    <%= name %>","
    "].join(""))}),this.viewSettingsPicker.on("item:select",_.bind(function(t,e,i){var n=i.get("panel");$("#id-settings-content > div").removeClass("active"),n.$el.addClass("active"),n.show()},this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments);var t=this.viewSettingsPicker.getSelectedRec();t&&t.get("panel").show()},setMode:function(t){this.mode=t,this.mode.canPrint||this.viewSettingsPicker.store.pop(),this.generalSettings&&this.generalSettings.setMode(this.mode)},setApi:function(t){this.generalSettings&&this.generalSettings.setApi(t)},txtGeneral:"General",txtPageSettings:"Page Settings"},SSE.Views.FileMenuPanels.Settings||{})),SSE.Views.MainSettingsPrint=Common.UI.BaseView.extend(_.extend({menu:void 0,template:_.template(['',"",'','',"",'','',"",'','',"",'',"",'','',"",'',"",'','',"",'',"",'','","",'',"",'','","",'','',"",'','',"","
    ','',"","","","","",'','',"","","","","","",'','',"","
    ","
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.spinners=[],this._initSettings=!0},render:function(t){return t&&this.setElement(t,!1),$(this.el).html(this.template({scope:this})),this.cmbSheet=new Common.UI.ComboBox({el:$("#advsettings-print-combo-sheets"),style:"width: 242px;",menuStyle:"min-width: 242px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.cmbPaperSize=new Common.UI.ComboBox({el:$("#advsettings-print-combo-pages"),style:"width: 242px;",menuStyle:"max-height: 280px; min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:"215.9|279.4",displayValue:"US Letter (21,59cm x 27,94cm)",caption:"US Letter"},{value:"215.9|355.6",displayValue:"US Legal (21,59cm x 35,56cm)",caption:"US Legal"},{value:"210|297",displayValue:"A4 (21cm x 29,7cm)",caption:"A4"},{value:"148|210",displayValue:"A5 (14,8cm x 21cm)",caption:"A5"},{value:"176|250",displayValue:"B5 (17,6cm x 25cm)",caption:"B5"},{value:"104.8|241.3",displayValue:"Envelope #10 (10,48cm x 24,13cm)",caption:"Envelope #10"},{value:"110|220",displayValue:"Envelope DL (11cm x 22cm)",caption:"Envelope DL"},{value:"279.4|431.8",displayValue:"Tabloid (27,94cm x 43,178m)",caption:"Tabloid"},{value:"297|420",displayValue:"A3 (29,7cm x 42cm)",caption:"A3"},{value:"304.8|457.1",displayValue:"Tabloid Oversize (30,48cm x 45,71cm)",caption:"Tabloid Oversize"},{value:"196.8|273",displayValue:"ROC 16K (19,68cm x 27,3cm)",caption:"ROC 16K"},{value:"119.9|234.9",displayValue:"Envelope Choukei 3 (11,99cm x 23,49cm)",caption:"Envelope Choukei 3"},{value:"330.2|482.5",displayValue:"Super B/A3 (33,02cm x 48,25cm)",caption:"Super B/A3"}]}),this.cmbPaperOrientation=new Common.UI.ComboBox({el:$("#advsettings-print-combo-orient"),style:"width: 132px;",menuStyle:"min-width: 132px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPageOrientation.PagePortrait,displayValue:this.strPortrait},{value:Asc.c_oAscPageOrientation.PageLandscape,displayValue:this.strLandscape}]}),this.cmbLayout=new Common.UI.ComboBox({el:$("#advsettings-print-combo-layout"),style:"width: 242px;",menuStyle:"min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textActualSize},{value:1,displayValue:this.textFitPage},{value:2,displayValue:this.textFitCols},{value:3,displayValue:this.textFitRows}]}),this.chPrintGrid=new Common.UI.CheckBox({el:$("#advsettings-print-chb-grid"),labelText:this.textPrintGrid}),this.chPrintRows=new Common.UI.CheckBox({el:$("#advsettings-print-chb-rows"),labelText:this.textPrintHeadings}),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-top"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-bottom"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-left"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-right"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginRight),this.btnOk=new Common.UI.Button({el:"#advsettings-print-button-save"}),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.fireEvent("render:after",this),this},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','','','
    ',"",'','','','
    ',"",'','','','',"",'','','','',"",'',"",'','
    ',"",'','','','','
    ','
    ',"",'',"",'','
    ',"",'',"",'','',"",'','','','',"",'','','','','
    ','
    ',"",'','','','','
    ','
    ',"",'',"",'','',"",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){$(this.el).html(this.template({scope:this})),this.chLiveComment=new Common.UI.CheckBox({el:$("#fms-chb-live-comment"),labelText:this.strLiveComment}).on("change",_.bind(function(t,e,i,n){this.chResolvedComment.setDisabled("checked"!==t.getValue())},this)),this.chResolvedComment=new Common.UI.CheckBox({el:$("#fms-chb-resolved-comment"),labelText:this.strResolvedComment}),this.chR1C1Style=new Common.UI.CheckBox({el:$("#fms-chb-r1c1-style"),labelText:this.strR1C1}),this.cmbCoAuthMode=new Common.UI.ComboBox({el:$("#fms-cmb-coauth-mode"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:1,displayValue:this.strFast,descValue:this.strCoAuthModeDescFast},{value:0,displayValue:this.strStrict,descValue:this.strCoAuthModeDescStrict}]}).on("selected",_.bind(function(t,e){1==e.value&&"checked"!==this.chAutosave.getValue()&&this.chAutosave.setValue(1),this.lblCoAuthMode.text(e.descValue)},this)),this.lblCoAuthMode=$("#fms-lbl-coauth-mode"),this.cmbZoom=new Common.UI.ComboBox({el:$("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 210px;",data:[{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90,displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbFontRender=new Common.UI.ComboBox({el:$("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling,displayValue:this.txtWin},{value:Asc.c_oAscFontRenderingModeType.noHinting,displayValue:this.txtMac},{value:Asc.c_oAscFontRenderingModeType.hinting,displayValue:this.txtNative}]}),this.chAutosave=new Common.UI.CheckBox({el:$("#fms-chb-autosave"),labelText:this.strAutosave}).on("change",_.bind(function(t,e,i,n){"checked"!==t.getValue()&&this.cmbCoAuthMode.getValue()&&(this.cmbCoAuthMode.setValue(0),this.lblCoAuthMode.text(this.strCoAuthModeDescStrict))},this)),this.lblAutosave=$("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:$("#fms-chb-forcesave"),labelText:this.strForcesave}),this.cmbUnit=new Common.UI.ComboBox({el:$("#fms-cmb-unit"), style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.cmbFuncLocale=new Common.UI.ComboBox({el:$("#fms-cmb-func-locale"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:"en",displayValue:this.txtEn,exampleValue:this.txtExampleEn},{value:"de",displayValue:this.txtDe,exampleValue:this.txtExampleDe},{value:"es",displayValue:this.txtEs,exampleValue:this.txtExampleEs},{value:"fr",displayValue:this.txtFr,exampleValue:this.txtExampleFr},{value:"it",displayValue:this.txtIt,exampleValue:this.txtExampleIt},{value:"ru",displayValue:this.txtRu,exampleValue:this.txtExampleRu},{value:"pl",displayValue:this.txtPl,exampleValue:this.txtExamplePl}]}).on("selected",_.bind(function(t,e){this.updateFuncExample(e.exampleValue)},this));var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];return t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbRegSettings=new Common.UI.ComboBox({el:$("#fms-cmb-reg-settings"),style:"width: 160px;",menuStyle:"max-height: 185px;",editable:!1,cls:"input-group-nr",data:t,template:_.template(['','','','','",""].join(""))}).on("selected",_.bind(function(t,e){this.updateRegionalExample(e.value)},this)),this.cmbRegSettings.scroller&&this.cmbRegSettings.scroller.update({alwaysVisibleY:!0}),this.btnApply=new Common.UI.Button({el:"#fms-btn-apply"}),this.btnApply.on("click",_.bind(this.applySettings,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings()},setMode:function(t){this.mode=t,$("tr.edit",this.el)[t.isEdit?"show":"hide"](),$("tr.autosave",this.el)[t.isEdit?"show":"hide"](),this.mode.isDesktopApp&&this.mode.isOffline&&(this.chAutosave.setCaption(this.strAutoRecover),this.lblAutosave.text(this.textAutoRecover)),$("tr.forcesave",this.el)[t.canForcesave?"show":"hide"](),$("tr.comments",this.el)[t.canCoAuthoring?"show":"hide"](),$("tr.coauth.changes",this.el)[t.isEdit&&!t.isOffline&&t.canCoAuthoring?"show":"hide"]()},setApi:function(t){this.api=t},updateSettings:function(){var t=Common.Utils.InternalSettings.get("sse-settings-zoom");t=null!==t?parseInt(t):this.mode.customization&&this.mode.customization.zoom?parseInt(this.mode.customization.zoom):100;var e=this.cmbZoom.store.findWhere({value:t});this.cmbZoom.setValue(e?parseInt(e.get("value")):t>0?t+"%":100),this.chLiveComment.setValue(Common.Utils.InternalSettings.get("sse-settings-livecomment")),this.chResolvedComment.setValue(Common.Utils.InternalSettings.get("sse-settings-resolvedcomment")),this.chR1C1Style.setValue(Common.Utils.InternalSettings.get("sse-settings-r1c1"));var i=Common.Utils.InternalSettings.get("sse-settings-coauthmode");e=this.cmbCoAuthMode.store.findWhere({value:i?1:0}),this.cmbCoAuthMode.setValue(e?e.get("value"):1),this.lblCoAuthMode.text(e?e.get("descValue"):this.strCoAuthModeDescFast),t=Common.Utils.InternalSettings.get("sse-settings-fontrender"),e=this.cmbFontRender.store.findWhere({value:parseInt(t)}),this.cmbFontRender.setValue(e?e.get("value"):window.devicePixelRatio>1?Asc.c_oAscFontRenderingModeType.noHinting:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling),t=Common.Utils.InternalSettings.get("sse-settings-unit"),e=this.cmbUnit.store.findWhere({value:t}),this.cmbUnit.setValue(e?parseInt(e.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),t=Common.Utils.InternalSettings.get("sse-settings-autosave"),this.chAutosave.setValue(1==t),this.mode.canForcesave&&this.chForcesave.setValue(Common.Utils.InternalSettings.get("sse-settings-forcesave")),t=Common.Utils.InternalSettings.get("sse-settings-func-locale"),e=this.cmbFuncLocale.store.findWhere({value:t}),!e&&t&&(e=this.cmbFuncLocale.store.findWhere({value:t.split(/[\-\_]/)[0]})),this.cmbFuncLocale.setValue(e?e.get("value"):"en"),this.updateFuncExample(e?e.get("exampleValue"):this.txtExampleEn),t=this.api.asc_getLocale(),t?(e=this.cmbRegSettings.store.findWhere({value:t}),this.cmbRegSettings.setValue(e?e.get("value"):Common.util.LanguageInfo.getLocalLanguageName(t)[1]),e&&(t=this.cmbRegSettings.getValue())):(t=this.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)):1033,this.cmbRegSettings.setValue(Common.util.LanguageInfo.getLocalLanguageName(t)[1])),this.updateRegionalExample(t)},applySettings:function(){Common.localStorage.setItem("sse-settings-zoom",this.cmbZoom.getValue()),Common.Utils.InternalSettings.set("sse-settings-zoom",Common.localStorage.getItem("sse-settings-zoom")),Common.localStorage.setItem("sse-settings-livecomment",this.chLiveComment.isChecked()?1:0),Common.localStorage.setItem("sse-settings-resolvedcomment",this.chResolvedComment.isChecked()?1:0),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("sse-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("sse-settings-r1c1",this.chR1C1Style.isChecked()?1:0),Common.localStorage.setItem("sse-settings-fontrender",this.cmbFontRender.getValue()),Common.localStorage.setItem("sse-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("sse-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("sse-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.localStorage.setItem("sse-settings-func-locale",this.cmbFuncLocale.getValue()),this.cmbRegSettings.getSelectedRecord()&&Common.localStorage.setItem("sse-settings-reg-settings",this.cmbRegSettings.getValue()),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},updateRegionalExample:function(t){if(this.api){var e="";if(t){var i=new Asc.asc_CFormatCellsInfo;i.asc_setType(Asc.c_oAscNumFormatType.None),i.asc_setSymbol(t);var n=this.api.asc_getFormatCells(i);e=this.api.asc_getLocaleExample(n[4],1000.01,t),e=e+" "+this.api.asc_getLocaleExample(n[5],Asc.cDate().getExcelDateWithTime(),t),e=e+" "+this.api.asc_getLocaleExample(n[6],Asc.cDate().getExcelDateWithTime(),t)}$("#fms-lbl-reg-settings").text(_.isEmpty(e)?"":this.strRegSettingsEx+e)}var o=this.cmbRegSettings.$el.find(".input-icon"),s=o.attr("lang"),a=Common.util.LanguageInfo.getLocalLanguageName(t)[0];s&&o.removeClass(s),o.addClass(a).attr("lang",a)},updateFuncExample:function(t){$("#fms-lbl-func-locale").text(_.isEmpty(t)?"":this.strRegSettingsEx+t)},strLiveComment:"Turn on option",strZoom:"Default Zoom Value",okButtonText:"Apply",txtLiveComment:"Live Commenting",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",strAutosave:"Turn on autosave",textAutoSave:"Autosave",txtEn:"English",txtDe:"Deutsch",txtRu:"Russian",txtPl:"Polish",txtEs:"Spanish",txtFr:"French",txtIt:"Italian",txtExampleEn:" SUM; MIN; MAX; COUNT",txtExampleDe:" SUMME; MIN; MAX; ANZAHL",txtExampleRu:" СУММ; МИН; МАКС; СЧЁТ",txtExamplePl:" SUMA; MIN; MAX; ILE.LICZB",txtExampleEs:" SUMA; MIN; MAX; CALCULAR",txtExampleFr:" SOMME; MIN; MAX; NB",txtExampleIt:" SOMMA; MIN; MAX; CONTA.NUMERI",strFuncLocale:"Formula Language",strFuncLocaleEx:"Example: SUM; MIN; MAX; COUNT",strRegSettings:"Regional Settings",strRegSettingsEx:"Example: ",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)",strResolvedComment:"Turn on display of the resolved comments",textRefStyle:"Reference Style",strR1C1:"Turn on R1C1 style"},SSE.Views.FileMenuPanels.MainSettingsGeneral||{})),SSE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:void 0,template:_.template(['
    '].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.recent=t.recent},render:function(){return $(this.el).html(this.template()),this.viewRecentPicker=new Common.UI.DataView({el:$("#id-recent-view"),store:new Common.UI.DataViewStore(this.recent),itemTemplate:_.template(['
    ','
    ','
    <%= Common.Utils.String.htmlEncode(title) %>
    ','
    <%= Common.Utils.String.htmlEncode(folder) %>
    ',"
    "].join(""))}),this.viewRecentPicker.on("item:click",_.bind(this.onRecentFileClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onRecentFileClick:function(t,e,i){this.menu&&this.menu.fireEvent("recent:open",[this.menu,i.get("url")])}}),SSE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:void 0,events:function(){return{"click .blank-document-btn":_.bind(this._onBlankDocument,this),"click .thumb-list .thumb-wrap":_.bind(this._onDocumentTemplate,this)}},template:_.template(['

    <%= scope.fromBlankText %>


    ','
    ','
    ','','',"","
    ",'
    ',"

    <%= scope.newDocumentText %>

    ","<%= scope.newDescriptionText %>","
    ","
    ","

    <%= scope.fromTemplateText %>


    ",'
    ',"<% _.each(docs, function(item) { %>",'
    ','
    \") } else { print(\">\") } %>","
    ",'
    <%= item.name %>
    ',"
    ","<% }) %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({scope:this,docs:this.options[0].docs})),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},_onBlankDocument:function(){this.menu&&this.menu.fireEvent("create:new",[this.menu,"blank"])},_onDocumentTemplate:function(t){this.menu&&this.menu.fireEvent("create:new",[this.menu,t.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Spreadsheet",newDescriptionText:"Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template"},SSE.Views.FileMenuPanels.CreateNew||{})),SSE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'","","
    ',"","",'',"","
    ","
    "].join("")),this.menu=t.menu,this.coreProps=null,this.authors=[],this._locked=!1},render:function(){$(this.el).html(this.template());var t=this;this.lblPlacement=$("#id-info-placement"),this.lblOwner=$("#id-info-owner"),this.lblUploaded=$("#id-info-uploaded");var e=function(t,e){if(e.keyCode===Common.UI.Keys.ESC){var i=t._input.val(),n=t.getValue();i!==n&&(t.setValue(n),e.stopPropagation())}};return this.inputTitle=new Common.UI.InputField({el:$("#id-info-title"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putTitle(t.inputTitle.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.inputSubject=new Common.UI.InputField({el:$("#id-info-subject"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putSubject(t.inputSubject.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.inputComment=new Common.UI.InputField({el:$("#id-info-comment"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putDescription(t.inputComment.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.lblModifyDate=$("#id-info-modify-date"),this.lblModifyBy=$("#id-info-modify-by"),this.lblDate=$("#id-info-date"),this.lblApplication=$("#id-info-appname"),this.tblAuthor=$("#id-info-author table"),this.trAuthor=$("#id-info-add-author").closest("tr"),this.authorTpl='
    ',this.tblAuthor.on("click",function(e){var i=$(e.target);if(i.hasClass("close")&&!i.hasClass("disabled")){var n=i.closest("tr"),o=t.tblAuthor.find("tr").index(n);n.remove(),t.authors.splice(o,1),t.coreProps&&t.api&&(t.coreProps.asc_putCreator(t.authors.join(";")),t.api.asc_setCoreProps(t.coreProps))}}),this.inputAuthor=new Common.UI.InputField({el:$("#id-info-add-author"),style:"width: 200px;",validateOnBlur:!1,placeHolder:this.txtAddAuthor}).on("changed:after",function(e,i,n){if(i!=n){var o=i.trim();o&&o!==n.trim()&&(o.split(/\s*[,;]\s*/).forEach(function(e){var i=e.trim();if(i){var n=$(Common.Utils.String.format(t.authorTpl,Common.Utils.String.htmlEncode(i)));t.trAuthor.before(n),t.authors.push(e)}}),t.inputAuthor.setValue(""),t.coreProps&&t.api&&(t.coreProps.asc_putCreator(t.authors.join(";")),t.api.asc_setCoreProps(t.coreProps)))}}).on("keydown:before",e),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateFileInfo()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){if(!this.doc&&t&&t.info&&(t.info.author&&console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead."),t.info.created&&console.log("Obsolete: The 'created' parameter of the document 'info' section is deprecated. Please use 'uploaded' instead.")),this.doc=t,this.rendered){var e=!1;if(t=t||{},t.info){t.info.folder&&this.lblPlacement.text(t.info.folder),e=this._ShowHideInfoItem(this.lblPlacement,void 0!==t.info.folder&&null!==t.info.folder)||e;var i=t.info.owner||t.info.author;i&&this.lblOwner.text(i),e=this._ShowHideInfoItem(this.lblOwner,!!i)||e,i=t.info.uploaded||t.info.created,i&&this.lblUploaded.text(i),e=this._ShowHideInfoItem(this.lblUploaded,!!i)||e}else this._ShowHideDocInfo(!1);$("tr.divider.general",this.el)[e?"show":"hide"]();var n=this.api?this.api.asc_getAppProps():null;if(n&&(n=(n.asc_getApplication()||"")+" "+(n.asc_getAppVersion()||""),this.lblApplication.text(n)),this._ShowHideInfoItem(this.lblApplication,!!n),this.coreProps=this.api?this.api.asc_getCoreProps():null,this.coreProps){var i=this.coreProps.asc_getCreated();i&&this.lblDate.text(i.toLocaleString()),this._ShowHideInfoItem(this.lblDate,!!i)}}},updateFileInfo:function(){if(this.rendered){var t,e=this,i=this.api?this.api.asc_getCoreProps():null;if(this.coreProps=i,i){var n=!1;t=i.asc_getModified(),t&&this.lblModifyDate.text(t.toLocaleString()),n=this._ShowHideInfoItem(this.lblModifyDate,!!t)||n,t=i.asc_getLastModifiedBy(),t&&this.lblModifyBy.text(t),n=this._ShowHideInfoItem(this.lblModifyBy,!!t)||n,$("tr.divider.modify",this.el)[n?"show":"hide"](),t=i.asc_getTitle(),this.inputTitle.setValue(t||""),t=i.asc_getSubject(),this.inputSubject.setValue(t||""),t=i.asc_getDescription(),this.inputComment.setValue(t||""),this.tblAuthor.find("tr:not(:last-of-type)").remove(),this.authors=[],t=i.asc_getCreator(),t&&t.split(/\s*[,;]\s*/).forEach(function(t){var i=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(t)));e.trAuthor.before(i),e.authors.push(t)}),this.tblAuthor.find(".close").toggleClass("hidden",!this.mode.isEdit)}this.SetDisabled()}},_ShowHideInfoItem:function(t,e){return t.closest("tr")[e?"show":"hide"](),e},_ShowHideDocInfo:function(t){this._ShowHideInfoItem(this.lblPlacement,t),this._ShowHideInfoItem(this.lblOwner,t),this._ShowHideInfoItem(this.lblUploaded,t)},setMode:function(t){return this.mode=t,this.inputAuthor.setVisible(t.isEdit),this.tblAuthor.find(".close").toggleClass("hidden",!t.isEdit),this.SetDisabled(),this},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onLockCore",_.bind(this.onLockCore,this)),this.updateInfo(this.doc),this},onLockCore:function(t){this._locked=t,this.updateFileInfo()},SetDisabled:function(){var t=!this.mode.isEdit||this._locked;this.inputTitle.setDisabled(t),this.inputSubject.setDisabled(t),this.inputComment.setDisabled(t),this.inputAuthor.setDisabled(t),this.tblAuthor.find(".close").toggleClass("disabled",this._locked),this.tblAuthor.toggleClass("disabled",t)},txtPlacement:"Location",txtOwner:"Owner",txtUploaded:"Uploaded",txtAppName:"Application",txtTitle:"Title",txtSubject:"Subject",txtComment:"Comment",txtModifyDate:"Last Modified",txtModifyBy:"Last Modified By",txtCreated:"Created",txtAuthor:"Author",txtAddAuthor:"Add Author",txtAddText:"Add Text",txtMinutes:"min"},SSE.Views.FileMenuPanels.DocumentInfo||{})),SSE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['','','",'',"",'','","","
    "].join("")),this.templateRights=_.template(["","<% _.each(users, function(item) { %>","",'',"","","<% }); %>","
    <%= Common.Utils.String.htmlEncode(item.user) %><%= Common.Utils.String.htmlEncode(item.permissions) %>
    "].join("")),this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.cntRights=$("#id-info-rights"),this.btnEditRights=new Common.UI.Button({el:"#id-info-btn-edit"}),this.btnEditRights.on("click",_.bind(this.changeAccessRights,this)),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),Common.NotificationCenter.on("collaboration:sharing",_.bind(this.changeAccessRights,this)),Common.NotificationCenter.on("collaboration:sharingdeny",_.bind(this.onLostEditRights,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},t.info?(t.info.sharingSettings&&this.cntRights.html(this.templateRights({users:t.info.sharingSettings})),this._ShowHideInfoItem("rights",void 0!==t.info.sharingSettings&&null!==t.info.sharingSettings&&t.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&!0!==this._readonlyRights)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("rights",t),this._ShowHideInfoItem("edit-rights",t)},setMode:function(t){return this.sharingSettingsUrl=t.sharingSettingsUrl,!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&Common.Gateway.on("showsharingsettings",_.bind(this.changeAccessRights,this)),!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&Common.Gateway.on("setsharingsettings",_.bind(this.setSharingSettings,this)),this},changeAccessRights:function(t,e,i){if(!this._docAccessDlg&&!this._readonlyRights){var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.updateSharingSettings(e)}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},setSharingSettings:function(t){t&&this.updateSharingSettings(t.sharingSettings)},updateSharingSettings:function(t){this.doc.info.sharingSettings=t,this._ShowHideInfoItem("rights",void 0!==this.doc.info.sharingSettings&&null!==this.doc.info.sharingSettings&&this.doc.info.sharingSettings.length>0),this.cntRights.html(this.templateRights({users:this.doc.info.sharingSettings})),Common.NotificationCenter.trigger("mentions:clearusers",this)},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},SSE.Views.FileMenuPanels.DocumentRights||{})),SSE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:void 0,template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"ProgramInterface/ProgramInterface.htm",name:"Introducing Spreadsheet Editor user interface",headername:"Program Interface"},{src:"ProgramInterface/FileTab.htm",name:"File tab"},{src:"ProgramInterface/HomeTab.htm",name:"Home Tab"},{src:"ProgramInterface/InsertTab.htm",name:"Insert tab"},{src:"ProgramInterface/PluginsTab.htm",name:"Plugins tab"},{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new spreadsheet or open an existing one",headername:"Basic operations"},{src:"UsageInstructions/CopyPasteData.htm",name:"Cut/copy/paste data"},{src:"UsageInstructions/UndoRedo.htm",name:"Undo/redo your actions"},{src:"UsageInstructions/ManageSheets.htm",name:"Manage sheets",headername:"Operations with sheets"},{src:"UsageInstructions/FontTypeSizeStyle.htm",name:"Set font type, size, style, and colors",headername:"Cell text formatting"},{src:"UsageInstructions/AddHyperlinks.htm",name:"Add hyperlinks"},{src:"UsageInstructions/ClearFormatting.htm",name:"Clear text, format in a cell, copy cell format"},{src:"UsageInstructions/AddBorders.htm",name:"Add borders",headername:"Editing cell properties"},{src:"UsageInstructions/AlignText.htm",name:"Align data in cells"},{src:"UsageInstructions/MergeCells.htm",name:"Merge cells"},{src:"UsageInstructions/ChangeNumberFormat.htm",name:"Change number format"},{src:"UsageInstructions/InsertDeleteCells.htm",name:"Manage cells, rows, and columns",headername:"Editing rows/columns"},{src:"UsageInstructions/SortData.htm",name:"Sort and filter data"},{src:"UsageInstructions/InsertFunction.htm",name:"Insert function",headername:"Work with functions"},{src:"UsageInstructions/UseNamedRanges.htm",name:"Use named ranges"},{src:"UsageInstructions/InsertImages.htm",name:"Insert images",headername:"Operations on objects"},{src:"UsageInstructions/InsertChart.htm",name:"Insert chart"},{src:"UsageInstructions/InsertAutoshapes.htm",name:"Insert and format autoshapes"},{src:"UsageInstructions/InsertTextObjects.htm",name:"Insert text objects"},{src:"UsageInstructions/ManipulateObjects.htm",name:"Manipulate objects"},{src:"UsageInstructions/InsertEquation.htm",name:"Insert equations",headername:"Math equations"},{src:"HelpfulHints/CollaborativeEditing.htm",name:"Collaborative spreadsheet editing",headername:"Spreadsheet co-editing"},{src:"UsageInstructions/ViewDocInfo.htm",name:"View file information",headername:"Tools and settings"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your spreadsheet"},{src:"HelpfulHints/AdvancedSettings.htm",name:"Advanced settings of Spreadsheet Editor"},{src:"HelpfulHints/Navigation.htm",name:"View settings and navigation tools"},{src:"HelpfulHints/Search.htm",name:"Search and replace functions"},{src:"HelpfulHints/About.htm",name:"About Spreadsheet Editor",headername:"Helpful hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported formats of spreadsheets"},{src:"HelpfulHints/KeyboardShortcuts.htm",name:"Keyboard shortcuts"}],Common.Utils.isIE&&(window.onhelp=function(){return!1})},render:function(){var t=this;return $(this.el).html(this.template()),this.viewHelpPicker=new Common.UI.DataView({el:$("#id-help-contents"),store:new Common.UI.DataViewStore([]),keyMoveDirection:"vertical",itemTemplate:_.template(['
    ','
    <%= name %>
    ',"
    "].join(""))}),this.viewHelpPicker.on("item:add",function(t,e,i){i.has("headername")&&$(e.el).before('
    '+i.get("headername")+"
    ")}),this.viewHelpPicker.on("item:select",function(e,i,n){t.iFrame.src=t.urlPref+n.get("src")}),this.iFrame=document.createElement("iframe"),this.iFrame.src="",this.iFrame.align="top",this.iFrame.frameBorder="0",this.iFrame.width="100%",this.iFrame.height="100%",Common.Gateway.on("internalcommand",function(e){if("help:hyperlink"==e.type){var i=e.data,n=t.viewHelpPicker.store.find(function(t){return i.indexOf(t.get("src"))>0});n&&(t.viewHelpPicker.selectRecord(n,!0),t.viewHelpPicker.scrollToRecord(n))}}),$("#id-help-frame").append(this.iFrame),this},setLangConfig:function(t){var e=this,i=this.viewHelpPicker.store;if(t){t=t.split(/[\-\_]/)[0];var n={dataType:"json",error:function(){e.urlPref.indexOf("resources/help/en/")<0?(e.urlPref="resources/help/en/",i.url="resources/help/en/Contents.json",i.fetch(n)):(e.urlPref="resources/help/en/",i.reset(e.en_data))},success:function(){var t=i.at(0);e.viewHelpPicker.selectRecord(t),e.iFrame.src=e.urlPref+t.get("src")}};i.url="resources/help/"+t+"/Contents.json",i.fetch(n),this.urlPref="resources/help/"+t+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}}),SSE.Views.FileMenuPanels.ProtectDoc=Common.UI.BaseView.extend(_.extend({el:"#panel-protect",menu:void 0,template:_.template(['','
    ','','
    ','',"",'',"","",'','',"","
    ","
    ",'
    ','','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu;var e=this;this.templateSignature=_.template(['',"",'',"","",'",'","","
    "].join(""))},render:function(){$(this.el).html(this.template({scope:this}));var t=SSE.getController("Common.Controllers.Protection").getView();return this.btnAddPwd=t.getButton("add-password"),this.btnAddPwd.render(this.$el.find("#fms-btn-add-pwd")),this.btnAddPwd.on("click",_.bind(this.closeMenu,this)),this.btnChangePwd=t.getButton("change-password"), this.btnChangePwd.render(this.$el.find("#fms-btn-change-pwd")),this.btnChangePwd.on("click",_.bind(this.closeMenu,this)),this.btnDeletePwd=t.getButton("del-password"),this.btnDeletePwd.render(this.$el.find("#fms-btn-delete-pwd")),this.btnDeletePwd.on("click",_.bind(this.closeMenu,this)),this.cntPassword=$("#id-fms-password"),this.cntPasswordView=$("#id-fms-view-pwd"),this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#fms-btn-invisible-sign")),this.btnAddInvisibleSign.on("click",_.bind(this.closeMenu,this)),this.cntSignature=$("#id-fms-signature"),this.cntSignatureView=$("#id-fms-signature-view"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.$el.on("click",".signature-edit-link",_.bind(this.onEdit,this)),this.$el.on("click",".signature-view-link",_.bind(this.onView,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSignatures(),this.updateEncrypt()},setMode:function(t){this.mode=t,this.cntSignature.toggleClass("hidden",!this.mode.isSignatureSupport),this.cntPassword.toggleClass("hidden",!this.mode.isPasswordSupport)},setApi:function(t){return this.api=t,this},closeMenu:function(){this.menu&&this.menu.hide()},onEdit:function(){this.menu&&this.menu.hide();var t=this;Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(e){"ok"==e&&t.api.asc_RemoveAllSignatures()}})},onView:function(){this.menu&&this.menu.hide(),SSE.getController("RightMenu").rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature,!0)},updateSignatures:function(){var t=this.api.asc_getRequestSignatures(),e=this.api.asc_getSignatures(),i=t&&t.length>0,n=!1,o=!1;_.each(e,function(t,e){0==t.asc_getValid()?n=!0:o=!0});var s=o?this.txtSignedInvalid:n?this.txtSigned:"";i&&(s=this.txtRequestedSignatures+(""!=s?"

    ":"")+s),this.cntSignatureView.html(this.templateSignature({tipText:s,hasSigned:n||o,hasRequested:i}))},updateEncrypt:function(){this.cntPasswordView.toggleClass("hidden",this.btnAddPwd.isVisible())},strProtect:"Protect Workbook",strSignature:"With Signature",txtView:"View signatures",txtEdit:"Edit workbook",txtSigned:"Valid signatures has been added to the workbook. The workbook is protected from editing.",txtSignedInvalid:"Some of the digital signatures in workbook are invalid or could not be verified. The workbook is protected from editing.",txtRequestedSignatures:"This workbook needs to be signed.",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the workbook.
    Are you sure you want to continue?",strEncrypt:"With Password",txtEncrypted:"This workbook has been protected by password"},SSE.Views.FileMenuPanels.ProtectDoc||{}))}),define("text!spreadsheeteditor/main/app/template/PrintSettings.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n'}),define("spreadsheeteditor/main/app/view/PrintSettings",["text!spreadsheeteditor/main/app/template/PrintSettings.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(t){"use strict";SSE.Views.PrintSettings=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"PrintSettings",contentWidth:280,height:475},initialize:function(e){this.type=e.type||"print",_.extend(this.options,{title:"print"==this.type?this.textTitle:this.textTitlePDF,template:['
    ','",'
    '+_.template(t)({scope:this})+"
    ","
    ",'
    ','"].join("")},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[]},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this),this.cmbRange=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-range"),style:"width: 132px;",menuStyle:"min-width: 132px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPrintType.ActiveSheets,displayValue:this.textCurrentSheet},{value:Asc.c_oAscPrintType.EntireWorkbook,displayValue:this.textAllSheets},{value:Asc.c_oAscPrintType.Selection,displayValue:this.textSelection}]}),this.cmbRange.on("selected",_.bind(this.comboRangeChange,this)),this.chIgnorePrintArea=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-ignore"),labelText:this.textIgnore}),this.cmbSheet=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-sheets"),style:"width: 242px;",menuStyle:"min-width: 242px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.cmbPaperSize=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-pages"),style:"width: 242px;",menuStyle:"max-height: 280px; min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:"215.9|279.4",displayValue:"US Letter (21,59cm x 27,94cm)",caption:"US Letter"},{value:"215.9|355.6",displayValue:"US Legal (21,59cm x 35,56cm)",caption:"US Legal"},{value:"210|297",displayValue:"A4 (21cm x 29,7cm)",caption:"A4"},{value:"148|210",displayValue:"A5 (14,8cm x 21cm)",caption:"A5"},{value:"176|250",displayValue:"B5 (17,6cm x 25cm)",caption:"B5"},{value:"104.8|241.3",displayValue:"Envelope #10 (10,48cm x 24,13cm)",caption:"Envelope #10"},{value:"110|220",displayValue:"Envelope DL (11cm x 22cm)",caption:"Envelope DL"},{value:"279.4|431.8",displayValue:"Tabloid (27,94cm x 43,18cm)",caption:"Tabloid"},{value:"297|420",displayValue:"A3 (29,7cm x 42cm)",caption:"A3"},{value:"304.8|457.1",displayValue:"Tabloid Oversize (30,48cm x 45,71cm)",caption:"Tabloid Oversize"},{value:"196.8|273",displayValue:"ROC 16K (19,68cm x 27,3cm)",caption:"ROC 16K"},{value:"119.9|234.9",displayValue:"Envelope Choukei 3 (11,99cm x 23,49cm)",caption:"Envelope Choukei 3"},{value:"330.2|482.5",displayValue:"Super B/A3 (33,02cm x 48,25cm)",caption:"Super B/A3"}]}),this.cmbPaperOrientation=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-orient"),style:"width: 132px;",menuStyle:"min-width: 132px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPageOrientation.PagePortrait,displayValue:this.strPortrait},{value:Asc.c_oAscPageOrientation.PageLandscape,displayValue:this.strLandscape}]}),this.chPrintGrid=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-grid"),labelText:"print"==this.type?this.textPrintGrid:this.textShowGrid}),this.chPrintRows=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-rows"),labelText:"print"==this.type?this.textPrintHeadings:this.textShowHeadings}),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-top"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-bottom"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-left"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-right"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginRight),this.cmbLayout=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-layout"),style:"width: 242px;",menuStyle:"min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textActualSize},{value:1,displayValue:this.textFitPage},{value:2,displayValue:this.textFitCols},{value:3,displayValue:this.textFitRows}]}),this.btnHide=new Common.UI.Button({el:$("#printadv-dlg-btn-hide")}),this.btnHide.on("click",_.bind(this.handlerShowDetails,this)),this.panelDetails=$("#printadv-dlg-content-to-hide"),this.updateMetricUnit(),this.options.afterrender&&this.options.afterrender.call(this);var t=Common.localStorage.getItem("sse-hide-print-settings");this.extended=null!==t&&0==parseInt(t),this.handlerShowDetails(this.btnHide)},setRange:function(t){this.cmbRange.setValue(t)},getRange:function(){return this.cmbRange.getValue()},setIgnorePrintArea:function(t){this.chIgnorePrintArea.setValue(t)},getIgnorePrintArea:function(){return"checked"==this.chIgnorePrintArea.getValue()},comboRangeChange:function(t,e){this.fireEvent("changerange",this)},updateMetricUnit:function(){if(this.spinners)for(var t=0;te?l="left":o>e-n?l="right":s>i?l="top":a>i-s&&(l="bottom"),!l||(Common.UI.warning({title:this.textWarning,msg:this.warnCheckMargings,callback:function(e,i){switch(l){case"left":return void t.spnMarginLeft.$el.focus();case"right":return void t.spnMarginRight.$el.focus();case"top":return void t.spnMarginTop.$el.focus();case"bottom":return void t.spnMarginBottom.$el.focus()}}}),!1)},registerControlEvents:function(t){t.cmbPaperSize.on("selected",_.bind(this.propertyChange,this,t)),t.cmbPaperOrientation.on("selected",_.bind(this.propertyChange,this,t)),t.cmbLayout.on("selected",_.bind(this.propertyChange,this,t)),t.spnMarginTop.on("change",_.bind(this.propertyChange,this,t)),t.spnMarginBottom.on("change",_.bind(this.propertyChange,this,t)),t.spnMarginLeft.on("change",_.bind(this.propertyChange,this,t)),t.spnMarginRight.on("change",_.bind(this.propertyChange,this,t)),t.chPrintGrid.on("change",_.bind(this.propertyChange,this,t)),t.chPrintRows.on("change",_.bind(this.propertyChange,this,t))},propertyChange:function(t){this._changedProps&&(this._changedProps[t.cmbSheet.getValue()]=this.getPageOptions(t))},getPrintParams:function(){return this.adjPrintParams},warnCheckMargings:"Margins are incorrect",strAllSheets:"All Sheets",textWarning:"Warning",txtCustom:"Custom"},SSE.Controllers.Print||{}))}),define("spreadsheeteditor/main/app/view/DataTab",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(){"use strict";SSE.Views.DataTab=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.btnUngroup.menu.on("item:click",function(e,i,n){t.fireEvent("data:ungroup",[i.value])}),t.btnUngroup.on("click",function(e,i){t.fireEvent("data:ungroup")}),t.btnGroup.menu.on("item:click",function(e,i,n){t.fireEvent("data:group",[i.value,i.checked])}),t.btnGroup.on("click",function(e,i){t.fireEvent("data:group")}),t.btnGroup.menu.on("show:before",function(e,i){t.fireEvent("data:groupsettings",[e])}),t.btnTextToColumns.on("click",function(e,i){t.fireEvent("data:tocolumns")}),t.btnShow.on("click",function(e,i){t.fireEvent("data:show")}),t.btnHide.on("click",function(e,i){t.fireEvent("data:hide")}),t.btnsSortDown.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:sort",[Asc.c_oAscSortOptions.Ascending])})}),t.btnsSortUp.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:sort",[Asc.c_oAscSortOptions.Descending])})}),t.btnsSetAutofilter.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:setfilter",[Asc.c_oAscSortOptions.Descending])})}),t.btnsClearAutofilter.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:clearfilter",[Asc.c_oAscSortOptions.Descending])})})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this),this.toolbar=t.toolbar,this.lockedControls=[];var e=this,i=e.toolbar.$el,n=SSE.enumLock;this.btnGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-cell-group",caption:this.capBtnGroup,split:!0,menu:!0,disabled:!0,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.sheetLock,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-group"),this.btnGroup),this.lockedControls.push(this.btnGroup),this.btnUngroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-cell-ungroup",caption:this.capBtnUngroup,split:!0,menu:!0,disabled:!0,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.sheetLock,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-ungroup"),this.btnUngroup),this.lockedControls.push(this.btnUngroup),this.btnTextToColumns=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-to-columns",caption:this.capBtnTextToCol,split:!1,disabled:!0,lock:[n.multiselect,n.multiselectCols,n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-text-column"),this.btnTextToColumns),this.lockedControls.push(this.btnTextToColumns),this.btnShow=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-show-details",style:"padding-right: 2px;",caption:this.capBtnTextShow,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-show-details"),this.btnShow),this.lockedControls.push(this.btnShow),this.btnHide=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-hide-details",style:"padding-right: 2px;",caption:this.capBtnTextHide,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-hide-details"),this.btnHide),this.lockedControls.push(this.btnHide),this.btnsSortDown=Common.Utils.injectButtons(i.find(".slot-sortdesc"),"","btn-sort-down","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleFilter,n.editPivot,n.cantModifyFilter]),this.btnsSortUp=Common.Utils.injectButtons(i.find(".slot-sortasc"),"","btn-sort-up","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleFilter,n.editPivot,n.cantModifyFilter]),this.btnsSetAutofilter=Common.Utils.injectButtons(i.find(".slot-btn-setfilter"),"","btn-autofilter","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleFilter,n.editPivot,n.cantModifyFilter],!1,!1,!0),this.btnsClearAutofilter=Common.Utils.injectButtons(i.find(".slot-btn-clear-filter"),"","btn-clear-filter","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleDelFilter,n.editPivot]),Array.prototype.push.apply(this.lockedControls,this.btnsSortDown.concat(this.btnsSortUp,this.btnsSetAutofilter,this.btnsClearAutofilter)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){i.btnUngroup.updateHint(i.tipUngroup);var e=new Common.UI.Menu({items:[{caption:i.textRows,value:"rows"},{caption:i.textColumns,value:"columns"},{caption:i.textClear,value:"clear"}]});i.btnUngroup.setMenu(e),i.btnGroup.updateHint(i.tipGroup),e=new Common.UI.Menu({items:[{caption:i.textGroupRows,value:"rows"},{caption:i.textGroupColumns,value:"columns"},{caption:"--"},{caption:i.textBelow,value:"below",checkable:!0},{caption:i.textRightOf,value:"right",checkable:!0}]}),i.btnGroup.setMenu(e),i.btnTextToColumns.updateHint(i.tipToColumns),i.btnsSortDown.forEach(function(t){t.updateHint(i.toolbar.txtSortAZ)}),i.btnsSortUp.forEach(function(t){t.updateHint(i.toolbar.txtSortZA)}),i.btnsSetAutofilter.forEach(function(t){t.updateHint(i.toolbar.txtFilter+" (Ctrl+Shift+L)")}),i.btnsClearAutofilter.forEach(function(t){t.updateHint(i.toolbar.txtClearFilter)}),t.call(i)})},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButtons:function(t){return"sort-down"==t?this.btnsSortDown:"sort-up"==t?this.btnsSortUp:"set-filter"==t?this.btnsSetAutofilter:"clear-filter"==t?this.btnsClearAutofilter:void 0===t?this.lockedControls:[]},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},capBtnGroup:"Group",capBtnUngroup:"Ungroup",textRows:"Ungroup rows",textColumns:"Ungroup columns",textGroupRows:"Group rows",textGroupColumns:"Group columns",textClear:"Clear outline",tipGroup:"Group range of cells",tipUngroup:"Ungroup range of cells",capBtnTextToCol:"Text to Columns",tipToColumns:"Separate cell text into columns",capBtnTextShow:"Show details",capBtnTextHide:"Hide details",textBelow:"Summary rows below detail",textRightOf:"Summary columns to right of detail"}}(),SSE.Views.DataTab||{}))}),define("spreadsheeteditor/main/app/view/GroupDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";SSE.Views.GroupDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg"},initialize:function(t){_.extend(this.options,t||{}),this.template=['
    ','
    ','
    ','"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.radioRows=new Common.UI.RadioBox({el:$("#group-radio-rows"),labelText:this.textRows,name:"asc-radio-group-cells",checked:"rows"==this.options.props}),this.radioColumns=new Common.UI.RadioBox({el:$("#group-radio-cols"),labelText:this.textColumns,name:"asc-radio-group-cells",checked:"columns"==this.options.props}),