diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e28e69132..76981253b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us improve +about: Report a bug in the software title: '' labels: '' assignees: '' diff --git a/.github/ISSUE_TEMPLATE/initial-instance-configuration.md b/.github/ISSUE_TEMPLATE/initial-instance-configuration.md new file mode 100644 index 000000000..00c54918e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/initial-instance-configuration.md @@ -0,0 +1,57 @@ +--- +name: Initial instance configuration +about: Difficulty configuring a CryptPad instance +title: CONFIG +labels: configuration +assignees: '' + +--- + +We receive many issues from people that have tried to set up a new CryptPad instance that does not load any of the interactive editors or which mostly works but has particular problems with the sheet editor. + +Before you create an issue: + +## See your instance's checkup page + +If your instance is able to at least partially load some pages then you should be able to access the diagnostic page `http(s):///checkup/`. It will perform some automated tests of your instance's configuration and will provide hints indicating: + +1. what is incorrect about your configuration +2. what to change in order to correct the problem + +## Write down the exact steps you followed to configure your instance + +0. Provide the URL of the guide you followed +1. Confirm that your system has the necessary pre-requisites + * Did you fetch the source code with `git` as recommended? + * Have you installed the recommend version of Nodejs (12.14.0) using [NVM](https://github.com/nvm-sh/nvm)? + * Have you installed `bower` using `npm`? + * Have you fetched the latest source code? Run `git branch` and confirm that it returns either `main` or [the latest of our releases](github.com/xwiki-labs/cryptpad/releases/latest). +2. Did you copy `cryptpad/config/config.example.js` to `cryptpad/config/config.js`, read the comments, and edit the fields which are described as being necessary for a production environment? +3. Did you restart the application server (`server.js`) after making configuration changes? +4. Are you running NGINX as a reverse proxy as we recommend? +5. Have you generated an SSL certificate that is valid for both the domains that are required by the sandboxing system? +6. Do the domains in your NGINX conf match those in `cryptpad/config/config.js`? + +## Review the steps you took + +If the answer to any of the above questions is _No_ then that is the most likely cause of your difficulty. + +Identifying the problem on your own reduces the time we spend answering GitHub issues and leaves more time to fix actual bugs and develop new features. + +## Confirm that the problem stems from your instance and not from your browser + +Not all browsers support CryptPad correctly, and various browser extensions interfere with its intended behaviour. + +https://CryptPad.fr is a good reference point that you can use to confirm that your browser can load a correctly configured instance. If you can't load CryptPad.fr then the problem may be with your browser, its configuration, or one of its active extensions. + +## Create a detailed report + +If you believe you've done all of those steps correctly then proceed with creating an issue with the following: + +0. A concise description of the problem you're experiencing and why you believe it stems from a bug in the software and not a configuration issue +1. The list of all the steps you wrote down when following our instructions above +2. A link to your instance so we can easily load your `/checkup/` page for ourselves +3. A list of any errors visible in your browser's console on whichever page is not behaving as expected +4. A list of any further steps you've taken to debug the problem on your own + +Finally, remove the text of this issue template and leave only the content you've written. diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 57b2a501b..e3ae2b83e 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -94,7 +94,7 @@ define([ var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ? '/imprint.html' : AppConfig.imprint); - Pages.versionString = "v4.4.0"; + Pages.versionString = "v4.5.0"; // used for the about menu diff --git a/customize.dist/pages/contact.js b/customize.dist/pages/contact.js index 88a5053e3..b86ad4480 100644 --- a/customize.dist/pages/contact.js +++ b/customize.dist/pages/contact.js @@ -7,8 +7,13 @@ define([ ], function (Config, h, Msg, Pages, LocalStore) { return function () { - var adminEmail = Config.adminEmail && Config.adminEmail !== 'i.did.not.read.my.config@cryptpad.fr'; + var developerEmail = "contact@cryptpad.fr"; + var adminEmail = Config.adminEmail && [ + 'i.did.not.read.my.config@cryptpad.fr', + developerEmail + ].indexOf(Config.adminEmail) === -1; var adminMailbox = Config.supportMailbox && LocalStore.isLoggedIn(); + return h('div#cp-main', [ Pages.infopageTopbar(), h('div.container.cp-container', [ @@ -110,7 +115,7 @@ define([ ) ), h('div.col-12.col-sm-6.col-md-3.col-lg-3', - h('a.card', {href : "mailto:contact@cryptpad.fr"}, + h('a.card', {href : "mailto:" + developerEmail}, h('div.card-body', h('p', [ h('img', { diff --git a/customize.dist/src/less2/include/cursor.less b/customize.dist/src/less2/include/cursor.less index 355cf4076..132922c21 100644 --- a/customize.dist/src/less2/include/cursor.less +++ b/customize.dist/src/less2/include/cursor.less @@ -1,6 +1,12 @@ .cursor_main() { // CodeMirror .cp-codemirror-cursor { + &:before { + content: ""; + display: inline-block; + } + + cursor: default; background-color: red; background-clip: padding-box; @@ -8,8 +14,8 @@ border: 2px solid red; border-right-color: transparent !important; border-left-color: transparent !important; - margin-left: -3px; - margin-right: -3px; + display: inline-block; + margin: -2px -3px; } .cp-codemirror-selection { background-color: rgba(255,0,0,0.3); diff --git a/package-lock.json b/package-lock.json index c8bc7dac5..8b1c24cbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cryptpad", - "version": "4.4.0", + "version": "4.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f68a09e63..3314ffd17 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "realtime collaborative visual editor with zero knowlege server", - "version": "4.4.0", + "version": "4.5.0", "license": "AGPL-3.0+", "repository": { "type": "git", diff --git a/customize.dist/src/less2/pages/page-checkup.less b/www/checkup/app-checkup.less similarity index 66% rename from customize.dist/src/less2/pages/page-checkup.less rename to www/checkup/app-checkup.less index 751db910d..ad8cecbb1 100644 --- a/customize.dist/src/less2/pages/page-checkup.less +++ b/www/checkup/app-checkup.less @@ -1,7 +1,6 @@ -@import (reference) "../include/colortheme-all.less"; -@import (reference) "../include/font.less"; -//@import (reference) "../include/forms.less"; -@import (reference) "../include/alertify.less"; +@import (reference) "../../customize/src/less2/include/colortheme-all.less"; +@import (reference) "../../customize/src/less2/include/font.less"; +@import (reference) "../../customize/src/less2/include/alertify.less"; html, body { .font_main(); @@ -55,9 +54,16 @@ html, body { word-break: break-word; padding: 5px; //font-size: 16px; - border: 1px solid red; - background-color: @cp_alerts-danger-bg; - color: @cp_alerts-danger-text; + &.cp-danger { + border: 1px solid @cp_alerts-danger-bg; + background-color: @cp_alerts-danger-bg; + color: @cp_alerts-danger-text; + } + &.cp-warning { + border: 1px solid @cp_alerts-warning-bg; + background-color: @cp_alerts-warning-bg; + color: @cp_alerts-warning-text; + } code { word-break: keep-all; font-style: italic; diff --git a/www/checkup/main.js b/www/checkup/main.js index f8b7e5612..89458d52b 100644 --- a/www/checkup/main.js +++ b/www/checkup/main.js @@ -15,7 +15,7 @@ define([ '/bower_components/tweetnacl/nacl-fast.min.js', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', - 'less!/customize/src/less2/pages/page-checkup.less', + 'less!/checkup/app-checkup.less', ], function ($, ApiConfig, Assertions, h, Messages, DomReady, nThen, SFCommonO, Login, Hash, Util, Pinpad, NetConfig) { @@ -26,7 +26,7 @@ define([ }; var assert = function (f, msg) { - Assert(f, msg || h('span.advisory-text')); + Assert(f, msg || h('span.advisory-text.cp-danger')); }; var CONFIG_PATH = function () { @@ -420,10 +420,7 @@ define([ dataType: 'text', complete: function (xhr) { var allHeaders = xhr.getAllResponseHeaders(); - console.error(allHeaders); - var headers = {}; - var duplicated = allHeaders.split('\n').some(function (header) { var duplicate; header.replace(/([^:]+):(.*)/, function (all, type, value) { @@ -436,8 +433,6 @@ define([ return duplicate; }); - if (duplicated) { return void cb(false); } - var expect = { 'cross-origin-resource-policy': 'cross-origin', }; @@ -448,7 +443,8 @@ define([ } }); - cb(!incorrect); + if (duplicated || incorrect) { console.error(allHeaders); } + cb(!duplicated && !incorrect); }, }); }; @@ -467,6 +463,59 @@ define([ checkAPIHeaders(url, cb); }); + var setWarningClass = function (msg) { + $(msg).removeClass('cp-danger').addClass('cp-warning'); + }; + + assert(function (cb, msg) { + var email = ApiConfig.adminEmail; + if (typeof(email) === 'string' && email && email !== 'i.did.not.read.my.config@cryptpad.fr') { + return void cb(true); + } + + setWarningClass(msg); + msg.appendChild(h('span', [ + 'This instance does not provide a valid ', + h('code', 'adminEmail'), + ' which can make it difficult to contact its adminstrator to report vulnerabilities or abusive content.', + ' This can be configured in ', CONFIG_PATH(), '. ', + RESTART_WARNING(), + ])); + cb(email); + }); + + assert(function (cb, msg) { + var support = ApiConfig.supportMailbox; + setWarningClass(msg); + msg.appendChild(h('span', [ + "This instance's encrypted support ticket functionality has not been enabled. This can make it difficult for its users to safely report issues that concern sensitive information. ", + "This can be configured via the ", + h('code', 'supportMailbox'), + " attribute in ", + CONFIG_PATH(), + ". ", + RESTART_WARNING(), + ])); + cb(support && typeof(support) === 'string' && support.length === 44); + }); + + assert(function (cb, msg) { + var adminKeys = ApiConfig.adminKeys; + if (Array.isArray(adminKeys) && adminKeys.length >= 1 && typeof(adminKeys[0]) === 'string' && adminKeys[0].length === 44) { + return void cb(true); + } + setWarningClass(msg); + msg.appendChild(h('span', [ + "This instance has not been configured to support web administration. This can be enabled by adding a registered user's public signing key to the ", + h('code', 'adminKeys'), + ' array in ', + CONFIG_PATH(), + '. ', + RESTART_WARNING(), + ])); + cb(false); + }); + var row = function (cells) { return h('tr', cells.map(function (cell) { return h('td', cell); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index a89092e55..d63bb8c91 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -789,7 +789,6 @@ define([ ])).click(common.prepareFeedback(type)); break; case 'storeindrive': - Messages.toolbar_storeInDrive = "Store in CryptDrive"; // XXX button = $(h('button.cp-toolbar-storeindrive', { style: 'display:none;' }, [ diff --git a/www/common/inner/common-mediatag.js b/www/common/inner/common-mediatag.js index 9f7506d61..966724fa1 100644 --- a/www/common/inner/common-mediatag.js +++ b/www/common/inner/common-mediatag.js @@ -431,7 +431,7 @@ define([ else if ($this.hasClass("cp-app-code-context-download")) { if ($mt.is('pre.mermaid') || $mt.is('pre.markmap')) { (function () { - var name = 'image.svg'; // XXX + var name = Messages.mediatag_defaultImageName + '.svg'; var svg = $mt.find('svg')[0].cloneNode(true); $(svg).attr('xmlns', 'http://www.w3.org/2000/svg').attr('width', $mt.width()).attr('height', $mt.height()); $(svg).find('foreignObject').each(function (i, el) { @@ -454,7 +454,7 @@ define([ } if ($mt.is('pre.mathjax')) { (function () { - var name = 'image.png'; // XXX + var name = Messages.mediatag_defaultImageName + '.png'; var svg = $mt.find('> span > svg')[0]; var clone = svg.cloneNode(true); var html = clone.outerHTML; diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 8127c326e..f87cff136 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -2668,16 +2668,22 @@ define([ } + // Only execute the following code the first time we call onReady + if (!firstReady) { + setMyId(); + oldHashes = JSON.parse(JSON.stringify(content.hashes)); + initializing = false; + return void setEditable(!readOnly); + } + firstReady = false; + + var useNewDefault = content.version && content.version >= 2; openRtChannel(function () { setMyId(); oldHashes = JSON.parse(JSON.stringify(content.hashes)); initializing = false; - // Only execute the following code the first time we call onReady - if (!firstReady) { return void setEditable(!readOnly); } - firstReady = false; - common.openPadChat(APP.onLocal); if (!readOnly) { @@ -2790,10 +2796,8 @@ define([ checkNewCheckpoint(); }); }; - var isModified = editor.asc_isDocumentModified || function () { - return editor.isDocumentModify; - }; - if (isModified()) { + var editing = editor.asc_isDocumentModified ? editor.asc_isDocumentModified() : editor.isDocumentModify; + if (editing) { setEditable(false); APP.unsavedLocks = myLocks; APP.onStrictSaveChanges = function () { @@ -2838,10 +2842,12 @@ define([ common.gotoURL(); }); } - setEditable(true); + //setEditable(true); + try { getEditor().asc_setViewMode(false); } catch (e) {} offline = false; } else { - setEditable(false); + try { getEditor().asc_setViewMode(true); } catch (e) {} + //setEditable(false); offline = true; UI.findOKButton().click(); UIElements.disconnectAlert(); diff --git a/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js b/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js index 8f3cebf17..4cb1f3ba0 100644 --- a/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js +++ b/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js @@ -27,7 +27,7 @@ this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",s)}},onSuperscri ;t=e.asc_getIsTop10Sum(),this.setTitle(this.txtValueTitle+" ("+n[0]+")"),n.shift();var s=[];n&&n.forEach(function(t,e){t&&s.push({value:e,displayValue:t})}),this.cmbFields.setData(s),this.cmbFields.setValue(0!==i?i-1:0)}var o=this.properties.asc_getFilterObj();if(o.asc_getType()==Asc.c_oAscAutoFilterTypes.Top10){var a=o.asc_getFilter(),l=a.asc_getTop(),r=a.asc_getPercent();this.cmbType.setValue(l||null===l),this.cmbItem.setValue(t?0:r||null===r),this.spnCount.setDefaultUnit(!r&&null!==r||t?"":"%"),this.spnCount.setValue(a.asc_getVal())}}},save:function(){if(this.api&&this.properties){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.Top10),t.asc_setType(Asc.c_oAscAutoFilterTypes.Top10);var e=t.asc_getFilter();if(e.asc_setTop(this.cmbType.getValue()),e.asc_setPercent(!0===this.cmbItem.getValue()),e.asc_setVal(this.spnCount.getNumberValue()),"value"==this.type){var i=this.properties.asc_getPivotObj();i.asc_setIsTop10Sum(0===this.cmbItem.getValue()),i.asc_setDataFieldIndexFilter("value"==this.type?this.cmbFields.getValue()+1:0)}this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},txtTitle:"Top 10 AutoFilter",textType:"Show",txtTop:"Top",txtBottom:"Bottom",txtItems:"Item",txtPercent:"Percent",txtValueTitle:"Top 10 Filter",txtSum:"Sum",txtBy:"by"},SSE.Views.Top10FilterDialog||{})),SSE.Views.PivotDigitalFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={};_.extend(i,{width:501,height:210,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:"label"==t.type?e.txtTitleLabel:e.txtTitleValue,items:[]},t),this.api=t.api,this.handler=t.handler,this.type=t.type||"value",this.template=t.template||['
','
','",'
','
','
','
','",'
',"
",'
','",'","
","
","
",'
','"].join(""),i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.conditions=[{value:Asc.c_oAscCustomAutoFilter.equals,displayValue:this.capCondition1},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,displayValue:this.capCondition2},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,displayValue:this.capCondition3},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,displayValue:this.capCondition4},{value:Asc.c_oAscCustomAutoFilter.isLessThan,displayValue:this.capCondition5},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,displayValue:this.capCondition6},{value:-2,displayValue:this.capCondition13},{value:-3,displayValue:this.capCondition14}],"label"==this.type&&(this.conditions=this.conditions.concat([{value:Asc.c_oAscCustomAutoFilter.beginsWith,displayValue:this.capCondition7},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,displayValue:this.capCondition8},{value:Asc.c_oAscCustomAutoFilter.endsWith,displayValue:this.capCondition9},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,displayValue:this.capCondition10},{value:Asc.c_oAscCustomAutoFilter.contains,displayValue:this.capCondition11},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,displayValue:this.capCondition12}])),this.cmbCondition1=new Common.UI.ComboBox({el:$("#id-cond-digital-combo",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1,takeFocusOnClose:!0}),this.cmbCondition1.setValue(Asc.c_oAscCustomAutoFilter.equals),this.cmbCondition1.on("selected",_.bind(function(t,e){var i=-2==e.value||-3==e.value;this.inputValue2.setVisible(i),this.lblAnd.toggleClass("hidden",!i),this.inputValue.$el.width(i?100:225);var n=this;_.defer(function(){n.inputValue&&n.inputValue.focus()},10)},this)),this.cmbFields=new Common.UI.ComboBox({el:$("#id-field-digital-combo",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1,takeFocusOnClose:!0}),this.cmbFields.setVisible("value"==this.type),this.cmbFields.on("selected",_.bind(function(t,e){var i=this;_.defer(function(){i.inputValue&&i.inputValue.focus()},10)},this)),this.inputValue=new Common.UI.InputField({el:$("#id-input-digital-value1"),allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.inputValue2=new Common.UI.InputField({el:$("#id-input-digital-value2"),allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.lblAnd=this.$window.find("#id-label-digital-and"),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},getFocusedComponents:function(){return[this.cmbFields,this.cmbCondition1,this.inputValue,this.inputValue2]},getDefaultFocusableComponent:function(){return this.inputValue},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties&&this.cmbCondition1&&this.cmbFields&&this.inputValue){var t=this.properties.asc_getPivotObj(),e=t.asc_getDataFieldIndexFilter(),i=t.asc_getDataFields();if(this.setTitle(this.options.title+" ("+i[0]+")"),"value"==this.type){i.shift();var n=[];i&&i.forEach(function(t,e){t&&n.push({value:e,displayValue:t})}),this.cmbFields.setData(n),this.cmbFields.setValue(0!==e?e-1:0)}var s=this.properties.asc_getFilterObj();if(s.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var o=s.asc_getFilter(),a=o.asc_getCustomFilters(),l=a[0].asc_getOperator();if(a.length>1){var r=o.asc_getAnd(),c=a[0].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&a[1].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,h=a[0].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isLessThan&&a[1].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isGreaterThan;r&&c?l=-2:!r&&h&&(l=-3)}this.cmbCondition1.setValue(l||Asc.c_oAscCustomAutoFilter.equals),this.inputValue.setValue(null===a[0].asc_getVal()?"":a[0].asc_getVal()),this.inputValue.$el.width(-2==l||-3==l?100:225),this.lblAnd.toggleClass("hidden",!(-2==l||-3==l)),this.inputValue2.setVisible(-2==l||-3==l),this.inputValue2.setValue(a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.cmbCondition1&&this.cmbFields&&this.inputValue){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.CustomFilters),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var e=t.asc_getFilter(),i=this.cmbCondition1.getValue();if(-2==i){e.asc_setCustomFilters([new Asc.CustomFilter,new Asc.CustomFilter]),e.asc_setAnd(!0);var n=e.asc_getCustomFilters();n[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo),n[0].asc_setVal(this.inputValue.getValue()),n[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),n[1].asc_setVal(this.inputValue2.getValue())}else if(-3==i){e.asc_setCustomFilters([new Asc.CustomFilter,new Asc.CustomFilter]),e.asc_setAnd(!1);var n=e.asc_getCustomFilters();n[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThan),n[0].asc_setVal(this.inputValue.getValue()),n[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThan),n[1].asc_setVal(this.inputValue2.getValue())}else{e.asc_setCustomFilters([new Asc.CustomFilter]),e.asc_setAnd(!0);var n=e.asc_getCustomFilters();n[0].asc_setOperator(this.cmbCondition1.getValue()),n[0].asc_setVal(this.inputValue.getValue())}this.properties.asc_getPivotObj().asc_setDataFieldIndexFilter("value"==this.type?this.cmbFields.getValue()+1:0),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},capCondition1:"equals",capCondition10:"does not end with",capCondition11:"contains",capCondition12:"does not contain",capCondition2:"does not equal",capCondition3:"is greater than",capCondition4:"is greater than or equal to",capCondition5:"is less than",capCondition6:"is less than or equal to",capCondition7:"begins with",capCondition8:"does not begin with",capCondition9:"ends with",textShowLabel:"Show items for which the label:",textShowValue:"Show items for which:",textUse1:"Use ? to present any single character",textUse2:"Use * to present any series of character",txtTitleValue:"Value Filter",txtTitleLabel:"Label Filter",capCondition13:"between",capCondition14:"not between",txtAnd:"and"},SSE.Views.PivotDigitalFilterDialog||{})),SSE.Views.SortFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={};this.type=t.type,_.extend(i,{width:250,height:215,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[],buttons:["ok","cancel"]},t),this.template=t.template||['
','
','
','
','
','
',"
","
",'
'].join(""),this.api=t.api,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.radioAsc=new Common.UI.RadioBox({el:$("#id-sort-filter-radio-asc"),labelText:this.textAsc,name:"asc-radio-sort",checked:!0}),this.radioAsc.on("change",_.bind(function(t,e){e&&this.cmbFieldsAsc.setDisabled(!1),e&&this.cmbFieldsDesc.setDisabled(!0)},this)),this.radioDesc=new Common.UI.RadioBox({el:$("#id-sort-filter-radio-desc"),labelText:this.textDesc,name:"asc-radio-sort"}),this.radioDesc.on("change",_.bind(function(t,e){e&&this.cmbFieldsAsc.setDisabled(!0),e&&this.cmbFieldsDesc.setDisabled(!1)},this)),this.cmbFieldsAsc=new Common.UI.ComboBox({el:$("#id-sort-filter-fields-asc",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1}),this.cmbFieldsDesc=new Common.UI.ComboBox({el:$("#id-sort-filter-fields-desc",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1,disabled:!0}),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties){var t=this.properties.asc_getPivotObj(),e=t.asc_getDataFieldIndexSorting(),i=t.asc_getDataFields(),n=this.properties.asc_getSortState();this.setTitle(this.txtTitle+" ("+i[0]+")");var s=[];i&&i.forEach(function(t,e){t&&s.push({value:e,displayValue:t})}),this.cmbFieldsAsc.setData(s),this.cmbFieldsAsc.setValue(e>=0?e:0),this.cmbFieldsDesc.setData(s),this.cmbFieldsDesc.setValue(e>=0?e:0),this.radioDesc.setValue(n==Asc.c_oAscSortOptions.Descending,!0),this.cmbFieldsDesc.setDisabled(n!==Asc.c_oAscSortOptions.Descending)}},save:function(){if(this.api&&this.properties){var t=this.radioAsc.getValue()?this.cmbFieldsAsc:this.cmbFieldsDesc;this.properties.asc_getPivotObj().asc_setDataFieldIndexSorting(t.getValue()),this.properties.asc_setSortState(this.radioAsc.getValue()?Asc.c_oAscSortOptions.Ascending:Asc.c_oAscSortOptions.Descending),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},txtTitle:"Sort",textAsc:"Ascenging (A to Z) by",textDesc:"Descending (Z to A) by"},SSE.Views.SortFilterDialog||{})),SSE.Views.AutoFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={},n=450,s=void 0;Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(n=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0],s=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[1]),_.extend(i,{width:n||450,height:s||265,contentWidth:n-50||400,header:!1,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,modal:!1,animate:!1,items:[],resizable:!0,minwidth:450,minheight:265},t),this.template=t.template||['
','
','
','','
','
',"
","
",'","
",'","
"].join(""),this.api=t.api,this.handler=t.handler,this.throughIndexes=[],this.filteredIndexes=[],this.curSize=null,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this))},render:function(){var t=this;Common.UI.Window.prototype.render.call(this);var e=this.$window.find(".resize-border");this.$window.find(".resize-border.left, .resize-border.top").css({cursor:"default"}),e.css({background:"none",border:"none"}),e.removeClass("left"),e.removeClass("top"),this.$window.find(".btn").on("click",_.bind(this.onBtnClick,this)),this.btnOk=new Common.UI.Button({cls:"btn normal dlg-btn primary",caption:this.okButtonText,enableToggle:!1,allowDepress:!1}),this.btnOk&&(this.btnOk.render($("#id-apply-filter",this.$window)),this.btnOk.on("click",_.bind(this.onApplyFilter,this))),this.miSortLow2High=new Common.UI.MenuItem({caption:this.txtSortLow2High,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortLow2High.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),this.miSortHigh2Low=new Common.UI.MenuItem({caption:this.txtSortHigh2Low,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortHigh2Low.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),this.miSortOptions=new Common.UI.MenuItem({caption:this.txtSortOption}),this.miSortOptions.on("click",_.bind(this.onSortOptions,this)),this.miSortCellColor=new Common.UI.MenuItem({caption:this.txtSortCellColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miSortFontColor=new Common.UI.MenuItem({caption:this.txtSortFontColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miNumFilter=new Common.UI.MenuItem({caption:this.txtNumFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10},{value:Asc.c_oAscDynamicAutoFilter.aboveAverage,caption:this.txtAboveAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:Asc.c_oAscDynamicAutoFilter.belowAverage,caption:this.txtBelowAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})});for(var i=this.miNumFilter.menu.items,n=0;n')}]})}),this.miFilterFontColor=new Common.UI.MenuItem({caption:this.txtFilterFontColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miClear=new Common.UI.MenuItem({caption:this.txtClear,checkable:!1}),this.miClear.on("click",_.bind(this.onClear,this)),this.miReapply=new Common.UI.MenuItem({caption:this.txtReapply,checkable:!1}),this.miReapply.on("click",_.bind(this.onReapply,this)),this.miReapplySeparator=new Common.UI.MenuItem({caption:"--"}),this.miValueFilter=new Common.UI.MenuItem({caption:this.txtValueFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:-3,caption:this.txtNotBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10,pivottype:"value"}]})}),this.miValueFilter.menu.on("item:click",_.bind(this.onValueFilterMenuClick,this)),this.miLabelFilter=new Common.UI.MenuItem({caption:this.txtLabelFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.beginsWith,caption:this.txtBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,caption:this.txtNotBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.endsWith,caption:this.txtEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,caption:this.txtNotEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.contains,caption:this.txtContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,caption:this.txtNotContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{caption:"--"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:-3,caption:this.txtNotBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"}]})}),this.miLabelFilter.menu.on("item:click",_.bind(this.onLabelFilterMenuClick,this)),this.filtersMenu=new Common.UI.Menu({items:[this.miSortLow2High,this.miSortHigh2Low,this.miSortOptions,this.miSortCellColor,this.miSortFontColor,{caption:"--"},this.miLabelFilter,this.miValueFilter,this.miNumFilter,this.miTextFilter,this.miFilterCellColor,this.miFilterFontColor,this.miClear,this.miReapplySeparator,this.miReapply]});var s=this.$window.find("#menu-container-filters");this.filtersMenu.render(s),this.filtersMenu.cmpEl.attr({tabindex:"-1"}),this.mnuSortColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-cells-color"),colors:[]}),this.mnuSortColorCellsPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFill)),this.mnuSortColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-font-color"),colors:[]}),this.mnuSortColorFontPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFont)),this.mnuFilterColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-cells-color"),colors:[]}),this.mnuFilterColorCellsPicker.on("select",_.bind(this.onFilterColorSelect,this,!0)),this.mnuFilterColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-font-color"),colors:[]}),this.mnuFilterColorFontPicker.on("select",_.bind(this.onFilterColorSelect,this,!1)),this.input=new Common.UI.InputField({el:$("#id-sd-cell-search",this.$window),allowBlank:!0,placeHolder:this.txtEmpty,validateOnChange:!0,validation:function(){return!0}}).on("changing",function(e,i){i.length?(i=i.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),t.filter=new RegExp(i,"ig")):t.filter=void 0,t.setupDataCells()}),this.cells=new Common.UI.DataViewStore,this.filterExcludeCells=new Common.UI.DataViewStore,this.cells&&(this.cellsList=new Common.UI.ListView({el:$("#id-dlg-filter-values",this.$window),store:this.cells,simpleAddMode:!0,template:_.template(['
'].join("")),itemTemplate:_.template(["
",'",'
','
<%= Common.Utils.String.htmlEncode(value) %>
','<% if (typeof count !=="undefined" && count) { %>','
<%= count%>
',"<% } %>","
","
"].join(""))}),this.cellsList.store.comparator=function(t,e){if("0"==t.get("groupid"))return-1;if("0"==e.get("groupid"))return 1;if("2"==t.get("groupid"))return-1;if("2"==e.get("groupid"))return 1;var i=t.get("intval"),n=e.get("intval"),s=void 0!==i;return s!==(void 0!==n)?s?-1:1:(!s&&(i=t.get("cellvalue").toLowerCase())&&(n=e.get("cellvalue").toLowerCase()),i==n?0:""==n||""!==i&&i1?r[1].asc_getOperator()||0:0,i=null===r[0].asc_getVal()?"":r[0].asc_getVal(),n=r.length>1?null===r[1].asc_getVal()?"":r[1].asc_getVal():""}if(-1!==t.value){var c=new Asc.CustomFilters;c.asc_setCustomFilters(-2==t.value||-3==t.value?[new Asc.CustomFilter,new Asc.CustomFilter]:[new Asc.CustomFilter]);var h=c.asc_getCustomFilters();if(h[0].asc_setOperator(-2==t.value?Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:-3==t.value?Asc.c_oAscCustomAutoFilter.isLessThan:t.value),-2==t.value){var d=s==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&o==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo;c.asc_setAnd(!d||a),h[0].asc_setVal(d?i:""),h[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),h[1].asc_setVal(d?n:"")}else if(-3==t.value){var p=s==Asc.c_oAscCustomAutoFilter.isLessThan&&o==Asc.c_oAscCustomAutoFilter.isGreaterThan;c.asc_setAnd(!!p&&a),h[0].asc_setVal(p?i:""),h[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThan),h[1].asc_setVal(p?n:"")}else c.asc_setAnd(!0),h[0].asc_setVal(t.value==s?i:"");e.asc_setFilter(c),e.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var m,u=this;m="label"==t.options.pivottype||"value"==t.options.pivottype?new SSE.Views.PivotDigitalFilterDialog({api:this.api,type:t.options.pivottype}).on({close:function(){u.close()}}):new SSE.Views.DigitalFilterDialog({api:this.api,type:"number"}).on({close:function(){u.close()}}),this.close(),m.setSettings(this.configTo),m.show()},onTextFilterMenuClick:function(t,e){var i=this.configTo.asc_getFilterObj(),n="",s=Asc.c_oAscCustomAutoFilter.equals;if(i.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var o=i.asc_getFilter(),a=o.asc_getCustomFilters();o.asc_getAnd(),s=a[0].asc_getOperator(),a.length>1?a[1].asc_getOperator()||0:0,n=null===a[0].asc_getVal()?"":a[0].asc_getVal(),a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():""}if(-1!==e.value){var l=new Asc.CustomFilters;l.asc_setCustomFilters([new Asc.CustomFilter]);var r=l.asc_getCustomFilters();l.asc_setAnd(!0),r[0].asc_setOperator(e.value),r[0].asc_setVal(e.value==s?n:""),i.asc_setFilter(l),i.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var c,h=this;c="label"==e.options.pivottype||"value"==e.options.pivottype?new SSE.Views.PivotDigitalFilterDialog({api:this.api,type:e.options.pivottype}).on({ close:function(){h.close()}}):new SSE.Views.DigitalFilterDialog({api:this.api,type:"text"}).on({close:function(){h.close()}}),this.close(),c.setSettings(this.configTo),c.show()},onNumDynamicFilterItemClick:function(t){var e=this.configTo.asc_getFilterObj();e.asc_getType()!==Asc.c_oAscAutoFilterTypes.DynamicFilter&&(e.asc_setFilter(new Asc.DynamicFilter),e.asc_setType(Asc.c_oAscAutoFilterTypes.DynamicFilter)),e.asc_getFilter().asc_setType(t.value),this.api.asc_applyAutoFilter(this.configTo),this.close()},onTop10FilterItemClick:function(t){var e=this,i=new SSE.Views.Top10FilterDialog({api:this.api,type:t.options.pivottype}).on({close:function(){e.close()}});this.close(),i.setSettings(this.configTo),i.show()},onLabelFilterMenuClick:function(t,e){e.value==Asc.c_oAscCustomAutoFilter.isGreaterThan||e.value==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo||e.value==Asc.c_oAscCustomAutoFilter.isLessThan||e.value==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo||-2==e.value||-3==e.value?this.onNumCustomFilterItemClick(e):this.onTextFilterMenuClick(t,e)},onValueFilterMenuClick:function(t,e){var i=this;this.configTo.asc_getPivotObj().asc_getDataFields().length<2?Common.UI.warning({title:this.textWarning,msg:this.warnFilterError,callback:function(){_.delay(function(){i.close()},10)}}):e.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters?this.onNumCustomFilterItemClick(e):this.onTop10FilterItemClick(e)},onFilterColorSelect:function(t,e,i){var n=this.configTo.asc_getFilterObj();n.asc_getType()!==Asc.c_oAscAutoFilterTypes.ColorFilter&&(n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter));var s=n.asc_getFilter();s.asc_setCellColor(!!t&&null),s.asc_setCColor(t&&"transparent"==i||!t&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i)),this.api.asc_applyAutoFilter(this.configTo),this.close()},onSortColorSelect:function(t,e,i){if(this.api&&this.configTo){var n=t==Asc.c_oAscSortOptions.ByColorFill;this.api.asc_sortColFilter(t,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName(),n&&"transparent"==i||!n&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i))}this.close()},onCellCheck:function(t,e,i){if(!this.checkCellTrigerBlock){var n="",s=!1,o=null,a=window.event?window.event:window._event;if(a){if(n=$(a.currentTarget).find(".list-item"),n.length){o=n.get(0).getBoundingClientRect();var l=a.clientX*Common.Utils.zoom(),r=a.clientY*Common.Utils.zoom();o.left1&&(s[parseInt(t.get("throughIndex"))]=i))});else{e.set("check",i),s[parseInt(e.get("throughIndex"))]=i;for(var o=i,a=0;a0;if(this.miSortFontColor.setVisible(m),this.miFilterFontColor.setVisible(!i&&m),m){var u=[];h.forEach(function(t,e){t?u.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):u.push("000000")}),this.mnuSortColorFontPicker.updateColors(u),this.mnuFilterColorFontPicker.updateColors(u),this.miFilterFontColor.setChecked(!1,!0),this.miSortFontColor.setChecked(d==Asc.c_oAscSortOptions.ByColorFont,!0),d==Asc.c_oAscSortOptions.ByColorFont&&this.mnuSortColorFontPicker.select(p||"000000",!0)}if(m=c&&c.length>0,this.miSortCellColor.setVisible(m),this.miFilterCellColor.setVisible(!i&&m),m){var u=[];c.forEach(function(t,e){t?u.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):u.push("transparent")}),this.mnuSortColorCellsPicker.updateColors(u),this.mnuFilterColorCellsPicker.updateColors(u),this.miFilterCellColor.setChecked(!1,!0),this.miSortCellColor.setChecked(d==Asc.c_oAscSortOptions.ByColorFill,!0),d==Asc.c_oAscSortOptions.ByColorFill&&this.mnuSortColorCellsPicker.select(p||"transparent",!0)}if(o){var g=s.asc_getFilter(),b=g.asc_getCustomFilters(),f=(g.asc_getAnd(),b[0].asc_getOperator()),C=b.length>1?b[1].asc_getOperator()||0:0,v=i?n?this.miValueFilter.menu.items:this.miLabelFilter.menu.items:r?this.miTextFilter.menu.items:this.miNumFilter.menu.items,_=!0;1==b.length?v.forEach(function(t){var e=t.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters&&t.value==f;t.setChecked(e,!0),e&&(_=!1)}):!i&&r||f!=Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo||C!=Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo?i&&f==Asc.c_oAscCustomAutoFilter.isLessThan&&C==Asc.c_oAscCustomAutoFilter.isGreaterThan&&(v[n?7:14].setChecked(!0,!0),_=!1):(v[i&&!n?13:6].setChecked(!0,!0),_=!1),_&&v[v.length-1].setChecked(!0,!0)}else if(this.initialFilterType===Asc.c_oAscAutoFilterTypes.ColorFilter){var y=s.asc_getFilter(),x=y.asc_getCColor();x&&(x=Common.Utils.ThemeColor.getHexColor(x.get_r(),x.get_g(),x.get_b()).toLocaleUpperCase()),null===y.asc_getCellColor()?(this.miFilterCellColor.setChecked(!0,!0),this.mnuFilterColorCellsPicker.select(x||"transparent",!0)):!1===y.asc_getCellColor()&&(this.miFilterFontColor.setChecked(!0,!0),this.mnuFilterColorFontPicker.select(x||"000000",!0))}else if(a||l){var w=a?s.asc_getFilter().asc_getType():null,v=i?this.miValueFilter.menu.items:this.miNumFilter.menu.items;v.forEach(function(t){t.setChecked(a&&t.options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter&&t.value==w||l&&t.options.type==Asc.c_oAscAutoFilterTypes.Top10,!0)})}this.miClear.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.miReapply.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.btnOk.setDisabled(this.initialFilterType!==Asc.c_oAscAutoFilterTypes.Filters&&this.initialFilterType!==Asc.c_oAscAutoFilterTypes.None),this.menuPanelWidth=t.innerWidth();var S=this.getWidth();S-this.menuPanelWidth<260&&(S=Math.ceil(this.menuPanelWidth+260),this.setResizable(!0,[S,this.initConfig.minheight])),Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(S=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0]+this.menuPanelWidth),i&&e.asc_getIsPageFilter()&&(this.setResizable(!0,[this.initConfig.minwidth-this.menuPanelWidth,this.initConfig.minheight]),t.addClass("hidden"),S-=this.menuPanelWidth,this.menuPanelWidth=0),this.setSize(S,this.getHeight())},setupDataCells:function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}var e,i,n,s=this,o=0,a=2,l=!0,r=!1,c=0,h=[],d=[],p=s.filter?s.filteredIndexes:s.throughIndexes;this.configTo.asc_getValues().forEach(function(r){i=r.asc_getText(),e=t(i),l=!0,n=r.asc_getRepeats?r.asc_getRepeats():void 0,s.filter?(null===i.match(s.filter)&&(l=!1),p[a]=l):void 0==p[a]&&(p[a]=r.asc_getVisible()),l?(h.push(new Common.UI.DataViewModel({id:++o,selected:!1,allowSelected:!0,cellvalue:i,value:e?i:i.length>0?i:s.textEmptyItem,intval:e?parseFloat(i):void 0,strval:e?"":i,groupid:"1",check:p[a],throughIndex:a,count:n?n.toString():""})),p[a]&&c++):d.push(new Common.UI.DataViewModel({cellvalue:i})),++a}),c==h.length?r=!0:c>0&&(r="indeterminate"),(s.filter||void 0==p[0])&&(p[0]=!0),(!s.filter||h.length>0)&&h.unshift(new Common.UI.DataViewModel({id:++o,selected:!1,allowSelected:!0,value:s.filter?this.textSelectAllResults:this.textSelectAll,groupid:"0",check:p[0],throughIndex:0})),s.filter&&h.length>1&&(void 0==p[1]&&(p[1]=!1),h.splice(1,0,new Common.UI.DataViewModel({id:++o,selected:!1,allowSelected:!0,value:this.textAddSelection,groupid:"2",check:p[1],throughIndex:1}))),this.cells.reset(h),this.filterExcludeCells.reset(d),this.cells.length&&(this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",r),this.checkCellTrigerBlock=void 0),this.btnOk.setDisabled(this.cells.length<1),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),this.cellsList.cmpEl.toggleClass("scroll-padding",this.cellsList.scroller.isVisible())},testFilter:function(){var t=this,e=!1;return this.cells&&(this.filter&&this.filteredIndexes[1]?e=!0:this.cells.forEach(function(t){if("1"==t.get("groupid")&&t.get("check"))return e=!0,!0})),e||(t._skipCheckDocumentClick=!0,Common.UI.warning({title:this.textWarning,msg:this.warnNoSelected,callback:function(){t._skipCheckDocumentClick=!1,_.delay(function(){t.input.focus()},100,this)}})),e},save:function(){if(this.api&&this.configTo&&this.cells&&this.filterExcludeCells){var t=this.configTo.asc_getValues(),e=!1;if(this.filter&&this.filteredIndexes[1])this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters&&t.forEach(function(t,e){t.asc_setVisible(!0)}),this.cells.each(function(e){"1"==e.get("groupid")&&t[parseInt(e.get("throughIndex"))-2].asc_setVisible(e.get("check"))}),t.forEach(function(t,i){if(t.asc_getVisible())return e=!0,!0});else{var i=this.filter?this.filteredIndexes:this.throughIndexes;t.forEach(function(t,e){t.asc_setVisible(i[e+2])}),e=!0}if(e){var n=this.configTo.asc_getPivotObj();n&&n.asc_getIsPageFilter()&&n.asc_setIsMultipleItemSelectionAllowed(!0),this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),this.api.asc_applyAutoFilter(this.configTo)}}},onPrimary:function(){return this.save(),this.close(),!1},onWindowResize:function(t){if(t&&"start"==t[1])this.curSize={resize:!1,height:this.getSize()[1]};else if(this.curSize.resize){var e=this.getSize();this.$window.find(".combo-values").css({height:e[1]-100+"px"}),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();t[1]!==this.curSize.height&&(this.curSize.resize||(this.curSize.resize=!0,this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!1,suppressScrollX:!0})),this.$window.find(".combo-values").css({height:t[1]-100+"px"}),this.curSize.height=t[1]),t[0]-=this.menuPanelWidth,Common.Utils.InternalSettings.set("sse-settings-size-filter-window",t)}},onItemChanged:function(t,e){var i=e.model.get("check");"indeterminate"==i?$("input[type=checkbox]",e.$el).prop("indeterminate",!0):$("input[type=checkbox]",e.$el).prop({checked:i,indeterminate:!1})},btnCustomFilter:"Custom Filter",textSelectAll:"Select All",txtTitle:"Filter",warnNoSelected:"You must choose at least one value",textWarning:"Warning",textEmptyItem:"{Blanks}",txtEmpty:"Enter cell's filter",txtSortLow2High:"Sort Lowest to Highest",txtSortHigh2Low:"Sort Highest to Lowest",txtSortCellColor:"Sort by cells color",txtSortFontColor:"Sort by font color",txtNumFilter:"Number filter",txtTextFilter:"Text filter",txtFilterCellColor:"Filter by cells color",txtFilterFontColor:"Filter by font color",txtClear:"Clear",txtReapply:"Reapply",txtEquals:"Equals...",txtNotEquals:"Does not equal...",txtGreater:"Greater than...",txtGreaterEquals:"Greater than or equal to...",txtLess:"Less than...",txtLessEquals:"Less than or equal to...",txtBetween:"Between...",txtTop10:"Top 10",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with...",txtNotBegins:"Does not begin with...",txtEnds:"Ends with...",txtNotEnds:"Does not end with...",txtContains:"Contains...",txtNotContains:"Does not contain...",textSelectAllResults:"Select All Search Results",textAddSelection:"Add current selection to filter",txtValueFilter:"Value filter",txtLabelFilter:"Label filter",warnFilterError:"You need at least one field in the Values area in order to apply a value filter.",txtNotBetween:"Not between...",txtSortOption:"More sort options..."},SSE.Views.AutoFilterDialog||{}))}),define("spreadsheeteditor/main/app/view/SpecialPasteDialog",["common/main/lib/util/utils","common/main/lib/component/RadioBox","common/main/lib/component/CheckBox","common/main/lib/view/AdvancedSettingsWindow"],function(){"use strict";SSE.Views.SpecialPasteDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:350,height:385},initialize:function(t){var e=this;_.extend(this.options,{title:this.textTitle,template:['
','
','
','',"",'","","",'",'","","",'",'","","",'",'","","",'",'","","",'",'","","",'",'","","",'","","",'",'","","",'",'","","",'",'","","",'","","",'",'","","
','","
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','","
','
',"
','
',"
','
',"
','
',"
','
',"
',"
',"
','
',"
','
',"
","
","
","
"].join("")},t),this.handler=t.handler,this.props=t.props,this._changedProps=null,this.isTable=!!t.isTable,Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.propControls=[],this.radioAll=new Common.UI.RadioBox({el:$("#paste-radio-all"),name:"asc-radio-paste",labelText:this.textAll,value:Asc.c_oSpecialPasteProps.paste,disabled:!0}),this.radioAll.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.paste]=this.radioAll,this.radioFormulas=new Common.UI.RadioBox({el:$("#paste-radio-formulas"),name:"asc-radio-paste",labelText:this.textFormulas,value:Asc.c_oSpecialPasteProps.pasteOnlyFormula,disabled:!0}),this.radioFormulas.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=this.radioFormulas,this.radioValues=new Common.UI.RadioBox({el:$("#paste-radio-values"),name:"asc-radio-paste",labelText:this.textValues,value:Asc.c_oSpecialPasteProps.pasteOnlyValues,disabled:!0}),this.radioValues.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.pasteOnlyValues]=this.radioValues,this.radioFormats=new Common.UI.RadioBox({el:$("#paste-radio-formats"),name:"asc-radio-paste",labelText:this.textFormats,value:Asc.c_oSpecialPasteProps.pasteOnlyFormating,disabled:!0}),this.radioFormats.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=this.radioFormats,this.radioComments=new Common.UI.RadioBox({el:$("#paste-radio-comments"),name:"asc-radio-paste",labelText:this.textComments,value:Asc.c_oSpecialPasteProps.comments,disabled:!0}),this.radioComments.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.comments]=this.radioComments,this.radioColWidth=new Common.UI.RadioBox({el:$("#paste-radio-col-width"),name:"asc-radio-paste",labelText:this.textColWidth,value:Asc.c_oSpecialPasteProps.columnWidth,disabled:!0}),this.radioColWidth.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.columnWidth]=this.radioColWidth,this.radioWBorders=new Common.UI.RadioBox({el:$("#paste-radio-without-borders"),name:"asc-radio-paste",labelText:this.textWBorders,value:Asc.c_oSpecialPasteProps.formulaWithoutBorders,disabled:!0}),this.radioWBorders.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=this.radioWBorders,this.radioFFormat=new Common.UI.RadioBox({el:$("#paste-radio-formula-formats"),name:"asc-radio-paste",labelText:this.textFFormat,value:Asc.c_oSpecialPasteProps.formulaAllFormatting,disabled:!0}),this.radioFFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaAllFormatting]=this.radioFFormat,this.radioFWidth=new Common.UI.RadioBox({el:$("#paste-radio-formula-col-width"),name:"asc-radio-paste",labelText:this.textFWidth,value:Asc.c_oSpecialPasteProps.formulaColumnWidth,disabled:!0}),this.radioFWidth.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaColumnWidth]=this.radioFWidth,this.radioFNFormat=new Common.UI.RadioBox({el:$("#paste-radio-formula-num-format"),name:"asc-radio-paste",labelText:this.textFNFormat,value:Asc.c_oSpecialPasteProps.formulaNumberFormat,disabled:!0}),this.radioFNFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaNumberFormat]=this.radioFNFormat,this.radioVNFormat=new Common.UI.RadioBox({el:$("#paste-radio-value-num-format"),name:"asc-radio-paste",labelText:this.textVNFormat,value:Asc.c_oSpecialPasteProps.valueNumberFormat,disabled:!0}),this.radioVNFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.valueNumberFormat]=this.radioVNFormat,this.radioVFormat=new Common.UI.RadioBox({el:$("#paste-radio-value-formats"),name:"asc-radio-paste",labelText:this.textVFormat,value:Asc.c_oSpecialPasteProps.valueAllFormating,disabled:!0}),this.radioVFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.valueAllFormating]=this.radioVFormat,this.radioNone=new Common.UI.RadioBox({el:$("#paste-radio-none"),name:"asc-radio-paste-operation",labelText:this.textNone,value:Asc.c_oSpecialPasteOperation.none,checked:!0}),this.radioNone.on("change",_.bind(this.onRadioOperationChange,this)),this.radioAdd=new Common.UI.RadioBox({el:$("#paste-radio-add"),name:"asc-radio-paste-operation",labelText:this.textAdd,value:Asc.c_oSpecialPasteOperation.add}),this.radioAdd.on("change",_.bind(this.onRadioOperationChange,this)),this.radioMult=new Common.UI.RadioBox({el:$("#paste-radio-mult"),name:"asc-radio-paste-operation",labelText:this.textMult,value:Asc.c_oSpecialPasteOperation.multiply}),this.radioMult.on("change",_.bind(this.onRadioOperationChange,this)),this.radioSub=new Common.UI.RadioBox({el:$("#paste-radio-sub"),name:"asc-radio-paste-operation",labelText:this.textSub,value:Asc.c_oSpecialPasteOperation.subtract}),this.radioSub.on("change",_.bind(this.onRadioOperationChange,this)),this.radioDiv=new Common.UI.RadioBox({el:$("#paste-radio-div"),name:"asc-radio-paste-operation",labelText:this.textDiv,value:Asc.c_oSpecialPasteOperation.divide}),this.radioDiv.on("change",_.bind(this.onRadioOperationChange,this)),this.chBlanks=new Common.UI.CheckBox({el:$("#paste-checkbox-blanks"),labelText:this.textBlanks}),this.chTranspose=new Common.UI.CheckBox({el:$("#paste-checkbox-transpose"),labelText:this.textTranspose}),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(t){var e=this;t&&_.each(t,function(t,i){e.propControls[t]&&e.propControls[t].setDisabled(!1)}),this._changedProps=new Asc.SpecialPasteProps,this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste),this._changedProps.asc_setOperation(Asc.c_oSpecialPasteOperation.none),this.radioAll.setValue(!0)},getSettings:function(){return this._changedProps&&(this._changedProps.asc_setTranspose("checked"==this.chTranspose.getValue()),this._changedProps.asc_setSkipBlanks("checked"==this.chBlanks.getValue())),this._changedProps},onDlgBtnClick:function(t){this._handleInput("object"==typeof t?t.currentTarget.attributes.result.value:t)},onPrimary:function(){return this._handleInput("ok"),!1},_handleInput:function(t){this.handler&&this.handler.call(this,t,"ok"==t?this.getSettings():void 0),this.close()},onRadioPasteChange:function(t,e,i){if(e&&this._changedProps){this._changedProps.asc_setProps(t.options.value);var n=t.options.value==Asc.c_oSpecialPasteProps.pasteOnlyFormating||t.options.value==Asc.c_oSpecialPasteProps.comments||t.options.value==Asc.c_oSpecialPasteProps.columnWidth,s=this.isTable&&!!this._changedProps.asc_getTableAllowed();this.radioNone.setDisabled(n||s),this.radioAdd.setDisabled(n||s),this.radioDiv.setDisabled(n||s),this.radioSub.setDisabled(n||s),this.radioMult.setDisabled(n||s),this.chBlanks.setDisabled(s),this.chTranspose.setDisabled(s)}},onRadioOperationChange:function(t,e,i){e&&this._changedProps&&this._changedProps.asc_setOperation(t.options.value)},textTitle:"Paste Special",textAll:"All",textFormulas:"Formulas",textValues:"Values",textFormats:"Formats",textComments:"Comments",textColWidth:"Column widths",textWBorders:"All except borders",textFFormat:"Formulas & formatting",textFWidth:"Formulas & column widths",textFNFormat:"Formulas & number formats",textVNFormat:"Values & number formats",textVFormat:"Values & formatting",textNone:"None",textAdd:"Add",textMult:"Multiply",textDiv:"Divide",textSub:"Subtract",textBlanks:"Skip blanks",textTranspose:"Transpose",textOperation:"Operation",textPaste:"Paste"},SSE.Views.SpecialPasteDialog||{}))}),define("text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template",[],function(){return'
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \x3c!--
--\x3e\n
\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n \n
\n \n
\n
\n
'}),void 0===Common)var Common={};define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['
','
','
',"
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store, itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=e.$el||$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=s.indexOf(t);if(l<0)return;var r=s.length,c=Math.floor(Math.max(o.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),h=[];o.height()/n.itemHeight>2&&(c*=Math.floor(o.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),define("spreadsheeteditor/main/app/view/SlicerSettingsAdvanced",["text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.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/ComboDataView"],function(t){"use strict";SSE.Views.SlicerSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:330,height:435,toggleGroup:"slicer-adv-settings-group",storageName:"sse-slicer-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-slicer-style",panelCaption:this.strStyleSize},{panelId:"id-adv-slicer-sorting",panelCaption:this.strSorting},{panelId:"id-adv-slicer-references",panelCaption:this.strReferences},{panelId:"id-adv-slicer-snap",panelCaption:this.textSnap},{panelId:"id-adv-slicer-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),this.options.handler=function(t,i){return"ok"==t&&!this.isNameValid()||void(e.handler&&e.handler.call(this,t,i))},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this._noApply=!0,this.spinners=[],this._nRatio=1,this._originalProps=this.options.imageProps},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.inputHeader=new Common.UI.InputField({el:$("#sliceradv-text-header"),allowBlank:!0,style:"width: 178px;"}).on("changed:after",function(){t.isCaptionChanged=!0}),this.chHeader=new Common.UI.CheckBox({el:$("#sliceradv-checkbox-header"),labelText:this.strShowHeader}),this.chHeader.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setShowCaption("checked"==t.getValue())},this)),this.btnSlicerStyle=new Common.UI.Button({parentEl:$("#sliceradv-btn-style"),cls:"btn-large-dataview sheet-template-slicer",iconCls:"icon-template-slicer",menu:new Common.UI.Menu({style:"width: 333px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('')}]})}),this.mnuSlicerPicker=new Common.UI.DataView({el:$("#sliceradv-menu-style"),parentMenu:this.btnSlicerStyle.menu,restoreHeight:325,groups:new Common.UI.DataViewGroupStore,store:new Common.UI.DataViewStore,itemTemplate:_.template('
'),style:"max-height: 325px;"}),this.mnuSlicerPicker.on("item:click",_.bind(this.onSelectSlicerStyle,this,this.btnSlicerStyle)),this.numWidth=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-width"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:5963.9,minValue:0}),this.numWidth.on("change",_.bind(function(t,e,i,n){if(this.btnRatio.pressed){var s=t.getNumberValue(),o=s/this._nRatio;o>this.numHeight.options.maxValue&&(o=this.numHeight.options.maxValue,s=o*this._nRatio,this.numWidth.setValue(s,!0)),this.numHeight.setValue(o,!0)}this._originalProps&&(this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.numHeight.getNumberValue())))},this)),this.spinners.push(this.numWidth),this.numHeight=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-height"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:5963.9,minValue:0}),this.numHeight.on("change",_.bind(function(t,e,i,n){var s=t.getNumberValue(),o=null;this.btnRatio.pressed&&(o=s*this._nRatio,o>this.numWidth.options.maxValue&&(o=this.numWidth.options.maxValue,s=o/this._nRatio,this.numHeight.setValue(s,!0)),this.numWidth.setValue(o,!0)),this._originalProps&&(this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.numWidth.getNumberValue())),this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numHeight),this.btnRatio=new Common.UI.Button({parentEl:$("#sliceradv-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.numHeight.getNumberValue()>0&&(this._nRatio=this.numWidth.getNumberValue()/this.numHeight.getNumberValue()),this._originalProps&&this._originalProps.asc_putLockAspect(t.pressed)},this)),this.numColHeight=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-col-height"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:5963.9,minValue:0}),this.numColHeight.on("change",_.bind(function(t,e,i,n){var s=t.getNumberValue();this._changedProps&&this._changedProps.asc_setRowHeight(36e3*Common.Utils.Metric.fnRecalcToMM(s))},this)),this.spinners.push(this.numColHeight),this.numCols=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-columns"),step:1,width:85,defaultUnit:"",defaultValue:1,value:"1",allowDecimal:!1,maxValue:2e4,minValue:1}),this.numCols.on("change",_.bind(function(t,e,i,n){var s=t.getNumberValue();this._changedProps&&this._changedProps.asc_setColumnCount(s)},this)),this.radioAsc=new Common.UI.RadioBox({el:$("#sliceradv-radio-asc"),name:"asc-radio-sliceradv-sort",labelText:this.textAsc,checked:!0}),this.radioAsc.on("change",_.bind(function(t,e,i){e&&this._changedProps&&this._changedProps.asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Ascending)},this)),this.radioDesc=new Common.UI.RadioBox({el:$("#sliceradv-radio-desc"),name:"asc-radio-sliceradv-sort",labelText:this.textDesc,checked:!1}),this.radioDesc.on("change",_.bind(function(t,e,i){e&&this._changedProps&&this._changedProps.asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Descending)},this)),this.chHideNoData=new Common.UI.CheckBox({el:$("#sliceradv-check-hide-nodata"),labelText:this.strHideNoData}),this.chHideNoData.on("change",_.bind(function(t,e,i,n){var s="checked"==t.getValue();this.chIndNoData.setDisabled(s),this.chShowNoData.setDisabled(s||"checked"!=this.chIndNoData.getValue()),this.chShowDel.setDisabled(s),this._changedProps&&this._changedProps.asc_setHideItemsWithNoData(s)},this)),this.chIndNoData=new Common.UI.CheckBox({el:$("#sliceradv-check-indicate-nodata"),labelText:this.strIndNoData}),this.chIndNoData.on("change",_.bind(function(t,e,i,n){var s="checked"==t.getValue();this.chShowNoData.setDisabled(!s),this._changedProps&&this._changedProps.asc_setIndicateItemsWithNoData(s)},this)),this.chShowNoData=new Common.UI.CheckBox({el:$("#sliceradv-check-show-nodata-last"),disabled:!0,labelText:this.strShowNoData}),this.chShowNoData.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setShowItemsWithNoDataLast("checked"==t.getValue())},this)),this.chShowDel=new Common.UI.CheckBox({el:$("#sliceradv-check-show-deleted"),labelText:this.strShowDel}),this.chShowDel.on("change",_.bind(function(t,e,i,n){this._changedProps},this)),this.inputName=new Common.UI.InputField({el:$("#sliceradv-text-name"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 178px;"}).on("changed:after",function(){t.isNameChanged=!0}),this.lblSource=$("#sliceradv-lbl-source"),this.lblFormula=$("#sliceradv-lbl-formula"),this.radioTwoCell=new Common.UI.RadioBox({el:$("#slicer-advanced-radio-twocell"),name:"asc-radio-snap",labelText:this.textTwoCell,value:AscCommon.c_oAscCellAnchorType.cellanchorTwoCell}),this.radioTwoCell.on("change",_.bind(this.onRadioSnapChange,this)),this.radioOneCell=new Common.UI.RadioBox({el:$("#slicer-advanced-radio-onecell"),name:"asc-radio-snap",labelText:this.textOneCell,value:AscCommon.c_oAscCellAnchorType.cellanchorOneCell}),this.radioOneCell.on("change",_.bind(this.onRadioSnapChange,this)),this.radioAbsolute=new Common.UI.RadioBox({el:$("#slicer-advanced-radio-absolute"),name:"asc-radio-snap",labelText:this.textAbsolute,value:AscCommon.c_oAscCellAnchorType.cellanchorAbsolute}),this.radioAbsolute.on("change",_.bind(this.onRadioSnapChange,this)),this.inputAltTitle=new Common.UI.InputField({el:$("#sliceradv-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},getFocusedComponents:function(){return[this.inputHeader,this.numWidth,this.numHeight,this.numCols,this.numColHeight,this.inputName,this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.inputHeader.focus();break;case 2:i.inputName.focus();break;case 4:i.inputAltTitle.focus()}},10)},getSettings:function(){return this.isCaptionChanged&&this._changedProps.asc_setCaption(this.inputHeader.getValue()),this.isNameChanged&&this._changedProps.asc_setName(this.inputName.getValue()),this.isAltTitleChanged&&this._originalProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._originalProps.asc_putDescription(this.textareaAltDescription.val()),{imageProps:this._originalProps}},_setDefaults:function(t){if(t){var e=t.asc_getWidth();switch(this.numWidth.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0),e=t.asc_getHeight(),this.numHeight.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0),t.asc_getHeight()>0&&(this._nRatio=t.asc_getWidth()/t.asc_getHeight()),e=t.asc_getLockAspect(),this.btnRatio.toggle(e),e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),e=t.asc_getAnchor()){case AscCommon.c_oAscCellAnchorType.cellanchorTwoCell:this.radioTwoCell.setValue(!0,!0);break;case AscCommon.c_oAscCellAnchorType.cellanchorOneCell:this.radioOneCell.setValue(!0,!0);break;case AscCommon.c_oAscCellAnchorType.cellanchorAbsolute:this.radioAbsolute.setValue(!0,!0)}var i=t.asc_getSlicerProperties();if(i){this._noApply=!0,this.numCols.setValue(i.asc_getColumnCount(),!0),this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(i.asc_getRowHeight()/36e3).toFixed(2),!0),this.inputHeader.setValue(i.asc_getCaption(),!0);var n=i.asc_getShowCaption();this.chHeader.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),this.radioAsc.setCaption(this.textAsc+" ("+this.textAZ+")"),this.radioDesc.setCaption(this.textDesc+" ("+this.textZA+")"),i.asc_getSortOrder()==Asc.ST_tabularSlicerCacheSortOrder.Ascending?this.radioAsc.setValue(!0,!0):this.radioDesc.setValue(!0,!0),n=i.asc_getIndicateItemsWithNoData(),this.chIndNoData.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),n=i.asc_getShowItemsWithNoDataLast(),this.chShowNoData.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),n=i.asc_getHideItemsWithNoData(),this.chHideNoData.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),this.chIndNoData.setDisabled(n),this.chShowNoData.setDisabled(n||"checked"!=this.chIndNoData.getValue()),this.chShowDel.setDisabled(n),e=i.asc_getName(),this.inputName.setValue(null!==e&&void 0!==e?e:""),this.inputName.setDisabled(null===e||void 0===e),this.lblSource.text(i.asc_getSourceName()),this.lblFormula.text(i.asc_getNameInFormulas()),e=i.asc_getStyle();var s=this.mnuSlicerPicker.store.findWhere({type:e});!s&&this.mnuSlicerPicker.store.length>0&&(s=this.mnuSlicerPicker.store.at(0)),s?(this.btnSlicerStyle.suspendEvents(),this.mnuSlicerPicker.selectRecord(s,!0),this.btnSlicerStyle.resumeEvents(),this.$window.find(".icon-template-slicer").css({"background-image":"url("+s.get("imageUrl")+")",height:"49px",width:"36px","background-position":"center","background-size":"cover"})):this.$window.find(".icon-template-slicer").css({height:"49px",width:"36px","background-position":"center","background-size":"cover"}),this._noApply=!1,this._changedProps=i}}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t0){n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var s=n.asc_getFilter();s.asc_setCellColor(1==e.value&&null),s.asc_setCColor(1==e.value?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{n.asc_setFilter(new Asc.CustomFilters),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var o=n.asc_getFilter();o.asc_setCustomFilters([new Asc.CustomFilter]),o.asc_setAnd(!0);o.asc_getCustomFilters()[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}i.asc_setFilterObj(n),this.api.asc_applyAutoFilterByType(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(t,e){this.api&&(this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(t){var e=this.getApplication().getController("FormulaDialog");e&&this.api&&e.showDialog(void 0,t.value==Asc.ETotalsRowFunction.totalrowfunctionCustom)},onInsHyperlink:function(t){var e,i,n=this;if(n.api){for(var s=n.api.asc_getWorksheetsCount(),o=-1,a=[];++o-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")))},onParagraphVAlign:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVerticalTextAlign(e.value),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVert(e.options.direction),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")}},onSelectBulletMenu:function(t,e){if(this.api)if(-1==e.options.value)this.api.asc_setListType(0,e.options.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type");else if("settings"==e.options.value){for(var i,n=this,s=n.api.asc_getGraphicObjectProps(),o=0;o0;r--)switch(t[r-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:e=r;break;case Asc.c_oAscMouseMoveType.Comment:i=r;break;case Asc.c_oAscMouseMoveType.LockedObject:n=r;break;case Asc.c_oAscMouseMoveType.ResizeColumn:s=r;break;case Asc.c_oAscMouseMoveType.ResizeRow:o=r;break;case Asc.c_oAscMouseMoveType.Filter:a=r;break;case Asc.c_oAscMouseMoveType.Tooltip:l=r}var c=this,h=[0,0],d=c.tooltips.coauth,p=c.tooltips.comment,m=c.tooltips.hyperlink,u=c.tooltips.row_column,g=c.tooltips.filter,b=c.tooltips.slicer,f=[c.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),c.documentHolder.cmpEl.offset().top-$(window).scrollTop()];if(e||c.hideHyperlinkTip(),void 0===s&&void 0===o&&!u.isHidden&&u.ref&&(u.ref.hide(),u.ref=void 0,u.text="",u.isHidden=!0),(c.permissions.isEdit||c.permissions.canViewComments)&&(!i||this.popupmenu)&&(p.moveCommentId=void 0,void 0!=p.viewCommentId)){p={};var C=this.getApplication().getController("Common.Controllers.Comments");C&&(this.permissions.canCoAuthoring&&this.permissions.canViewComments?setTimeout(function(){C.onApiHideComment(!0)},200):C.onApiHideComment(!0))}c.permissions.isEdit&&(n||c.hideCoAuthTips(),void 0===l&&!b.isHidden&&b.ref&&(b.ref.hide(),b.ref=void 0,b.text="",b.isHidden=!0)),(void 0===a||c.dlgFilter&&c.dlgFilter.isVisible()||c.currentMenu&&c.currentMenu.isVisible())&&!g.isHidden&&g.ref&&(g.ref.hide(),g.ref=void 0,g.text="",g.isHidden=!0);if(e){m.parentEl||(m.parentEl=$('
'),c.documentHolder.cmpEl.append(m.parentEl));var v=t[e-1],_=v.asc_getHyperlink();if(_.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var y=_.asc_getTooltip();y=y?Common.Utils.String.htmlEncode(y)+"
"+c.textCtrlClick+"":Common.Utils.String.htmlEncode(_.asc_getHyperlinkUrl())+"
"+c.textCtrlClick+""}else y=Common.Utils.String.htmlEncode(_.asc_getTooltip()||_.asc_getLocation()),y+="
"+c.textCtrlClick+"";if(m.ref&&m.ref.isVisible()&&m.text!=y&&(m.ref.hide(),m.ref=void 0,m.text="",m.isHidden=!0),!m.ref||!m.ref.isVisible()){m.text=y,m.ref=new Common.UI.Tooltip({owner:m.parentEl,html:!0,title:y}),m.ref.show([-1e4,-1e4]),m.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20,h[1]-=m.ref.getBSTip().$tip.height();var x=m.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x),m.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==s||void 0!==o){u.parentEl||(u.parentEl=$('
'),c.documentHolder.cmpEl.append(u.parentEl));var v=t[void 0!==s?s-1:o-1],w=Common.Utils.String.format(void 0!==s?this.textChangeColumnWidth:this.textChangeRowHeight,v.asc_getSizeCCOrPt().toFixed(2),v.asc_getSizePx().toFixed());if(u.ref&&u.ref.isVisible()&&u.text!=w&&(u.text=w,u.ref.setTitle(w),u.ref.updateTitle()),!u.ref||!u.ref.isVisible()){u.text=w,u.ref=new Common.UI.Tooltip({owner:u.parentEl,html:!0,title:w}),u.ref.show([-1e4,-1e4]),u.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-u.ttHeight;var x=u.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),u.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if((c.permissions.isEdit||c.permissions.canViewComments)&&i&&!this.popupmenu&&(v=t[i-1],!p.editCommentId&&p.moveCommentId!=v.asc_getCommentIndexes()[0])){p.moveCommentId=v.asc_getCommentIndexes()[0],p.moveCommentTimer&&clearTimeout(p.moveCommentTimer);var S=v.asc_getCommentIndexes(),A=v.asc_getX(),k=v.asc_getY(),T=v.asc_getReverseX();p.moveCommentTimer=setTimeout(function(){if(p.moveCommentId&&!p.editCommentId){p.viewCommentId=p.moveCommentId;var t=c.getApplication().getController("Common.Controllers.Comments");t&&(t.isSelectedComment||t.onApiShowComment(S,A,k,T,!1,!0))}},400)}if(c.permissions.isEdit&&n&&(v=t[n-1],d.XY||c.onDocumentResize(),d.x_point!=v.asc_getX()||d.y_point!=v.asc_getY())){c.hideCoAuthTips(),d.x_point=v.asc_getX(),d.y_point=v.asc_getY();var I=$(document.createElement("div")),E=v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;d.ref=I,I.addClass("username-tip"),I.css({height:d.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(I),h=[E?d.x_point+d.rightMenuWidth:d.bodyWidth-(d.x_point+d.XY[0]),d.y_point+d.XY[1]],h[1]>=d.XY[1]&&h[1]+d.ttHeight'),c.documentHolder.cmpEl.append(g.parentEl));var v=t[a-1],w=c.makeFilterTip(v.asc_getFilter());if(g.ref&&g.ref.isVisible()&&g.text!=w&&(g.text=w,g.ref.setTitle(w),g.ref.updateTitle()),!g.ref||!g.ref.isVisible()){g.text=w,g.ref=new Common.UI.Tooltip({owner:g.parentEl,html:!0,title:w,cls:"auto-tooltip"}),g.ref.show([-1e4,-1e4]),g.isHidden=!1,h=[v.asc_getX()+f[0]-10,v.asc_getY()+f[1]+20];g.ref.getBSTip().$tip.width();h[1]+g.ttHeight>c.tooltips.coauth.bodyHeight&&(h[1]=c.tooltips.coauth.bodyHeight-g.ttHeight-5,h[0]+=20);var x=g.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),g.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==l&&c.permissions.isEdit){b.parentEl||(b.parentEl=$('
'),c.documentHolder.cmpEl.append(b.parentEl));var v=t[l-1],w=v.asc_getTooltip();if(b.ref&&b.ref.isVisible()&&b.text!=w&&(b.text=w,b.ref.setTitle(w),b.ref.updateTitle()),!b.ref||!b.ref.isVisible()){b.text=w,b.ref=new Common.UI.Tooltip({owner:b.parentEl,html:!0,title:w}),b.ref.show([-1e4,-1e4]),b.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-b.ttHeight;var x=b.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),b.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=void 0},onApiHyperlinkClick:function(t){if(!t)return void Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});try{window.parent.APP.openURL(t)}catch(i){console.error(i);var e=window.open(t,"_blank");e&&e.focus()}},onApiAutofilter:function(t){var e=this;if(!e.tooltips.filter.isHidden&&e.tooltips.filter.ref&&(e.tooltips.filter.ref.hide(),e.tooltips.filter.ref=void 0,e.tooltips.filter.text="",e.tooltips.filter.isHidden=!0),e.permissions.isEdit)if(e.dlgFilter)e.dlgFilter.close();else{e.dlgFilter=new SSE.Views.AutoFilterDialog({api:this.api}).on({close:function(){e.api&&e.api.asc_enableKeyEvents(!0),e.dlgFilter=void 0}}),e.api&&e.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),e.dlgFilter.setSettings(t);var i=e.documentHolder.cmpEl.offset(),n=t.asc_getCellCoord(),s=n.asc_getX()+n.asc_getWidth()+i.left,o=n.asc_getY()+n.asc_getHeight()+i.top,a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight();s+e.dlgFilter.options.width>a&&(s=a-e.dlgFilter.options.width-5),o+e.dlgFilter.options.height>l&&(o=l-e.dlgFilter.options.height-5),e.dlgFilter.show(s,o)}},makeFilterTip:function(t){var e=t.asc_getFilterObj(),i=e.asc_getType(),n=(t.asc_getIsTextFilter(),t.asc_getColorsFill(),t.asc_getColorsFont(),"");if(i===Asc.c_oAscAutoFilterTypes.CustomFilters){var s=e.asc_getFilter(),o=s.asc_getCustomFilters();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[0].asc_getOperator())+' "'+o[0].asc_getVal()+'"',o.length>1&&(n=n+" "+(s.asc_getAnd()?this.txtAnd:this.txtOr),n=n+" "+this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[1].asc_getOperator())+' "'+o[1].asc_getVal()+'"')}else if(i===Asc.c_oAscAutoFilterTypes.ColorFilter){var a=e.asc_getFilter();null===a.asc_getCellColor()?n=this.txtEqualsToCellColor:!1===a.asc_getCellColor()&&(n=this.txtEqualsToFontColor)}else if(i===Asc.c_oAscAutoFilterTypes.DynamicFilter)n=this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter,e.asc_getFilter().asc_getType());else if(i===Asc.c_oAscAutoFilterTypes.Top10){var l=e.asc_getFilter(),r=l.asc_getPercent();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10,l.asc_getTop()),n+=" "+l.asc_getVal()+" "+(r||null===r?this.txtPercent:this.txtItems)}else if(i===Asc.c_oAscAutoFilterTypes.Filters){var c=0,h=0,d=void 0,p=t.asc_getValues();p.forEach(function(t){t.asc_getVisible()&&(h++,c<100&&t.asc_getText()&&(n+=t.asc_getText()+"; ",c=n.length)),t.asc_getText()||(d=t.asc_getVisible())}),h==p.length?n=this.txtAll:1==h&&d?n=this.txtEquals+' "'+this.txtBlanks+'"':h==p.length-1&&0==d?n=this.txtNotEquals+' "'+this.txtBlanks+'"':(d&&(n+=this.txtBlanks+"; "),n=this.txtEquals+' "'+n.substring(0,n.length-2)+'"')}else i===Asc.c_oAscAutoFilterTypes.None&&(n=this.txtAll);return n.length>100&&(n=n.substring(0,100)+"..."),n=""+(t.asc_getColumnName()||"("+this.txtColumn+" "+t.asc_getSheetColumnName()+")")+":
"+n},getFilterName:function(t,e){var i="";if(t==Asc.c_oAscAutoFilterTypes.CustomFilters)switch(e){case Asc.c_oAscCustomAutoFilter.equals:i=this.txtEquals;break;case Asc.c_oAscCustomAutoFilter.isGreaterThan:i=this.txtGreater;break;case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:i=this.txtGreaterEquals;break;case Asc.c_oAscCustomAutoFilter.isLessThan:i=this.txtLess;break;case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo:i=this.txtLessEquals;break;case Asc.c_oAscCustomAutoFilter.doesNotEqual:i=this.txtNotEquals;break;case Asc.c_oAscCustomAutoFilter.beginsWith:i=this.txtBegins;break;case Asc.c_oAscCustomAutoFilter.doesNotBeginWith:i=this.txtNotBegins;break;case Asc.c_oAscCustomAutoFilter.endsWith:i=this.txtEnds;break;case Asc.c_oAscCustomAutoFilter.doesNotEndWith:i=this.txtNotEnds;break;case Asc.c_oAscCustomAutoFilter.contains:i=this.txtContains;break;case Asc.c_oAscCustomAutoFilter.doesNotContain:i=this.txtNotContains}else if(t==Asc.c_oAscAutoFilterTypes.DynamicFilter)switch(e){case Asc.c_oAscDynamicAutoFilter.aboveAverage:i=this.txtAboveAve;break;case Asc.c_oAscDynamicAutoFilter.belowAverage:i=this.txtBelowAve}else t==Asc.c_oAscAutoFilterTypes.Top10&&(i=e||null===e?this.txtFilterTop:this.txtFilterBottom);return i},onUndo:function(){this.api&&(this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder))},onApiContextMenu:function(t){var e=this;_.delay(function(){e.showObjectMenu.call(e,t)},10)},onAfterRender:function(t){},onDocumentResize:function(t){var e=this;e.documentHolder&&(e.tooltips.coauth.XY=[e.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),e.documentHolder.cmpEl.offset().top-$(window).scrollTop()],e.tooltips.coauth.apiHeight=e.documentHolder.cmpEl.height(),e.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),e.tooltips.coauth.bodyWidth=$(window).width(),e.tooltips.coauth.bodyHeight=$(window).height())},onDocumentWheel:function(t){if(this.api&&!this.isEditCell){var e=_.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;if(_.isUndefined(e)&&(e=t.deltaY),(t.ctrlKey||t.metaKey)&&!t.altKey){var i=this.api.asc_getZoom();e<0?(i=Math.ceil(10*i)/10,(i-=.1)<.5||this.api.asc_setZoom(i)):e>0&&(i=Math.floor(10*i)/10,(i+=.1)>0&&!(i>2)&&this.api.asc_setZoom(i)),t.preventDefault(),t.stopPropagation()}}},onDocumentKeyDown:function(t){if(this.api){var e=t.keyCode;if(!t.ctrlKey&&!t.metaKey||t.shiftKey||t.altKey){if(e==Common.UI.Keys.F10&&t.shiftKey)return this.showObjectMenu(t),t.preventDefault(),t.stopPropagation(),!1}else if(e===Common.UI.Keys.NUM_PLUS||e===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&e===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==e){if(!this.api.isCellEdited){var i=Math.floor(10*this.api.asc_getZoom())/10;return i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}}else if(e===Common.UI.Keys.NUM_MINUS||e===Common.UI.Keys.MINUS||Common.Utils.isGecko&&e===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==e){if(!this.api.isCellEdited)return i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,i<.5||this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}else if((48===e||96===e)&&!this.api.isCellEdited)return this.api.asc_setZoom(1),t.preventDefault(),t.stopPropagation(),!1}},onDocumentRightDown:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!1)},onProcessMouse:function(t){"mouseup"==t.type&&(this.mouse.isLeftButtonDown=!1)},onDragEndMouseUp:function(){this.mouse.isLeftButtonDown=!1},onDocumentMouseMove:function(t){"canvas"!==t.target.localName&&this.hideHyperlinkTip()},showObjectMenu:function(t){!this.api||this.mouse.isLeftButtonDown||this.rangeSelectionMode||(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(this.api.asc_getCellInfo(),!0,t):this.fillViewMenuProps(this.api.asc_getCellInfo(),!0,t))},onSelectionChanged:function(t){!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(t,!0):this.fillViewMenuProps(t,!0))},fillMenuProps:function(t,e,i){var n,s,o,a,l,r,c,h,d,p,m,u=this.documentHolder,g=t.asc_getSelectionType(),b=t.asc_getLocked(),f=!0===t.asc_getLockedTable(),C=!1,v=this.getApplication().getController("Common.Controllers.Comments"),y=this.permissions.isEditMailMerge||this.permissions.isEditDiagram,x=t.asc_getXfs();switch(g){case Asc.c_oAscSelectionType.RangeCells:n=!0;break;case Asc.c_oAscSelectionType.RangeRow:s=!0;break;case Asc.c_oAscSelectionType.RangeCol:o=!0;break;case Asc.c_oAscSelectionType.RangeMax:a=!0;break;case Asc.c_oAscSelectionType.RangeSlicer:case Asc.c_oAscSelectionType.RangeImage:r=!y;break;case Asc.c_oAscSelectionType.RangeShape:h=!y;break;case Asc.c_oAscSelectionType.RangeChart:l=!y;break;case Asc.c_oAscSelectionType.RangeChartText:d=!y;break;case Asc.c_oAscSelectionType.RangeShapeText:c=!y}if(this.api.asc_getHeaderFooterMode()){if(!u.copyPasteMenu||!e&&!u.copyPasteMenu.isVisible())return;e&&this.showPopupMenu(u.copyPasteMenu,{},i)}else if(r||h||l){if(!u.imgMenu||!e&&!u.imgMenu.isVisible())return;r=h=l=m=!1,u.mnuImgAdvanced.imageInfo=void 0;for(var w,S=!1,A=this.api.asc_getGraphicObjectProps(),k=0;k-1),u.menuImageArrange.setDisabled(C),u.menuImgRotate.setVisible(!(l||null!==P&&void 0!==P||m)),u.menuImgRotate.setDisabled(C),u.menuImgCrop.setVisible(this.api.asc_canEditCrop()),u.menuImgCrop.setDisabled(C);var V=!!w;u.menuSignatureEditSign.setVisible(V),u.menuSignatureEditSetup.setVisible(V),u.menuEditSignSeparator.setVisible(V),e&&this.showPopupMenu(u.imgMenu,{},i),u.mnuShapeSeparator.setVisible(u.mnuShapeAdvanced.isVisible()||u.mnuChartEdit.isVisible()||u.mnuImgAdvanced.isVisible()),u.mnuSlicerSeparator.setVisible(u.mnuSlicerAdvanced.isVisible()),V&&(u.menuSignatureEditSign.cmpEl.attr("data-value",w),u.menuSignatureEditSetup.cmpEl.attr("data-value",w))}else if(c||d){if(!u.textInShapeMenu||!e&&!u.textInShapeMenu.isVisible())return;u.pmiTextAdvanced.textInfo=void 0;for(var A=this.api.asc_getGraphicObjectProps(),M=!1,k=0;k0){n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var s=n.asc_getFilter();s.asc_setCellColor(1==e.value&&null),s.asc_setCColor(1==e.value?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{n.asc_setFilter(new Asc.CustomFilters),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var o=n.asc_getFilter();o.asc_setCustomFilters([new Asc.CustomFilter]),o.asc_setAnd(!0);o.asc_getCustomFilters()[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}i.asc_setFilterObj(n),this.api.asc_applyAutoFilterByType(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(t,e){this.api&&(this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(t){var e=this.getApplication().getController("FormulaDialog");e&&this.api&&e.showDialog(void 0,t.value==Asc.ETotalsRowFunction.totalrowfunctionCustom)},onInsHyperlink:function(t){var e,i,n=this;if(n.api){for(var s=n.api.asc_getWorksheetsCount(),o=-1,a=[];++o-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")))},onParagraphVAlign:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVerticalTextAlign(e.value),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVert(e.options.direction),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")}},onSelectBulletMenu:function(t,e){if(this.api)if(-1==e.options.value)this.api.asc_setListType(0,e.options.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type");else if("settings"==e.options.value){for(var i,n=this,s=n.api.asc_getGraphicObjectProps(),o=0;o0;r--)switch(t[r-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:e=r;break;case Asc.c_oAscMouseMoveType.Comment:i=r;break;case Asc.c_oAscMouseMoveType.LockedObject:n=r;break;case Asc.c_oAscMouseMoveType.ResizeColumn:s=r;break;case Asc.c_oAscMouseMoveType.ResizeRow:o=r;break;case Asc.c_oAscMouseMoveType.Filter:a=r;break;case Asc.c_oAscMouseMoveType.Tooltip:l=r}var c=this,h=[0,0],d=c.tooltips.coauth,p=c.tooltips.comment,m=c.tooltips.hyperlink,u=c.tooltips.row_column,g=c.tooltips.filter,b=c.tooltips.slicer,f=[c.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),c.documentHolder.cmpEl.offset().top-$(window).scrollTop()];if(e||c.hideHyperlinkTip(),void 0===s&&void 0===o&&!u.isHidden&&u.ref&&(u.ref.hide(),u.ref=void 0,u.text="",u.isHidden=!0),(c.permissions.isEdit||c.permissions.canViewComments)&&(!i||this.popupmenu)&&(p.moveCommentId=void 0,void 0!=p.viewCommentId)){p={};var C=this.getApplication().getController("Common.Controllers.Comments");C&&(this.permissions.canCoAuthoring&&this.permissions.canViewComments?setTimeout(function(){C.onApiHideComment(!0)},200):C.onApiHideComment(!0))}c.permissions.isEdit&&(n||c.hideCoAuthTips(),void 0===l&&!b.isHidden&&b.ref&&(b.ref.hide(),b.ref=void 0,b.text="",b.isHidden=!0)),(void 0===a||c.dlgFilter&&c.dlgFilter.isVisible()||c.currentMenu&&c.currentMenu.isVisible())&&!g.isHidden&&g.ref&&(g.ref.hide(),g.ref=void 0,g.text="",g.isHidden=!0);if(e){m.parentEl||(m.parentEl=$('
'),c.documentHolder.cmpEl.append(m.parentEl));var v=t[e-1],_=v.asc_getHyperlink();if(_.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var y=_.asc_getTooltip();y=y?Common.Utils.String.htmlEncode(y)+"
"+c.textCtrlClick+"":Common.Utils.String.htmlEncode(_.asc_getHyperlinkUrl())+"
"+c.textCtrlClick+""}else y=Common.Utils.String.htmlEncode(_.asc_getTooltip()||_.asc_getLocation()),y+="
"+c.textCtrlClick+"";if(m.ref&&m.ref.isVisible()&&m.text!=y&&(m.ref.hide(),m.ref=void 0,m.text="",m.isHidden=!0),!m.ref||!m.ref.isVisible()){m.text=y,m.ref=new Common.UI.Tooltip({owner:m.parentEl,html:!0,title:y}),m.ref.show([-1e4,-1e4]),m.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20,h[1]-=m.ref.getBSTip().$tip.height();var x=m.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x),m.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==s||void 0!==o){u.parentEl||(u.parentEl=$('
'),c.documentHolder.cmpEl.append(u.parentEl));var v=t[void 0!==s?s-1:o-1],w=Common.Utils.String.format(void 0!==s?this.textChangeColumnWidth:this.textChangeRowHeight,v.asc_getSizeCCOrPt().toFixed(2),v.asc_getSizePx().toFixed());if(u.ref&&u.ref.isVisible()&&u.text!=w&&(u.text=w,u.ref.setTitle(w),u.ref.updateTitle()),!u.ref||!u.ref.isVisible()){u.text=w,u.ref=new Common.UI.Tooltip({owner:u.parentEl,html:!0,title:w}),u.ref.show([-1e4,-1e4]),u.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-u.ttHeight;var x=u.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),u.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if((c.permissions.isEdit||c.permissions.canViewComments)&&i&&!this.popupmenu&&(v=t[i-1],!p.editCommentId&&p.moveCommentId!=v.asc_getCommentIndexes()[0])){p.moveCommentId=v.asc_getCommentIndexes()[0],p.moveCommentTimer&&clearTimeout(p.moveCommentTimer);var S=v.asc_getCommentIndexes(),A=v.asc_getX(),k=v.asc_getY(),T=v.asc_getReverseX();p.moveCommentTimer=setTimeout(function(){if(p.moveCommentId&&!p.editCommentId){p.viewCommentId=p.moveCommentId;var t=c.getApplication().getController("Common.Controllers.Comments");t&&(t.isSelectedComment||t.onApiShowComment(S,A,k,T,!1,!0))}},400)}if(c.permissions.isEdit&&n&&(v=t[n-1],d.XY||c.onDocumentResize(),d.x_point!=v.asc_getX()||d.y_point!=v.asc_getY())){c.hideCoAuthTips(),d.x_point=v.asc_getX(),d.y_point=v.asc_getY();var I=$(document.createElement("div")),E=v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;d.ref=I,I.addClass("username-tip"),I.css({height:d.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(I),h=[E?d.x_point+d.rightMenuWidth:d.bodyWidth-(d.x_point+d.XY[0]),d.y_point+d.XY[1]],h[1]>=d.XY[1]&&h[1]+d.ttHeight'),c.documentHolder.cmpEl.append(g.parentEl));var v=t[a-1],w=c.makeFilterTip(v.asc_getFilter());if(g.ref&&g.ref.isVisible()&&g.text!=w&&(g.text=w,g.ref.setTitle(w),g.ref.updateTitle()),!g.ref||!g.ref.isVisible()){g.text=w,g.ref=new Common.UI.Tooltip({owner:g.parentEl,html:!1,title:w,cls:"auto-tooltip"}),g.ref.show([-1e4,-1e4]),g.isHidden=!1,h=[v.asc_getX()+f[0]-10,v.asc_getY()+f[1]+20];g.ref.getBSTip().$tip.width();h[1]+g.ttHeight>c.tooltips.coauth.bodyHeight&&(h[1]=c.tooltips.coauth.bodyHeight-g.ttHeight-5,h[0]+=20);var x=g.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),g.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==l&&c.permissions.isEdit){b.parentEl||(b.parentEl=$('
'),c.documentHolder.cmpEl.append(b.parentEl));var v=t[l-1],w=v.asc_getTooltip();if(b.ref&&b.ref.isVisible()&&b.text!=w&&(b.text=w,b.ref.setTitle(w),b.ref.updateTitle()),!b.ref||!b.ref.isVisible()){b.text=w,b.ref=new Common.UI.Tooltip({owner:b.parentEl,html:!0,title:w}),b.ref.show([-1e4,-1e4]),b.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-b.ttHeight;var x=b.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),b.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=void 0},onApiHyperlinkClick:function(t){if(!t)return void Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});try{window.parent.APP.openURL(t)}catch(i){console.error(i);var e=window.open(t,"_blank");e&&e.focus()}},onApiAutofilter:function(t){var e=this;if(!e.tooltips.filter.isHidden&&e.tooltips.filter.ref&&(e.tooltips.filter.ref.hide(),e.tooltips.filter.ref=void 0,e.tooltips.filter.text="",e.tooltips.filter.isHidden=!0),e.permissions.isEdit)if(e.dlgFilter)e.dlgFilter.close();else{e.dlgFilter=new SSE.Views.AutoFilterDialog({api:this.api}).on({close:function(){e.api&&e.api.asc_enableKeyEvents(!0),e.dlgFilter=void 0}}),e.api&&e.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),e.dlgFilter.setSettings(t);var i=e.documentHolder.cmpEl.offset(),n=t.asc_getCellCoord(),s=n.asc_getX()+n.asc_getWidth()+i.left,o=n.asc_getY()+n.asc_getHeight()+i.top,a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight();s+e.dlgFilter.options.width>a&&(s=a-e.dlgFilter.options.width-5),o+e.dlgFilter.options.height>l&&(o=l-e.dlgFilter.options.height-5),e.dlgFilter.show(s,o)}},makeFilterTip:function(t){var e=t.asc_getFilterObj(),i=e.asc_getType(),n=(t.asc_getIsTextFilter(),t.asc_getColorsFill(),t.asc_getColorsFont(),"");if(i===Asc.c_oAscAutoFilterTypes.CustomFilters){var s=e.asc_getFilter(),o=s.asc_getCustomFilters();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[0].asc_getOperator())+' "'+o[0].asc_getVal()+'"',o.length>1&&(n=n+" "+(s.asc_getAnd()?this.txtAnd:this.txtOr),n=n+" "+this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[1].asc_getOperator())+' "'+o[1].asc_getVal()+'"')}else if(i===Asc.c_oAscAutoFilterTypes.ColorFilter){var a=e.asc_getFilter();null===a.asc_getCellColor()?n=this.txtEqualsToCellColor:!1===a.asc_getCellColor()&&(n=this.txtEqualsToFontColor)}else if(i===Asc.c_oAscAutoFilterTypes.DynamicFilter)n=this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter,e.asc_getFilter().asc_getType());else if(i===Asc.c_oAscAutoFilterTypes.Top10){var l=e.asc_getFilter(),r=l.asc_getPercent();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10,l.asc_getTop()),n+=" "+l.asc_getVal()+" "+(r||null===r?this.txtPercent:this.txtItems)}else if(i===Asc.c_oAscAutoFilterTypes.Filters){var c=0,h=0,d=void 0,p=t.asc_getValues();p.forEach(function(t){t.asc_getVisible()&&(h++,c<100&&t.asc_getText()&&(n+=t.asc_getText()+"; ",c=n.length)),t.asc_getText()||(d=t.asc_getVisible())}),h==p.length?n=this.txtAll:1==h&&d?n=this.txtEquals+' "'+this.txtBlanks+'"':h==p.length-1&&0==d?n=this.txtNotEquals+' "'+this.txtBlanks+'"':(d&&(n+=this.txtBlanks+"; "),n=this.txtEquals+' "'+n.substring(0,n.length-2)+'"')}else i===Asc.c_oAscAutoFilterTypes.None&&(n=this.txtAll);return n.length>100&&(n=n.substring(0,100)+"..."),n=""+(t.asc_getColumnName()||"("+this.txtColumn+" "+t.asc_getSheetColumnName()+")")+":
"+n},getFilterName:function(t,e){var i="";if(t==Asc.c_oAscAutoFilterTypes.CustomFilters)switch(e){case Asc.c_oAscCustomAutoFilter.equals:i=this.txtEquals;break;case Asc.c_oAscCustomAutoFilter.isGreaterThan:i=this.txtGreater;break;case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:i=this.txtGreaterEquals;break;case Asc.c_oAscCustomAutoFilter.isLessThan:i=this.txtLess;break;case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo:i=this.txtLessEquals;break;case Asc.c_oAscCustomAutoFilter.doesNotEqual:i=this.txtNotEquals;break;case Asc.c_oAscCustomAutoFilter.beginsWith:i=this.txtBegins;break;case Asc.c_oAscCustomAutoFilter.doesNotBeginWith:i=this.txtNotBegins;break;case Asc.c_oAscCustomAutoFilter.endsWith:i=this.txtEnds;break;case Asc.c_oAscCustomAutoFilter.doesNotEndWith:i=this.txtNotEnds;break;case Asc.c_oAscCustomAutoFilter.contains:i=this.txtContains;break;case Asc.c_oAscCustomAutoFilter.doesNotContain:i=this.txtNotContains}else if(t==Asc.c_oAscAutoFilterTypes.DynamicFilter)switch(e){case Asc.c_oAscDynamicAutoFilter.aboveAverage:i=this.txtAboveAve;break;case Asc.c_oAscDynamicAutoFilter.belowAverage:i=this.txtBelowAve}else t==Asc.c_oAscAutoFilterTypes.Top10&&(i=e||null===e?this.txtFilterTop:this.txtFilterBottom);return i},onUndo:function(){this.api&&(this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder))},onApiContextMenu:function(t){var e=this;_.delay(function(){e.showObjectMenu.call(e,t)},10)},onAfterRender:function(t){},onDocumentResize:function(t){var e=this;e.documentHolder&&(e.tooltips.coauth.XY=[e.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),e.documentHolder.cmpEl.offset().top-$(window).scrollTop()],e.tooltips.coauth.apiHeight=e.documentHolder.cmpEl.height(),e.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),e.tooltips.coauth.bodyWidth=$(window).width(),e.tooltips.coauth.bodyHeight=$(window).height())},onDocumentWheel:function(t){if(this.api&&!this.isEditCell){var e=_.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;if(_.isUndefined(e)&&(e=t.deltaY),(t.ctrlKey||t.metaKey)&&!t.altKey){var i=this.api.asc_getZoom();e<0?(i=Math.ceil(10*i)/10,(i-=.1)<.5||this.api.asc_setZoom(i)):e>0&&(i=Math.floor(10*i)/10,(i+=.1)>0&&!(i>2)&&this.api.asc_setZoom(i)),t.preventDefault(),t.stopPropagation()}}},onDocumentKeyDown:function(t){if(this.api){var e=t.keyCode;if(!t.ctrlKey&&!t.metaKey||t.shiftKey||t.altKey){if(e==Common.UI.Keys.F10&&t.shiftKey)return this.showObjectMenu(t),t.preventDefault(),t.stopPropagation(),!1}else if(e===Common.UI.Keys.NUM_PLUS||e===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&e===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==e){if(!this.api.isCellEdited){var i=Math.floor(10*this.api.asc_getZoom())/10;return i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}}else if(e===Common.UI.Keys.NUM_MINUS||e===Common.UI.Keys.MINUS||Common.Utils.isGecko&&e===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==e){if(!this.api.isCellEdited)return i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,i<.5||this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}else if((48===e||96===e)&&!this.api.isCellEdited)return this.api.asc_setZoom(1),t.preventDefault(),t.stopPropagation(),!1}},onDocumentRightDown:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!1)},onProcessMouse:function(t){"mouseup"==t.type&&(this.mouse.isLeftButtonDown=!1)},onDragEndMouseUp:function(){this.mouse.isLeftButtonDown=!1},onDocumentMouseMove:function(t){"canvas"!==t.target.localName&&this.hideHyperlinkTip()},showObjectMenu:function(t){!this.api||this.mouse.isLeftButtonDown||this.rangeSelectionMode||(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(this.api.asc_getCellInfo(),!0,t):this.fillViewMenuProps(this.api.asc_getCellInfo(),!0,t))},onSelectionChanged:function(t){!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(t,!0):this.fillViewMenuProps(t,!0))},fillMenuProps:function(t,e,i){var n,s,o,a,l,r,c,h,d,p,m,u=this.documentHolder,g=t.asc_getSelectionType(),b=t.asc_getLocked(),f=!0===t.asc_getLockedTable(),C=!1,v=this.getApplication().getController("Common.Controllers.Comments"),y=this.permissions.isEditMailMerge||this.permissions.isEditDiagram,x=t.asc_getXfs();switch(g){case Asc.c_oAscSelectionType.RangeCells:n=!0;break;case Asc.c_oAscSelectionType.RangeRow:s=!0;break;case Asc.c_oAscSelectionType.RangeCol:o=!0;break;case Asc.c_oAscSelectionType.RangeMax:a=!0;break;case Asc.c_oAscSelectionType.RangeSlicer:case Asc.c_oAscSelectionType.RangeImage:r=!y;break;case Asc.c_oAscSelectionType.RangeShape:h=!y;break;case Asc.c_oAscSelectionType.RangeChart:l=!y;break;case Asc.c_oAscSelectionType.RangeChartText:d=!y;break;case Asc.c_oAscSelectionType.RangeShapeText:c=!y}if(this.api.asc_getHeaderFooterMode()){if(!u.copyPasteMenu||!e&&!u.copyPasteMenu.isVisible())return;e&&this.showPopupMenu(u.copyPasteMenu,{},i)}else if(r||h||l){if(!u.imgMenu||!e&&!u.imgMenu.isVisible())return;r=h=l=m=!1,u.mnuImgAdvanced.imageInfo=void 0;for(var w,S=!1,A=this.api.asc_getGraphicObjectProps(),k=0;k-1),u.menuImageArrange.setDisabled(C),u.menuImgRotate.setVisible(!(l||null!==P&&void 0!==P||m)),u.menuImgRotate.setDisabled(C),u.menuImgCrop.setVisible(this.api.asc_canEditCrop()),u.menuImgCrop.setDisabled(C);var V=!!w;u.menuSignatureEditSign.setVisible(V),u.menuSignatureEditSetup.setVisible(V),u.menuEditSignSeparator.setVisible(V),e&&this.showPopupMenu(u.imgMenu,{},i),u.mnuShapeSeparator.setVisible(u.mnuShapeAdvanced.isVisible()||u.mnuChartEdit.isVisible()||u.mnuImgAdvanced.isVisible()),u.mnuSlicerSeparator.setVisible(u.mnuSlicerAdvanced.isVisible()),V&&(u.menuSignatureEditSign.cmpEl.attr("data-value",w),u.menuSignatureEditSetup.cmpEl.attr("data-value",w))}else if(c||d){if(!u.textInShapeMenu||!e&&!u.textInShapeMenu.isVisible())return;u.pmiTextAdvanced.textInfo=void 0;for(var A=this.api.asc_getGraphicObjectProps(),M=!1,k=0;k',t.id)),s.cmpEl.append(a)),t.render(a),t.cmpEl.attr({tabindex:"-1"})),2!==i.button){var l=n.api.asc_getActiveCellCoord(),r={left:0,top:0};o[0]=l.asc_getX()+l.asc_getWidth()+r.left,o[1]=(l.asc_getY()<0?0:l.asc_getY())+l.asc_getHeight()+r.top}a.css({left:o[0],top:o[1]}),_.isFunction(t.options.initMenu)&&(t.options.initMenu(e),t.alignPosition()),_.delay(function(){t.cmpEl.focus()},10),t.show(),n.currentMenu=t}},onEntriesListMenu:function(t,e,i){if(e&&e.length>0){var n=this,s=n.documentHolder,o=s.entriesMenu,a=s.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",o.id));if(t&&o.isVisible())return void o.hide();for(var l=0;l',o.id)),s.cmpEl.append(a)),o.render(a),o.cmpEl.attr({tabindex:"-1"}));var r=n.api.asc_getActiveCellCoord(),c={left:0,top:0},h=[r.asc_getX()+c.left,(r.asc_getY()<0?0:r.asc_getY())+r.asc_getHeight()+c.top];a.css({left:h[0],top:h[1]}),n._preventClick=t,t&&a.attr("data-value","prevent-canvas-click"),o.show(),o.alignPosition(),_.delay(function(){o.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),!t&&Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onTableTotalMenu:function(t){if(void 0!==t){var e=this,i=e.documentHolder,n=i.tableTotalMenu,s=i.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",n.id));if(n.isVisible())return void n.hide();Common.UI.Menu.Manager.hideAll(),n.rendered||(s.length<1&&(s=$(Common.Utils.String.format('',n.id)),i.cmpEl.append(s)),n.render(s),n.cmpEl.attr({tabindex:"-1"})),n.clearAll();var o=_.find(n.items,function(e){return e.value==t});o&&o.setChecked(!0,!0);var a=e.api.asc_getActiveCellCoord(),l={left:0,top:0},r=[a.asc_getX()+l.left,(a.asc_getY()<0?0:a.asc_getY())+a.asc_getHeight()+l.top];s.css({left:r[0],top:r[1]}),e._preventClick=!0,s.attr("data-value","prevent-canvas-click"),n.show(),n.alignPosition(),_.delay(function(){n.cmpEl.focus()},10)}else this.documentHolder.tableTotalMenu.hide()},onTotalMenuClick:function(t,e){e.value==Asc.ETotalsRowFunction.totalrowfunctionCustom?this.onInsFunction(e):this.api.asc_insertInCell(e.value,Asc.c_oAscPopUpSelectorType.TotalRowFunc),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onFormulaCompleteMenu:function(t){if(this.documentHolder.funcMenu&&!Common.Utils.ModalWindow.isVisible()&&!this.rangeSelectionMode)if(t){for(var e=this,i=e.documentHolder,n=i.funcMenu,s=i.cmpEl.find("#menu-formula-selection"),o=e.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),a=0;an?1:0}),_.each(t,function(t,i){var s=t.asc_getType(),a=t.asc_getName(!0),l=e.api.asc_getFormulaNameByLocale(a),r="btn-named-range";switch(s){case Asc.c_oAscPopUpSelectorType.Func:r="btn-function";break;case Asc.c_oAscPopUpSelectorType.Table:r="btn-menu-table";break;case Asc.c_oAscPopUpSelectorType.Slicer:r="btn-slicer"}var c=new Common.UI.MenuItem({iconCls:"menu__icon "+r,caption:a,hint:o&&o[l]?o[l].d:""}).on("click",function(t,i){setTimeout(function(){e.api.asc_insertInCell(t.caption,s,!1)},10)});n.addItem(c)}),n.rendered||(s.length<1&&(s=$(Common.Utils.String.format('')),i.cmpEl.append(s)),n.onAfterKeydownMenu=function(t){if(t.keyCode!=Common.UI.Keys.RETURN||!t.ctrlKey&&!t.altKey){var e;if(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),s.hasClass("open"))if(t.keyCode==Common.UI.Keys.TAB||t.keyCode==Common.UI.Keys.RETURN&&!t.ctrlKey&&!t.altKey)e=s.find("a.focus").closest("li");else if(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN){var i=n.cmpEl,o=i.offset().top,a=s.find("a.focus").closest("li"),l=a.offset().top;(lo+i.height())&&(n.scroller?n.scroller.scrollTop(i.scrollTop()+l-o,0):i.scrollTop(i.scrollTop()+l-o))}e&&(e.length>0&&e.click(),Common.UI.Menu.Manager.hideAll())}},n.on("hide:after",function(){for(var t=0;t'),this.documentHolder.cmpEl.append(e.parentEl));var i=this.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),n=(i&&i[t]?this.api.asc_getFormulaLocaleName(t)+i[t].a:"").replace(/[,;]/g,this.api.asc_getFunctionArgumentSeparator());if(e.ref&&e.ref.isVisible()&&e.text!=n&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0),!n)return;e.ref&&e.ref.isVisible()||(e.text=n,e.ref=new Common.UI.Tooltip({owner:e.parentEl,html:!0,title:n,cls:"auto-tooltip"}),e.ref.show([-1e4,-1e4]),e.isHidden=!1);var s=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],o=this.api.asc_getActiveCellCoord(),a=[o.asc_getX()+s[0]-3,o.asc_getY()+s[1]-e.ref.getBSTip().$tip.height()-5],l=e.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),e.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!e.isHidden&&e.ref&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0)},onInputMessage:function(t,e){var i=this.tooltips.input_msg;if(e){i.parentEl||(i.parentEl=$('
'),this.documentHolder.cmpEl.append(i.parentEl));var n=t?""+Common.Utils.String.htmlEncode(t||"")+"
":"";n+=Common.Utils.String.htmlEncode(e||""),i.ref&&i.ref.isVisible()&&i.text!=n&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0),i.ref&&i.ref.isVisible()||(i.text=n,i.ref=new Common.UI.Tooltip({owner:i.parentEl,html:!0,title:n}),i.ref.show([-1e4,-1e4]),i.isHidden=!1);var s=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],o=this.api.asc_getActiveCellCoord(),a=[o.asc_getX()+s[0]-3,o.asc_getY()+s[1]-i.ref.getBSTip().$tip.height()-5],l=i.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),i.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px","z-index":900})}else!i.isHidden&&i.ref&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0)},onShowSpecialPasteOptions:function(t){var e=this,i=e.documentHolder,n=t.asc_getCellCoord(),s=i.cmpEl.find("#special-paste-container"),o=t.asc_getOptions(),a=!!t.asc_getContainTables();if(o){if(s.length<1&&(e._arrSpecialPaste=[],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=[e.txtPaste,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=[e.txtPasteFormulas,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=[e.txtPasteFormulaNumFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=[e.txtPasteKeepSourceFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=[e.txtPasteBorders,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=[e.txtPasteColWidths,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=[e.txtPasteMerge,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=[e.txtPasteTranspose,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=[e.txtPasteValues,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=[e.txtPasteValNumFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=[e.txtPasteValFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=[e.txtPasteFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=[e.txtPasteLink,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=[e.txtPastePicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=[e.txtPasteLinkPicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=[e.txtPasteSourceFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=[e.txtPasteDestFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=[e.txtKeepTextOnly,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport]=[e.txtUseTextImport,3],s=$('
'),i.cmpEl.append(s),e.btnSpecialPaste=new Common.UI.Button({parentEl:$("#id-document-holder-btn-special-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",menu:new Common.UI.Menu({items:[]})})),o.length>0){for(var l=e.btnSpecialPaste.menu,r=0;r0&&(l.addItem(new Common.UI.MenuItem({caption:"--"})),d=!1),_.each(c[r],function(t,e){l.addItem(t),d=!0});if(l.items.length>0&&l.items[0].setChecked(!0,!0),e._state.lastSpecPasteChecked=l.items.length>0?l.items[0]:null,h&&(l.addItem(new Common.UI.MenuItem({caption:"--"})),l.addItem(h)),l.items.length>0&&t.asc_getShowPasteSpecial()){l.addItem(new Common.UI.MenuItem({caption:"--"}));var p=new Common.UI.MenuItem({caption:e.textPasteSpecial,value:"special"}).on("click",function(t,i){new SSE.Views.SpecialPasteDialog({props:o,isTable:a,handler:function(t,i){"ok"==t&&(e._state.lastSpecPasteChecked&&e._state.lastSpecPasteChecked.setChecked(!1,!0),e._state.lastSpecPasteChecked=i&&e._arrSpecialPaste[i.asc_getProps()]?e._arrSpecialPaste[i.asc_getProps()][2]:null,e._state.lastSpecPasteChecked&&e._state.lastSpecPasteChecked.setChecked(!0,!0),e&&e.api&&e.api.asc_SpecialPaste(i))}}).show(),setTimeout(function(){l.hide()},100)});l.addItem(p)}}if(n[0].asc_getX()<0||n[0].asc_getY()<0)return void(s.is(":visible")&&s.hide());var m=n[0],u=n[1],g=e.tooltips.coauth.bodyWidth-e.tooltips.coauth.XY[0]-e.tooltips.coauth.rightMenuWidth-15,b=e.tooltips.coauth.apiHeight-15,f=[],C=[31,20],v=m.asc_getX()+m.asc_getWidth()+3+C[0],y=m.asc_getY()+m.asc_getHeight()+3+C[1];v>g?(f[0]=void 0!==u?u.asc_getX():g-C[0]-3,y>b&&(f[0]-=C[0]+3),f[0]<0&&(f[0]=g-3-C[0])):f[0]=v-C[0],f[1]=y>b?b-3-C[1]:y-C[1],s.css({left:f[0],top:f[1]}),s.show()}},onHideSpecialPasteOptions:function(){var t=this.documentHolder.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},onToggleAutoCorrectOptions:function(t){if(!t){var e=this.documentHolder.cmpEl.find("#autocorrect-paste-container");return void(e.is(":visible")&&e.hide())}var i=this,n=i.documentHolder,s=t.asc_getCellCoord(),e=n.cmpEl.find("#autocorrect-paste-container"),o=t.asc_getOptions();if(e.length<1&&(i._arrAutoCorrectPaste=[],i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.UndoTableAutoExpansion]={caption:i.txtUndoExpansion,icon:"menu__icon btn-undo"},i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.RedoTableAutoExpansion]={caption:i.txtRedoExpansion,icon:"menu__icon btn-redo"},e=$('
'),n.cmpEl.append(e),i.btnAutoCorrectPaste=new Common.UI.Button({parentEl:$("#id-document-holder-btn-autocorrect-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-autocorrect",menu:new Common.UI.Menu({cls:"shifted-right",items:[]})}),i.btnAutoCorrectPaste.menu.on("show:after",_.bind(i.onAutoCorrectOpenAfter,i))),o.length>0){for(var a=i.btnAutoCorrectPaste.menu,l=0;lc||m>h||s.asc_getX()<0||s.asc_getY()<0?e.is(":visible")&&e.hide():(e.css({left:p-d[0],top:m-d[1]}),e.show())},onCellsRange:function(t){this.rangeSelectionMode=t!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(t){this.isEditFormula=t==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onChangeCropState:function(t){this.documentHolder.menuImgCrop.menu.items[0].setChecked(t,!0)},initEquationMenu:function(){if(this._currentMathObj){var t,e=this,i=e._currentMathObj.get_Type(),n=e._currentMathObj,s=[];switch(i){case Asc.c_oAscMathInterfaceType.Accent:t=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_AccentCharacter"}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.BorderBox:t=new Common.UI.MenuItem({caption:e.txtBorderProps,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:n.get_HideTop()?e.txtAddTop:e.txtHideTop,equationProps:{type:i,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:i,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:i,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:i,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:i,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:i,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:i,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:i,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),s.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Bar"}}),s.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var o=n.get_ScriptType();o==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),s.push(t)):(o==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),s.push(t)),o!=Asc.c_oAscMathInterfaceScript.SubSup&&o!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:o==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),s.push(t)),o!=Asc.c_oAscMathInterfaceScript.SubSup&&o!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:o==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),s.push(t)));break;case Asc.c_oAscMathInterfaceType.Fraction:var a=n.get_FractionType();a!=Asc.c_oAscMathInterfaceFraction.Skewed&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),s.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),s.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),s.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),s.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.Matrix:t=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),s.push(t),t=new Common.UI.MenuItem({caption:e.insertText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.insertRowAboveText,equationProps:{type:i,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:i,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!1}}]})}),s.push(t),t=new Common.UI.MenuItem({caption:e.deleteText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{ caption:e.deleteRowText,equationProps:{type:i,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:i,callback:"delete_MatrixColumn"}}]})}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtMatrixAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtColumnAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.leftText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),s.push(t);break;case Asc.c_oAscMathInterfaceType.EqArray:t=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!0}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!1}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_Equation"}}),s.push(t),t=new Common.UI.MenuItem({caption:e.alignmentText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),s.push(t);break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),s.push(t),void 0!==n.get_HideUpper()&&(t=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideUpper",value:!n.get_HideUpper()}}),s.push(t)),void 0!==n.get_HideLower()&&(t=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideLower",value:!n.get_HideLower()}}),s.push(t));break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!0}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!1}}),s.push(t),n.can_DeleteArgument()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_DelimiterArgument"}}),s.push(t)),t=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_DelimiterCharacters"}}),s.push(t),t=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),s.push(t),t=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:i,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtMatchBrackets,equation:!0,disabled:!n.get_StretchBrackets()||e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets()&&n.get_MatchBrackets(),equationProps:{type:i,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),s.push(t));break;case Asc.c_oAscMathInterfaceType.Radical:void 0!==n.get_HideDegree()&&(t=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideDegree",value:!n.get_HideDegree()}}),s.push(t)),t=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Radical"}}),s.push(t)}return n.can_IncreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"increase_ArgumentSize"}}),s.push(t)),n.can_DecreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"decrease_ArgumentSize"}}),s.push(t)),n.can_InsertManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_ManualBreak"}}),s.push(t)),n.can_DeleteManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_ManualBreak"}}),s.push(t)),n.can_AlignToCharacter()&&(t=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"align_ToCharacter"}}),s.push(t)),s}},addEquationMenu:function(t){var e=this;e.clearEquationMenu(t);var i=e.documentHolder.textInShapeMenu,n=e.initEquationMenu();return n.length>0&&_.each(n,function(n,s){n.menu?_.each(n.menu.items,function(t){t.on("click",_.bind(e.equationCallback,e,t.options.equationProps))}):n.on("click",_.bind(e.equationCallback,e,n.options.equationProps)),i.insertItem(t,n),t++}),n.length},clearEquationMenu:function(t){for(var e=this,i=e.documentHolder.textInShapeMenu,n=t;n')}),e.paraBulletsPicker.on("item:click",_.bind(this.onSelectBullets,this)),i&&e.paraBulletsPicker.selectRecord(i.rec,!0)},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onOriginalSizeClick:function(t){if(this.api){var e=this.api.asc_getOriginalImageSize(),i=e.asc_getImageWidth(),n=e.asc_getImageHeight(),s=new Asc.asc_CImgProperty;s.asc_putWidth(i),s.asc_putHeight(n),s.put_ResetCrop(!0),this.api.asc_setGraphicObjectProps(s),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}},onImgReplace:function(t,e){var i=this;this.api&&("file"==e.value?setTimeout(function(){i.api&&i.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",i.documentHolder)},10):"storage"==e.value?Common.NotificationCenter.trigger("storage:image-load","change"):new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&i.api){var n=e.replace(/ /g,"");if(!_.isEmpty(n)){var s=new Asc.asc_CImgProperty;s.asc_putImageUrl(n),i.api.asc_setGraphicObjectProps(s)}}Common.NotificationCenter.trigger("edit:complete",i.documentHolder)}}).show())},onNumberFormatSelect:function(t,e){void 0!==e.value&&"advanced"!==e.value&&this.api&&this.api.asc_setCellFormat(e.options.format),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onCustomNumberFormat:function(t){var e=this,i=e.api.asc_getLocale();!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,i){i&&e.api.asc_setCellFormat(i.format),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},props:{format:t.options.numformat,formatInfo:t.options.numformatinfo,langId:i}}).show(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onNumberFormatOpenAfter:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);for(var s=this.api.asc_getFormatCells(n),o=0;oOnly text values from the column can be selected for replacement.",txtExpandSort:"The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",txtExpand:"Expand and sort",txtSorting:"Sorting",txtSortSelected:"Sort selected",txtPaste:"Paste",txtPasteFormulas:"Formulas",txtPasteFormulaNumFormat:"Formulas & number formats",txtPasteKeepSourceFormat:"Formulas & formatting",txtPasteBorders:"All except borders",txtPasteColWidths:"Formulas & column widths",txtPasteMerge:"Merge conditional formatting",txtPasteTranspose:"Transpose",txtPasteValues:"Values",txtPasteValNumFormat:"Values & number formats",txtPasteValFormat:"Values & formatting",txtPasteFormat:"Paste only formatting",txtPasteLink:"Paste Link",txtPastePicture:"Picture",txtPasteLinkPicture:"Linked Picture",txtPasteSourceFormat:"Source formatting",txtPasteDestFormat:"Destination formatting",txtKeepTextOnly:"Keep text only",txtUseTextImport:"Use text import wizard",txtUndoExpansion:"Undo table autoexpansion",txtRedoExpansion:"Redo table autoexpansion",txtAnd:"and",txtOr:"or",txtEquals:"Equals",txtNotEquals:"Does not equal",txtGreater:"Greater than",txtGreaterEquals:"Greater than or equal to",txtLess:"Less than",txtLessEquals:"Less than or equal to",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with",txtNotBegins:"Does not begin with",txtEnds:"Ends with",txtNotEnds:"Does not end with",txtContains:"Contains",txtNotContains:"Does not contain",txtFilterTop:"Top",txtFilterBottom:"Bottom",txtItems:"items",txtPercent:"percent",txtEqualsToCellColor:"Equals to cell color",txtEqualsToFontColor:"Equals to font color",txtAll:"(All)",txtBlanks:"(Blanks)",txtColumn:"Column",txtImportWizard:"Text Import Wizard",textPasteSpecial:"Paste special",textStopExpand:"Stop automatically expanding tables",textAutoCorrectSettings:"AutoCorrect options"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.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'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(t){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(t),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t)},render:function(){$(this.el).html(this.template()),this.btnNamedRanges=new Common.UI.Button({parentEl:$("#ce-cell-name-menu"),menu:new Common.UI.Menu({style:"min-width: 70px;max-width:400px;",maxHeight:250,items:[{caption:this.textManager,value:"manager"},{caption:"--"}]})}),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-81),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var t=this;return this.$cellname.on("focus",function(e){var i=t.$cellname[0];i.selectionStart=0,i.selectionEnd=i.value.length,i.scrollLeft=i.scrollWidth}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(t){t&&this.$cellname.val("string"==typeof t?t:t.asc_getName())},cellNameDisabled:function(t){t?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(t)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.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
'}),define("spreadsheeteditor/main/app/view/NameManagerDlg",["text!spreadsheeteditor/main/app/template/NameManagerDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/ListView","common/main/lib/component/InputField"],function(t){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:525,height:353,buttons:null},initialize:function(e){_.extend(this.options,{title:this.txtTitle,template:['
','
'+_.template(t)({scope:this})+"
","
",'
','"].join("")},e),this.api=e.api,this.handler=e.handler,this.sheets=e.sheets||[],this.sheetNames=e.sheetNames||[],this.ranges=e.ranges||[],this.props=e.props,this.sort=e.sort||{type:"name",direction:1},this.locked=e.locked||!1,this.userTooltip=!0,this.currentNamedRange=void 0,this.rangesStore=new Common.UI.DataViewStore,this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbFilter=new Common.UI.ComboBox({el:$("#name-manager-combo-filter"),menuStyle:"min-width: 100%;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textFilterAll},{value:1,displayValue:this.textFilterDefNames},{value:2,displayValue:this.textFilterTableNames},{value:3,displayValue:this.textFilterSheet},{value:4,displayValue:this.textFilterWorkbook}],takeFocusOnClose:!0}).on("selected",function(e,i){t.refreshRangeList(null,0)}),this.cmbFilter.setValue(0),this.rangeList=new Common.UI.ListView({el:$("#name-manager-range-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,emptyText:this.textEmpty,template:_.template(['
'].join("")),itemTemplate:_.template(['
','
">
','
<%= name %>
','
<%= scopeName %>
','
<%= range %>
',"<% if (lock) { %>",'
<%=lockuser%>
',"<% } %>","
"].join("")),tabindex:1}),this.rangeList.store.comparator=function(e,i){var n=e.get(t.sort.type).toLowerCase(),s=i.get(t.sort.type).toLowerCase();return n==s?0:n0?this.textnoNames:this.textEmpty)}var l=this,r=this.rangeList.store,c=this.rangesStore.models,h=this.cmbFilter.getValue(),d=h<3?2==h:-1,p=h>2?4==h:-1;if(h>0&&(c=this.rangesStore.filter(function(t){return-1!==d?d===t.get("isTable"):-1!==p&&p===(null===t.get("scope"))})),r.reset(c,{silent:!1}),h=r.length,this.btnEditRange.setDisabled(!h),this.btnDeleteRange.setDisabled(!h),h>0){if(void 0!==e&&null!==e||(e=0),_.isNumber(e))e>h-1&&(e=h-1),this.rangeList.selectByIndex(e),setTimeout(function(){l.rangeList.scrollToRecord(r.at(e))},50);else if(e){var m=r.findWhere({name:e.asc_getName(!0),scope:e.asc_getScope()});m&&(this.rangeList.selectRecord(m),setTimeout(function(){l.rangeList.scrollToRecord(m)},50))}!0===this.userTooltip&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(l.onMouseOverLock,l)).on("mouseout",_.bind(l.onMouseOutLock,l))}_.delay(function(){l.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(t,e,i){if(!0===this.userTooltip&&$(t.target).hasClass("lock-user")){var n=this,s=$(t.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=s.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),s.show(),setTimeout(function(){n.userTipHide()},5e3)}},userTipHide:function(){"object"==typeof this.userTooltip&&(this.userTooltip.remove(),this.userTooltip=void 0,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(t,e,i){"object"==typeof this.userTooltip&&this.userTipHide()},onEditRange:function(t){if(this.locked)return void Common.NotificationCenter.trigger("namedrange:locked");var e=this,i=e.$window.offset(),n=this.rangeList.getSelectedRec(),s=(_.indexOf(this.rangeList.store.models,n),t&&n?new Asc.asc_CDefName(n.get("name"),n.get("range"),n.get("scope"),n.get("type"),void 0,void 0,void 0,!0):null),o=new SSE.Views.NamedRangeEditDlg({api:e.api,sheets:this.sheets,props:t?s:this.props,isEdit:t,handler:function(i,n){"ok"==i&&n&&(t?(e.currentNamedRange=n,e.api.asc_editDefinedNames(s,n)):(e.cmbFilter.setValue(0),e.currentNamedRange=n,e.api.asc_setDefinedNames(n)))}}).on("close",function(){e.show()});e.hide(),o.show(i.left+65,i.top+77)},onDeleteRange:function(){var t=this.rangeList.getSelectedRec();t&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,t),this.api.asc_delDefinedNames(new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("type"),void 0,void 0,void 0,!0)))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(t){this.handler&&this.handler.call(this,t.currentTarget.attributes.result.value),this.close()},onSortNames:function(t){t!==this.sort.type?(this.sort={type:t,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var e="name"==t?this.spanSortName:this.spanSortScope;this.sort.direction>0?e.removeClass("sort-desc"):e.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(t){var e=SSE.getCollection("Common.Collections.Users");if(e){var i=e.findUser(t);if(i)return Common.Utils.UserInfoParser.getParsedName(i.get("username"))}return this.guestText}, onSelectRangeItem:function(t,e,i){if(i){this.userTipHide();var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,i),this.btnEditRange.setDisabled(n.lock),this.btnDeleteRange.setDisabled(n.lock||n.isTable||n.isSlicer)}}},hide:function(){this.userTipHide(),Common.UI.Window.prototype.hide.call(this)},close:function(){this.userTipHide(),this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},onKeyDown:function(t,e,i){i.keyCode!=Common.UI.Keys.DELETE||this.btnDeleteRange.isDisabled()||this.onDeleteRange()},onDblClickItem:function(t,e,i){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(t){this.locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},txtTitle:"Name Manager",closeButtonText:"Close",textDataRange:"Data Range",textNew:"New",textEdit:"Edit",textDelete:"Delete",textRanges:"Named Ranges",textScope:"Scope",textFilter:"Filter",textEmpty:"No named ranges have been created yet.
Create at least one named range and it will appear in this field.",textnoNames:"No named ranges matching your filter could be found.",textFilterAll:"All",textFilterDefNames:"Defined names",textFilterTableNames:"Table names",textFilterSheet:"Names Scoped to Sheet",textFilterWorkbook:"Names Scoped to Workbook",textWorkbook:"Workbook",guestText:"Guest",tipIsLocked:"This element is being edited by another user."},SSE.Views.NameManagerDlg||{}))}),define("spreadsheeteditor/main/app/controller/CellEditor",["core","spreadsheeteditor/main/app/view/CellEditor","spreadsheeteditor/main/app/view/NameManagerDlg"],function(t){"use strict";SSE.Controllers.CellEditor=Backbone.Controller.extend({views:["CellEditor"],events:function(){return{"keyup input#ce-cell-name":_.bind(this.onCellName,this),"keyup textarea#ce-cell-content":_.bind(this.onKeyupCellEditor,this),"blur textarea#ce-cell-content":_.bind(this.onBlurCellEditor,this),"click button#ce-btn-expand":_.bind(this.expandEditorField,this),"click button#ce-func-label":_.bind(this.onInsertFunction,this)}},initialize:function(){this.addListeners({CellEditor:{},Viewport:{"layout:resizedrag":_.bind(this.onLayoutResize,this)},"Common.Views.Header":{"formulabar:hide":function(t){this.editor.setVisible(!t),Common.localStorage.setBool("sse-hidden-formula",t),Common.NotificationCenter.trigger("layout:changed","celleditor",t?"hidden":"showed")}.bind(this)}})},setApi:function(t){return this.api=t,this.api.isCEditorFocused=!1,this.api.asc_registerCallback("asc_onSelectionNameChanged",_.bind(this.onApiCellSelection,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onInputKeyDown",_.bind(this.onInputKeyDown,this)),this},setMode:function(t){this.mode=t,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge),this.mode.isEdit&&this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this))},onInputKeyDown:function(t){if(Common.UI.Keys.UP===t.keyCode||Common.UI.Keys.DOWN===t.keyCode||Common.UI.Keys.TAB===t.keyCode||Common.UI.Keys.RETURN===t.keyCode||Common.UI.Keys.ESC===t.keyCode||Common.UI.Keys.LEFT===t.keyCode||Common.UI.Keys.RIGHT===t.keyCode){var e=$("#menu-formula-selection");e.hasClass("open")&&e.find(".dropdown-menu").trigger("keydown",t)}},onLaunch:function(){this.editor=this.getView("CellEditor"),this.bindViewEvents(this.editor,this.events),this.editor.$el.parent().find(".after").css({zIndex:"4"});var t=Common.localStorage.getItem("sse-celleditor-height");this.editor.keep_height=null!==t&&parseInt(t)>0?parseInt(t):74,Common.localStorage.getBool("sse-celleditor-expand")&&(this.editor.$el.height(this.editor.keep_height),this.onLayoutResize(void 0,"cell:edit")),this.editor.btnNamedRanges.menu.on("item:click",_.bind(this.onNamedRangesMenu,this)).on("show:before",_.bind(this.onNameBeforeShow,this)),this.namedrange_locked=!1},onApiEditCell:function(t){this.viewmode||(t==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):t==Asc.c_oAscCellEditorState.editInCell?this.api.isCEditorFocused="clear":t==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",t==Asc.c_oAscCellEditorState.editText))},onApiCellSelection:function(t){this.editor.updateCellInfo(t)},onApiSelectionChanged:function(t){if(!this.viewmode){var e=t.asc_getSelectionType(),i=!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()||!0===t.asc_getLockedPivotTable()),n=e==Asc.c_oAscSelectionType.RangeChartText,s=e==Asc.c_oAscSelectionType.RangeChart,o=e==Asc.c_oAscSelectionType.RangeShapeText,a=e==Asc.c_oAscSelectionType.RangeShape,l=e==Asc.c_oAscSelectionType.RangeImage||e==Asc.c_oAscSelectionType.RangeSlicer,r=o||a||n||s;this.editor.$btnfunc.toggleClass("disabled",l||r||i)}},onApiDisconnect:function(){this.mode.isEdit=!1;var t=this.getApplication().getController("FormulaDialog");t&&t.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(t){this.editor.cellNameDisabled(t!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",t!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(t,e){"cell:edit"==e&&(this.editor.$el.height()>19?(this.editor.$btnexpand.hasClass("btn-collapse")||this.editor.$btnexpand.addClass("btn-collapse"),t&&Common.localStorage.setItem("sse-celleditor-height",this.editor.$el.height()),t&&Common.localStorage.setBool("sse-celleditor-expand",!0)):(this.editor.$btnexpand.removeClass("btn-collapse"),t&&Common.localStorage.setBool("sse-celleditor-expand",!1)))},onCellName:function(t){if(t.keyCode==Common.UI.Keys.RETURN){var e=this.editor.$cellname.val();e&&e.length&&this.api.asc_findCell(e),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){"clear"==this.api.isCEditorFocused?this.api.isCEditorFocused=void 0:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(t){t.keyCode!=Common.UI.Keys.RETURN||t.altKey||(this.api.isCEditorFocused="clear")},expandEditorField:function(){this.editor.$el.height()>19?(this.editor.keep_height=this.editor.$el.height(),this.editor.$el.height(19),this.editor.$btnexpand.removeClass("btn-collapse"),Common.localStorage.setBool("sse-celleditor-expand",!1)):(this.editor.$el.height(this.editor.keep_height),this.editor.$btnexpand.addClass("btn-collapse"),Common.localStorage.setBool("sse-celleditor-expand",!0)),Common.NotificationCenter.trigger("layout:changed","celleditor"),Common.NotificationCenter.trigger("edit:complete",this.editor,{restorefocus:!0})},onInsertFunction:function(){if(!this.viewmode&&this.mode.isEdit&&!this.editor.$btnfunc.hasClass("disabled")){var t=this.getApplication().getController("FormulaDialog");t&&($("#ce-func-label",this.editor.el).blur(),t.showDialog())}},onNamedRangesMenu:function(t,e){var i=this;if("manager"==e.options.value){for(var n=this.api.asc_getWorksheetsCount(),s=-1,o=[],a=[];++s2)},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},disableEditing:function(t){this.editor.$btnfunc[t?"addClass":"removeClass"]("disabled"),this.editor.btnNamedRanges.setVisible(!t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,this.editor.$btnfunc[t?"addClass":"removeClass"]("disabled"),this.editor.cellNameDisabled(t))}})}),define("common/main/lib/view/ImageFromUrlDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ImageFromUrlDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",buttons:["ok","cancel"]},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);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.title=this.options.title,this.ownerEl=this.options.owner instanceof Common.UI.BaseView?$(this.options.owner.el):$(this.options.owner),this.loaderEl=$(this.template({id:this.id,cls:this.options.cls,style:this.options.style,title:this.title})),this.maskeEl=$('
'),this.timerId=0},render:function(){return this},show:function(){var t=this.ownerEl,e=this.loaderEl,i=this.maskeEl;if(t.ismasked)return this;t.ismasked=!0;var n=this;return n.title!=n.options.title&&(n.options.title=n.title,$(".asc-loadmask-title",e).html(n.title)),n.timerId=setTimeout(function(){t.append(i),t.append(e),t&&0==t.closest(".asc-window.modal").length&&Common.util.Shortcuts.suspendEvents()},500),this},hide:function(){var t=this.ownerEl;this.timerId&&(clearTimeout(this.timerId),this.timerId=0),t&&t.ismasked&&(0!=t.closest(".asc-window.modal").length||Common.Utils.ModalWindow.isVisible()||Common.util.Shortcuts.resumeEvents(),this.maskeEl&&this.maskeEl.remove(),this.loaderEl&&this.loaderEl.remove()),delete t.ismasked},setTitle:function(t){this.title=t,this.ownerEl&&this.ownerEl.ismasked&&this.loaderEl&&$(".asc-loadmask-title",this.loaderEl).html(t)},isVisible:function(){return!!this.ownerEl.ismasked},updatePosition:function(){var t=this.ownerEl,e=this.loaderEl;t&&t.ismasked&&e&&(e.css({top:Math.round(t.height()/2-(e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")))/2)+"px"}),e.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
'].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",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=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;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){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),define("common/main/lib/view/OptionsDialog",["common/main/lib/component/Window","common/main/lib/component/RadioBox"],function(){"use strict";Common.Views.OptionsDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",items:[],buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
','<% if (typeof label !== "undefined" && label !=="") { %>','',"<% } %>","<% _.each(items, function(item, index) { %>","<% if (!item.id) item.id = Common.UI.getId(); %>",'
',"<% }) %>","
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.radio=[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=t.getChild(),i=this.options.items,n=!0,s=-1;if(i){for(var o=0;o=0&&this.radio[s].setValue(!0)}e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.currentCell},onPrimary:function(){return this._handleInput("ok"),!1}},Common.Views.OptionsDialog||{}))}),void 0===Common)var Common={};if(void 0===Common.define&&(Common.define={}),define("common/main/lib/util/define",[],function(){"use strict";Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521},Common.define.chartData=_.extend(new function(){return{textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textSurface:"Surface",textCharts:"Charts",textSparks:"Sparklines",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",getChartGroupData:function(t){return[{id:"menu-chart-group-bar",caption:this.textColumn,headername:t?this.textCharts:void 0},{id:"menu-chart-group-line",caption:this.textLine},{id:"menu-chart-group-pie",caption:this.textPie},{id:"menu-chart-group-hbar",caption:this.textBar},{id:"menu-chart-group-area",caption:this.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:this.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:this.textStock,inline:!0}]},getChartData:function(){return[{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]},getSparkGroupData:function(t){return[{id:"menu-chart-group-sparkcolumn",inline:!0,headername:t?this.textSparks:void 0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]},getSparkData:function(){return[{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:this.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:this.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:this.textWinLossSpark}]}}},Common.define.chartData||{})}),define("text!spreadsheeteditor/main/app/template/Toolbar.template",[],function(){ diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index 4274a5538..1286da14d 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -129,8 +129,8 @@ define([ var l = privateData.plan ? ApiConfig.premiumUploadSize : false; l = l || ApiConfig.maxUploadSize || "?"; var maxSizeStr = Util.bytesToMegabytes(l); - // XXX blob.byteLength is wrong: we should use the lenght of the encrypted content (see whiteboard) - if (blob && blob.byteLength && typeof(l) === "number" && blob.byteLength > l) { + var estimate = FileCrypto.computeEncryptedSize((blob && blob.byteLength) || 0, metadata); + if (blob && blob.byteLength && typeof(estimate) === 'number' && typeof(l) === "number" && estimate > l) { $pv.text(Messages.error); queue.inProgress = false; queue.next(); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index d24f62f9d..198d17099 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -626,7 +626,6 @@ define([ }, isNewFile: isNewFile, isDeleted: isDeleted, - password: password, channel: secret.channel, enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default devMode: localStorage.CryptPad_dev === "1", @@ -651,6 +650,7 @@ define([ if (isSafe) { additionalPriv.hashes = hashes; + additionalPriv.password = password; } for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; } diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index 3a7e1d5c1..3f7b628c1 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1226,5 +1226,7 @@ "calendar": "Kalender", "calendar_before": "vorher", "calendar_weekNumber": "Woche {0}", - "oo_cantMigrate": "Diese Tabelle überschreitet die maximale Größe für hochgeladene Dateien und kann nicht migriert werden." + "oo_cantMigrate": "Diese Tabelle überschreitet die maximale Größe für hochgeladene Dateien und kann nicht migriert werden.", + "toolbar_storeInDrive": "In CryptDrive speichern", + "genericCopySuccess": "In die Zwischenablage kopiert" } diff --git a/www/common/translations/messages.fr.json b/www/common/translations/messages.fr.json index f1d782e43..4620265c1 100644 --- a/www/common/translations/messages.fr.json +++ b/www/common/translations/messages.fr.json @@ -1226,5 +1226,8 @@ "pad_goToAnchor": "Aller à cette ancre", "settings_padOpenLinkLabel": "Activer l'ouverture directe des liens", "settings_padOpenLinkHint": "Cette option permet d'ouvrir les liens dans un document texte sans fenêtre d’aperçu", - "settings_padOpenLinkTitle": "Ouvrir les lien avec un seul clic" + "settings_padOpenLinkTitle": "Ouvrir les lien avec un seul clic", + "toolbar_storeInDrive": "Stocker dans CryptDrive", + "genericCopySuccess": "Copié dans le presse-papiers", + "mediatag_defaultImageName": "image" } diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 06df08b31..4cb54075c 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1226,5 +1226,8 @@ "settings_notifCalendarCheckbox": "Enable calendar notifications", "calendar_notifications": "Reminders", "calendar_addNotification": "Add reminder", - "calendar_noNotification": "None" + "calendar_noNotification": "None", + "toolbar_storeInDrive": "Store in CryptDrive", + "genericCopySuccess": "Copied to clipboard", + "mediatag_defaultImageName": "image" } diff --git a/www/profile/inner.js b/www/profile/inner.js index 0f0d8e2b8..11abd6ae8 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -513,7 +513,7 @@ define([ var privateData = metadataMgr.getPrivateData(); var url = Hash.getPublicSigningKeyString(privateData.origin, data.name, data.edPublic); var success = Clipboard.copy(url); - if (success) { UI.log(Messages.shareSuccess); } + if (success) { UI.log(Messages.genericCopySuccess); } }; };