Files
cryptpad/www/common/onlyoffice/web-apps/apps/documenteditor/main/app.js

53 lines
1.4 MiB
JavaScript
Raw Normal View History

/*
* Copyright (c) Ascensio System SIA 2019. All rights reserved
*
* http://www.onlyoffice.com
*
* Version: 0.0.0 (build:0)
*/
function onDropDownKeyDown(t){var e=$(this),i=e.parent(),n=jQuery.Event("keydown.before.bs.dropdown"),o=jQuery.Event("keydown.after.bs.dropdown");i.trigger(n),i.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),!/^(38|40|27|13|9|37|39)$/.test(t.keyCode)||t.ctrlKey||t.altKey||(patchDropDownKeyDownAdditional.call(this,t),/(37|39)/.test(t.keyCode)||(t.preventDefault(),t.stopPropagation()))):(patchDropDownKeyDown.call(this,t),t.preventDefault(),t.stopPropagation()),i.trigger(o)}function patchDropDownKeyDown(t){if(/(38|40|27|37|39)/.test(t.keyCode)){var e=$(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=getParent(e),n=i.hasClass("open")||i.hasClass("over");if(!n||n&&27==t.keyCode){if(27==t.which){if(o=$("[role=menu] li.dropdown-submenu.over:visible",i),o.size())return o.eq(o.size()-1).removeClass("over"),!1;i.hasClass("dropdown-submenu")&&i.hasClass("over")?(i.removeClass("over"),i.find("> a").focus()):i.find("[data-toggle=dropdown]").focus()}return n?e.click():void 0}var o=$("> [role=menu] > li:not(.divider):not(.disabled):visible",i).find("> a");if(o.length){var s=o.index(o.filter(":focus"));if(39==t.keyCode){if(s<0)return;var a=o.eq(s).parent();a.hasClass("dropdown-submenu")&&!a.hasClass("over")&&(a.mouseenter(),a.addClass("focused-submenu"),_.delay(function(){var t=$("> [role=menu]",a),e=t.find("> li:not(.divider):not(.disabled):visible > a"),i=0;if(t.find("> .menu-scroll").length>0)for(var n=t.scrollTop(),o=0;o<e.length;o++)if(e[o].offsetTop>n){i=o;break}e.length>0&&e.eq(i).focus()},250))}else 37==t.keyCode?i.hasClass("dropdown-submenu")&&i.hasClass("over")&&(i.removeClass("over"),i.find("> a").focus()):(38==t.keyCode?s>0?s--:s=e.hasClass("no-cyclic")?0:o.length-1:40==t.keyCode&&(s<o.length-1?s++:s=e.hasClass("no-cyclic")?o.length-1:0),~s||(s=0),i.hasClass("dropdown-submenu")&&i.hasClass("over")&&i.addClass("focused-submenu"),o.eq(s).focus())}}}}function patchDropDownKeyDownAdditional(t){if(/(38|40|27|37|39)/.test(t.keyCode)){var e=$(this);if(/(37|39)/.test(t.keyCode)||(t.preventDefault(),t.stopPropagation()),!e.is(".disabled, :disabled")){var i=getParent(e),n=i.hasClass("open")||i.hasClass("over");if(!n||n&&(27==t.keyCode||37==t.keyCode||39==t.keyCode))return n?e.click():void 0;var o=$("> [role=menu] > li:not(.divider):not(.disabled):visible",i).find("> a");if(o.length){var s=o.index(o.filter(".focus"));38==t.keyCode?s>0?s--:s=e.hasClass("no-cyclic")?0:o.length-1:40==t.keyCode&&(s<o.length-1?s++:s=e.hasClass("no-cyclic")?o.length-1:0),~s||(s=0),o.removeClass("focus"),o.eq(s).addClass("focus")}}}}function getParent(t){var e=t.attr("data-target");e||(e=t.attr("href"),e=e&&/#/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i=e&&$(e);return i&&i.length?i:t.parent()}function clearMenus(t){$(".dropdown-toggle").each(function(e){var i=$(this).parent();i.hasClass("open")&&(i.trigger(e=$.Event("hide.bs.dropdown")),e.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown",t))})}if(function(){var t=this,e=t._,i={},n=Array.prototype,o=Object.prototype,s=Function.prototype,a=n.push,r=n.slice,l=n.concat,c=o.toString,d=o.hasOwnProperty,h=n.forEach,p=n.map,m=n.reduce,u=n.reduceRight,g=n.filter,b=n.every,f=n.some,C=n.indexOf,v=n.lastIndexOf,_=Array.isArray,y=Object.keys,w=s.bind,x=function(t){return t instanceof x?t:this instanceof x?void(this._wrapped=t):new x(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):t._=x,x.VERSION="1.5.2";var S=x.each=x.forEach=function(t,e,n){if(null!=t)if(h&&t.forEach===h)t.forEach(e,n);else if(t.length===+t.length){for(var o=0,s=t.length;o<s;o++)if(e.call(n,t[o],o,t)===i)return}else for(var a=x.keys(t),o=0,s=a.length;o<s;o++)if(e.call(n,t[a[o]],a[o],t)===i)return};x.map=x.collect=function(t,e,i){var n=[];return null==t?n:p&&t.map===p?t.map(e,i):(S(t,function(t,o,s){n.push(e.call(i,t,o,s))}),n)};var A="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(t,e,i,n){var o=arguments.length>2;if(null==t&&(t=[])
;if(i(t))for(n=t.length;o<n&&!1!==e.call(t[o],o,t[o]);o++);else for(o in t)if(!1===e.call(t[o],o,t[o]))break;return t},trim:function(t){return null==t?"":(t+"").replace(st,"")},makeArray:function(t,e){var n=e||[];return null!=t&&(i(Object(t))?ot.merge(n,"string"==typeof t?[t]:t):Z.call(n,t)),n},inArray:function(t,e,i){return null==e?-1:Q.call(e,t,i)},merge:function(t,e){for(var i=+e.length,n=0,o=t.length;n<i;n++)t[o++]=e[n];return t.length=o,t},grep:function(t,e,i){for(var n=[],o=0,s=t.length,a=!i;o<s;o++)!e(t[o],o)!==a&&n.push(t[o]);return n},map:function(t,e,n){var o,s,a=0,r=[];if(i(t))for(o=t.length;a<o;a++)null!=(s=e(t[a],a,n))&&r.push(s);else for(a in t)null!=(s=e(t[a],a,n))&&r.push(s);return J.apply([],r)},guid:1,proxy:function(t,e){var i,n,o;if("string"==typeof e&&(i=t[e],e=t,t=i),ot.isFunction(t))return n=X.call(arguments,2),o=function(){return t.apply(e||this,n.concat(X.call(arguments)))},o.guid=t.guid=t.guid||ot.guid++,o},now:Date.now,support:nt}),"function"==typeof Symbol&&(ot.fn[Symbol.iterator]=K[Symbol.iterator]),ot.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){tt["[object "+e+"]"]=e.toLowerCase()});var ct=function(t){function e(t,e,i,n){var o,s,a,r,c,h,p,m,u=e&&e.ownerDocument,g=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==g&&9!==g&&11!==g)return i;if(!n&&((e?e.ownerDocument||e:L)!==M&&P(e),e=e||M,U)){if(11!==g&&(h=gt.exec(t)))if(o=h[1]){if(9===g){if(!(a=e.getElementById(o)))return i;if(a.id===o)return i.push(a),i}else if(u&&(a=u.getElementById(o))&&R(e,a)&&a.id===o)return i.push(a),i}else{if(h[2])return X.apply(i,e.getElementsByTagName(t)),i;if((o=h[3])&&v.getElementsByClassName&&e.getElementsByClassName)return X.apply(i,e.getElementsByClassName(o)),i}if(v.qsa&&!$[t+" "]&&(!E||!E.test(t))){if(1!==g)u=e,m=t;else if("object"!==e.nodeName.toLowerCase()){for((r=e.getAttribute("id"))?r=r.replace(ft,"\\$&"):e.setAttribute("id",r=F),p=x(t),s=p.length,c=dt.test(r)?"#"+r:"[id='"+r+"']";s--;)p[s]=c+" "+d(p[s]);m=p.join(","),u=bt.test(t)&&l(e.parentNode)||e}if(m)try{return X.apply(i,u.querySelectorAll(m)),i}catch(t){}finally{r===F&&e.removeAttribute("id")}}}return A(t.replace(st,"$1"),e,i,n)}function i(){function t(i,n){return e.push(i+" ")>_.cacheLength&&delete t[e.shift()],t[i+" "]=n}var e=[];return t}function n(t){return t[F]=!0,t}function o(t){var e=M.createElement("div");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function s(t,e){for(var i=t.split("|"),n=i.length;n--;)_.attrHandle[i[n]]=e}function a(t,e){var i=e&&t,n=i&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||G)-(~t.sourceIndex||G);if(n)return n;if(i)for(;i=i.nextSibling;)if(i===e)return-1;return t?1:-1}function r(t){return n(function(e){return e=+e,n(function(i,n){for(var o,s=t([],i.length,e),a=s.length;a--;)i[o=s[a]]&&(i[o]=!(n[o]=i[o]))})})}function l(t){return t&&void 0!==t.getElementsByTagName&&t}function c(){}function d(t){for(var e=0,i=t.length,n="";e<i;e++)n+=t[e].value;return n}function h(t,e,i){var n=e.dir,o=i&&"parentNode"===n,s=N++;return e.first?function(e,i,s){for(;e=e[n];)if(1===e.nodeType||o)return t(e,i,s)}:function(e,i,a){var r,l,c,d=[H,s];if(a){for(;e=e[n];)if((1===e.nodeType||o)&&t(e,i,a))return!0}else for(;e=e[n];)if(1===e.nodeType||o){if(c=e[F]||(e[F]={}),l=c[e.uniqueID]||(c[e.uniqueID]={}),(r=l[n])&&r[0]===H&&r[1]===s)return d[2]=r[2];if(l[n]=d,d[2]=t(e,i,a))return!0}}}function p(t){return t.length>1?function(e,i,n){for(var o=t.length;o--;)if(!t[o](e,i,n))return!1;return!0}:t[0]}function m(t,i,n){for(var o=0,s=i.length;o<s;o++)e(t,i[o],n);return n}function u(t,e,i,n,o){for(var s,a=[],r=0,l=t.length,c=null!=e;r<l;r++)(s=t[r])&&(i&&!i(s,n,o)||(a.push(s),c&&e.push(r)));return a}function g(t,e,i,o,s,a){return o&&!o[F]&&(o=g(o)),s&&!s[F]&&(s=g(s,a)),n(function(n,a,r,l){var c,d,h,p=[],g=[],b=a.length,f=n||m(e||"*",r.nodeType?[r]:r,[]),C=!t||!n&&e?f:u(f,p,t,r,l),v=i?s||(n?t:b||o)?[]:a:C;if(i&&i(C,v,r,l),o)for(c=u(v,g),o(c,[],r,l),d=c.length;d--;)(h=c[d])&&(v[g[d]]=!(C[g[d]]=h));if(n){if(s||t){if(s){for(c=[],d=v.length;d--;)(
return void 0!==ot&&ot.event.triggered!==e.type?ot.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(vt)||[""],c=e.length;c--;)r=Lt.exec(e[c])||[],m=g=r[1],u=(r[2]||"").split(".").sort(),m&&(h=ot.event.special[m]||{},m=(o?h.delegateType:h.bindType)||m,h=ot.event.special[m]||{},d=ot.extend({type:m,origType:g,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&ot.expr.match.needsContext.test(o),namespace:u.join(".")},s),(p=l[m])||(p=l[m]=[],p.delegateCount=0,h.setup&&!1!==h.setup.call(t,n,u,a)||t.addEventListener&&t.addEventListener(m,a)),h.add&&(h.add.call(t,d),d.handler.guid||(d.handler.guid=i.guid)),o?p.splice(p.delegateCount++,0,d):p.push(d),ot.event.global[m]=!0)},remove:function(t,e,i,n,o){var s,a,r,l,c,d,h,p,m,u,g,b=xt.hasData(t)&&xt.get(t);if(b&&(l=b.events)){for(e=(e||"").match(vt)||[""],c=e.length;c--;)if(r=Lt.exec(e[c])||[],m=g=r[1],u=(r[2]||"").split(".").sort(),m){for(h=ot.event.special[m]||{},m=(n?h.delegateType:h.bindType)||m,p=l[m]||[],r=r[2]&&new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;s--;)d=p[s],!o&&g!==d.origType||i&&i.guid!==d.guid||r&&!r.test(d.namespace)||n&&n!==d.selector&&("**"!==n||!d.selector)||(p.splice(s,1),d.selector&&p.delegateCount--,h.remove&&h.remove.call(t,d));a&&!p.length&&(h.teardown&&!1!==h.teardown.call(t,u,b.handle)||ot.removeEvent(t,m,b.handle),delete l[m])}else for(m in l)ot.event.remove(t,m+e[c],i,n,!0);ot.isEmptyObject(l)&&xt.remove(t,"handle events")}},dispatch:function(t){t=ot.event.fix(t);var e,i,n,o,s,a=[],r=X.call(arguments),l=(xt.get(this,"events")||{})[t.type]||[],c=ot.event.special[t.type]||{};if(r[0]=t,t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){for(a=ot.event.handlers.call(this,t,l),e=0;(o=a[e++])&&!t.isPropagationStopped();)for(t.currentTarget=o.elem,i=0;(s=o.handlers[i++])&&!t.isImmediatePropagationStopped();)t.rnamespace&&!t.rnamespace.test(s.namespace)||(t.handleObj=s,t.data=s.data,void 0!==(n=((ot.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,r))&&!1===(t.result=n)&&(t.preventDefault(),t.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(t,e){var i,n,o,s,a=[],r=e.delegateCount,l=t.target;if(r&&l.nodeType&&("click"!==t.type||isNaN(t.button)||t.button<1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(!0!==l.disabled||"click"!==t.type)){for(n=[],i=0;i<r;i++)s=e[i],o=s.selector+" ",void 0===n[o]&&(n[o]=s.needsContext?ot(o,this).index(l)>-1:ot.find(o,this,null,[l]).length),n[o]&&n.push(s);n.length&&a.push({elem:l,handlers:n})}return r<e.length&&a.push({elem:this,handlers:e.slice(r)}),a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,e){var i,n,o,s=e.button;return null==t.pageX&&null!=e.clientX&&(i=t.target.ownerDocument||Y,n=i.documentElement,o=i.body,t.pageX=e.clientX+(n&&n.scrollLeft||o&&o.scrollLeft||0)-(n&&n.clientLeft||o&&o.clientLeft||0),t.pageY=e.clientY+(n&&n.scrollTop||o&&o.scrollTop||0)-(n&&n.clientTop||o&&o.clientTop||0)),t.which||void 0===s||(t.which=1&s?1:2&s?3:4&s?2:0),t}},fix:function(t){if(t[ot.expando])return t;var e,i,n,o=t.type,s=t,a=this.fixHooks[o];for(a||(this.fixHooks[o]=a=Ft.test(o)?this.mouseHooks:Rt.test(o)?this.keyHooks:{}),n=a.props?this.props.concat(a.props):this.props,t=new ot.Event(s),e=n.length;e--;)i=n[e],t[i]=s[i];return t.target||(t.target=Y),3===t.target.nodeType&&(t.target=t.target.parentNode),a.filter?a.filter(t,s):t},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==g()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===g()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&ot.nod
ot.isArray(t)||t.jquery&&!ot.isPlainObject(t))ot.each(t,function(){o(this.name,this.value)});else for(i in t)j(i,t[i],e,o);return n.join("&").replace(ke,"+")},ot.fn.extend({serialize:function(){return ot.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ot.prop(this,"elements");return t?ot.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ot(this).is(":disabled")&&Be.test(this.nodeName)&&!Me.test(t)&&(this.checked||!Bt.test(t))}).map(function(t,e){var i=ot(this).val();return null==i?null:ot.isArray(i)?ot.map(i,function(t){return{name:e.name,value:t.replace(Pe,"\r\n")}}):{name:e.name,value:i.replace(Pe,"\r\n")}}).get()}}),ot.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var Ue={0:200,1223:204},Ee=ot.ajaxSettings.xhr();nt.cors=!!Ee&&"withCredentials"in Ee,nt.ajax=Ee=!!Ee,ot.ajaxTransport(function(e){var i,n;if(nt.cors||Ee&&!e.crossDomain)return{send:function(o,s){var a,r=e.xhr();if(r.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)r[a]=e.xhrFields[a];e.mimeType&&r.overrideMimeType&&r.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)r.setRequestHeader(a,o[a]);i=function(t){return function(){i&&(i=n=r.onload=r.onerror=r.onabort=r.onreadystatechange=null,"abort"===t?r.abort():"error"===t?"number"!=typeof r.status?s(0,"error"):s(r.status,r.statusText):s(Ue[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=i(),n=r.onerror=i("error"),void 0!==r.onabort?r.onabort=n:r.onreadystatechange=function(){4===r.readyState&&t.setTimeout(function(){i&&n()})},i=i("abort");try{r.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}}),ot.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return ot.globalEval(t),t}}}),ot.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ot.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,o){e=ot("<script>").prop({charset:t.scriptCharset,src:t.url}).on("load error",i=function(t){e.remove(),i=null,t&&o("error"===t.type?404:200,t.type)}),Y.head.appendChild(e[0])},abort:function(){i&&i()}}}});var Ve=[],De=/(=)\?(?=&|$)|\?\?/;ot.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Ve.pop()||ot.expando+"_"+ge++;return this[t]=!0,t}}),ot.ajaxPrefilter("json jsonp",function(e,i,n){var o,s,a,r=!1!==e.jsonp&&(De.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&De.test(e.data)&&"data");if(r||"jsonp"===e.dataTypes[0])return o=e.jsonpCallback=ot.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,r?e[r]=e[r].replace(De,"$1"+o):!1!==e.jsonp&&(e.url+=(be.test(e.url)?"&":"?")+e.jsonp+"="+o),e.converters["script json"]=function(){return a||ot.error(o+" was not called"),a[0]},e.dataTypes[0]="json",s=t[o],t[o]=function(){a=arguments},n.always(function(){void 0===s?ot(t).removeProp(o):t[o]=s,e[o]&&(e.jsonpCallback=i.jsonpCallback,Ve.push(o)),a&&ot.isFunction(s)&&s(a[0]),a=s=void 0}),"script"}),ot.parseHTML=function(t,e,i){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(i=e,e=!1),e=e||Y;var n=mt.exec(t),o=!i&&[];return n?[e.createElement(n[1])]:(n=p([t],e,o),o&&o.length&&ot(o).remove(),ot.merge([],n.childNodes))};var Re=ot.fn.load;ot.fn.load=function(t,e,i){if("string"!=typeof t&&Re)return Re.apply(this,arguments);var n,o,s,a=this,r=t.indexOf(" ");return r>-1&&(n=ot.trim(t.slice(r)),t=t.slice(0,r)),ot.isFunction(e)?(i=e,e=void 0):e&&"object"==typeof e&&(o="POST"),a.length>0&&ot.ajax({url:t,type:o||"GET",dataType:"html",data:e}).done(function(t){s=arguments,a.html(n?ot("<div>").append(ot.parseHTML(t)).find(n):t)}).always(i&&function(t,e){a.each(function(){i.apply(thi
i.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},i.prototype.next=function(){if(!this.sliding)return this.slide("next")},i.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},i.prototype.slide=function(e,n){var o=this.$element.find(".item.active"),s=n||this.getItemForDirection(e,o),a=this.interval,r="next"==e?"left":"right",l=this;if(s.hasClass("active"))return this.sliding=!1;var c=s[0],d=t.Event("slide.bs.carousel",{relatedTarget:c,direction:r});if(this.$element.trigger(d),!d.isDefaultPrevented()){if(this.sliding=!0,a&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=t(this.$indicators.children()[this.getItemIndex(s)]);h&&h.addClass("active")}var p=t.Event("slid.bs.carousel",{relatedTarget:c,direction:r});return t.support.transition&&this.$element.hasClass("slide")?(s.addClass(e),s[0].offsetWidth,o.addClass(r),s.addClass(r),o.one("bsTransitionEnd",function(){s.removeClass([e,r].join(" ")).addClass("active"),o.removeClass(["active",r].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(p)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)):(o.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(p)),a&&this.cycle(),this}};var n=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=i,t.fn.carousel.noConflict=function(){return t.fn.carousel=n,this};var o=function(i){var n,o=t(this),s=t(o.attr("data-target")||(n=o.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var a=t.extend({},s.data(),o.data()),r=o.attr("data-slide-to");r&&(a.interval=!1),e.call(s,a),r&&s.data("bs.carousel").to(r),i.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",o).on("click.bs.carousel.data-api","[data-slide-to]",o),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var i=t(this);e.call(i,i.data())})})}(jQuery),function(t){"use strict";function e(e){var i,n=e.attr("data-target")||(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return t(n)}function i(e){return this.each(function(){var i=t(this),o=i.data("bs.collapse"),s=t.extend({},n.DEFAULTS,i.data(),"object"==typeof e&&e);!o&&s.toggle&&/show|hide/.test(e)&&(s.toggle=!1),o||i.data("bs.collapse",o=new n(this,s)),"string"==typeof e&&o[e]()})}var n=function(e,i){this.$element=t(e),this.options=t.extend({},n.DEFAULTS,i),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};n.VERSION="3.3.7",n.TRANSITION_DURATION=350,n.DEFAULTS={toggle:!0},n.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},n.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,o=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(o&&o.length&&(e=o.data("bs.collapse"))&&e.transitioning)){var s=t.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){o&&o.length&&(i.call(o,"hide"),e||o.data("bs.collapse",null));var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var r=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return r.call(this);var l=t.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",t.proxy(r,this)).emulateTransitionEnd(n.TRANSITION_DURATION)[a](this.$element[0][l])}}}},n.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPreve
this[t]=this[t]||{}},this)},initialize:function(){},onReady:function(){this.start()},start:function(){this.initializeControllers(this.controllers||{}),this.launchControllers(),this.launch.call(this)},getClasseRefs:function(e,i){var n={},o=this.allocationMap[e],s=this[o];return _.each(i,function(e){n[e]=t(e,e.indexOf(".")>-1?window:s)},this),n},initializeControllers:function(e){this.controllers={},_.each(e,function(e){var i=e.indexOf(".")>-1?window:this[this.allocationMap.controller],n=t(e,i),o=(e.split(".").pop(),new n({id:e,application:this}));o.views=this.getClasseRefs("view",o.views||[]),_.extend(this.models,this.getClasseRefs("model",o.models||[])),_.extend(this.collections,this.getClasseRefs("collection",o.collections||{})),this.buildCollections(),this.controllers[e]=o},this)},launchControllers:function(){_.each(this.controllers,function(t,e){t.onLaunch(this)},this)},launch:function(){},addListeners:function(t,e){this.eventbus.addListeners(t,e)},getController:function(t){return this.controllers[t]},getModel:function(t){this._modelsCache=this._modelsCache||{};var e=this._modelsCache[t],i=this.getModelConstructor(t);return!e&&i&&(e=this.createModel(t),this._modelsCache[t]=e),e||null},getModelConstructor:function(t){return this.models[t]},createModel:function(t,e){var i=this.getModelConstructor(t),n=null;return i&&(n=new i(_.extend(e||{}))),n},getCollection:function(t){this._collectionsCache=this._collectionsCache||{};var e=this._collectionsCache[t],i=this.getCollectionConstructor(t);return!e&&i&&(e=this.createCollection(t),this._collectionsCache[t]=e),e||null},getCollectionConstructor:function(t){return this.collections[t]},createCollection:function(t){var e=this.getCollectionConstructor(t),i=null;return e&&(i=new e),i},buildCollections:function(){_.each(this.collections,function(t,e){this.getCollection(e)},this)}}),void 0!==Backbone.Application)throw"Native Backbone.Application instance already defined.";Backbone.Application=e,Backbone.Application.extend=Backbone.Model.extend;var i=function(t){_.extend(this,t||{}),this.initialize.apply(this,arguments)};if(_.extend(i.prototype,{name:null,views:{},models:{},collections:{},initialize:function(t){},addListeners:function(t){this.getApplication().addListeners(t,this)},onLaunch:function(t){},getApplication:function(){return this.application},getView:function(t){return this._viewsCache[t]},getViewConstructor:function(t){return this.views[t]},createView:function(t,e){var i=this.getViewConstructor(t),n=_.extend(e||{},{alias:t});return this._viewsCache=this._viewsCache||{},this._viewsCache[t]=new i(n),this._viewsCache[t].options=_.extend({},n),this._viewsCache[t]},getModel:function(t){return this.application.getModel(t)},getModelConstructor:function(t){return this.application.getModelConstructor(t)},createModel:function(t,e){return this.application.createModel(t)},getCollection:function(t){return this.application.getCollection(t)},getCollectionConstructor:function(t){return this.application.getCollectionConstructor(t)},createCollection:function(t){return this.application.createCollection(t)},fireEvent:function(t,e,i){this.application.eventbus.fireEvent(t,e,i)},bindViewEvents:function(t,e){this.unbindViewEvents(t),e=_.isFunction(e)?e.call(this):e;for(var i in e){var n=e[i];_.isFunction(n)||(n=this[e[i]]);var o=i.match(/^(\S+)\s*(.*)$/),s=o[1],a=o[2];n=_.bind(n,this),s+=".bindViewEvents"+t.cid,t.$el.on(s,a,n)}return this},unbindViewEvents:function(t){return t.$el.off(".bindViewEvents"+t.cid),this}}),void 0!==Backbone.Controller)throw"Native Backbone.Controller instance already defined.";Backbone.Controller=i,Backbone.Controller.extend=Backbone.Model.extend;var n=function(t){var e=this;_.extend(this,t||{}),_.extend(Backbone.View.prototype,{alias:null,hidden:!1,getAlias:function(){return this.options.alias},fireEvent:function(t,i){this.trigger.apply(this,arguments),e.fireEvent(this.getAlias(),t,i)},hide:function(){this.$el.hide(),this.hidden=!0},show:function(){this.$el.show(),this.hidden=!1}})};if(_.extend(n.prototype,{pool:{},addListeners:function(t,e){this.pool[e.id]=this.pool[
this.$window.append(_.template(n)),this.binding.resize=_.bind(l,this),this.binding.resizeStop=_.bind(c,this),this.binding.resizeStart=_.bind(r,this),e&&e.length>1&&(this.initConfig.minwidth=e[0]),e&&e.length>1&&(this.initConfig.minheight=e[1]),i&&i.length>1&&(this.initConfig.maxwidth=i[0]),i&&i.length>1&&(this.initConfig.maxheight=i[1]),this.$window.find(".resize-border").on("mousedown",this.binding.resizeStart)}else this.$window.find(".resize-border").remove();this.resizable=t}},onPrimary:function(){},cancelButtonText:"Cancel",okButtonText:"OK",yesButtonText:"Yes",noButtonText:"No",closeButtonText:"Close",textWarning:"Warning",textError:"Error",textConfirmation:"Confirmation",textInformation:"Information",textDontShow:"Don't show this message again"}}(),Common.UI.Window||{}))}),define("common/main/lib/view/RenameDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.RenameDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",filename:""},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textName+"</label>","</div>",'<div id="id-dlg-newname" class="input-row"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].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.inputName=new Common.UI.InputField({el:$("#id-dlg-newname"),style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!/[\t*\+:\"<>?|\\\\\/]/gim.test(e)||t.txtInvalidName+'*+:"<>?|/'}});var e=this.getChild();e.find(".btn").on("click",_.bind(this.onBtnClick,this)),t.inputNameEl=e.find("input"),t.inputNameEl.on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputName.setValue(t.options.filename),t.inputNameEl.focus().select()},100)},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputName.checkValidate())return void this.inputNameEl.focus();this.options.handler.call(this,t,this.inputName.getValue())}this.close()},textName:"File name",cancelButtonText:"Cancel",okButtonText:"Ok",txtInvalidName:"The file name cannot contain any of the following characters: "},Common.Views.RenameDialog||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Header",["backbone","text!common/main/lib/template/Header.template","core","common/main/lib/view/RenameDialog"],function(t,e){"use strict";Common.Views.Header=t.View.extend(_.extend({options:{branding:{},headerCaption:"Default Caption",documentCaption:"",canBack:!1},el:"#header",template:_.template(e),events:{"click #header-logo":function(t){var e=this.branding&&this.branding.logo&&this.branding.logo.url?this.branding.logo.url:"http://www.onlyoffice.com",i=window.open(e);i&&i.focus()}},initialize:function(t){this.options=this.options?_({}).extend(this.options,t):t,this.headerCaption=this.options.headerCaption,this.documentCaption=this.options.documentCaption,this.canBack=this.options.canBack,this.branding=this.options.customization,this.isModified=!1},render:function(){$(this.el).html(this.template({headerCaption:this.headerCaption,documentCaption:Common.Utils.String.htmlEncode(this.documentCaption),canBack:this.canBack,textBack:this.textBack}));var t=new Common.UI.MenuItem({caption:this.openNewTabText}).on("click",function(t,e){Common.NotificationCenter.trigger("goback",!0),Common.component.Analytics.trackEvent("Back to Folder")});this.gotoDocsMenu=new Common.UI.Menu({style:"min-width: 100px;",items:[t]})},set
e=!0):r&&!l&&(d?a.scrollLeft(a.scrollLeft()+d*s.wheelSpeed):a.scrollLeft(a.scrollLeft()-h*s.wheelSpeed),e=!0):(a.scrollTop(a.scrollTop()-h*s.wheelSpeed),a.scrollLeft(a.scrollLeft()+d*s.wheelSpeed)),P(),(e=e||U(d,h))&&(i.stopPropagation(),i.preventDefault())}),a.bind("MozMousePixelScroll"+S,function(t){e&&t.preventDefault()})},V=function(){var e=!1;a.bind("mouseenter"+S,function(t){e=!0}),a.bind("mouseleave"+S,function(t){e=!1});var i=!1;t(document).bind("keydown"+S,function(n){if(e&&!t(document.activeElement).is(":input,[contenteditable]")){var o=0,s=0;switch(n.which){case 37:o=-30;break;case 38:s=30;break;case 39:o=30;break;case 40:s=-30;break;case 33:s=90;break;case 32:case 34:s=-90;break;case 35:s=-d;break;case 36:s=d;break;default:return}a.scrollTop(a.scrollTop()-s),a.scrollLeft(a.scrollLeft()+o),i=U(o,s),i&&n.preventDefault()}})},D=function(){var t=function(t){t.stopPropagation()};y.bind("click"+S,t),v.bind("click"+S,function(t){var e=parseInt(g/2,10),i=t.pageY-v.offset().top-e,n=f-g,o=i/n;o<0?o=0:o>1&&(o=1),a.scrollTop((p-d)*o)}),_.bind("click"+S,t),C.bind("click"+S,function(t){var e=parseInt(m/2,10),i=t.pageX-C.offset().left-e,n=c-m,o=i/n;o<0?o=0:o>1&&(o=1),a.scrollLeft((h-c)*o)})},R=function(){var e=function(t,e){a.scrollTop(a.scrollTop()-e),a.scrollLeft(a.scrollLeft()-t),P()},i={},n=0,o={},s=null,r=!1;t(window).bind("touchstart"+S,function(t){r=!0}),t(window).bind("touchend"+S,function(t){r=!1}),a.bind("touchstart"+S,function(t){var e=t.originalEvent.targetTouches[0];i.pageX=e.pageX,i.pageY=e.pageY,n=(new Date).getTime(),null!==s&&clearInterval(s),t.stopPropagation()}),a.bind("touchmove"+S,function(t){if(!r&&1===t.originalEvent.targetTouches.length){var s=t.originalEvent.targetTouches[0],a={};a.pageX=s.pageX,a.pageY=s.pageY;var l=a.pageX-i.pageX,c=a.pageY-i.pageY;e(l,c),i=a;var d=(new Date).getTime(),h=d-n;h>0&&(o.x=l/h,o.y=c/h,n=d),t.preventDefault()}}),a.bind("touchend"+S,function(t){clearInterval(s),s=setInterval(function(){if(Math.abs(o.x)<.01&&Math.abs(o.y)<.01)return void clearInterval(s);e(30*o.x,30*o.y),o.x*=.8,o.y*=.8},10)})},F=function(){a.bind("scroll"+S,function(t){P()})},L=function(){a.unbind(S),t(window).unbind(S),t(document).unbind(S),a.data("perfect-scrollbar",null),a.data("perfect-scrollbar-update",null),a.data("perfect-scrollbar-destroy",null),_.remove(),y.remove(),C.remove(),v.remove(),_=y=c=d=h=p=m=u=w=g=b=x=null},H=function(e){a.addClass("ie").addClass("ie"+e);6===e&&(function(){var e=function(){t(this).addClass("hover")},i=function(){t(this).removeClass("hover")};a.bind("mouseenter"+S,e).bind("mouseleave"+S,i),C.bind("mouseenter"+S,e).bind("mouseleave"+S,i),v.bind("mouseenter"+S,e).bind("mouseleave"+S,i),_.bind("mouseenter"+S,e).bind("mouseleave"+S,i),y.bind("mouseenter"+S,e).bind("mouseleave"+S,i)}(),function(){I=function(){_.css({left:u+a.scrollLeft(),bottom:w,width:m}),y.css({top:b+a.scrollTop(),right:x,height:g}),_.hide().show(),y.hide().show()}}())},N="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;return function(){var t=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);t&&"msie"===t[1]&&H(parseInt(t[2],10)),P(),F(),M(),B(),D(),N&&R(),a.mousewheel&&E(),s.useKeyboard&&V(),a.data("perfect-scrollbar",a),a.data("perfect-scrollbar-update",P),a.data("perfect-scrollbar-destroy",L)}(),a})}}),void 0===Common)var Common={};if(define("common/main/lib/component/Scroller",["jmousewheel","perfectscrollbar","common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Scroller=function(){var t;return _.extend(Common.UI.BaseView.extend({options:{wheelSpeed:20,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:5,scrollYMarginOffset:5,includePadding:!0,includeMargin:!0,alwaysVisibleX:!1,alwaysVisibleY:!1},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.options.el&&this.render()},render:function(){var t=this;return t.cmpEl=$(this.el),t.rendered||(t.cmpEl.perfectScrollbar(_.extend({},t.options)),t.rendered=!0,this.setAlwaysVisib
;e.innerHTML='<div class="app-error-panel"><div class="message-block"><div class="message-inner"><div class="title">Your browser is not supported.</div><div class="text">Sorry, '+t+' Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div></div></div><div class="message-auxiliary"></div></div>',document.body.appendChild(e),$("#loading-mask").hide().remove(),$("#viewport").hide().remove()},Common.Utils.applyCustomization=function(t,e){for(var i in t){var n;if(e[i]&&(n=$(e[i]),n.length)){var o=t[i];!1===o||!1===o.visible?n.hide():(o.text&&n.text(o.text),!1===o.visible&&n.hide())}}},Common.Utils.applyCustomizationPlugins=function(plugins){if(plugins&&!(plugins.length<1)){var _createXMLHTTPObject=function(){var t;try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t||"undefined"==typeof XMLHttpRequest||(t=new XMLHttpRequest),t},_getPluginCode=function(url){if(!url)return"";try{var xhrObj=_createXMLHTTPObject();xhrObj&&url&&(xhrObj.open("GET",url,!1),xhrObj.send(""),200==xhrObj.status&&eval(xhrObj.responseText))}catch(t){}return null};plugins.forEach(function(t){t&&_getPluginCode(t)})}},Common.Utils.fillUserInfo=function(t,e,i){var n=t||{};return!n.id&&(n.id="uid-"+Date.now()),_.isEmpty(n.name)?(_.isEmpty(n.firstname)&&_.isEmpty(n.lastname)&&(n.firstname=i),_.isEmpty(n.firstname)?n.fullname=n.lastname:_.isEmpty(n.lastname)?n.fullname=n.firstname:n.fullname=/^ru/.test(e)?n.lastname+" "+n.firstname:n.firstname+" "+n.lastname):n.fullname=n.name,n},String.prototype.strongMatch=function(t){if(t&&t instanceof RegExp){var e=this.toString().match(t);return!!(e&&e.length>0&&e[0].length==this.length)}return!1},define("common/main/lib/util/utils",function(){}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboBox",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.ComboBoxModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),value:null,displayValue:null}}}),Common.UI.ComboBoxStore=Backbone.Collection.extend({model:Common.UI.ComboBoxModel}),Common.UI.ComboBox=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",hint:!1,editable:!0,disabled:!1,menuCls:"",menuStyle:"",displayField:"displayValue",valueField:"value",scrollAlwaysVisible:!1},template:_.template(['<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',"<% }); %>","</ul>","</span>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);this.id=e.options.id||Common.UI.getId(),this.cls=e.options.cls,this.style=e.options.style,this.menuCls=e.options.menuCls,this.menuStyle=e.options.menuStyle,this.template=e.options.template||e.template,this.itemsTemplate=e.options.itemsTemplate,this.hint=e.options.hint,this.editable=e.options.editable,this.disabled=e.options.disabled,this.store=e.options.store||new Common.UI.ComboBoxStore,this.displayField=e.options.displayField,this.valueField=e.options.valueField,this.scrollAlwaysVisible=e.options.scrollAlwaysVisible,e.rendered=e.options.rendered||!1,this.lastValue=null,e.store.add(e.options.data),e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered)this.cmpEl=$(this.el);else{var i=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:i,scope:e})),this.itemsTemplate&&this.cmpEl.find("ul").append($(this.itemsTemplate({items:i,scope:e}))),t?(this.setElement(t,!1),t.html(this
t.calculateSizeOfContent(),e.fireEvent("comment:show",[d]),a();else if(r.hasClass("btn-inner-edit",!1)){if(o.get("dummy"))return void e.fireEvent("comment:addDummyComment",[this.getActiveTextBoxVal()]);this.clearTextBoxBind(),_.isUndefined(this.replyId)?l&&(e.fireEvent("comment:change",[d,this.getActiveTextBoxVal()]),e.fireEvent("comment:closeEditing"),t.calculateSizeOfContent()):(e.fireEvent("comment:changeReply",[d,this.replyId,this.getActiveTextBoxVal()]),this.replyId=void 0,e.fireEvent("comment:closeEditing")),a()}else if(r.hasClass("btn-inner-close",!1)){if(o.get("dummy"))return void t.hide();p&&this.getActiveTextBoxVal().length>0?(t.saveText(),o.set("hideAddReply",!1),this.getTextBox().val(t.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),e.fireEvent("comment:closeEditing",[d])),this.replyId=void 0,t.calculateSizeOfContent(),t.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),t.calculateSizeOfContent(),a()}else if(r.hasClass("btn-resolve",!1)){var m=r.data("bs.tooltip");m&&(m.dontShow=!0),e.fireEvent("comment:resolve",[d]),a()}else if(r.hasClass("btn-resolve-check",!1)){var m=r.data("bs.tooltip");m&&(m.dontShow=!0),e.fireEvent("comment:resolve",[d]),a()}}}),t.on({show:function(){t.commentsView.autoHeightTextBox(),t.$window.find("textarea").keydown(function(e){e.keyCode==Common.UI.Keys.ESC&&t.hide()})},"animate:before":function(){var e=t.$window.find("textarea");e&&e.length&&e.focus()}})}},show:function(t,e,i,n){this.options.animate=t;var o=this.commentsView.getTextBox();e&&this.textVal&&o&&o.val(this.textVal),n&&n.length&&o&&o.val(n),Common.UI.Window.prototype.show.call(this),this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.hookTextBox()},hide:function(){this.handlerHide&&this.handlerHide(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n,o){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var s=$("#id-comments-popover"),a=$("#id-comments-arrow"),r=$("#editor_sdk"),l=null,c=0,d="",h=0,p="",m=0,u="",g=0,b="",f=0,C=0,v=0,y=0,w=0,x=0;s&&a&&r&&r.get(0)&&(l=r.get(0).getBoundingClientRect())&&(c=l.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:c+"px"}),this.sdkBounds.width=l.width,this.sdkBounds.height=l.height,_.isUndefined(t)||(d=$("#id_vertical_scroll"),d.length?h="none"!==d.css("display")?d.width():0:(d=$("#ws-v-scrollbar"),d.length&&(h="none"!==d.css("display")?d.width():0)),this.sdkBounds.width-=h,p=$("#id_panel_left"),p.length&&(m="none"!==p.css("display")?p.width():0),u=$("#id_panel_thumbnails"),u.length&&(g="none"!==u.css("display")?u.width():0,this.sdkBounds.width-=g),C=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()-25),C=Math.max(0+m+this.arrow.width,C),a.removeClass("right").addClass("left"),_.isUndefined(i)||(v=this.$window.outerWidth())&&(t+v>this.sdkBounds.width-this.arrow.width+5&&this.leftX>v?(C=this.leftX-v+0-this.arrow.width,a.removeClass("left").addClass("right")):C=0+t+this.arrow.width),this.$window.css("left",C+"px")),_.isUndefined(e)||(b=$("#id_panel_top"),x=0,b.length?(f="none"!==b.css("display")?b.height():0,x+=this.sdkBounds.paddingTop):(b=$("#ws-h-scrollbar"),b.length&&(f="none"!==b.css("display")?b.height():0)),this.sdkBounds.height-=f,y=this.$window.outerHeight(),w=Math.min(0+c-y,this.arrowPosY+0-this.arrow.height),w=Math.max(w,x),this.$window.css("top",w+"px"))),o||this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-comments-arrow"),i=$("#id-comments-popover"),n=null,o=null,s=null,a=0,r="",l=0,c=0,d=0
this.pluginsMask.css("display",t?"block":"none"))},openInsideMode:function(t,e){return!!this.pluginsPanel&&(this.pluginsPanel.toggleClass("hidden",!0),this.currentPluginPanel.toggleClass("hidden",!1),this.pluginName.text(t),this.iframePlugin||(this.iframePlugin=document.createElement("iframe"),this.iframePlugin.id="plugin_iframe",this.iframePlugin.name="pluginFrameEditor",this.iframePlugin.width="100%",this.iframePlugin.height="100%",this.iframePlugin.align="top",this.iframePlugin.frameBorder=0,this.iframePlugin.scrolling="no",this.iframePlugin.onload=_.bind(this._onLoad,this),this.currentPluginFrame.append(this.iframePlugin),this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:this.currentPluginFrame})),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),this.iframePlugin.src=e),!0)},closeInsideMode:function(){this.pluginsPanel&&(this.iframePlugin&&(this.currentPluginFrame.empty(),this.iframePlugin=null),this.currentPluginPanel.toggleClass("hidden",!0),this.pluginsPanel.toggleClass("hidden",!1))},openNotVisualMode:function(t){var e=this.viewPluginsList.store.findWhere({guid:t});e&&this.viewPluginsList.cmpEl.find("#"+e.get("id")).parent().addClass("selected")},closeNotVisualMode:function(){this.viewPluginsList.cmpEl.find(".selected").removeClass("selected")},_onLoad:function(){this.loadMask&&this.loadMask.hide()},strPlugins:"Plugins",textLoading:"Loading",textStart:"Start"},Common.Views.Plugins||{})),Common.Views.PluginDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{cls:"advanced-settings-dlg",header:!0,enableKeyEvents:!1},t);var i=e.buttons&&_.size(e.buttons)>0?85:34;e.width=Common.Utils.innerWidth()-e.width<0?Common.Utils.innerWidth():e.width,e.height+=i,e.height=Common.Utils.innerHeight()-e.height<0?Common.Utils.innerHeight():e.height,this.template=['<div id="id-plugin-container" class="box" style="height:'+(e.height-i)+'px;">','<div id="id-plugin-placeholder" style="width: 100%;height: 100%;"></div>',"</div>","<% if (_.size(buttons) > 0) { %>",'<div class="separator horizontal"/>','<div class="footer" style="text-align: center;">',"<% for(var bt in buttons) { %>",'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" style="margin-right: 10px;"><%= buttons[bt].text %></button>',"<% } %>","</div>","<% } %>"].join(""),e.tpl=_.template(this.template,e),this.url=t.url||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"}),this.boxEl=this.$window.find(".body > .box"),this._headerFooterHeight=this.options.buttons&&_.size(this.options.buttons)>0?85:34,this._headerFooterHeight+=parseInt(this.$window.css("border-top-width"))+parseInt(this.$window.css("border-bottom-width"));var t=document.createElement("iframe");t.id="plugin_iframe",t.name="pluginFrameEditor",t.width="100%",t.height="100%",t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this);var e=this;setTimeout(function(){e.isLoaded||(e.loadMask=new Common.UI.LoadMask({owner:$("#id-plugin-placeholder")}),e.loadMask.setTitle(e.textLoading),e.loadMask.show(),e.isLoaded&&e.loadMask.hide())},500),t.src=this.url,$("#id-plugin-placeholder").append(t),this.on("resizing",function(t){e.boxEl.css("height",parseInt(e.$window.css("height"))-e._headerFooterHeight)})},_onLoad:function(){this.isLoaded=!0,this.loadMask&&this.loadMask.hide()},setInnerSize:function(t,e){var i=Common.Utils.innerHeight(),n=Common.Utils.innerWidth(),o=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width"));i<e+this._headerFooterHeight&&(e=i-this._headerFooterHeight),n<t+o&&(t=n-o),this.boxEl.css("height",e),Common.UI.Window.prototype.setHeight.call(this,e+this._headerFooterHeight),Common.UI.Window.prototype.setWidth.call(this,t+o),this.$window.css("left",(n-t-o)/2),this.$window.css("top",(i-e-this._headerFooterHeight)/2*.9)},textLoading:"Loading"},Common.Views.PluginDlg||{}))}),define("common/main/lib/view/SearchDialog",["common/main/lib/c
;if(e.cmpEl.hasClass("dropdown-submenu")&&e.cmpEl.hasClass("over")&&(t&&t.relatedTarget&&e.cmpEl.find(t.relatedTarget).length>0||e.cmpEl.hasClass("focused-submenu")))return void e.cmpEl.removeClass("focused-submenu");if(e.menu&&!e.disabled&&(clearTimeout(e.expandMenuTimer),e.hideMenuTimer=_.delay(function(){e.menu.isOver||e.cmpEl.removeClass("over")},200),t&&"focusout"!==t.type)){var i=e.cmpEl.children(":focus");i.length>0&&(i.blur(),e.cmpEl.closest("ul").focus())}}}),Common.UI.MenuItemSeparator=function(t){return t=t||{},t.caption="--",new Common.UI.MenuItem(t)}}),void 0===Common)var Common={};if(define("common/main/lib/component/Menu",["common/main/lib/extend/Bootstrap","common/main/lib/component/BaseView","common/main/lib/component/MenuItem","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.Menu=function(){var t=function(){var t=[],e={};return{register:function(i){e[i.id]=i,i.on("show:after",function(e){t.push(e)}).on("hide:after",function(e){var i=t.indexOf(e);i>-1&&t.splice(i,1)})},unregister:function(i){var n=t.indexOf(i);delete e[i.id],n>-1&&t.splice(n,1),i.off("show:after").off("hide:after")},hideAll:function(){return Common.NotificationCenter.trigger("menumanager:hideall"),!!(t&&t.length>0)&&(_.each(t,function(t){t&&t.hide()}),!0)}}}();return _.extend(Common.UI.BaseView.extend({options:{cls:"",style:"",itemTemplate:null,items:[],menuAlign:"tl-bl",menuAlignEl:null,offset:[0,0],cyclic:!0},template:_.template(['<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var i=this;this.id=this.options.id||Common.UI.getId(),this.itemTemplate=this.options.itemTemplate||Common.UI.MenuItem.prototype.template,this.rendered=!1,this.items=[],this.offset=[0,0],this.menuAlign=this.options.menuAlign,this.menuAlignEl=this.options.menuAlignEl,this.options.cyclic||(this.options.cls+=" no-cyclic"),_.each(this.options.items,function(t){t instanceof Common.UI.MenuItem?i.items.push(t):i.items.push(new Common.UI.MenuItem(_.extend({tagName:"li",template:i.itemTemplate},t)))}),this.options.el&&this.render(),t.register(this)},remove:function(){t.unregister(this),Common.UI.BaseView.prototype.remove.call(this)},render:function(t){var e=this;this.trigger("render:before",this),this.cmpEl=$(this.el),t?(this.setElement(t,!1),e.rendered||(this.cmpEl=$(this.template({options:e.options})),t.append(this.cmpEl))):e.rendered||(this.cmpEl=this.template({options:e.options}),$(this.el).append(this.cmpEl));var i=this.cmpEl.parent(),n="menu"===i.attr("role")?i:i.find("[role=menu]");return n&&(e.rendered||_.each(e.items||[],function(t){n.append(t.render().el),t.on("click",_.bind(e.onItemClick,e)),t.on("toggle",_.bind(e.onItemToggle,e))}),n.css({"max-height":e.options.maxHeight||"none",position:"fixed",right:"auto",left:-1e3,top:-1e3}),this.parentEl=n.parent(),this.parentEl.on("show.bs.dropdown",_.bind(e.onBeforeShowMenu,e)),this.parentEl.on("shown.bs.dropdown",_.bind(e.onAfterShowMenu,e)),this.parentEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),this.parentEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e)),this.parentEl.on("keydown.after.bs.dropdown",_.bind(e.onAfterKeydownMenu,e)),n.on("scroll",_.bind(e.onScroll,e)),n.hover(function(t){e.isOver=!0},function(t){e.isOver=!1})),this.rendered=!0,this.trigger("render:after",this),this},isVisible:function(){return this.rendered&&this.cmpEl.is(":visible")},show:function(){this.rendered&&this.parentEl&&!this.parentEl.hasClass("open")&&this.cmpEl.dropdown("toggle")},hide:function(){this.rendered&&this.parentEl&&(this.parentEl.hasClass("open")?this.cmpEl.dropdown("toggle"):this.parentEl.hasClass("over")&&this.parentEl.removeClass("over"))},insertItem:function(t,e){var i=this,n=this.cmpEl;if(e instanceof Common.UI.MenuItem||(e=new Common.UI.MenuItem(_.extend({tagName:"li",template:i.itemTemplate},e))),t<0||t>=i.items.length?i.items.push(e):i.items.splice(t,0,e),this.rendered){var o="menu"===n.attr("role")?n:n.find("[role=menu]");o&&(t<0?
var e=_.isFunction(t.get_Name)?t.get_Name():t.asc_getName();if(this.getRawValue()!==e){var i=this.store.findWhere({name:e});if($(".selected",$(this.el)).removeClass("selected"),i){this.setRawValue(i.get(this.displayField));var n=$("#"+i.get("id"),$(this.el)),o=$("ul.dropdown-menu",this.cmpEl);n&&o&&(n.addClass("selected"),this.recent<=0&&o.scrollTop(n.offset().top-o.offset().top))}else this.setRawValue(e)}},itemClicked:function(t){var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i),Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['<li id="<%= item.id %>">','<a class="font-item" tabindex="-1" type="menuitem" style="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',"</li>"].join(""),{item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t){if(t.get("type")!=FONT_TYPE_RECENT&&!this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT})){var e=this.store.where({type:FONT_TYPE_RECENT});e.length<this.recent||this.store.remove(e[this.recent-1]);var i=t.clone();i.set({type:FONT_TYPE_RECENT,id:Common.UI.getId(),cloneid:t.id}),this.store.add(i,{at:0})}},selectCandidate:function(t){var e=this,i=this._input.val().toLowerCase();this._fontsArray||(this._fontsArray=this.store.toJSON());var n=_.find(this._fontsArray,function(n){return t?n[e.displayField].toLowerCase()==i:0==n[e.displayField].toLowerCase().indexOf(i)});if(this._selectedItem=n?this.store.findWhere({id:n.id}):null,$(".selected",$(this.el)).removeClass("selected"),this._selectedItem){var o=$("#"+this._selectedItem.get("id"),$(this.el)),s=$("ul[role=menu]",$(this.el));if(o.length>0&&s.length>0){o.addClass("selected");var a=o.position().top,r=s.scrollTop();0!=a&&s.scrollTop(r+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,a=o.store.length,r=0;if(o.tiles||(o.tiles=[]),a!==o.tiles.length)for(s=o.tiles.length;s<a;++s)o.tiles.unshift(null);_.isUndefined(n)&&(n=parseInt($(o.el).find(".ps-scrollbar-x-rail").css("bottom")));var l=$(o.el).find(".dropdown-menu").height(),c=Math.max(Math.floor(l/36)+3,0),d=Math.max(Math.floor(-n/36)-1,0),h=d+c,p=$(o.el).find("a");for(s=0;s<a;++s)if(d<=s&&s<h){if(null===o.tiles[s]){var m=document.createElement("canvas"),u=m.getContext("2d");m.height=e?2*t:t,m.width=e?604:302,m.style.width="302px",m.style.height=t+"px",r=o.store.at(s).get("imgidx"),e?(u.clearRect(0,0,604,2*t),u.drawImage(o.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*r)):(u.clearRect(0,0,302,t),u.drawImage(o.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*r)),o.tiles[s]=m,$(p[s]).get(0).appendChild(m)}}else o.tiles[s]&&(o.tiles[s].parentNode.removeChild(o.tiles[s]),o.tiles[s]=null)},flushVisibleFontsTiles:function(){for(var t=this.tiles.length-1;t>=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/MetricSpinner",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MetricSpinner=Common.UI.BaseView.extend({options:{minValue:0,maxValue:100,step:1,defaultUnit:"px",allowAuto:!1,autoText:"Auto",hold:!0,speed:"medium",width:90,allowDecimal:!0},disabled:!1,value:"0 px",rendere
h:d,s:h,b:p})}},f=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",b),b(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",b)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();m(e,!0)},w=function(t){var m,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),r=g.find(".color-text"),l=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",f)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),l.length>0&&(l.off("click"),l.on("click",y)),m="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),d=m.h,h=m.s,p=m.b,d==h&&d==p&&0==d&&(h=100),u())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),d=e.h,h=e.s,p=e.b,d==h&&d==p&&0==d&&(h=100),c.color=t,u()}},c.getColor=function(){return c.color},c.on("render:after",w),c.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||t.keyCode===Common.UI.Keys.DELETE||t.keyCode===Common.UI.Keys.BACKSPACE||t.keyCode===Common.UI.Keys.LEFT||t.keyCode===Common.UI.Keys.RIGHT||t.keyCode===Common.UI.Keys.HOME||t.keyCode===Common.UI.Keys.END||t.keyCode===Common.UI.Keys.ESC||t.keyCode===Common.UI.Keys.INSERT||t.keyCode===Common.UI.Keys.TAB||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&$(this.el).val(t)},getValue:function(){$(this.el).val()}})}),void 0===Common)var Common={};if(define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:1,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:2,maskExp:/[0-9]/,allowDecimal:!1}),thi
t._changedProps&&(t.cmbWidth.suspendEvents(),t.cmbWidth.setValue(this._arrWidth[1].value),t.cmbWidth.resumeEvents(),t._changedProps.put_W(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},t)),this._arrHeight=[{displayValue:this.textAuto,value:0},{displayValue:this.textExact,value:1},{displayValue:this.textAtLeast,value:2}],this.cmbHeight=new Common.UI.ComboBox({el:$("#frame-advanced-input-heighttype"),cls:"input-group-nr",menuStyle:"min-width: 130px;",editable:!1,data:this._arrHeight}).on("selected",_.bind(function(e,i){t._changedProps&&(t.spnHeight.suspendEvents(),t.spnHeight.setValue(0==i.value?"":1),t.spnHeight.resumeEvents(),t._changedProps.put_HRule(0==i.value?Asc.linerule_Auto:1==i.value?Asc.linerule_Exact:Asc.linerule_AtLeast),i.value>0&&this._changedProps.put_H(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},t)),this.cmbHeight.setValue(this._arrHeight[0].value),this.spnHeight=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-height"),maxValue:55.88,minValue:.02,step:.1,defaultUnit:"cm",value:""}).on("change",_.bind(function(e,i,n){if(t._changedProps){var o=Asc.linerule_Auto;t.cmbHeight.getValue()==t._arrHeight[1].value?o=Asc.linerule_Exact:t.cmbHeight.getValue()==t._arrHeight[2].value&&(o=Asc.linerule_AtLeast),o==Asc.linerule_Auto&&(t.cmbHeight.suspendEvents(),t.cmbHeight.setValue(t._arrHeight[2].value),o=Asc.linerule_AtLeast,t.cmbHeight.resumeEvents()),t._changedProps.put_HRule(o),t._changedProps.put_H(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))}},t)),this.spnX=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-hdist"),maxValue:55.87,minValue:0,step:.1,defaultUnit:"cm",value:"0 cm",width:"auto"}).on("change",_.bind(function(e,i,n){t._changedProps&&t._changedProps.put_HSpace(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))},t)),this.spnY=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-vdist"),maxValue:55.87,minValue:0,step:.1,defaultUnit:"cm",value:"0 cm",width:"auto"}).on("change",_.bind(function(e,i,n){t._changedProps&&t._changedProps.put_VSpace(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))},t)),this._arrHAlign=[{displayValue:this.textLeft,value:Asc.c_oAscXAlign.Left},{displayValue:this.textCenter,value:Asc.c_oAscXAlign.Center},{displayValue:this.textRight,value:Asc.c_oAscXAlign.Right}],this.cmbHAlign=new Common.UI.ComboBox({el:$("#frame-advanced-input-hposition"),cls:"input-group-nr",menuStyle:"min-width: 130px;",data:this._arrHAlign}).on("changed:after",_.bind(function(e,i){t._changedProps&&(t._changedProps.put_XAlign(void 0),t._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(parseFloat(i.value))))},t)).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_XAlign(i.value)},t)),this.cmbHAlign.setValue(this._arrHAlign[0].value),this._arrHRelative=[{displayValue:this.textMargin,value:Asc.c_oAscHAnchor.Margin},{displayValue:this.textPage,value:Asc.c_oAscHAnchor.Page},{displayValue:this.textColumn,value:Asc.c_oAscHAnchor.Text}],this.cmbHRelative=new Common.UI.ComboBox({el:$("#frame-advanced-input-hrelative"),cls:"input-group-nr",menuStyle:"min-width: 95px;",data:this._arrHRelative,editable:!1}).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_HAnchor(i.value)},t)),this.cmbHRelative.setValue(this._arrHRelative[1].value),this._arrVAlign=[{displayValue:this.textTop,value:Asc.c_oAscYAlign.Top},{displayValue:this.textCenter,value:Asc.c_oAscYAlign.Center},{displayValue:this.textBottom,value:Asc.c_oAscYAlign.Bottom}],this.cmbVAlign=new Common.UI.ComboBox({el:$("#frame-advanced-input-vposition"),cls:"input-group-nr",menuStyle:"min-width: 130px;",data:this._arrVAlign}).on("changed:after",_.bind(function(e,i){t._changedProps&&(t._changedProps.put_YAlign(void 0),t._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(parseFloat(i.value))))},t)).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_YAlign(i.value)},t)),this.cmbVAlign.setValue(this._arrVAlign[0].value),this._arrVRelative=[{displayValue:this.textMargin,value:Asc.c_oAscVAnchor.Margin},{displayValue:this.textPage,value:Asc.c_oAscV
maxLength:Asc.c_oAscMaxTooltipLength}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputUrl.cmpEl.find("input").focus()},500)},setSettings:function(t){if(t){var e=this;t.get_Value()?e.inputUrl.setValue(t.get_Value().replace(new RegExp(" ","g"),"%20")):e.inputUrl.setValue(""),null!==t.get_Text()?(e.inputDisplay.setValue(t.get_Text()),e.inputDisplay.setDisabled(!1)):(e.inputDisplay.setValue(this.textDefault),e.inputDisplay.setDisabled(!0)),this.isTextChanged=!1,e.inputTip.setValue(t.get_ToolTip())}},getSettings:function(){var t=this,e=new Asc.CHyperlinkProperty,i=$.trim(t.inputUrl.getValue());return/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(i)||(i=(t.isEmail?"mailto:":"http://")+i),i=i.replace(new RegExp("%20","g")," "),e.put_Value(i),t.inputDisplay.isDisabled()||!this.isTextChanged&&!_.isEmpty(t.inputDisplay.getValue())?e.put_Text(null):(_.isEmpty(t.inputDisplay.getValue())&&t.inputDisplay.setValue(i),e.put_Text(t.inputDisplay.getValue())),e.put_ToolTip(t.inputTip.getValue()),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){if(t.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){var e=this.inputUrl.checkValidate(),i=this.inputDisplay.checkValidate();if(!0!==e)return void this.inputUrl.cmpEl.find("input").focus();if(!0!==i)return void this.inputDisplay.cmpEl.find("input").focus()}this.options.handler.call(this,this,t)}this.close()},textUrl:"Link to",textDisplay:"Display",cancelButtonText:"Cancel",okButtonText:"Ok",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"',textTooltip:"ScreenTip text",textDefault:"Selected text",textTitle:"Hyperlink Settings"},DE.Views.HyperlinkSettingsDialog||{}))}),define("text!documenteditor/main/app/template/ParagraphSettingsAdvanced.template",[],function(){return'<div id="id-adv-paragraph-indents" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsFirstLine %></label>\r\n <div id="paragraphadv-spin-first-line" style="width: 85px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsLeftText %></label>\r\n <div id="paragraphadv-spin-indent-left"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsRightText %></label>\r\n <div id="paragraphadv-spin-indent-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large text-only"></div>\r\n <div class="inner-content text-only" style="padding-right: 0px;" >\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-break-before"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-keep-lines"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-orphan"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-keep-next"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-borders" class="settings-panel">\r\n <div class="inner-content">\r\n <div style="width: 100%;" class="padding-small">\r\n
i=null!==e&&void 0!==e&&null!==e.get_Space()&&void 0!==e.get_Space()?Common.Utils.Metric.fnRecalcFromMM(e.get_Space()):"",this.spnMarginBottom.setValue(i,!0)}var n=t.get_Shade();if(null!==n&&void 0!==n&&n.get_Value()===Asc.c_oAscShdClear){var o=n.get_Color();o?o.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.paragraphShade={color:Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()),effectValue:o.get_value()}:this.paragraphShade=Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()):this.paragraphShade="transparent"}else this.paragraphShade="transparent";if(this.btnBackColor.setColor(this.paragraphShade),"object"==typeof this.paragraphShade){for(var s=!1,a=0;a<10;a++)if(Common.Utils.ThemeColor.ThemeValues[a]==this.paragraphShade.effectValue){this.colorsBack.select(this.paragraphShade,!0),s=!0;break}s||this.colorsBack.clearSelection()}else this.colorsBack.select(this.paragraphShade,!0);this._UpdateBorders(),this._noApply=!0,this.chStrike.setValue(null!==t.get_Strikeout()&&void 0!==t.get_Strikeout()?t.get_Strikeout():"indeterminate",!0),this.chDoubleStrike.setValue(null!==t.get_DStrikeout()&&void 0!==t.get_DStrikeout()?t.get_DStrikeout():"indeterminate",!0),this.chSubscript.setValue(null!==t.get_Subscript()&&void 0!==t.get_Subscript()?t.get_Subscript():"indeterminate",!0),this.chSuperscript.setValue(null!==t.get_Superscript()&&void 0!==t.get_Superscript()?t.get_Superscript():"indeterminate",!0),this.chSmallCaps.setValue(null!==t.get_SmallCaps()&&void 0!==t.get_SmallCaps()?t.get_SmallCaps():"indeterminate",!0),this.chAllCaps.setValue(null!==t.get_AllCaps()&&void 0!==t.get_AllCaps()?t.get_AllCaps():"indeterminate",!0),this.numSpacing.setValue(null!==t.get_TextSpacing()&&void 0!==t.get_TextSpacing()?Common.Utils.Metric.fnRecalcFromMM(t.get_TextSpacing()):"",!0),this.numPosition.setValue(null!==t.get_Position()&&void 0!==t.get_Position()?Common.Utils.Metric.fnRecalcFromMM(t.get_Position()):"",!0),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(null!==t.get_DefaultTab()&&void 0!==t.get_DefaultTab()?Common.Utils.Metric.fnRecalcFromMM(parseFloat(t.get_DefaultTab().toFixed(1))):"",!0);var r=this.tabList.store,l=t.get_Tabs();if(l){for(var c=[],d=l.get_Count(),a=0;a<d;a++){var h=l.get_Tab(a),p=Common.Utils.Metric.fnRecalcFromMM(parseFloat(h.get_Pos().toFixed(1))),m=new Common.UI.DataViewModel;m.set({tabPos:p,value:parseFloat(p.toFixed(3))+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:h.get_Value()}),c.push(m)}r.reset(c,{silent:!1}),this.tabList.selectByIndex(0)}this._noApply=!1,this._changedProps=new Asc.asc_CParagraphProperty,this.ChangedBorders=void 0}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),"paragraphadv-spin-spacing"==e.el.id||"paragraphadv-spin-position"==e.el.id?e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01):e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},updateThemeColors:function(){this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},afterRender:function(){if(this.updateMetricUnit(),this.updateThemeColors(),this._setDefaults(this._originalProps),void 0!==this.borderProps){this.btnBorderColor.setColor(this.borderProps.borderColor),this.BordersImage.setVirtualBorderColor("object"==typeof this.borderProps.borderColor?this.borderProps.borderColor.color:this.borderProps.borderColor),this.cmbBorderSize.setValue(this.borderProps.borderSize.ptValue);var t=this.cmbBorderSize.getSelectedRecord();t&&this.onBorderSizeSelect(this.cmbBorderSize,t),this.colorsBorder.select(this.borderProps.borderColor,!0)}for(var e=0;e<this.BordersImage.rows;e++)for(var i=0;i<this.BordersImage.columns;i++)this.BordersImage.getCell(i,e).on("borderclick",functi
return'<div id="id-adv-table-width" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td colspan="3" class="padding-small">\r\n <label class="header"><%= scope.textTableSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 11px;">\r\n <div id="tableadv-checkbox-width"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="tableadv-number-width" style="margin-right: 10px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textMeasure %></label>\r\n <div id="tableadv-cmb-unit" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="3" class="padding-large">\r\n <div id="tableadv-checkbox-autofit"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n <div class="padding-small"></div>\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textDefaultMargins %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="tableadv-number-margin-table-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="tableadv-number-margin-table-left"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textBottom %></label>\r\n <div id="tableadv-number-margin-table-bottom"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="tableadv-number-margin-table-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n <div class="padding-small"></div>\r\n <table cols="2">\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label class="header"><%= scope.textOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="tableadv-checkbox-spacing"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textAllowSpacing %></label>\r\n <div id="tableadv-number-spacing"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n </div>\r\n</div>\r\n<div id="id-adv-table-cell-props" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td colspan="3" class="padding-small">\r\n <label class="header"><%= scope.textCellSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="tableadv-checkbox-prefwidth"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textPrefWidth %></label>\r\n <div id="tableadv-number-prefwidth" style="margin-right: 10px;"></div>\r\
cls:"btn-options huge",iconCls:"icon-right-panel btn-wrap-parallel",posId:c_tableWrap.TABLE_WRAP_PARALLEL,hint:this.textWrapParallelTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablewrapGroup"}),this.btnWrapParallel.render($("#tableadv-button-wrap-parallel")),this.btnWrapParallel.on("click",_.bind(this.onBtnFlowWrapClick,this)),this.btnAlignLeft=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-table-align-left",posId:c_tableAlign.TABLE_ALIGN_LEFT,hint:this.textLeftTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablealignGroup"}),this.btnAlignLeft.render($("#tableadv-button-align-left")),this.btnAlignLeft.on("click",_.bind(function(t){this._changedProps&&t.pressed&&(this._changedProps.put_TableAlignment(t.options.posId),this._changedProps.put_TableIndent(Common.Utils.Metric.fnRecalcToMM(this.spnIndentLeft.getNumberValue())),this.spnIndentLeft.setDisabled(!t.pressed),this._state.alignChanged=!0)},this)),this.btnAlignCenter=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-table-align-center",posId:c_tableAlign.TABLE_ALIGN_CENTER,hint:this.textCenterTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablealignGroup"}),this.btnAlignCenter.render($("#tableadv-button-align-center")),this.btnAlignCenter.on("click",_.bind(function(t){this._changedProps&&t.pressed&&(this._changedProps.put_TableAlignment(t.options.posId),this._changedProps.put_TableIndent(0),this.spnIndentLeft.setDisabled(t.pressed),this._state.alignChanged=!0)},this)),this.btnAlignRight=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-table-align-right",posId:c_tableAlign.TABLE_ALIGN_RIGHT,hint:this.textRightTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablealignGroup"}),this.btnAlignRight.render($("#tableadv-button-align-right")),this.btnAlignRight.on("click",_.bind(function(t){this._changedProps&&t.pressed&&(this._changedProps.put_TableAlignment(t.options.posId),this._changedProps.put_TableIndent(0),this.spnIndentLeft.setDisabled(t.pressed),this._state.alignChanged=!0)},this)),this.spnIndentLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-indent"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:38.09,minValue:-38.09}),this.spnIndentLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_TableIndent(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnIndentLeft),this.spnDistanceTop=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-top"),step:.1,width:85,defaultUnit:"cm",value:"1 cm",maxValue:55.87,minValue:0}),this.spnDistanceTop.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Top(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceTop),this.spnDistanceBottom=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-bottom"),step:.1,width:85,defaultUnit:"cm",value:"1 cm",maxValue:55.87,minValue:0}),this.spnDistanceBottom.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Bottom(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceBottom),this.spnDistanceLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-left"),step:.1,width:85,defaultUnit:"cm",value:"1 cm",maxValue:9.34,minValue:0}),this.spnDistanceLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Left(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceLeft),this.spnDistanceRight=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-right"),step:.1,width:85,
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom),!this._state.spnXChanged){var i=this._originalProps.get_Value_X(this._state.HPositionFrom);this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0)}this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()))}},onVAlignSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._state.VAlignType=e.value,this._changedProps.get_PositionV().put_UseAlign(!0),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._changedProps.get_PositionV().put_Align(this._state.VAlignType))},onVRelativeSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._state.VAlignFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!0),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._changedProps.get_PositionV().put_Align(this._state.VAlignType),this.chMove.setValue(this._state.VAlignFrom==Asc.c_oAscVAnchor.Text,!0))},onVPositionSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._state.VPositionFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom),!this._state.spnYChanged){var i=this._originalProps.get_Value_Y(this._state.VPositionFrom);this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0)}this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),this.chMove.setValue(this._state.VPositionFrom==Asc.c_oAscVAnchor.Text,!0)}},onRadioHAlignChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._changedProps.get_PositionH().put_UseAlign(e),e&&(this._changedProps.get_PositionH().put_Align(this._state.HAlignType),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom))),e&&(this.cmbHAlign.setDisabled(!1),this.cmbHRelative.setDisabled(!1),this.spnX.setDisabled(!0),this.cmbHPosition.setDisabled(!0),this._state.horizontalPropChanged=!0,this._state.alignChanged=!0)},onRadioHPositionChange:function(t,e,i){if(this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._changedProps.get_PositionH().put_UseAlign(!e),e)){if(!this._state.spnXChanged){var n=this._originalProps.get_Value_X(this._state.HPositionFrom);this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(n))}this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom)}e&&(this.cmbHAlign.setDisabled(!0),this.cmbHRelative.setDisabled(!0),this.spnX.setDisabled(!1),this.cmbHPosition.setDisabled(!1),this._state.alignChanged=!1)},onRadioVAlignChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._changedProps.get_PositionV().put_UseAlign(e),e&&(this._changedProps.get_PositionV().put_Align(this._state.VAlignType),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._state.verticalPropChanged=!0)),e&&(this.cmbVAlign.setDisabled(!1),this.cmbVRelative.setDisabled(!1),this.spnY.setDisabled(!0),this.cmbVPosition.setDisabled(!0),this.chMove.setValue(this._state.VAlignFrom==Asc.c_oAscVAnchor.Text,!0))},onRadioVPositionChange:function(t,e,i){if(this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==th
caption:n.get_HideVer()?i.txtAddVer:i.txtHideVer,equationProps:{type:e,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?i.txtAddLT:i.txtHideLT,equationProps:{type:e,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?i.txtAddLB:i.txtHideLB,equationProps:{type:e,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:i.txtRemoveBar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"remove_Bar"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?i.txtUnderbar:i.txtOverbar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();s==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:i.txtScriptsAfter,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtRemScripts,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)):(s==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:i.txtScriptsBefore,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:i.txtRemSubscript,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:i.txtRemSuperscript,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),o.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:i.txtFractionStacked,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:i.txtFractionSkewed,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:i.txtFractionLinear,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?i.txtRemFractionBar:i.txtAddFractionBar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?i.txtLimitUnder:i.txtLimitOver,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oA
}),f=new Common.UI.MenuItem({caption:i.splitCellsText}).on("click",function(t){i.api&&new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&(i.api&&i.api.SplitCell(e.columns,e.rows),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Table"))}}).show()}),C=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsVAlign(t.options.valign),i.api.tblApply(n)}},v=new Common.UI.MenuItem({caption:i.cellAlignText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuTableCellTop=new Common.UI.MenuItem({caption:i.topCellText,toggleGroup:"popuptablecellalign",checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Top}).on("click",e.bind(C,i)),i.menuTableCellCenter=new Common.UI.MenuItem({caption:i.centerCellText,toggleGroup:"popuptablecellalign",checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Center}).on("click",e.bind(C,i)),i.menuTableCellBottom=new Common.UI.MenuItem({caption:i.bottomCellText,toggleGroup:"popuptablecellalign",checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Bottom}).on("click",e.bind(C,i))]})}),_=new Common.UI.MenuItem({caption:i.advancedTableText}).on("click",function(t,n,o){var s;if(i.api){var a=i.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==l){s=new DE.Views.TableSettingsAdvanced({tableStylerRows:null===c.get_CellBorders().get_InsideH()&&1==c.get_CellSelect()?1:2,tableStylerColumns:null===c.get_CellBorders().get_InsideV()&&1==c.get_CellSelect()?1:2,tableProps:c,borderProps:i.borderAdvancedProps,sectionProps:i.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&i.api&&(i.borderAdvancedProps=e.borderProps,i.api.tblApply(e.tableProps)),i.fireEvent("editcomplete",i)}});break}}}s&&s.show()}),y=new Common.UI.MenuItem({caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),w=new Common.UI.MenuItem({caption:"--"}),x=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),S=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api&&i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i)}),A=new Common.UI.MenuItem({caption:i.hyperlinkText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[x,S]})}),T=new Common.UI.MenuItem({caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),k=new Common.UI.MenuItem({caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i));i.menuSpellTable=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMoreTable=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[]})}),i.langTableMenu=new Common.UI.MenuItem({caption:i.langText,menu:new Common.UI.Menu({menuAlign:"tl-tr",maxHeight:300,items:[]}).on("show:after",function(t){})});var I=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i))}),P=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i))}),M=new Common.UI.MenuItem({caption:"--"}),B=new Common.UI.MenuItem({caption:"--"});i.menuSpellCheckTable=new Common.UI.MenuItem({caption:i.spellcheckText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuSpellTable,i.menuSpellMoreTable,M,I,P,{caption:"--"},i.langTableMenu]})});var U=new Common.UI.MenuItem({caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),E=new Common.UI.MenuItem({caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),V=new Common.UI.MenuItem({caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),D=new Common.UI.MenuItem({caption:"--"}),R=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsTextDirection(t.options.direction),i.api.tblApply(n)}},F=new Common.UI.MenuItem({caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar",menuAlign:"tl-tr",items:[i.menuTableDirectH=new Common.UI.M
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_UnitOfMeasur
target:$(document.body),text:"",placement:"right"},template:_.template(['<div class="synch-tip-root <%= scope.placement %>">','<div class="asc-synchronizetip">','<div class="tip-arrow <%= scope.placement %>"></div>',"<div>",'<div class="tip-text" style="width: 260px;"><%= scope.text %></div>','<div class="close img-commonctrl"></div>',"</div>",'<div class="show-link"><label><%= scope.textDontShow %></label></div>',"</div>","</div>"].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.placement=this.options.placement},render:function(){return t=$(this.template({scope:this})),t.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),t.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this)),$(document.body).append(t),this.applyPlacement(),this},show:function(){t?(this.applyPlacement(),t.show()):this.render()},hide:function(){t&&t.hide()},applyPlacement:function(){var e=this.target.offset();"top"==this.placement?t.css({bottom:Common.Utils.innerHeight()-e.top+"px",right:Common.Utils.innerWidth()-e.left-this.target.width()/2+"px"}):t.css({top:e.top+this.target.height()/2+"px",left:e.left+this.target.width()+"px"})},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.<br/>Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("documenteditor/main/app/view/Toolbar",["jquery","underscore","backbone","text!documenteditor/main/app/template/Toolbar.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip"],function(t,e,i,n){"use strict";DE.Views.Toolbar=i.View.extend(e.extend({el:"#toolbar",template:e.template(n),events:{},initialize:function(){var i=this;this.SchemeNames=[this.txtScheme1,this.txtScheme2,this.txtScheme3,this.txtScheme4,this.txtScheme5,this.txtScheme6,this.txtScheme7,this.txtScheme8,this.txtScheme9,this.txtScheme10,this.txtScheme11,this.txtScheme12,this.txtScheme13,this.txtScheme14,this.txtScheme15,this.txtScheme16,this.txtScheme17,this.txtScheme18,this.txtScheme19,this.txtScheme20,this.txtScheme21],this.paragraphControls=[],this.toolbarControls=[],this.textOnlyControls=[],this._state={hasCollaborativeChanges:void 0},this.btnSaveCls="btn-save",this.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),this.btnNewDocument=new Common.UI.Button({id:"id-toolbar-btn-newdocument",cls:"btn-toolbar",iconCls:"btn-newdocument"}),this.toolbarControls.push(this.btnNewDocument),this.btnOpenDocument=new Common.UI.Button({id:"id-toolbar-btn-opendocument",cls:"btn-toolbar",iconCls:"btn-opendocument"}),this.toolbarControls.push(this.btnOpenDocument),this.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print no-mask"}),this.toolbarControls.push(this.btnPrint),this.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"no-mask "+this.btnSaveCls}),this.toolbarControls.push(this.btnSave),this.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo"}),this.toolbarControls.push(this.btnUndo),this.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo"}),this.toolbarControls.push(this.btnRedo),this.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),this.toolbarControls.push(this.btnCopy),this.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",i
n("#id-toolbar-"+i+"-placeholder-btn-hidebars",this.btnHide),n("#id-toolbar-"+i+"-placeholder-btn-settings",this.btnAdvSettings),n("#id-toolbar-full-placeholder-btn-paracolor",this.btnParagraphColor),n("#id-toolbar-full-placeholder-field-styles",this.listStyles),n("#id-toolbar-short-placeholder-btn-halign",this.btnHorizontalAlign),n("#id-toolbar-full-placeholder-btn-mailrecepients",this.btnMailRecepients),n("#id-toolbar-"+i+"-placeholder-btn-notes",this.btnNotes)},createDelayedElements:function(){this.api&&(this.mnuNonPrinting.items[0].setChecked(this.api.get_ShowParaMarks(),!0),this.mnuNonPrinting.items[1].setChecked(this.api.get_ShowTableEmptyLine(),!0),this.btnShowHidenChars.toggle(this.mnuNonPrinting.items[0].checked,!0),this.updateMetricUnit()),this.btnNewDocument.updateHint(this.tipNewDocument),this.btnOpenDocument.updateHint(this.tipOpenDocument),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnStrikeout.updateHint(this.textStrikeout),this.btnSuperscript.updateHint(this.textSuperscript),this.btnSubscript.updateHint(this.textSubscript),this.btnHighlightColor.updateHint(this.tipHighlightColor),this.btnFontColor.updateHint(this.tipFontColor),this.btnParagraphColor.updateHint(this.tipPrColor),this.btnAlignLeft.updateHint(this.tipAlignLeft+Common.Utils.String.platformKey("Ctrl+L")),this.btnAlignCenter.updateHint(this.tipAlignCenter+Common.Utils.String.platformKey("Ctrl+E")),this.btnAlignRight.updateHint(this.tipAlignRight+Common.Utils.String.platformKey("Ctrl+R")),this.btnAlignJust.updateHint(this.tipAlignJust+Common.Utils.String.platformKey("Ctrl+J")),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft+Common.Utils.String.platformKey("Ctrl+M")),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnShowHidenChars.updateHint(this.tipShowHiddenChars),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnMultilevels.updateHint(this.tipMultilevels),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertPageBreak.updateHint(this.tipPageBreak),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnEditHeader.updateHint(this.tipEditHeader),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnDropCap.updateHint(this.tipDropCap),this.btnColumns.updateHint(this.tipColumns),this.btnPageOrient.updateHint(this.tipPageOrient),this.btnPageSize.updateHint(this.tipPageSize),this.btnPageMargins.updateHint(this.tipPageMargins),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnMailRecepients.updateHint(this.tipMailRecepients),this.btnHide.updateHint(this.tipViewSettings),this.btnAdvSettings.updateHint(this.tipAdvSettings),this.btnNotes.updateHint(this.tipNotes);var i=this;this.btnHide.set
this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},DE.Views.MailMergeRecepients||{}))}),void 0===Common)var Common={};if(define("documenteditor/main/app/view/StyleTitleDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";DE.Views.StyleTitleDialog=Common.UI.Window.extend(_.extend({options:{width:350,height:200,style:"min-width: 230px;",cls:"modal-dlg"},initialize:function(t){_.extend(this.options,{title:this.textHeader},t||{}),this.template=['<div class="box">','<label class="input-row" style="margin-bottom: -5px;">'+this.textTitle+" </label>",'<div id="id-dlg-style-title" class="input-row" style="margin-bottom: 5px;"></div>','<label class="input-row" style="margin-bottom: -5px; margin-top: 5px;">'+this.textNextStyle+"</label>",'<div id="id-dlg-style-next-par" class="input-group-nr" style="margin-bottom: 5px;" ></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].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,e=this.getChild();t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-style-title"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!(""==e)||t.txtNotEmpty}}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.cmbNextStyle=new Common.UI.ComboBox({el:$("#id-dlg-style-next-par"),style:"width: 100%;",menuStyle:"width: 100%; max-height: 290px;",editable:!1,cls:"input-group-nr",data:this.options.formats}),this.cmbNextStyle.setValue(this.options.formats[0].value)},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputTitle.cmpEl.find("input").focus()},500)},getTitle:function(){return this.inputTitle.getValue()},getNextStyle:function(){return this.cmbNextStyle.getValue()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){if(t.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){if(!0!==this.inputTitle.checkValidate())return void this.inputTitle.cmpEl.find("input").focus()}this.options.handler.call(this,this,t)}this.close()},textTitle:"Title",textHeader:"Create New Style",txtEmpty:"This field is required",txtNotEmpty:"Field must not be empty",textNextStyle:"Next paragraph style"},DE.Views.StyleTitleDialog||{}))}),define("documenteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";DE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:215,header:!0,style:"min-width: 216px;",cls:"modal-dlg",id:"window-page-margins"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box" style="height: 85px;">','<table cols="2" style="width: 100%;margin-bottom: 10px;">',"<tr>",'<td style="padding-right: 10px;padding-bottom: 8px;">','<label class="input-label">'+this.textTop+"</label>",'<div id="page-margins-spin-top"></div>',"</td>",'<td style="padding-bottom: 8px;">','<label class="input-label">'+this.textBottom+"</label>",'<div id="page-margins-spin-bottom"></div>',"</td>","</tr>","<tr>",'<td class="padding-small" style="padding-right: 10px;">','<label class="input-label">'+this.textLeft+"</label>",'<div id="page-margins-spin-left"></div>',"</td>",'<td class="padding-small">','<label class="input-label">'+this.textRight+"</label>",'<div id="page-margins-spin-right"></div>',"</td>","</tr>","</table>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn
this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this)),this.api.asc_registerCallback("asc_onColumnsProps",_.bind(this.onColumnsProps,this)),this.api.asc_registerCallback("asc_onSectionProps",_.bind(this.onSectionProps,this))},onChangeCompactView:function(t,e){Common.localStorage.setItem("de-compact-toolbar",e?1:0),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onApiFontSize:function(t){this._state.fontsize!==t&&(this.toolbar.cmbFontSize.setValue(t),this._state.fontsize=t)},onApiBold:function(t){this._state.bold!==t&&(this.toolbar.btnBold.toggle(!0===t,!0),this._state.bold=t)},onApiItalic:function(t){this._state.italic!==t&&(this.toolbar.btnItalic.toggle(!0===t,!0),this._state.italic=t)},onApiUnderline:function(t){this._state.underline!==t&&(this.toolbar.btnUnderline.toggle(!0===t,!0),this._state.underline=t)},onApiStrikeout:function(t){this._state.strike!==t&&(this.toolbar.btnStrikeout.toggle(!0===t,!0),this._state.strike=t)},onApiVerticalAlign:function(t){this._state.valign!==t&&(this.toolbar.btnSuperscript.toggle(1==t,!0),this.toolbar.btnSubscript.toggle(2==t,!0),this._state.valign=t)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.btnUndo.setDisabled(!e),this._state.can_undo=e):this._state.can_redo!==e&&(this.toolbar.btnRedo.setDisabled(!e),this._state.can_redo=e)},onApiCanCopyCut:function(t){this._state.can_copycut!==t&&(this.toolbar.btnCopy.setDisabled(!t),this._state.can_copycut=t)},onApiBullets:function(t){var e=t.get_ListType();if(this._state.bullets.type!=e||this._state.bullets.subtype!=t.get_ListSubType()||this.toolbar.btnMarkers.pressed&&0!==e||this.toolbar.btnNumbers.pressed&&1!==e||this.toolbar.btnMultilevels.pressed&&2!==e)switch(this._state.bullets.type=e,this._state.bullets.subtype=t.get_ListSubType(),this._clearBullets(),this._state.bullets.type){case 0:this.toolbar.btnMarkers.toggle(!0,!0),this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype,!0);break;case 1:var i=0;switch(this._state.bullets.subtype){case 1:i=4;break;case 2:i=5;break;case 3:i=6;break;case 4:i=1;break;case 5:i=2;break;case 6:i=3;break;case 7:i=7}this.toolbar.btnNumbers.toggle(!0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(i,!0);break;case 2:this.toolbar.btnMultilevels.toggle(!0,!0),this.toolbar.mnuMultilevelPicker.selectByIndex(this._state.bullets.subtype,!0)}},onApiParagraphAlign:function(t){if(this._state.pralign!==t){this._state.pralign=t;var e,i=-1,n=this.toolbar;switch(t){case 0:i=2,e="btn-align-right";break;case 1:i=0,e="btn-align-left";break;case 2:i=1,e="btn-align-center";break;case 3:i=3,e="btn-align-just";break;default:i=-255,e="btn-align-left"}i<0?-255==i&&this._clearChecked(this.toolbar.btnHorizontalAlign.menu):this.toolbar.btnHorizontalAlign.menu.items[i].setChecked(!0);var o=this.toolbar.btnHorizontalAlign;if(o.rendered){var s=$(".btn-icon",o.cmpEl);s&&(s.removeClass(o.options.icls),o.options.icls=e,s.addClass(o.options.icls))}if(null===t||void 0===t)return n.btnAlignRight.toggle(!1,!0),n.btnAlignLeft.toggle(!1,!0),n.btnAlignCenter.toggle(!1,!0),void n.btnAlignJust.toggle(!1,!0);n.btnAlignRight.toggle(0===t,!0),n.btnAlignLeft.toggle(1===t,!0),n.btnAlignCenter.toggle(2===t,!0),n.btnAlignJust.toggle(3===t,!0)}},onApiLineSpacing:function(t){var e=null===t.get_Line()||null===t.get_LineRule()||1!=t.get_LineRule()?-1:t.get_Line();if(this._state.linespace!==e){if(this._state.linespace=e,_.each(this.toolbar.mnuLineSpace.items,function(t){t.setChecked(!1,!0)}),e<0)return;Math.abs(e-1)<1e-4?this.toolbar.mnuLineSpace.items[0].setChecked(!0,!0):Math.abs(e-1.15)<1e-4?this.toolbar.mnuLineSpace.items[1].setChecked(!0,!0):Math.abs(e-1.5)<1e-4?this.toolbar.mnuLineSpace.items[2].setChecked(!0,!0):Math.abs(e-2)<1e-4?this.toolbar.mnuLineSpace.items[3].setChecked(!0,!0):Math.abs(e-2.5)<1e-4?this.toolbar.mnuLineSpace.items[4].setChecked(!0,!0):Math.abs(e-3)<1e-4&&this.toolbar.mnuLineSpace.items[5].setChecked(!0,!0)}},onApiCanAddHyperlink:function(t){var e=!t||this._state.prcontrolsdisabl
o.render(m),o.cmpEl.attr({tabindex:"-1"})),m.css({left:n[0],top:n[1]});var u=$(o.el);u.trigger($.Event("show.bs.dropdown")),u.trigger($.Event("hide.bs.dropdown")),o.isVisible()&&$(o).toggleClass("open").trigger("shown.bs.dropdown"),this.toolbar.listStyles.isStylesNotClosable=!0,o.show()}}},onSaveStyle:function(t){window.styles_loaded=!1;var e,i=this;if(i.api){var n=function(e,n){if("ok"==n){var o=e.getTitle(),s=e.getNextStyle(),a=t.get_Link();i._state.prstyle=o,t.put_Name(o),a.put_Name(o+"_character"),t.put_Next(s.asc_getName()),i.api.asc_AddNewStyle(t)}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},o=[];_.each(window.styles.get_MergedStyles(),function(t){o.push({value:t,displayValue:t.get_Name()})}),e=new DE.Views.StyleTitleDialog({handler:n,formats:o}),e.show()}Common.component.Analytics.trackEvent("ToolBar","Save as Style")},onMenuSaveStyle:function(t,e){var i=this;i.api&&!i.toolbar.listStylesAdditionalMenuItem.isDisabled()&&i.onSaveStyle(i.api.asc_GetStyleFromFormatting())},onUpdateStyle:function(t){this.api&&(t.put_Name(this._state.prstyle),this.api.asc_AddNewStyle(t))},onHideTitleBar:function(t,e){var i=this.getApplication().getController("Viewport").getView("Common.Views.Header");i&&i.setVisible(!e),Common.localStorage.setItem("de-hidden-title",e?1:0),Common.NotificationCenter.trigger("layout:changed","header"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideStatusBar:function(t,e){var i=this.getApplication().getController("Statusbar").getView("Statusbar");i&&i.setVisible(!e),Common.localStorage.setItem("de-hidden-status",e?1:0),Common.NotificationCenter.trigger("layout:changed","status"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideRulers:function(t,e){this.api&&this.api.asc_SetViewRulers(!e),Common.localStorage.setItem("de-hidden-rulers",e?1:0),Common.NotificationCenter.trigger("layout:changed","rulers"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomToPageToggle:function(t,e){this.api&&(e?this.api.zoomFitToPage():this.api.zoomCustomMode()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomToWidthToggle:function(t,e){this.api&&(e?this.api.zoomFitToWidth():this.api.zoomCustomMode()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomInClick:function(t){this.api&&this.api.zoomIn(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomOutClick:function(t){this.api&&this.api.zoomOut(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onNotesClick:function(){this.api&&this.api.asc_AddFootnote()},onNotesMenuClick:function(t,e){if(this.api){if("ins_footnote"==e.value)this.api.asc_AddFootnote();else if("delele"==e.value)Common.UI.warning({msg:this.confirmDeleteFootnotes,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){"yes"==t&&this.api.asc_RemoveAllFootnotes(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},this)});else{if("settings"!=e.value)return;var i=this;new DE.Views.NoteSettingsDialog({api:i.api,handler:function(t,e){e&&(i.api.asc_SetFootnoteProps(e.props,e.applyToAll),"insert"==t&&i.api.asc_AddFootnote(e.custom)),Common.NotificationCenter.trigger("edit:complete",i.toolbar)},props:i.api.asc_GetFootnoteProps()}).show()}Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onFootnotePrevClick:function(t){this.api&&this.api.asc_GotoFootnote(!1);var e=this;setTimeout(function(){Common.NotificationCenter.trigger("edit:complete",e.toolbar)},50)},onFootnoteNextClick:function(t){this.api&&this.api.asc_GotoFootnote(!0);var e=this;setTimeout(function(){Common.NotificationCenter.trigger("edit:complete",e.toolbar)},50)},_clearBullets:function(){this.toolbar.btnMarkers.toggle(!1,!0),this.toolbar.btnNumbers.toggle(!1,!0),this.toolbar.btnMultilevels.toggle(!1,!0),this.toolbar.mnuMarkersPicker.selectByIndex(0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(0,!0),this.toolbar.mnuMultilevelPicker.selectByIndex(0,!0)},_getApiTextSize:function(){var t=12,e=this.api.get_TextProps();return e&&e.get_TextPr&&(t=e.get_TextPr().get_Font
txtMatrix_Flat_Square:"Sparse Matrix",confirmAddFontName:"The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?",notcriticalErrorTitle:"Warning",txtMarginsW:"Left and right margins are too high for a given page wight",txtMarginsH:"Top and bottom margins are too high for a given page height",confirmDeleteFootnotes:"Do you want to delete all footnotes?"},DE.Controllers.Toolbar||{}))}),define("text!documenteditor/main/app/template/StatusBar.template",[],function(){return'\r\n<div class="statusbar" style="display:table;">\r\n <div class="status-group dropup">\r\n <label id="label-pages" class="status-label dropdown-toggle" style="margin-left: 40px;" data-toggle="dropdown"><%= Common.Utils.String.format(scope.pageIndexText, 1, 1) %></label>\r\n <div id="status-goto-box" class="dropdown-menu">\r\n <label style="float:left;line-height:22px;"><%= scope.goToPageText %></label>\r\n <div id="status-goto-page" style="display:inline-block;"></div>\r\n </div>\r\n </div>\r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n <div id="status-users-ct" class="status-group dropup" style="display:none;">\r\n <div class="separator short" style="margin-right: 12px; margin-left: 40px;" />\r\n <div id="status-users-block" style="display:inline-block; cursor:pointer;">\r\n <span id="users-icon" class="img-commonctrl" style="margin-bottom: 2px;"/>\r\n <label id="status-users-count" class="status-label" style="font-size: 14px; font-weight: normal; margin-top: -1px;">+</label>\r\n </div>\r\n <div id="status-users-menu" class="dropdown-menu">\r\n <label style="display: block;margin-right: 14px;"><%= scope.tipUsers %></label>\r\n <div id="status-users-list"></div>\r\n <label id="status-change-rights" class="link" style="margin-top: 15px;"><%= scope.txAccessRights %></label>\r\n </div>\r\n <div class="separator short" style="margin-left: 10px;" />\r\n </div>\r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n <div class="status-group" style="width:100%; text-align:center;">\r\n <label id="label-action" class="status-label"></label>\r\n </div>\r\n <div class="status-group" style="">\r\n <div class="separator short el-edit"></div>\r\n <div class="cnt-lang el-edit">\r\n <div class="dropdown-toggle" data-toggle="dropdown" style="margin-right: 6px;">\r\n <span class="icon-lang-flag img-toolbarmenu lang-flag" data-vertical-offset="10" />\r\n <label id="status-label-lang" class="status-label">English (United States)</label>\r\n <div class="caret up img-commonctrl" />\r\n </div>\r\n </div>\r\n <button id="btn-doc-lang" type="button" class="btn small btn-toolbar el-edit"><span class="btn-icon btn-ic-doclang">&nbsp;</span></button>\r\n <button id="btn-doc-spell" type="button" class="btn small btn-toolbar el-edit"><span class="btn-icon btn-ic-docspell">&nbsp;</span></button>\r\n <div class="separator short el-edit"></div>\r\n <div id="btn-doc-review" class="el-edit el-review" style="display: inline-block;"></div>\r\n <div class="separator short el-edit el-review"></div>\r\n <button id="btn-zoom-topage" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-ic-zoomtopage">&nbsp;</span></button>\r\n <button id="btn-zoom-towidth" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-ic-zoomtowidth">&nbsp;</span></button>\r\n <button id="btn-zoom-down" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-ic-zoomdown">&nbsp;</span></button>\r\n <div class="cnt-zoom">\r\n <div class="dropdown-toggle" data-toggle="dropdown">\r\n <label id="label-zoom" class="status-label">Zoom 100%</label>\r\n </div>\r\n </div
return'<div id="<%=id%>" class="user-comment-item">\r\n <div class="user-name-colored"><span style="background-color:<%=usercolor%>;"><%=scope.getUserName(username)%></span></div>\r\n <div class="user-date"><%=date%></div>\r\n <div class="user-message limit-height"><%=changetext%></div>\r\n <div class="edit-ct">\r\n <% if (scope.isReviewOnly) { %>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% } else { %>\r\n <div class="btn-accept img-commonctrl"></div>\r\n <div class="btn-reject img-commonctrl"></div>\r\n <% } %>\r\n </div>\r\n</div>'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewChanges",["text!common/main/lib/template/ReviewChangesPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.ReviewChangesPopover=Common.UI.Window.extend({initialize:function(t){var e={};_.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1},t),this.template=t.template||['<div class="box">','<div id="id-review-popover" class="comments-popover dataview-ct"></div>','<div id="id-review-arrow" class="comments-arrow review"></div>',"</div>"].join(""),this.store=t.store,this.delegate=t.delegate,e.tpl=_.template(this.template,e),this.arrow={margin:20,width:12,height:34},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,i=this.delegate,n=this.$window;n.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"991"});var o=n.find(".body");o&&o.css("position","relative"),n.on("click",function(){n.css({zIndex:"991"}),Common.NotificationCenter.trigger("review:click")}),Common.NotificationCenter.on("comments:click",function(){n.css({zIndex:"990"})});var s=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,template:_.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></div><div class="lock-area" style="cursor: default;"></div><div class="lock-author" style="cursor: default;"></div>')}}}());s&&(this.reviewChangesView?(this.reviewChangesView.render($("#id-review-popover")),this.reviewChangesView.onResetItems()):(this.reviewChangesView=new s({el:$("#id-review-popover"),store:e.store,itemTemplate:_.template(t)}),this.reviewChangesView.on("item:click",function(t,e,n,o){var s=$(o.target);s&&(s.hasClass("btn-accept")?i.fireEvent("reviewchange:accept",[n.get("changedata")]):s.hasClass("btn-reject")?i.fireEvent("reviewchange:reject",[n.get("changedata")]):s.hasClass("btn-delete")&&i.fireEvent("reviewchange:delete",[n.get("changedata")]))})))},show:function(t,e,i){this.options.animate=t;Common.UI.Window.prototype.show.call(this),this.reviewChangesView.scroller&&this.reviewChangesView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.reviewChangesView.cmpEl.find(".lock-area").toggleClass("hidden",!e),this.reviewChangesView.cmpEl.find(".lock-author").toggleClass("hidden",!e||_.isEmpty(i)).text(i)},hide:function(){this.handlerHide&&this.handlerHide(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(){this.reviewChangesView&&this.reviewChangesView.scroller&&this.reviewChangesView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var o=$("#id-review-popover"),s=$("#id-review-arrow"),a=$("#editor_sdk"),r=null,l=0,c="",d=0,h="",p=0,m="",u=0,g="",b=0,f=0,C=0,v=0,y=0,w=0;o&&s&&a&&a.get(0)&&(r=a.get(0).getBoundingClientRect())&&(l=r.height-2*this.sdkBou
null!==this._state.LineRuleIdx&&(this.numLineHeight.setDefaultUnit(this._arrLineRule[this._state.LineRuleIdx].defaultUnit),this.numLineHeight.setStep(this._arrLineRule[this._state.LineRuleIdx].step))},createDelayedElements:function(){this.UpdateThemeColors(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new DE.Views.ParagraphSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,paragraphProps:o,borderProps:e.borderAdvancedProps,isChart:e.isChart,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.borderAdvancedProps=i.borderProps,e.api.paraApply(i.paragraphProps)),e.fireEvent("editcomplete",e)}}).show();break}}}},addNewColor:function(){this.mnuColorPicker.addNewColor("object"==typeof this.btnColor.color?this.btnColor.color.color:this.btnColor.color)},UpdateThemeColors:function(){this.mnuColorPicker||(this.btnColor.setMenu(new Common.UI.Menu({items:[{template:i.template('<div id="paragraph-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="paragraph-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})),this.mnuColorPicker=new Common.UI.ThemeColorPalette({el:e("#paragraph-color-menu"),transparent:!0}),this.mnuColorPicker.on("select",i.bind(this.onColorPickerSelect,this))),this.mnuColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},onHideMenus:function(t,e,i){i||this.fireEvent("editcomplete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},hideTextOnlySettings:function(t){this._state.HideTextOnlySettings!==t&&(this._state.HideTextOnlySettings=t,this.TextOnlySettings.toggleClass("hidden",1==t))},strParagraphSpacing:"Paragraph Spacing",strSomeParagraphSpace:"Don't add interval between paragraphs of the same style",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto",textBackColor:"Background color",textNewColor:"Add New Custom Color"},DE.Views.ParagraphSettings||{}))}),define("text!documenteditor/main/app/template/HeaderFooterSettings.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textPageNum %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="headerfooter-button-top-left" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-top-center" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-top-right" style="display: inline-block; margin-right:5px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="headerfooter-button-bottom-left" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-bottom-center" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-bottom-right" style="display: inline-block; margin-right:5px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textPosition %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label id="headerfooter-label-position" class="input-label"><%= scope.textHeaderFromTop %></label>\r\n <d
this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-height"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;this.btnRatio.pressed&&(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.spinners.push(this.spnHeight),this.btnOriginalSize=new Common.UI.Button({el:$("#image-advanced-button-original-size")}),this.btnOriginalSize.on("click",_.bind(function(t,e){this.spnWidth.setValue(this.sizeOriginal.width,!0),this.spnHeight.setValue(this.sizeOriginal.height,!0),this._nRatio=this.sizeOriginal.width/this.sizeOriginal.height,this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())),this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render($("#image-advanced-button-ratio")),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect(t.pressed)},this)),this.radioHSize=new Common.UI.RadioBox({el:$("#shape-radio-hsize"),name:"asc-radio-width",checked:!0}),this.radioHSize.on("change",_.bind(this.onRadioHSizeChange,this)),this.radioHSizePc=new Common.UI.RadioBox({el:$("#shape-radio-hsizepc"),name:"asc-radio-width"}),this.radioHSizePc.on("change",_.bind(this.onRadioHSizePcChange,this)),this.radioVSize=new Common.UI.RadioBox({el:$("#shape-radio-vsize"),name:"asc-radio-height",checked:!0}),this.radioVSize.on("change",_.bind(this.onRadioVSizeChange,this)),this.radioVSizePc=new Common.UI.RadioBox({el:$("#shape-radio-vsizepc"),name:"asc-radio-height"}),this.radioVSizePc.on("change",_.bind(this.onRadioVSizePcChange,this)),this.chRatio=new Common.UI.CheckBox({el:$("#shape-checkbox-ratio"),labelText:this.textAspectRatio}),this.chRatio.on("change",_.bind(function(t,e,i,n){"checked"==t.getValue()&&this.spnShapeHeight.getNumberValue()>0&&(this._nRatio=this.spnShapeWidth.getNumberValue()/this.spnShapeHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect("checked"==t.getValue())},this)),this.spnShapeWidth=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnShapeWidth.on("change",_.bind(function(t,e,i,n){if("checked"==this.chRatio.getValue()&&!this.chRatio.isDisabled()){var o=t.getNumberValue(),s=o/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,o=s*this._nRatio,this.spnShapeWidth.setValue(o,!0)),this.spnShapeHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.fillShapeHeight())},this)),this.spinners.push(this.spnShapeWidth),this.spnShapeHeight=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-height"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnShapeHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;"checked"!=this.chRatio.getValue()||this.chRatio.isDisabled()||(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnShapeHeight.setValue(o,!0)),this.spnShapeWidth.setValue(s,!0)),t
for(e=n.get_RelativeFrom(),o=0;o<this._arrVRelative.length;o++)if(e==this._arrVRelative[o].value){this.cmbVRelative.setValue(e),this._state.VAlignFrom=e;break}}else if(n.get_Percent()){for(this.radioVPositionPc.setValue(!0),this.spnYPc.setValue(n.get_Value()),e=n.get_RelativeFrom(),o=0;o<this._arrVRelativePc.length;o++)if(e==this._arrVRelativePc[o].value){this.cmbVPositionPc.setValue(e),this._state.VPositionPcFrom=e;break}}else for(this.radioVPosition.setValue(!0),e=n.get_Value(),this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(e)),e=n.get_RelativeFrom(),o=0;o<this._arrVRelative.length;o++)if(e==this._arrVRelative[o].value){this.cmbVPosition.setValue(e),this._state.VPositionFrom=e;break}this.chMove.setValue(e==Asc.c_oAscRelativeFromV.Line||e==Asc.c_oAscRelativeFromV.Paragraph,!0),this.chMove.setDisabled(!n.get_UseAlign()&&n.get_Percent())}this.chOverlap.setValue(null!==t.get_AllowOverlap()&&void 0!==t.get_AllowOverlap()?t.get_AllowOverlap():"indeterminate",!0),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height());var s=t.get_ShapeProperties(),a=t.get_ChartProperties();if(this.btnOriginalSize.setVisible(!(s||a)),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl()),this.btnsCategory[4].setVisible(null!==s&&!s.get_FromChart()),this.btnsCategory[5].setVisible(null!==s&&!s.get_FromChart()),this.btnsCategory[2].setDisabled(t.get_FromGroup()),s){this._objectType=Asc.c_oAscTypeSelectElement.Shape,this._setShapeDefaults(s),this.setTitle(this.textTitleShape),e=t.asc_getLockAspect(),this.chRatio.setValue(e),this.spnShapeWidth.setMaxValue(this.sizeMax.width),this.spnShapeHeight.setMaxValue(this.sizeMax.height);var r=t.get_SizeRelH();if(r){for(this.radioHSizePc.setValue(!0),this.spnShapeWidthPc.setValue(r.get_Value()),e=r.get_RelativeFrom(),o=0;o<this._arrHRelativePc.length;o++)if(e==this._arrHRelativePc[o].value){this.cmbWidthPc.setValue(e),this.spnShapeWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrHRelativePc[o].size*r.get_Value()/100).toFixed(2),!0),this._state.ShapeWidthPcFrom=e;break}}else this.radioHSize.setValue(!0),e=t.get_Width(),this.spnShapeWidth.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0);var l=t.get_SizeRelV();if(l){for(this.radioVSizePc.setValue(!0),this.spnShapeHeightPc.setValue(l.get_Value()),e=l.get_RelativeFrom(),o=0;o<this._arrVRelativePc.length;o++)if(e==this._arrVRelativePc[o].value){this.cmbHeightPc.setValue(e),this.spnShapeHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrVRelativePc[o].size*l.get_Value()/100).toFixed(2),!0),this._state.ShapeHeightPcFrom=e;break}}else this.radioVSize.setValue(!0),e=t.get_Height(),this.spnShapeHeight.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0);this.chRatio.setDisabled(this.radioVSizePc.getValue()||this.radioHSizePc.getValue());var c=s.get_paddings();if(c){var d=c.get_Left();this.spnMarginLeft.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0),d=c.get_Top(),this.spnMarginTop.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0),d=c.get_Right(),this.spnMarginRight.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0),d=c.get_Bottom(),this.spnMarginBottom.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0)}this.btnsCategory[5].setDisabled(null===c)}else e=t.asc_getLockAspect(),a?(this._objectType=Asc.c_oAscTypeSelectElement.Chart,this.setTitle(this.textTitleChart)):this.setTitle(this.textTitle),this.btnRatio.toggle(e),this.spnWidth.setMaxValue(this.sizeMax.width),this.spnHeight.setMaxValue(this.sizeMax.height),e=t.get_Width(),this.spnWidth.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0),e=t.get_Height(),this.spnHeight.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0);e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),this._changedProps=new Asc.asc_CImgProperty}},getSettings:function(){var t=this._changedProps;if(this._objectType==Asc.c_oAscTypeS
a.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),r=this._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),a.get_PositionV().put_Value(r)}this.api.ImgApply(a)}this.fireEvent("editcomplete",this)}},setOriginalSize:function(){if(this.api){var t=this.api.get_OriginalSizeImage(),e=t.get_ImageWidth(),i=t.get_ImageHeight();this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(i).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName();var n=new Asc.asc_CImgProperty;n.put_Width(e),n.put_Height(i),this.api.ImgApply(n),this.fireEvent("editcomplete",this)}},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)){var s=new Asc.asc_CImgProperty;s.put_ImageUrl(o),t.api.ImgApply(s)}}t.fireEvent("editcomplete",t)}}).show()},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a;e.btnOriginalSize.isDisabled()||(a=e.api.get_OriginalSizeImage())&&(a={width:a.get_ImageWidth(),height:a.get_ImageHeight()});var r=this.api.GetSectionInfo();r={width:r.get_PageWidth()-(r.get_MarginLeft()+r.get_MarginRight()),height:r.get_PageHeight()-(r.get_MarginTop()+r.get_MarginBottom())},new DE.Views.ImageSettingsAdvanced({imageProps:o,sizeOriginal:a,sizeMax:r,sectionProps:e.api.asc_GetSectionProps(),handler:function(t,i){"ok"==t&&e.api&&e.api.ImgApply(i.imageProps),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textSize:"Size",textWrap:"Wraping Style",textWidth:"Width",textHeight:"Height",textOriginalSize:"Default Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textAdvanced:"Show advanced settings",txtInline:"Inline",txtSquare:"Square",txtTight:"Tight",txtThrough:"Through",txtTopAndBottom:"Top and bottom",txtBehind:"Behind",txtInFront:"In front",textEditObject:"Edit Object",textEdit:"Edit"},DE.Views.ImageSettings||{}))}),define("text!documenteditor/main/app/template/ChartSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label id="chart-label-width" class="input-label"><%= scope.textWidth %></label>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label id="chart-label-height" class="input-label"><%= scope.textHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textWrap %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="chart-button-wrap" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textChartType %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="chart-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <di
define("documenteditor/main/app/view/TableSettings",["text!documenteditor/main/app/template/TableSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboBorderSize","common/main/lib/component/ComboDataView","common/main/lib/view/InsertTableDialog","documenteditor/main/app/view/TableSettingsAdvanced"],function(t,e,i,n){"use strict";DE.Views.TableSettings=n.View.extend(i.extend({el:"#id-table-settings",template:i.template(t),events:{},options:{alias:"TableSettings"},initialize:function(){this._initSettings=!0,this._state={TemplateId:0,CheckHeader:!1,CheckTotal:!1,CheckBanded:!1,CheckFirst:!1,CheckLast:!1,CheckColBanded:!1,WrapStyle:-1,CanBeFlow:!0,TableAlignment:-1,TableIndent:0,BackColor:"#000000",RepeatRow:!1,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this._originalLook=new Asc.CTablePropLook,this._originalProps=null,this.CellBorders={},this.CellColor={Value:1,Color:"transparent"},this.BorderSize=1,this._noApply=!1,this._wrapHandled=!1,this.render()},onCheckTemplateChange:function(t,e,i,n,o){if(this.api){var s=new Asc.CTableProp,a=this._originalLook?this._originalLook:new Asc.CTablePropLook;switch(t){case 0:a.put_FirstRow("checked"==e.getValue());break;case 1:a.put_LastRow("checked"==e.getValue());break;case 2:a.put_BandHor("checked"==e.getValue());break;case 3:a.put_FirstCol("checked"==e.getValue());break;case 4:a.put_LastCol("checked"==e.getValue());break;case 5:a.put_BandVer("checked"==e.getValue())}s.put_TableLook(a),this.api.tblApply(s)}this.fireEvent("editcomplete",this)},onTableTemplateSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.CTableProp;i.put_TableStyle(e.get("templateId")),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBtnWrapClick:function(t,e){if(this.api&&t.pressed&&!this._noApply){var i=new Asc.CTableProp;i.put_TableWrap(t.options.posId),t.options.posId==c_tableWrap.TABLE_WRAP_NONE&&(this._state.TableAlignment<0&&(this._state.TableAlignment=c_tableAlign.TABLE_ALIGN_LEFT),i.put_TableAlignment(this._state.TableAlignment),i.put_TableIndent(this._state.TableIndent)),i.put_CellSelect(!0),this.api.tblApply(i)}if(this._wrapHandled)return void(this._wrapHandled=!1);this._wrapHandled=!0,this.fireEvent("editcomplete",this)},onCheckRepeatRowChange:function(t,e,i,n){if(this.api){var o=new Asc.CTableProp;o.put_RowsInHeader("checked"==t.getValue()?1:0),this.api.tblApply(o)}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.btnBackColor.setColor(e),this.CellColor={Value:1,Color:e},this.api){var i=new Asc.CTableProp,n=new Asc.CBackground;i.put_CellsBackground(n),"transparent"==this.CellColor.Color?n.put_Value(1):(n.put_Value(0),n.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color))),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onColorsBorderSelect:function(t,e){this.btnBorderColor.setColor(e)},onBtnBordersClick:function(t,e){if(this._UpdateBordersStyle(t.options.strId,!0),this.api){var i=new Asc.CTableProp;i.put_CellBorders(this.CellBorders),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBorderSizeSelect:function(t,e){this.BorderSize=e.value},onEditClick:function(t,e,i){if(this.api)switch(e.value){case 0:this.api.selectRow();break;case 1:this.api.selectColumn();break;case 2:this.api.selectCell();break;case 3:this.api.selectTable();break;case 4:this.api.addRowAbove();break;case 5:this.api.addRowBelow();break;case 6:this.api.addColumnLeft();break;case 7:this.api.addColumnRight();break;case 8:this.api.remRow();break;case 9:this.api.remColumn();break;case 10:this.api.remTable();break;case 11:this.api.MergeCells();break;case 12:this.splitCells(t,e,i)}this.fireEvent("editcomplete",this)},splitCells:function(t,e,i){var n=this;new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&(n.api&&
maxValue:100,values:[0,100]},disabled:!1,template:e.template(['<div class="slider multi-slider">','<div class="track">','<div class="track-left"></div>','<div class="track-center""></div>','<div class="track-right" style=""></div>',"</div>","<% _.each(items, function(item) { %>",'<div class="thumb" style=""></div>',"<% }); %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.thumbs=[],e.options.el&&e.render()},render:function(t){var i=this;i.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({items:this.options.values})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl));var n=this.cmpEl;n.find(".track-center").width(i.options.width-14),n.width(i.options.width);var o=function(t){t.preventDefault(),t.stopPropagation();var e=t.data,n=i.thumbs[e].value,a=e-1<0?0:i.thumbs[e-1].position,r=e+1<i.thumbs.length?i.thumbs[e+1].position:100,l=Math.max(a,Math.min(r,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100))),c=l/i.delta+i.minValue;i.setThumbPosition(e,l),i.thumbs[e].value=c,$(document).off("mouseup",o),$(document).off("mousemove",s),i._dragstart=void 0,i.trigger("changecomplete",i,c,n)},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=t.data,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1<i.thumbs.length?i.thumbs[e+1].position:100,a=Math.max(o,Math.min(s,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100))),r=a/i.delta+i.minValue;i.setThumbPosition(e,a),i.thumbs[e].value=r,Math.abs(r-n)>.001&&i.trigger("change",i,r,n)}},a=function(t){if(!i.disabled){var n=t.data,a=i.thumbs[n].thumb;i._dragstart=t.pageX*Common.Utils.zoom()-a.offset().left-a.width()/2,i.setActiveThumb(n),e.each(i.thumbs,function(t,e){n==e?t.thumb.css("z-index",500):t.thumb.css("z-index","")}),$(document).on("mouseup",null,n,o),$(document).on("mousemove",null,n,s)}},r=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100))),n=l(e),o=i.thumbs[n].value,s=e/i.delta+i.minValue;i.setThumbPosition(n,e),i.thumbs[n].value=s,i.trigger("change",i,s,o),i.trigger("changecomplete",i,s,o)}},l=function(t){for(var e,n=100,o=0,s=i.thumbs.length,a=0;a<s;a++)if(e=Math.abs(i.thumbs[a].position-t),Math.abs(e<=n)){var r=i.thumbs[a+1],l=i.thumbs[a-1];if(void 0!==l&&t<l.position)continue;if(void 0!==r&&t>r.position)continue;o=a,n=e}return o};return this.$thumbs=n.find(".thumb"),e.each(this.$thumbs,function(t,e){var n=$(t);i.thumbs.push({thumb:n,index:e}),i.setValue(e,i.options.values[e]),n.on("mousedown",null,e,a)}),i.setActiveThumb(0,!0),i.rendered||n.on("mousedown",".track",r),i.rendered=!0,this},setActiveThumb:function(t,e){this.currentThumb=t,this.$thumbs.removeClass("active"),this.thumbs[t].thumb.addClass("active"),!0!==e&&this.trigger("thumbclick",this,t)},setThumbPosition:function(t,e){this.thumbs[t].position=e,this.thumbs[t].thumb.css({left:e+"%"})},setValue:function(t,e){this.thumbs[t].value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(t,Math.round((e-this.minValue)*this.delta))},getValue:function(t){return this.thumbs[t].value},getValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.value)}),t},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t}})}),void 0===Common)var Common={};if(define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(t,e){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0},disabled:!1,template:e.template(['<div class="slider multi-slider-gradient">','<div class="track"></div>',"<% _.each(items, function(item) { %>",'<div class="thumb img-commonctrl" s
;null!==b&&(b/=1e3,this.GradColor.values[0]=b),b=g[1],null!==b&&(b/=1e3,this.GradColor.values[1]=b)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof this.GradColor.colors[0]?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof this.GradColor.colors[1]?this.GradColor.colors[1].color:this.GradColor.colors[1]),1),this.sldrGradient.setValue(0,this.GradColor.values[0]),this.sldrGradient.setValue(1,this.GradColor.values[1]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var f=typeof this.ShapeColor.Color,C=typeof this._state.ShapeColor;if(f!==C||"object"==f&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=f&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),v=!0;break}v||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var y,w=n.get_stroke(),x=w.get_type();if(w?(x==Asc.c_oAscStrokeType.STROKE_COLOR?(h=w.get_color(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},y=w.asc_getPrstDash()):(x=null,this.BorderColor={Value:0,Color:"transparent"}),f=typeof this.BorderColor.Color,C=typeof this._state.StrokeColor,f!==C||"object"==f&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=f&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),v=!0;break}v||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==x||x==Asc.c_oAscStrokeType.STROKE_COLOR){if(x==Asc.c_oAscStrokeType.STROKE_COLOR){var S=w.get_width(),A=Math.abs(this._state.StrokeWidth-S)<.001&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-S)>.001||A||(null===this._state.StrokeWidth||null===S)&&this._state.StrokeWidth!==S){this._state.StrokeWidth=S,null!==S&&(S=this._mm2pt(S));var T=null===S?S:i.find(this.cmbBorderSize.store.models,function(t){if(S<t.attributes.value+.01&&S>t.attributes.value-.01)return!0});T?this.cmbBorderSize.selectRecord(T):this.cmbBorderSize.setValue(null!==S?parseFloat(S.toFixed(2))+" "+this.txtPt:""),this.BorderSize=S}}else x==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=x}if(this._state.StrokeBorderType!==y&&(this.BorderType=this._state.Str
var e={};_.extend(e,{title:this.textTitle,width:420,height:681,header:!0},t),this.template=['<div id="id-mail-merge-folder-placeholder"></div>'].join(""),e.tpl=_.template(this.template,e),this.mergeFolderUrl=t.mergeFolderUrl||"",this.mergedFileUrl=t.mergedFileUrl||"",this.defFileName=t.defFileName||"",this.mergeFolderUrl=this.mergeFolderUrl.replace("{title}",encodeURIComponent(this.defFileName)).replace("{fileuri}",encodeURIComponent(this.mergedFileUrl)),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=645,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-mail-merge-folder-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-mail-merge-folder-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.mergeFolderUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&(_.isEmpty(t.error)||this.trigger("mailmergeerror",this,t.error),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Folder for save",textLoading:"Loading"},DE.Views.MailMergeSaveDlg||{}))}),define("text!documenteditor/main/app/template/MailMergeEmailDlg.template",[],function(){return'<div id="id-merge-email-dlg" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;" cellpadding="10">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textFrom %></label>\r\n <div id="merge-email-dlg-from"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textTo %></label>\r\n <div id="merge-email-dlg-to"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label class="input-label"><%= scope.textSubject %></label>\r\n <div id="merge-email-dlg-subject" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label class="input-label"><%= scope.textFormat %></label>\r\n <div id="merge-email-dlg-format" style="width: 170px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label id="merge-email-dlg-lbl-filename" class="input-label disabled"><%= scope.textFileName %></label>\r\n <div id="merge-email-dlg-filename" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label id="merge-email-dlg-lbl-message" class="input-label disabled"><%= scope.textMessage %></label>\r\n <textarea id="merge-email-dlg-message" class="disabled form-control" disabled="disabled" style="width: 100%;height: 70px;margin-bottom: 0;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <labe
return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTemplate %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-template" style="width: 100%; height: 64px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strFill %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="textart-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="textart-panel-color-fill" class="padding-small" style="width: 100%;">\r\n <div id="textart-back-color-btn" style=""></div>\r\n </div>\r\n <div id="textart-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div style="height:80px;">\r\n <div style="display: inline-block;">\r\n <label class="input-label" style=""><%= scope.textStyle %></label>\r\n <div id="textart-combo-grad-type" style="width: 90px;"></div>\r\n </div>\r\n <div style="display: inline-block;float: right;">\r\n <label class="input-label" style=""><%= scope.textDirection %></label>\r\n <div id="textart-button-direction" style=""></div>\r\n </div>\r\n </div>\r\n <label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <div id="textart-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="textart-gradient-color-btn" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div class="padding-small" id="textart-panel-transparent-fill" style="width: 100%;">\r\n <label class="header" style="display:block;"><%= scope.strTransparency %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <label id="textart-lbl-transparency-start">0</label>\r\n <div id="textart-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>\r\n <label id="textart-lbl-transparency-end">100</label>\r\n </div>\r\n <div id="textart-spin-transparency" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strStroke %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strSize %></label>\r\n <div id="textart-combo-border-size" style="width: 93px;"></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strColor %></label>\r\n <div id="textart-border-color-btn" style=""></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strType %></label>\r\n <div id="textart-combo-border-type" style="width: 93px;"></div>\r\
s[e].set("imageUrl",t.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(n),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))},onTextArtSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putStyle(e.get("data")),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},fillTransform:function(t){if(t&&t.length>1&&t[1]){for(var e=[],n=t[1],o=0;o<n.length;o++){var s=n[o];s&&s.length>0&&i.each(s,function(t){e.push({imageUrl:t.Image,type:t.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(e),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putForm(e.get("type")),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(e("#textart-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:e("#textart-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",i.bind(this.onColorsBorderSelect,this)),e(this.el).on("click","#textart-border-color-new",i.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(e("#textart-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.lockedControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:e("#textart-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",i.bind(this.onColorsGradientSelect,this)),e(this.el).on("click","#textart-gradient-color-new",i.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(e("#textart-back-color-btn")),this.btnBackColor.setColor("transparent"),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:e("#textart-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",i.bind(this.onColorsBackSelect,this)),e(this.el).on("click","#textart-back-color-new",i.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FIL
Common.NotificationCenter.trigger("goback");break;case"edit":this.getApplication().getController("Statusbar").setStatusCaption(this.requestEditRightsText),Common.Gateway.requestEditRights();break;case"new":i?n=!1:this.onCreateNew(void 0,"blank");break;case"history":if(!this.leftMenu.panelHistory.isVisible())if(this.api.isDocumentModified()){var o=this;this.api.asc_stopSaving(),Common.UI.warning({closable:!1,width:500,title:this.notcriticalErrorTitle,msg:this.leavePageText,buttons:["ok","cancel"],primary:"ok",callback:function(t){"ok"==t?(o.api.asc_undoAllChanges(),o.showHistory()):o.api.asc_continueSaving()}})}else this.showHistory();break;case"rename":var o=this,s=o.api.asc_getDocumentName();new Common.Views.RenameDialog({filename:s,handler:function(t,e){"ok"!=t||_.isEmpty(e.trim())||s===e.trim()||Common.Gateway.requestRename(e),Common.NotificationCenter.trigger("edit:complete",o)}}).show();break;default:n=!1}n&&(t.hide(),this.leftMenu.btnFile.toggle(!1,!0))},clickSaveAsFormat:function(t,e){t?e==Asc.c_oAscFileType.TXT?Common.UI.warning({closable:!1,title:this.notcriticalErrorTitle,msg:this.warnDownloadAs,buttons:["ok","cancel"],callback:_.bind(function(i){"ok"==i&&(this.api.asc_DownloadAs(e),t.hide(),this.leftMenu.btnFile.toggle(!1,!0))},this)}):(this.api.asc_DownloadAs(e),t.hide(),this.leftMenu.btnFile.toggle(!1,!0)):this.api.asc_DownloadOrigin()},applySettings:function(t){var e=Common.localStorage.getItem("de-settings-inputmode");if(this.api.SetTextBoxInputMode(1==parseInt(e)),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring){e=Common.localStorage.getItem("de-settings-coauthmode");var i=null===e||1==parseInt(e);switch(this.api.asc_SetFastCollaborative(i),e=Common.localStorage.getItem(i?"de-settings-showchanges-fast":"de-settings-showchanges-strict")){case"all":e=Asc.c_oAscCollaborativeMarksShowType.All;break;case"none":e=Asc.c_oAscCollaborativeMarksShowType.None;break;case"last":e=Asc.c_oAscCollaborativeMarksShowType.LastChanges;break;default:e=i?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges}this.api.SetCollaborativeMarksShowType(e)}switch(e=Common.localStorage.getItem("de-settings-livecomment"),null===e||0!=parseInt(e)?this.api.asc_showComments():this.api.asc_hideComments(),e=Common.localStorage.getItem("de-settings-fontrender")){case"1":this.api.SetFontRenderingMode(1);break;case"2":this.api.SetFontRenderingMode(2);break;case"0":this.api.SetFontRenderingMode(3)}e=Common.localStorage.getItem("de-settings-autosave"),this.api.asc_setAutoSaveGap(parseInt(e)),e=Common.localStorage.getItem("de-settings-spellcheck"),this.api.asc_setSpellCheck(null===e||1==parseInt(e)),e=Common.localStorage.getItem("de-settings-showsnaplines"),this.api.put_ShowSnapLines(null===e||1==parseInt(e)),t.hide(),this.leftMenu.btnFile.toggle(!1,!0)},onCreateNew:function(t,e){if(!0===this.mode.nativeApp)this.api.OpenNewDocument("blank"==e?"":e);else{var i=window.open("blank"==e?this.mode.createUrl:e,"_blank");i&&i.focus()}t&&(t.hide(),this.leftMenu.btnFile.toggle(!1,!0))},onOpenRecent:function(t,e){t&&(t.hide(),this.leftMenu.btnFile.toggle(!1,!0));var i=window.open(e);i&&i.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(t){this.leftMenu.btnFile.pressed&&"opts"==this.leftMenu.btnFile.panel.active?this.leftMenu.close():this.leftMenu.showMenu("file:opts")},clickStatusbarUsers:function(){this.leftMenu.btnFile.panel.panels.rights.changeAccessRights()},onHideChat:function(){$(this.leftMenu.btnChat.el).blur(),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onQuerySearch:function(t,e,i){if(i.textsearch&&i.textsearch.length&&!this.api.asc_findText(i.textsearch,"back"!=t,i.matchcase,i.matchword)){var n=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){n.dlgSearch.focus()}})}},onQueryReplace:function(t,e){if(!_.isEmpty(e.textsearch)&&!this.api.asc_replaceText(e.textsearch,e.textreplace,!1,e.matchcase,e.matchword)){var i=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){i.dlgSearch.focus()}})}},onQueryReplaceAl
selected:t.data.currentVersion==s.version,canRestore:this.appOptions.canHistoryRestore&&o<i.length-1,isExpanded:!0})),t.data.currentVersion==s.version&&(n=a[a.length-1]),r=s.versionGroup,l!==s.version){for(l=s.version,c.reverse(),g=0;g<c.length;g++)a[a.length-g-2].set("arrColors",c);c=[]}c.push(p.get("colorval"));var u,g,b=s.changes;if(b&&b.length>0){if(a[a.length-1].set("docIdPrev",d),!_.isEmpty(s.serverVersion)&&s.serverVersion==this.appOptions.buildVersion)for(a[a.length-1].set("changeid",b.length-1),a[a.length-1].set("hasChanges",b.length>1),g=b.length-2;g>=0;g--)u=b[g],p=h.findUser(u.user.id),p||(p=new Common.Models.User({id:u.user.id,username:u.user.name,colorval:Asc.c_oAscArrUserColors[m],color:this.generateUserColor(Asc.c_oAscArrUserColors[m++])}),h.add(p)),a.push(new Common.Models.HistoryVersion({version:s.versionGroup,revision:s.version,changeid:g,userid:u.user.id,username:u.user.name,usercolor:p.get("color"),created:u.created,docId:s.key,docIdPrev:d,selected:!1,canRestore:this.appOptions.canHistoryRestore,isRevision:!1,isVisible:!0})),c.push(p.get("colorval"))}else 0==o&&1==i.length&&a[a.length-1].set("docId",s.key+"1")}if(c.length>0){for(c.reverse(),g=0;g<c.length;g++)a[a.length-g-1].set("arrColors",c);c=[]}e.reset(a),null===n&&e.size()>0&&(n=e.at(0),n.set("selected",!0)),n&&this.getApplication().getController("Common.Controllers.History").onSelectRevision(null,null,n)}}},generateUserColor:function(t){return"#"+("000000"+t.toString(16)).substr(-6)},disableEditing:function(t){var e=this.getApplication();if(this.appOptions.canEdit&&"view"!==this.editorConfig.mode){e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t,t),e.getController("RightMenu").SetDisabled(t,!1),e.getController("Statusbar").getView("Statusbar").SetDisabled(t);var i=e.getController("Toolbar").getView("Toolbar").synchTooltip;i&&i.hide()}e.getController("LeftMenu").SetDisabled(t,!0)},goBack:function(t){var e=this.appOptions.customization.goback.url;t?window.open(e,"_blank"):parent.location.href=e},onEditComplete:function(t){var e=this.getApplication(),i=e.getController("Toolbar"),n=i.getView("Toolbar");if(!this.appOptions.isEdit||!n||!n.btnInsertShape.pressed&&!n.btnInsertText.pressed||_.isObject(arguments[1])&&"id-toolbar-btn-insertshape"===arguments[1].id||(this.api&&this.api.StartAddShape("",!1),n.btnInsertShape.toggle(!1,!1),n.btnInsertText.toggle(!1,!1)),this.appOptions.isEdit&&n&&n.btnHighlightColor.pressed&&(!_.isObject(arguments[1])||"id-toolbar-btn-highlight"!==arguments[1].id)&&(this.api.SetMarkerFormat(!1),n.btnHighlightColor.toggle(!1,!1)),e.getController("DocumentHolder").getView("DocumentHolder").focus(),this.api){var o=this.api.asc_isDocumentCanSave(),s=this.appOptions.forcesave,a=$(".btn-icon",n.btnSave.cmpEl).hasClass("btn-synch");n.btnSave.isDisabled()!==(!o&&!a&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)&&n.btnSave.setDisabled(!o&&!a&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)}},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(t,e){var i={id:e,type:t};if(this.stackLongActions.pop(i),this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(!0),i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}))this.setLongActionView(i);else if(e==Asc.c_oAscAsyncAction.Save||e==Asc.c_oAscAsyncAction.ForceSaveButton)if(this._state.fastCoauth&&this._state.usersCount>1){var n=this;n._state.timerSave=setTimeout(function(){n.getApplication().getController("Statusbar").setStatusCaption(n.textChangesSaved,!1,3e3)},500)}else this.getApplication().getController("Statusbar").setStatusCaption(this.textChangesSaved,!1,3e3);else this.getApplication().getController("Statusbar").setStatusCaption("");i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),i?this.setLongActionView(i):this.loadMas
;_.each(e,function(e,n,o){t=Common.util.LanguageInfo.getLocalLanguageName(e.asc_getId()),i.push({title:t[1],tip:t[0],code:e.asc_getId()})},this),i.sort(function(t,e){return t.tip<e.tip?-1:t.tip>e.tip?1:0}),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").setLanguages(i),this.getApplication().getController("Statusbar").setLanguages(i)},onInsertTable:function(){this.getApplication().getController("RightMenu").onInsertTable()},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},unitsChanged:function(t){var e=Common.localStorage.getItem("de-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),this.api.asc_SetDocumentUnits(e==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:e==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit(),this.getApplication().getController("Toolbar").getView("Toolbar").updateMetricUnit()},onAdvancedOptions:function(t){var e,i=t.asc_getOptionId(),n=this;i==Asc.c_oAscAdvancedOptionsID.TXT?e=new Common.Views.OpenDialog({type:i,codepages:t.asc_getOptions().asc_getCodePages(),settings:t.asc_getOptions().asc_getRecommendedSettings(),handler:function(t){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(i,new Asc.asc_CTXTAdvancedOptions(t)),n.loadMask&&n.loadMask.show())}}):i==Asc.c_oAscAdvancedOptionsID.DRM&&(e=new Common.Views.OpenDialog({type:i,handler:function(t){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(i,new Asc.asc_CDRMAdvancedOptions(t)),n.loadMask&&n.loadMask.show())}})),e&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),e.show())},onTryUndoInFastCollaborative:function(){var t=window.localStorage.getItem("de-hide-try-undoredo");t&&1==parseInt(t)||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&window.localStorage.setItem("de-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("de-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),this._state.fastCoauth=!1,Common.localStorage.setItem("de-settings-showchanges-strict","last"),this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.LastChanges)),this.fireEvent("editcomplete",this)},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=Common.localStorage.getItem("de-settings-coauthmode"),e=this._state.fastCoauth;this._state.fastCoauth=null===t||1==parseInt(t),this._state.fastCoauth&&!e&&this.synchronizeChanges()}this.appOptions.canForcesave&&(t=Common.localStorage.getItem("de-settings-forcesave"),this.appOptions.forcesave=null===t?this.appOptions.canForcesave:1==parseInt(t),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(t){this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t),this.updateWindowTitle(!0)},onMeta:function(t){var e=this.getApplication(),i=e.getController("LeftMenu").getView("LeftMenu").getMenu("file");e.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t.title),this.updateWindowTitle(!0),this.document.title=t.title,i.loadDocument({doc:this.document}),i.panels.info.updateInfo(this.document),Common.Gateway.metaChange(t)},onPrint:function(){this.appOptions.canPrint&&(this.api&&this.api.asc_Print(Comm
newDescriptionText:"Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template",noTemplatesText:"There are no templates"},DE.Views.FileMenuPanels.CreateNew||{})),DE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">',"<tr>",'<td class="left"><label>'+this.txtTitle+"</label></td>",'<td class="right"><label id="id-info-title">-</label></td>',"</tr>",'<tr class="author">','<td class="left"><label>'+this.txtAuthor+"</label></td>",'<td class="right"><span class="userLink img-commonctrl" id="id-info-author">-</span></td>',"</tr>",'<tr class="placement">','<td class="left"><label>'+this.txtPlacement+"</label></td>",'<td class="right"><label id="id-info-placement">-</label></td>',"</tr>",'<tr class="date">','<td class="left"><label>'+this.txtDate+"</label></td>",'<td class="right"><label id="id-info-date">-</label></td>',"</tr>",'<tr class="divider date"></tr>',"<tr>",'<td class="left" style="vertical-align: top;"><label>'+this.txtStatistics+"</label></td>",'<td class="right" style="vertical-align: top;"><div id="id-info-statistic">',"<table>","<tr>","<td><label>"+this.txtPages+"</label></td>",'<td><label id="id-info-pages"></label></td>',"</tr>","<tr>","<td><label>"+this.txtParagraphs+"</label></td>",'<td><label id="id-info-paragraphs"></label></td>',"</tr>","<tr>","<td><label>"+this.txtWords+"</label></td>",'<td><label id="id-info-words"></label></td>',"</tr>","<tr>","<td><label>"+this.txtSymbols+"</label></td>",'<td><label id="id-info-symbols"></label></td>',"</tr>","<tr>","<td><label>"+this.txtSpaces+"</label></td>",'<td><label id="id-info-spaces"></label></td>',"</tr>","</table>","</div></td>","</tr>","</table>"].join("")),this.infoObj={PageCount:0,WordsCount:0,ParagraphCount:0,SymbolsCount:0,SymbolsWSCount:0},this.inProgress=!1,this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.lblTitle=$("#id-info-title"),this.lblPlacement=$("#id-info-placement"),this.lblDate=$("#id-info-date"),this.lblAuthor=$("#id-info-author"),this.lblStatPages=$("#id-info-pages"),this.lblStatWords=$("#id-info-words"),this.lblStatParagraphs=$("#id-info-paragraphs"),this.lblStatSymbols=$("#id-info-symbols"),this.lblStatSpaces=$("#id-info-spaces"),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateStatisticInfo()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.stopUpdatingStatisticInfo()},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},this.lblTitle.text(t.title?t.title:"-"),t.info?(t.info.author&&this.lblAuthor.text(t.info.author),this._ShowHideInfoItem("author",void 0!==t.info.author&&null!==t.info.author),t.info.created&&this.lblDate.text(t.info.created),this._ShowHideInfoItem("date",void 0!==t.info.created&&null!==t.info.created),t.info.folder&&this.lblPlacement.text(t.info.folder),this._ShowHideInfoItem("placement",void 0!==t.info.folder&&null!==t.info.folder)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("date",t),this._ShowHideInfoItem("placement",t),this._ShowHideInfoItem("author",t)},updateStatisticInfo:function(){this.api&&this.doc&&this.api.startGetDocInfo()},stopUpdatingStatisticInfo:function(){this.api&&this.api.stopGetDocInfo()},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onGetDocInfoStart",_.bind(this._onGetDocInfoStart,this)),this.api.asc_registerCallback("asc_onGetDocInfoStop",_.bind(this._onGetDocInfoEnd,this)),this.api.asc_registerCallback("asc_o
r=e.asc_getRepliesCount(),o=0;o<r;++o)l=""==e.asc_getReply(o).asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getReply(o).asc_getTime())),a.push(new Common.Models.Reply({id:Common.UI.getId(),userid:e.asc_getReply(o).asc_getUserId(),username:e.asc_getReply(o).asc_getUserName(),date:n.dateToLocaleTimeString(l),reply:e.asc_getReply(o).asc_getText(),time:l.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:n.view,editable:n.mode.canEditComments||e.asc_getReply(o).asc_getUserId()==n.currentUserId}));a.sort(function(t,e){return t.get("time")-e.get("time")}),c.set("replys",a),i||(this.updateComments(!1,!0),this.getPopover()&&this.getPopover().isVisible()&&(this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)))}},onApiLockComment:function(t,e){var i=this.findComment(t),n=null,o=null;i&&(n=this.getApplication().getCollection("Common.Collections.Users"))&&(o=n.findWhere({id:e}))&&(this.getPopover()&&this.getPopover().saveText(),i.set("lock",!0),i.set("lockuserid",this.view.getUserName(o.get("username"))))},onApiUnLockComment:function(t){var e=this.findComment(t);e&&(e.set("lock",!1),this.getPopover()&&this.getPopover().loadText())},onApiShowComment:function(t,e,i,n,o,s){if(this.isModeChanged=!1,(!s||!this.isSelectedComment||0!==_.difference(this.uids,t).length)&&(this.mode&&!this.mode.canComments&&(s=!0),this.getPopover())){if(this.clearDummyComment(),this.isSelectedComment&&0===_.difference(this.uids,t).length)return void(this.api&&(this.getPopover().commentsView.setFocusToTextBox(!0),this.api.asc_enableKeyEvents(!0)));var a=0,r="",l="",c=null,d="",h=!0;for(this.popoverComments.reset(),a=0;a<t.length;++a)r=t[a],l=t[a]+"-R",c=this.findComment(r),this.subEditStrings[r]&&!s?(c.set("editTextInPopover",!0),d=this.subEditStrings[r]):this.subEditStrings[l]&&!s&&(c.set("showReplyInPopover",!0),d=this.subEditStrings[l]),c.set("hint",!_.isUndefined(s)&&s),!s&&this.hintmode&&(0===_.difference(this.uids,t).length&&0===this.uids.length&&(h=!1),this.oldUids.length&&0===_.difference(this.oldUids,t).length&&(h=!1,this.oldUids=[])),this.animate&&(h=this.animate,this.animate=!1),this.isSelectedComment=!s||!this.hintmode,this.uids=_.clone(t),this.popoverComments.push(c),this._dontScrollToComment||this.view.commentsView.scrollToRecord(c),this._dontScrollToComment=!1;this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(e,i,n),this.getPopover().show(h,!1,!0,d)}},onApiHideComment:function(t){var e=this;if(this.getPopover()){if(this.isSelectedComment&&t)return;if(t&&this.getPopover().isCommentsViewMouseOver())return;this.popoverComments.each(function(t){t.get("editTextInPopover")&&(e.subEditStrings[t.get("uid")]=e.getPopover().getEditText()),t.get("showReplyInPopover")&&(e.subEditStrings[t.get("uid")+"-R"]=e.getPopover().getEditText())}),this.getPopover().saveText(!0),this.getPopover().hide(),this.collection.clearEditing(),this.popoverComments.clearEditing(),this.oldUids=_.clone(this.uids),this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset()}},onApiUpdateCommentPosition:function(t,e,i,n){var o,s=!1,a=null,r=void 0,l="",c="";if(this.getPopover())if(this.getPopover().saveText(),this.getPopover().hideTips(),i<0||this.getPopover().sdkBounds.height<i||!_.isUndefined(n)&&this.getPopover().sdkBounds.width<n)this.getPopover().hide();else{if(this.isModeChanged&&this.onApiShowComment(t,e,i,n),0===this.popoverComments.length){for(this.popoverComments.reset(),o=0;o<t.length;++o)l=t[o],c=t[o]+"-R",a=this.findComment(l),this.subEditStrings[l]?(a.set("editTextInPopover",!0),r=this.subEditStrings[l]):this.subEditStrings[c]&&(a.set("showReplyInPopover",!0),r=this.subEditStrings[c]),this.popoverComments.push(a);s=!0,this.getPopover().show(s,void 0,void 0,r)}else this.getPopover().isVisible()||this.getPopover().show(!1,void 0,void 0,r);this.getPopover().setLeftTop(e,i,n,void 0,!0)}},onDocumentPlaceChanged:function(){if(this.isDummyComment&&this.getPopover()&&this.getPopover().isVisible()){var t=this.api.asc_getAnchorPosition();t&&this.getPopover().setLeftTop(t.asc_getX()+t.asc_getWi
textTitle:"Mail Merge Recipients"},Common.Views.ExternalMergeEditor||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ExternalMergeEditor",["core","common/main/lib/view/ExternalMergeEditor"],function(){"use strict";Common.Controllers.ExternalMergeEditor=Backbone.Controller.extend(_.extend(function(){var t="en",e=void 0,i="",n=null,o=function(){n=new DocsAPI.DocEditor("id-merge-editor-placeholder",{width:"100%",height:"100%",documentType:"spreadsheet",document:{url:"_offline_",permissions:{edit:!0,download:!1}},editorConfig:{mode:"editmerge",targetApp:i,lang:t,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:e,user:{id:"uid-"+Date.now()}},events:{onReady:function(){},onDocumentStateChange:function(){},onError:function(){},onInternalMessage:_.bind(this.onInternalMessage,this)}}),Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this))};return{views:["Common.Views.ExternalMergeEditor"],initialize:function(){this.addListeners({"Common.Views.ExternalMergeEditor":{setmergedata:_.bind(this.setMergeData,this),drag:_.bind(function(t,e){n&&n.serviceCommand("window:drag","start"==e)},this),show:_.bind(function(t){var e=this.mergeEditorView.getHeight(),i=Common.Utils.innerHeight();(i>e&&e<700||i<e)&&(e=Math.min(i,700),this.mergeEditorView.setHeight(e)),n?(n.serviceCommand("setAppDisabled",!1),this.needDisableEditing&&this.mergeEditorView._isExternalDocReady&&this.onMergeEditingDisabled(),n.attachMouseEvents()):o.apply(this),this.isExternalEditorVisible=!0},this),hide:_.bind(function(t){n&&(n.detachMouseEvents(),this.isExternalEditorVisible=!1)},this)}})},onLaunch:function(){this.mergeEditorView=this.createView("Common.Views.ExternalMergeEditor",{handler:_.bind(this.handler,this)})},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onCloseMergeEditor",_.bind(this.onMergeEditingDisabled,this)),this},handler:function(t,e){return n&&n.serviceCommand("queryClose",{mr:t}),!0},setMergeData:function(){n&&n.serviceCommand("setMergeData",this.mergeEditorView._mergeData),this.mergeEditorView.setEditMode(!0),this.mergeEditorView._mergeData=null},loadConfig:function(n){n&&n.config&&(n.config.lang&&(t=n.config.lang),n.config.customization&&(e=n.config.customization),n.config.targetApp&&(i=n.config.targetApp))},onMergeEditingDisabled:function(){if(!this.mergeEditorView.isVisible()||!this.mergeEditorView._isExternalDocReady)return void(this.needDisableEditing=!0);this.mergeEditorView.setControlsDisabled(!0),Common.UI.alert({title:this.warningTitle,msg:this.warningText,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.setControlsDisabled(!1),this.mergeEditorView.hide()},this)}),this.needDisableEditing=!1},onInternalMessage:function(t){var e=t.data;if(this.mergeEditorView)if("documentReady"==e.type)this.mergeEditorView._isExternalDocReady=!0,this.mergeEditorView.setControlsDisabled(!1),this.mergeEditorView._mergeData&&(n&&n.serviceCommand("setMergeData",this.mergeEditorView._mergeData),this.mergeEditorView._mergeData=null),this.needDisableEditing&&this.onMergeEditingDisabled();else if("shortcut"==e.type)"escape"==e.data.key&&this.mergeEditorView.hide();else if("canClose"==e.type)!0===e.data.answer&&(n&&(n.serviceCommand("setAppDisabled",!0),"ok"==e.data.mr&&n.serviceCommand("getMergeData")),this.mergeEditorView.hide());else if("processMouse"==e.type){if("mouse:up"==e.data.event)this.mergeEditorView.binding.dragStop();else if("mouse:move"==e.data.event){var i=parseInt(this.mergeEditorView.$window.css("left"))+e.data.pagex,o=parseInt(this.mergeEditorView.$window.css("top"))+e.data.pagey+34;this.mergeEditorView.binding.drag({pageX:i,pageY:o})}}else this.mergeEditorView.fireEvent("internalmessage",this.mergeEditorView,e)},onProcessMouse:function(t){"mouseup"==t.type&&this.isExternalEditorVisible&&n&&n.serviceCommand("processmouse",t)},warningTitle:"Warning",warningText:"The object is disabled because of editing by another user.",textClose:"Close",textAnonymous:"Anonymous"}}(),Common.Controllers.ExternalMergeEditor||{}))}),vo