/* * Copyright (c) Ascensio System SIA 2018. All rights reserved * * http://www.onlyoffice.com * * Version: 0.0.0 (build:0) */ function onDropDownKeyDown(e){var t=$(this),n=t.parent(),r=jQuery.Event("keydown.before.bs.dropdown"),i=jQuery.Event("keydown.after.bs.dropdown");n.trigger(r),n.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(e=arguments[1]),/^(38|40|27|13|9|37|39)$/.test(e.keyCode)&&!e.ctrlKey&&!e.altKey&&(patchDropDownKeyDownAdditional.call(this,e),/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation()))):(patchDropDownKeyDown.call(this,e),e.preventDefault(),e.stopPropagation()),n.trigger(i)}function patchDropDownKeyDown(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);e.preventDefault(),e.stopPropagation();if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&e.keyCode==27){if(e.which==27){i=$("[role=menu] li.dropdown-submenu.over:visible",n);if(i.size())return i.eq(i.size()-1).removeClass("over"),!1;n.hasClass("dropdown-submenu")&&n.hasClass("over")?(n.removeClass("over"),n.find("> a").focus()):n.find("[data-toggle=dropdown]").focus()}return r?t.click():undefined}var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(":focus"));if(e.keyCode==39){if(s<0)return;var o=i.eq(s).parent();o.hasClass("dropdown-submenu")&&!o.hasClass("over")&&(o.mouseenter(),o.addClass("focused-submenu"),_.delay(function(){var e=$("> [role=menu]",o),t=e.find("> li:not(.divider):not(.disabled):visible > a"),n=0;if(e.find("> .menu-scroll").length>0){var r=e.scrollTop();for(var i=0;ir){n=i;break}}t.length>0&&t.eq(n).focus()},250))}else e.keyCode==37?n.hasClass("dropdown-submenu")&&n.hasClass("over")&&(n.removeClass("over"),n.find("> a").focus()):(e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(".focus"));e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;or||n===void 0)return 1;if(n>>1;n.call(r,e[u])=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=x.max(x.pluck(arguments,"length").concat(0)),t=new Array(e);for(var n=0;n=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=x.keys(e),n=t.length,r=new Array(n);for(var i=0;i":">",'"':""","'":"'"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),define("underscore",function(e){return function(){var t,n;return t||e._}}(this)),function(e,t){typeof module=="object"&&typeof module.exports=="object"?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}(typeof window!="undefined"?window:this,function(window,noGlobal){function isArrayLike(e){var t=!!e&&"length"in e&&e.length,n=jQuery.type(e);return n==="function"||jQuery.isWindow(e)?!1:n==="array"||t===0||typeof t=="number"&&t>0&&t-1 in e}function winnow(e,t,n){if(jQuery.isFunction(t))return jQuery.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return jQuery.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(risSimple.test(t))return jQuery.filter(t,e,n);t=jQuery.filter(t,e)}return jQuery.grep(e,function(e){return indexOf.call(t,e)>-1!==n})}function sibling(e,t){while((e=e[t])&&e.nodeType!==1);return e}function createOptions(e){var t={};return jQuery.each(e.match(rnotwhite)||[],function(e,n){t[n]=!0}),t}function completed(){document.removeEventListener("DOMContentLoaded",completed),window.removeEventListener("load",completed),jQuery.ready()}function Data(){this.expando=jQuery.expando+Data.uid++}function dataAttr(e,t,n){var r;if(n===undefined&&e.nodeType===1){r="data-"+t.replace(rmultiDash,"-$&").toLowerCase(),n=e.getAttribute(r);if(typeof n=="string"){try{n=n==="true"?!0:n==="false"?!1:n==="null"?null:+n+""===n?+n:rbrace.test(n)?jQuery.parseJSON(n):n}catch(i){}dataUser.set(e,t,n)}else n=undefined}return n}function adjustCSS(e,t,n,r){var i,s=1,o=20,u=r?function(){return r.cur()}:function(){return jQuery.css(e,t,"")},a=u(),f=n&&n[3]||(jQuery.cssNumber[t]?"":"px"),l=(jQuery.cssNumber[t]||f!=="px"&&+a)&&rcssNum.exec(jQuery.css(e,t));if(l&&l[3]!==f){f=f||l[3],n=n||[],l=+a||1;do s=s||".5",l/=s,jQuery.style(e,t,l+f);while(s!==(s=u()/a)&&s!==1&&--o)}return n&&(l=+l||+a||0,i=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=f,r.start=l,r.end=i)),i}function getAll(e,t){var n=typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll(t||"*"):[];return t===undefined||t&&jQuery.nodeName(e,t)?jQuery.merge([e],n):n}function setGlobalEval(e,t){var n=0,r=e.length;for(;n-1){i&&i.push(s);continue}f=jQuery.contains(s.ownerDocument,s),o=getAll(c.appendChild(s),"script"),f&&setGlobalEval(o);if(n){l=0;while(s=o[l++])rscriptType.test(s.type||"")&&n.push(s)}}return c}function returnTrue(){return!0}function returnFalse(){return!1}function safeActiveElement(){try{return document.activeElement}catch(e){}}function on(e,t,n,r,i,s){var o,u;if(typeof t=="object"){typeof n!="string"&&(r=r||n,n=undefined);for(u in t)on(e,u,n,r,t[u],s);return e}r==null&&i==null?(i=n,r=n=undefined):i==null&&(typeof n=="string"?(i=r,r=undefined):(i=r,r=n,n=undefined));if(i===!1)i=returnFalse;else if(!i)return e;return s===1&&(o=i,i=function(e){return jQuery().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=jQuery.guid++)),e.each(function(){jQuery.event.add(this,t,i,r,n)})}function manipulationTarget(e,t){return jQuery.nodeName(e,"table")&&jQuery.nodeName(t.nodeType!==11?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function disableScript(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function restoreScript(e){var t=rscriptTypeMasked.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function cloneCopyEvent(e,t){var n,r,i,s,o,u,a,f;if(t.nodeType!==1)return;if(dataPriv.hasData(e)){s=dataPriv.access(e),o=dataPriv.set(t,s),f=s.events;if(f){delete o.handle,o.events={};for(i in f)for(n=0,r=f[i].length;n1&&typeof p=="string"&&!support.checkClone&&rchecked.test(p))return e.each(function(i){var s=e.eq(i);d&&(t[0]=p.call(this,i,s.html())),domManip(s,t,n,r)});if(c){i=buildFragment(t,e[0].ownerDocument,!1,e,r),s=i.firstChild,i.childNodes.length===1&&(i=s);if(s||r){o=jQuery.map(getAll(i,"script"),disableScript),u=o.length;for(;l")).appendTo(t.documentElement),t=iframe[0].contentDocument,t.write(),t.close(),n=actualDisplay(e,t),iframe.detach();elemdisplay[e]=n}return n}function curCSS(e,t,n){var r,i,s,o,u=e.style;return n=n||getStyles(e),o=n?n.getPropertyValue(t)||n[t]:undefined,(o===""||o===undefined)&&!jQuery.contains(e.ownerDocument,e)&&(o=jQuery.style(e,t)),n&&!support.pixelMarginRight()&&rnumnonpx.test(o)&&rmargin.test(t)&&(r=u.width,i=u.minWidth,s=u.maxWidth,u.minWidth=u.maxWidth=u.width=o,o=n.width,u.width=r,u.minWidth=i,u.maxWidth=s),o!==undefined?o+"":o}function addGetHookIf(e,t){return{get:function(){if(e()){delete this.get;return}return(this.get=t).apply(this,arguments)}}}function vendorPropName(e){if(e in emptyStyle)return e;var t=e[0].toUpperCase()+e.slice(1),n=cssPrefixes.length;while(n--){e=cssPrefixes[n]+t;if(e in emptyStyle)return e}}function setPositiveNumber(e,t,n){var r=rcssNum.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function augmentWidthOrHeight(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=jQuery.css(e,n+cssExpand[s],!0,i)),r?(n==="content"&&(o-=jQuery.css(e,"padding"+cssExpand[s],!0,i)),n!=="margin"&&(o-=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i))):(o+=jQuery.css(e,"padding"+cssExpand[s],!0,i),n!=="padding"&&(o+=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i)));return o}function getWidthOrHeight(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=getStyles(e),o=jQuery.css(e,"boxSizing",!1,s)==="border-box";document.msFullscreenElement&&window.top!==window&&e.getClientRects().length&&(i=Math.round(e.getBoundingClientRect()[t]*100));if(i<=0||i==null){i=curCSS(e,t,s);if(i<0||i==null)i=e.style[t];if(rnumnonpx.test(i))return i;r=o&&(support.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+augmentWidthOrHeight(e,t,n||(o?"border":"content"),r,s)+"px"}function showHide(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o=0&&n=0},isPlainObject:function(e){var t;if(jQuery.type(e)!=="object"||e.nodeType||jQuery.isWindow(e))return!1;if(e.constructor&&!hasOwn.call(e,"constructor")&&!hasOwn.call(e.constructor.prototype||{},"isPrototypeOf"))return!1;for(t in e);return t===undefined||hasOwn.call(e,t)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?class2type[toString.call(e)]||"object":typeof e},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code),code&&(code.indexOf("use strict")===1?(script=document.createElement("script"),script.text=code,document.head.appendChild(script).parentNode.removeChild(script)):indirect(code))},camelCase:function(e){return e.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,r=0;if(isArrayLike(e)){n=e.length;for(;rr.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function ut(e){return e[w]=!0,e}function at(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ft(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function lt(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function pt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function dt(e){return e&&typeof e.getElementsByTagName!="undefined"&&e}function vt(){}function mt(e){var t=0,n=e.length,r="";for(;t1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function bt(e,t,n){var r=0,i=t.length;for(;r-1&&(s[f]=!(o[f]=c))}}else g=wt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function St(e){var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=gt(function(e){return e===t},u,!0),c=gt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];for(;a1&&yt(h),a>1&&mt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(U,"$1"),n,a0,i=e.length>0,s=function(s,o,u,a,l){var c,d,m,g=0,y="0",b=s&&[],w=[],E=f,x=s||i&&r.find.TAG("*",l),T=S+=E==null?1:Math.random()||.1,N=x.length;l&&(f=o===p||o||l);for(;y!==N&&(c=x[y])!=null;y++){if(i&&c){d=0,!o&&c.ownerDocument!==p&&(h(c),u=!v);while(m=e[d++])if(m(c,o||p,u)){a.push(c);break}l&&(S=T)}n&&((c=!m&&c)&&g--,s&&b.push(c))}g+=y;if(n&&y!==g){d=0;while(m=t[d++])m(b,w,o,u);if(s){if(g>0)while(y--)!b[y]&&!w[y]&&(w[y]=M.call(a));w=wt(w)}D.apply(a,w),l&&!s&&w.length>0&&g+t.length>1&&st.uniqueSort(a)}return l&&(S=T,f=E),b};return n?ut(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ot(),N=ot(),C=ot(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){var n=0,r=e.length;for(;n+~]|"+j+")"+j+"*"),X=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),V=new RegExp(q),$=new RegExp("^"+F+"$"),J={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},K=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,G=/^[^{]+\{\s*\[native \w/,Y=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/[+~]/,et=/'|\\/g,tt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),nt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)},rt=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(it){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=st.support={},s=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},h=st.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;if(o===p||o.nodeType!==9||!o.documentElement)return p;p=o,d=p.documentElement,v=!s(p),(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",rt,!1):i.attachEvent&&i.attachEvent("onunload",rt)),n.attributes=at(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=at(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=G.test(p.getElementsByClassName),n.getById=at(function(e){return d.appendChild(e).id=w,!p.getElementsByName||!p.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!="undefined"&&v){var n=t.getElementById(e);return n?[n]:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e);if(n.qsa)return t.querySelectorAll(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!="undefined"&&v)return t.getElementsByClassName(e)},g=[],m=[];if(n.qsa=G.test(p.querySelectorAll))at(function(e){d.appendChild(e).innerHTML=""+"",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),at(function(e){var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")});return(n.matchesSelector=G.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&at(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",q)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=G.test(d.compareDocumentPosition),b=t||G.test(d.contains)?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,r&1||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===p||e.ownerDocument===E&&b(E,e)?-1:t===p||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:r&4?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,o=[e],u=[t];if(!i||!s)return e===p?-1:t===p?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return lt(e,t);n=e;while(n=n.parentNode)o.unshift(n);n=t;while(n=n.parentNode)u.unshift(n);while(o[r]===u[r])r++;return r?lt(o[r],u[r]):o[r]===E?-1:u[r]===E?1:0},p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){(e.ownerDocument||e)!==p&&h(e),t=t.replace(X,"='$1']");if(n.matchesSelector&&v&&!C[t+" "]&&(!g||!g.test(t))&&(!m||!m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&e.document.nodeType!==11)return r}catch(i){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},st.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):undefined;return s!==undefined?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},st.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,r=[],i=0,s=0;c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k);if(c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=st.getText=function(e){var t,n="",r=0,s=e.nodeType;if(!s)while(t=e[r++])n+=i(t);else if(s===1||s===9||s===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(s===3||s===4)return e.nodeValue;return n},r=st.selectors={cacheLength:50,createPseudo:ut,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(tt,nt),e[3]=(e[3]||e[4]||e[5]||"").replace(tt,nt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return J.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&V.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(tt,nt).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!="undefined"&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i.replace(R," ")+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u,b=!1;if(m){if(s){while(v){h=t;while(h=h[v])if(u?h.nodeName.toLowerCase()===g:h.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){h=m,c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),f=l[e]||[],p=f[0]===S&&f[1],b=p&&f[2],h=p&&m.childNodes[p];while(h=++p&&h&&h[v]||(b=p=0)||d.pop())if(h.nodeType===1&&++b&&h===t){l[e]=[S,p,b];break}}else{y&&(h=t,c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),f=l[e]||[],p=f[0]===S&&f[1],b=p);if(b===!1)while(h=++p&&h&&h[v]||(b=p=0)||d.pop())if((u?h.nodeName.toLowerCase()===g:h.nodeType===1)&&++b){y&&(c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),l[e]=[S,b]);if(h===t)break}}return b-=i,b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:ut(function(e){var t=[],n=[],r=u(e.replace(U,"$1"));return r[w]?ut(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:ut(function(e){return function(t){return st(e,t).length>0}}),contains:ut(function(e){return e=e.replace(tt,nt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:ut(function(e){return $.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(tt,nt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return K.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()==="text")},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[n<0?n+t:n]}),even:pt(function(e,t){var n=0;for(;n=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=n<0?n+t:n;for(;++r2&&(l=f[0]).type==="ID"&&n.getById&&t.nodeType===9&&v&&r.relative[f[1].type]){t=(r.find.ID(l.matches[0].replace(tt,nt),t)||[])[0];if(!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=J.needsContext.test(e)?0:f.length;while(a--){l=f[a];if(r.relative[c=l.type])break;if(h=r.find[c])if(s=h(l.matches[0].replace(tt,nt),Z.test(f[0].type)&&dt(t.parentNode)||t)){f.splice(a,1),e=s.length&&mt(f);if(!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,!t||Z.test(e)&&dt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=at(function(e){return e.compareDocumentPosition(p.createElement("div"))&1}),at(function(e){return e.innerHTML="",e.firstChild.getAttribute("href")==="#"})||ft("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}),(!n.attributes||!at(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),e.firstChild.getAttribute("value")===""}))&&ft("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input")return e.defaultValue}),at(function(e){return e.getAttribute("disabled")==null})||ft(B,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),st}(window);jQuery.find=Sizzle,jQuery.expr=Sizzle.selectors,jQuery.expr[":"]=jQuery.expr.pseudos,jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort,jQuery.text=Sizzle.getText,jQuery.isXMLDoc=Sizzle.isXML,jQuery.contains=Sizzle.contains;var dir=function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&e.nodeType!==9)if(e.nodeType===1){if(i&&jQuery(e).is(n))break;r.push(e)}return r},siblings=function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n},rneedsContext=jQuery.expr.match.needsContext,rsingleTag=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,risSimple=/^.[^:#\[\.,]*$/;jQuery.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),t.length===1&&r.nodeType===1?jQuery.find.matchesSelector(r,e)?[r]:[]:jQuery.find.matches(e,jQuery.grep(t,function(e){return e.nodeType===1}))},jQuery.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if(typeof e!="string")return this.pushStack(jQuery(e).filter(function(){for(t=0;t1?jQuery.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(winnow(this,e||[],!1))},not:function(e){return this.pushStack(winnow(this,e||[],!0))},is:function(e){return!!winnow(this,typeof e=="string"&&rneedsContext.test(e)?jQuery(e):e||[],!1).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(e,t,n){var r,i;if(!e)return this;n=n||rootjQuery;if(typeof e=="string"){e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?r=[null,e,null]:r=rquickExpr.exec(e);if(r&&(r[1]||!t)){if(r[1]){t=t instanceof jQuery?t[0]:t,jQuery.merge(this,jQuery.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:document,!0));if(rsingleTag.test(r[1])&&jQuery.isPlainObject(t))for(r in t)jQuery.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=document.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=document,this.selector=e,this}return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):jQuery.isFunction(e)?n.ready!==undefined?n.ready(e):e(jQuery):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),jQuery.makeArray(e,this))};init.prototype=jQuery.fn,rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:!0,contents:!0,next:!0,prev:!0};jQuery.fn.extend({has:function(e){var t=jQuery(e,this),n=t.length;return this.filter(function(){var e=0;for(;e-1:n.nodeType===1&&jQuery.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?jQuery.uniqueSort(s):s)},index:function(e){return e?typeof e=="string"?indexOf.call(jQuery(e),this[0]):indexOf.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),jQuery.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return dir(e,"parentNode")},parentsUntil:function(e,t,n){return dir(e,"parentNode",n)},next:function(e){return sibling(e,"nextSibling")},prev:function(e){return sibling(e,"previousSibling")},nextAll:function(e){return dir(e,"nextSibling")},prevAll:function(e){return dir(e,"previousSibling")},nextUntil:function(e,t,n){return dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return dir(e,"previousSibling",n)},siblings:function(e){return siblings((e.parentNode||{}).firstChild,e)},children:function(e){return siblings(e.firstChild)},contents:function(e){return e.contentDocument||jQuery.merge([],e.childNodes)}},function(e,t){jQuery.fn[e]=function(n,r){var i=jQuery.map(this,t,n);return e.slice(-5)!=="Until"&&(r=n),r&&typeof r=="string"&&(i=jQuery.filter(r,i)),this.length>1&&(guaranteedUnique[e]||jQuery.uniqueSort(i),rparentsprev.test(e)&&i.reverse()),this.pushStack(i)}});var rnotwhite=/\S+/g;jQuery.Callbacks=function(e){e=typeof e=="string"?createOptions(e):jQuery.extend({},e);var t,n,r,i,s=[],o=[],u=-1,a=function(){i=e.once,r=t=!0;for(;o.length;u=-1){n=o.shift();while(++u-1)s.splice(n,1),n<=u&&u--}),this},has:function(e){return e?jQuery.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return i=o=[],s=n="",this},disabled:function(){return!s},lock:function(){return i=o=[],n||(s=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],o.push(n),t||a()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},jQuery.extend({Deferred:function(e){var t=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return jQuery.Deferred(function(n){jQuery.each(t,function(t,s){var o=jQuery.isFunction(e[t])&&e[t];i[s[1]](function(){var e=o&&o.apply(this,arguments);e&&jQuery.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[s[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?jQuery.extend(e,r):r}},i={};return r.pipe=r.then,jQuery.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=slice.call(arguments),r=n.length,i=r!==1||e&&jQuery.isFunction(e.promise)?r:0,s=i===1?e:jQuery.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?slice.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t0)return;readyList.resolveWith(document,[jQuery]),jQuery.fn.triggerHandler&&(jQuery(document).triggerHandler("ready"),jQuery(document).off("ready"))}}),jQuery.ready.promise=function(e){return readyList||(readyList=jQuery.Deferred(),document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll?window.setTimeout(jQuery.ready):(document.addEventListener("DOMContentLoaded",completed),window.addEventListener("load",completed))),readyList.promise(e)},jQuery.ready.promise();var access=function(e,t,n,r,i,s,o){var u=0,a=e.length,f=n==null;if(jQuery.type(n)==="object"){i=!0;for(u in n)access(e,t,u,n[u],!0,s,o)}else if(r!==undefined){i=!0,jQuery.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(jQuery(e),n)}));if(t)for(;u-1&&n!==undefined&&dataUser.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){dataUser.remove(this,e)})}}),jQuery.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=dataPriv.get(e,t),n&&(!r||jQuery.isArray(n)?r=dataPriv.access(e,t,jQuery.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=jQuery.queue(e,t),r=n.length,i=n.shift(),s=jQuery._queueHooks(e,t),o=function(){jQuery.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return dataPriv.get(e,n)||dataPriv.access(e,n,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(e,[t+"queue",n])})})}}),jQuery.fn.extend({queue:function(e,t){var n=2;return typeof e!="string"&&(t=e,e="fx",n--),arguments.length",""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option,wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead,wrapMap.th=wrapMap.td;var rhtml=/<|&#?\w+;/;(function(){var e=document.createDocumentFragment(),t=e.appendChild(document.createElement("div")),n=document.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),support.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",support.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue})();var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;jQuery.event={global:{},add:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=dataPriv.get(e);if(!m)return;n.handler&&(s=n,n=s.handler,i=s.selector),n.guid||(n.guid=jQuery.guid++),(a=m.events)||(a=m.events={}),(o=m.handle)||(o=m.handle=function(t){return typeof jQuery!="undefined"&&jQuery.event.triggered!==t.type?jQuery.event.dispatch.apply(e,arguments):undefined}),t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p)continue;c=jQuery.event.special[p]||{},p=(i?c.delegateType:c.bindType)||p,c=jQuery.event.special[p]||{},l=jQuery.extend({type:p,origType:v,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&jQuery.expr.match.needsContext.test(i),namespace:d.join(".")},s),(h=a[p])||(h=a[p]=[],h.delegateCount=0,(!c.setup||c.setup.call(e,r,d,o)===!1)&&e.addEventListener&&e.addEventListener(p,o)),c.add&&(c.add.call(e,l),l.handler.guid||(l.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,l):h.push(l),jQuery.event.global[p]=!0}},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=dataPriv.hasData(e)&&dataPriv.get(e);if(!m||!(a=m.events))return;t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p){for(p in a)jQuery.event.remove(e,p+t[f],n,r,!0);continue}c=jQuery.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],(i||v===l.origType)&&(!n||n.guid===l.guid)&&(!u||u.test(l.namespace))&&(!r||r===l.selector||r==="**"&&l.selector)&&(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&((!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&jQuery.removeEvent(e,p,m.handle),delete a[p])}jQuery.isEmptyObject(a)&&dataPriv.remove(e,"handle events")},dispatch:function(e){e=jQuery.event.fix(e);var t,n,r,i,s,o=[],u=slice.call(arguments),a=(dataPriv.get(this,"events")||{})[e.type]||[],f=jQuery.event.special[e.type]||{};u[0]=e,e.delegateTarget=this;if(f.preDispatch&&f.preDispatch.call(this,e)===!1)return;o=jQuery.event.handlers.call(this,e,a),t=0;while((i=o[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((s=i.handlers[n++])&&!e.isImmediatePropagationStopped())if(!e.rnamespace||e.rnamespace.test(s.namespace))e.handleObj=s,e.data=s.data,r=((jQuery.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,u),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation())}return f.postDispatch&&f.postDispatch.call(this,e),e.result},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(e.type!=="click"||isNaN(e.button)||e.button<1))for(;a!==this;a=a.parentNode||this)if(a.nodeType===1&&(a.disabled!==!0||e.type!=="click")){r=[];for(n=0;n-1:jQuery.find(i,this,null,[a]).length),r[i]&&r.push(s);r.length&&o.push({elem:a,handlers:r})}return u]*)\/>/gi,rnoInnerhtml=/\s*$/g;jQuery.extend({htmlPrefilter:function(e){return e.replace(rxhtmlTag,"<$1>")},clone:function(e,t,n){var r,i,s,o,u=e.cloneNode(!0),a=jQuery.contains(e.ownerDocument,e);if(!support.noCloneChecked&&(e.nodeType===1||e.nodeType===11)&&!jQuery.isXMLDoc(e)){o=getAll(u),s=getAll(e);for(r=0,i=s.length;r0&&setGlobalEval(o,!a&&getAll(e,"script")),u},cleanData:function(e){var t,n,r,i=jQuery.event.special,s=0;for(;(n=e[s])!==undefined;s++)if(acceptData(n)){if(t=n[dataPriv.expando]){if(t.events)for(r in t.events)i[r]?jQuery.event.remove(n,r):jQuery.removeEvent(n,r,t.handle);n[dataPriv.expando]=undefined}n[dataUser.expando]&&(n[dataUser.expando]=undefined)}}}),jQuery.fn.extend({domManip:domManip,detach:function(e){return remove(this,e,!0)},remove:function(e){return remove(this,e)},text:function(e){return access(this,function(e){return e===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9)this.textContent=e})},null,e,arguments.length)},append:function(){return domManip(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.appendChild(e)}})},prepend:function(){return domManip(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return domManip(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return domManip(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++)e.nodeType===1&&(jQuery.cleanData(getAll(e,!1)),e.textContent="");return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return jQuery.clone(this,e,t)})},html:function(e){return access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&t.nodeType===1)return t.innerHTML;if(typeof e=="string"&&!rnoInnerhtml.test(e)&&!wrapMap[(rtagName.exec(e)||["",""])[1].toLowerCase()]){e=jQuery.htmlPrefilter(e);try{for(;n1)},show:function(){return showHide(this,!0)},hide:function(){return showHide(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){isHidden(this)?jQuery(this).show():jQuery(this).hide()})}}),jQuery.Tween=Tween,Tween.prototype={constructor:Tween,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||jQuery.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(jQuery.cssNumber[n]?"":"px")},cur:function(){var e=Tween.propHooks[this.prop];return e&&e.get?e.get(this):Tween.propHooks._default.get(this)},run:function(e){var t,n=Tween.propHooks[this.prop];return this.options.duration?this.pos=t=jQuery.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Tween.propHooks._default.set(this),this}},Tween.prototype.init.prototype=Tween.prototype,Tween.propHooks={_default:{get:function(e){var t;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(t=jQuery.css(e.elem,e.prop,""),!t||t==="auto"?0:t)},set:function(e){jQuery.fx.step[e.prop]?jQuery.fx.step[e.prop](e):e.elem.nodeType!==1||e.elem.style[jQuery.cssProps[e.prop]]==null&&!jQuery.cssHooks[e.prop]?e.elem[e.prop]=e.now:jQuery.style(e.elem,e.prop,e.now+e.unit)}}},Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},jQuery.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},jQuery.fx=Tween.prototype.init,jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return adjustCSS(n.elem,e,rcssNum.exec(t),n),n}]},tweener:function(e,t){jQuery.isFunction(e)?(t=e,e=["*"]):e=e.match(rnotwhite);var n,r=0,i=e.length;for(;r1)},removeAttr:function(e){return this.each(function(){jQuery.removeAttr(this,e)})}}),jQuery.extend({attr:function(e,t,n){var r,i,s=e.nodeType;if(s===3||s===8||s===2)return;if(typeof e.getAttribute=="undefined")return jQuery.prop(e,t,n);if(s!==1||!jQuery.isXMLDoc(e))t=t.toLowerCase(),i=jQuery.attrHooks[t]||(jQuery.expr.match.bool.test(t)?boolHook:undefined);if(n!==undefined){if(n===null){jQuery.removeAttr(e,t);return}return i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:(e.setAttribute(t,n+""),n)}return i&&"get"in i&&(r=i.get(e,t))!==null?r:(r=jQuery.find.attr(e,t),r==null?undefined:r)},attrHooks:{type:{set:function(e,t){if(!support.radioValue&&t==="radio"&&jQuery.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(rnotwhite);if(s&&e.nodeType===1)while(n=s[i++])r=jQuery.propFix[n]||n,jQuery.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)}}),boolHook={set:function(e,t,n){return t===!1?jQuery.removeAttr(e,n):e.setAttribute(n,n),n}},jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(e,t){var n=attrHandle[t]||jQuery.find.attr;attrHandle[t]=function(e,t,r){var i,s;return r||(s=attrHandle[t],attrHandle[t]=i,i=n(e,t,r)!=null?t.toLowerCase():null,attrHandle[t]=s),i}});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(e,t){return access(this,jQuery.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[jQuery.propFix[e]||e]})}}),jQuery.extend({prop:function(e,t,n){var r,i,s=e.nodeType;if(s===3||s===8||s===2)return;if(s!==1||!jQuery.isXMLDoc(e))t=jQuery.propFix[t]||t,i=jQuery.propHooks[t];return n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&(r=i.get(e,t))!==null?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=jQuery.find.attr(e,"tabindex");return t?parseInt(t,10):rfocusable.test(e.nodeName)||rclickable.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),support.optSelected||(jQuery.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;jQuery.fn.extend({addClass:function(e){var t,n,r,i,s,o,u,a=0;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).addClass(e.call(this,t,getClass(this)))});if(typeof e=="string"&&e){t=e.match(rnotwhite)||[];while(n=this[a++]){i=getClass(n),r=n.nodeType===1&&(" "+i+" ").replace(rclass," ");if(r){o=0;while(s=t[o++])r.indexOf(" "+s+" ")<0&&(r+=s+" ");u=jQuery.trim(r),i!==u&&n.setAttribute("class",u)}}}return this},removeClass:function(e){var t,n,r,i,s,o,u,a=0;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).removeClass(e.call(this,t,getClass(this)))});if(!arguments.length)return this.attr("class","");if(typeof e=="string"&&e){t=e.match(rnotwhite)||[];while(n=this[a++]){i=getClass(n),r=n.nodeType===1&&(" "+i+" ").replace(rclass," ");if(r){o=0;while(s=t[o++])while(r.indexOf(" "+s+" ")>-1)r=r.replace(" "+s+" "," ");u=jQuery.trim(r),i!==u&&n.setAttribute("class",u)}}}return this},toggleClass:function(e,t){var n=typeof e;return typeof t=="boolean"&&n==="string"?t?this.addClass(e):this.removeClass(e):jQuery.isFunction(e)?this.each(function(n){jQuery(this).toggleClass(e.call(this,n,getClass(this),t),t)}):this.each(function(){var t,r,i,s;if(n==="string"){r=0,i=jQuery(this),s=e.match(rnotwhite)||[];while(t=s[r++])i.hasClass(t)?i.removeClass(t):i.addClass(t)}else if(e===undefined||n==="boolean")t=getClass(this),t&&dataPriv.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":dataPriv.get(this,"__className__")||"")})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(n.nodeType===1&&(" "+getClass(n)+" ").replace(rclass," ").indexOf(t)>-1)return!0;return!1}});var rreturn=/\r/g,rspaces=/[\x20\t\r\n\f]+/g;jQuery.fn.extend({val:function(e){var t,n,r,i=this[0];if(!arguments.length){if(i)return t=jQuery.valHooks[i.type]||jQuery.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,typeof n=="string"?n.replace(rreturn,""):n==null?"":n);return}return r=jQuery.isFunction(e),this.each(function(n){var i;if(this.nodeType!==1)return;r?i=e.call(this,n,jQuery(this).val()):i=e,i==null?i="":typeof i=="number"?i+="":jQuery.isArray(i)&&(i=jQuery.map(i,function(e){return e==null?"":e+""})),t=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!t||!("set"in t)||t.set(this,i,"value")===undefined)this.value=i})}}),jQuery.extend({valHooks:{option:{get:function(e){var t=jQuery.find.attr(e,"value");return t!=null?t:jQuery.trim(jQuery.text(e)).replace(rspaces," ")}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a-1)n=!0}return n||(e.selectedIndex=-1),s}}}}),jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(e,t){if(jQuery.isArray(t))return e.checked=jQuery.inArray(jQuery(e).val(),t)>-1}},support.checkOn||(jQuery.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(e,t,n,r){var i,s,o,u,a,f,l,c=[n||document],h=hasOwn.call(e,"type")?e.type:e,p=hasOwn.call(e,"namespace")?e.namespace.split("."):[];s=o=n=n||document;if(n.nodeType===3||n.nodeType===8)return;if(rfocusMorph.test(h+jQuery.event.triggered))return;h.indexOf(".")>-1&&(p=h.split("."),h=p.shift(),p.sort()),a=h.indexOf(":")<0&&"on"+h,e=e[jQuery.expando]?e:new jQuery.Event(h,typeof e=="object"&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=undefined,e.target||(e.target=n),t=t==null?[e]:jQuery.makeArray(t,[e]),l=jQuery.event.special[h]||{};if(!r&&l.trigger&&l.trigger.apply(n,t)===!1)return;if(!r&&!l.noBubble&&!jQuery.isWindow(n)){u=l.delegateType||h,rfocusMorph.test(u+h)||(s=s.parentNode);for(;s;s=s.parentNode)c.push(s),o=s;o===(n.ownerDocument||document)&&c.push(o.defaultView||o.parentWindow||window)}i=0;while((s=c[i++])&&!e.isPropagationStopped())e.type=i>1?u:l.bindType||h,f=(dataPriv.get(s,"events")||{})[e.type]&&dataPriv.get(s,"handle"),f&&f.apply(s,t),f=a&&s[a],f&&f.apply&&acceptData(s)&&(e.result=f.apply(s,t),e.result===!1&&e.preventDefault());return e.type=h,!r&&!e.isDefaultPrevented()&&(!l._default||l._default.apply(c.pop(),t)===!1)&&acceptData(n)&&a&&jQuery.isFunction(n[h])&&!jQuery.isWindow(n)&&(o=n[a],o&&(n[a]=null),jQuery.event.triggered=h,n[h](),jQuery.event.triggered=undefined,o&&(n[a]=o)),e.result},simulate:function(e,t,n){var r=jQuery.extend(new jQuery.Event,n,{type:e,isSimulated:!0});jQuery.event.trigger(r,null,t),r.isDefaultPrevented()&&n.preventDefault()}}),jQuery.fn.extend({trigger:function(e,t){return this.each(function(){jQuery.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return jQuery.event.trigger(e,t,n,!0)}}),jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){jQuery.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),jQuery.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),support.focusin="onfocusin"in window,support.focusin||jQuery.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){jQuery.event.simulate(t,e.target,jQuery.event.fix(e))};jQuery.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=dataPriv.access(r,t);i||r.addEventListener(e,n,!0),dataPriv.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=dataPriv.access(r,t)-1;i?dataPriv.access(r,t,i):(r.removeEventListener(e,n,!0),dataPriv.remove(r,t))}}});var location=window.location,nonce=jQuery.now(),rquery=/\?/;jQuery.parseJSON=function(e){return JSON.parse(e+"")},jQuery.parseXML=function(e){var t;if(!e||typeof e!="string")return null;try{t=(new window.DOMParser).parseFromString(e,"text/xml")}catch(n){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&jQuery.error("Invalid XML: "+e),t};var rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href,jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ajaxExtend(ajaxExtend(e,jQuery.ajaxSettings),t):ajaxExtend(jQuery.ajaxSettings,e)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(e,t){function S(e,t,s,u){var f,m,g,b,E,S=t;if(y===2)return;y=2,o&&window.clearTimeout(o),n=undefined,i=u||"",w.readyState=e>0?4:0,f=e>=200&&e<300||e===304,s&&(b=ajaxHandleResponses(l,w,s)),b=ajaxConvert(l,b,w,f);if(f)l.ifModified&&(E=w.getResponseHeader("Last-Modified"),E&&(jQuery.lastModified[r]=E),E=w.getResponseHeader("etag"),E&&(jQuery.etag[r]=E)),e===204||l.type==="HEAD"?S="nocontent":e===304?S="notmodified":(S=b.state,m=b.data,g=b.error,f=!g);else{g=S;if(e||!S)S="error",e<0&&(e=0)}w.status=e,w.statusText=(t||S)+"",f?p.resolveWith(c,[m,S,w]):p.rejectWith(c,[w,S,g]),w.statusCode(v),v=undefined,a&&h.trigger(f?"ajaxSuccess":"ajaxError",[w,l,f?m:g]),d.fireWith(c,[w,S]),a&&(h.trigger("ajaxComplete",[w,l]),--jQuery.active||jQuery.event.trigger("ajaxStop"))}typeof e=="object"&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=jQuery.ajaxSetup({},t),c=l.context||l,h=l.context&&(c.nodeType||c.jquery)?jQuery(c):jQuery.event,p=jQuery.Deferred(),d=jQuery.Callbacks("once memory"),v=l.statusCode||{},m={},g={},y=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(y===2){if(!s){s={};while(t=rheaders.exec(i))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return y===2?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=g[n]=g[n]||e,m[e]=t),this},overrideMimeType:function(e){return y||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(y<2)for(t in e)v[t]=[v[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),S(0,t),this}};p.promise(w).complete=d.add,w.success=w.done,w.error=w.fail,l.url=((e||l.url||location.href)+"").replace(rhash,"").replace(rprotocol,location.protocol+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=jQuery.trim(l.dataType||"*").toLowerCase().match(rnotwhite)||[""];if(l.crossDomain==null){u=document.createElement("a");try{u.href=l.url,u.href=u.href,l.crossDomain=originAnchor.protocol+"//"+originAnchor.host!=u.protocol+"//"+u.host}catch(E){l.crossDomain=!0}}l.data&&l.processData&&typeof l.data!="string"&&(l.data=jQuery.param(l.data,l.traditional)),inspectPrefiltersOrTransports(prefilters,l,t,w);if(y===2)return w;a=jQuery.event&&l.global,a&&jQuery.active++===0&&jQuery.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rnoContent.test(l.type),r=l.url,l.hasContent||(l.data&&(r=l.url+=(rquery.test(r)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rts.test(r)?r.replace(rts,"$1_="+nonce++):r+(rquery.test(r)?"&":"?")+"_="+nonce++)),l.ifModified&&(jQuery.lastModified[r]&&w.setRequestHeader("If-Modified-Since",jQuery.lastModified[r]),jQuery.etag[r]&&w.setRequestHeader("If-None-Match",jQuery.etag[r])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):l.accepts["*"]);for(f in l.headers)w.setRequestHeader(f,l.headers[f]);if(!l.beforeSend||l.beforeSend.call(c,w,l)!==!1&&y!==2){b="abort";for(f in{success:1,error:1,complete:1})w[f](l[f]);n=inspectPrefiltersOrTransports(transports,l,t,w);if(!n)S(-1,"No Transport");else{w.readyState=1,a&&h.trigger("ajaxSend",[w,l]);if(y===2)return w;l.async&&l.timeout>0&&(o=window.setTimeout(function(){w.abort("timeout")},l.timeout));try{y=1,n.send(m,S)}catch(E){if(!(y<2))throw E;S(-1,E)}}return w}return w.abort()},getJSON:function(e,t,n){return jQuery.get(e,t,n,"json")},getScript:function(e,t){return jQuery.get(e,undefined,t,"script")}}),jQuery.each(["get","post"],function(e,t){jQuery[t]=function(e,n,r,i){return jQuery.isFunction(n)&&(i=i||r,r=n,n=undefined),jQuery.ajax(jQuery.extend({url:e,type:t,dataType:i,data:n,success:r},jQuery.isPlainObject(e)&&e))}}),jQuery._evalUrl=function(e){return jQuery.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},jQuery.fn.extend({wrapAll:function(e){var t;return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapAll(e.call(this,t))}):(this[0]&&(t=jQuery(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapInner(e.call(this,t))}):this.each(function(){var t=jQuery(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=jQuery.isFunction(e);return this.each(function(n){jQuery(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()}}),jQuery.expr.filters.hidden=function(e){return!jQuery.expr.filters.visible(e)},jQuery.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;jQuery.param=function(e,t){var n,r=[],i=function(e,t){t=jQuery.isFunction(t)?t():t==null?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};t===undefined&&(t=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional);if(jQuery.isArray(e)||e.jquery&&!jQuery.isPlainObject(e))jQuery.each(e,function(){i(this.name,this.value)});else for(n in e)buildParams(n,e[n],t,i);return r.join("&").replace(r20,"+")},jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=jQuery.prop(this,"elements");return e?jQuery.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=jQuery(this).val();return n==null?null:jQuery.isArray(n)?jQuery.map(n,function(e){return{name:t.name,value:e.replace(rCRLF,"\r\n")}}):{name:t.name,value:n.replace(rCRLF,"\r\n")}}).get()}}),jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&"withCredentials"in xhrSupported,support.ajax=xhrSupported=!!xhrSupported,jQuery.ajaxTransport(function(e){var t,n;if(support.cors||xhrSupported&&!e.crossDomain)return{send:function(r,i){var s,o=e.xhr();o.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(s in e.xhrFields)o[s]=e.xhrFields[s];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),!e.crossDomain&&!r["X-Requested-With"]&&(r["X-Requested-With"]="XMLHttpRequest");for(s in r)o.setRequestHeader(s,r[s]);t=function(e){return function(){t&&(t=n=o.onload=o.onerror=o.onabort=o.onreadystatechange=null,e==="abort"?o.abort():e==="error"?typeof o.status!="number"?i(0,"error"):i(o.status,o.statusText):i(xhrSuccessStatus[o.status]||o.status,o.statusText,(o.responseType||"text")!=="text"||typeof o.responseText!="string"?{binary:o.response}:{text:o.responseText},o.getAllResponseHeaders()))}},o.onload=t(),n=o.onerror=t("error"),o.onabort!==undefined?o.onabort=n:o.onreadystatechange=function(){o.readyState===4&&window.setTimeout(function(){t&&n()})},t=t("abort");try{o.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return jQuery.globalEval(e),e}}}),jQuery.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),jQuery.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=jQuery("")},trackEvent:function(t,n,r){if(typeof t!="undefined"&&Object.prototype.toString.apply(t)!=="[object String]")throw"Analytics: invalid action type.";if(typeof n!="undefined"&&Object.prototype.toString.apply(n)!=="[object String]")throw"Analytics: invalid label type.";if(typeof r!="undefined"&&(Object.prototype.toString.apply(r)!=="[object Number]"||!isFinite(r)))throw"Analytics: invalid value type.";if(typeof _gaq=="undefined")return;if(e==="undefined")throw"Analytics is not initialized.";_gaq.push(["_trackEvent",e,t,n,r])}}},define("analytics",["jquery"],function(){});if(Common===undefined)var Common={};Common.Gateway=new function(){var e=this,t=$(e),n={init:function(e){t.trigger("init",e)},openDocument:function(e){t.trigger("opendocument",e)},showMessage:function(e){t.trigger("showmessage",e)},applyEditRights:function(e){t.trigger("applyeditrights",e)},processSaveResult:function(e){t.trigger("processsaveresult",e)},processRightsChange:function(e){t.trigger("processrightschange",e)},refreshHistory:function(e){t.trigger("refreshhistory",e)},setHistoryData:function(e){t.trigger("sethistorydata",e)},setEmailAddresses:function(e){t.trigger("setemailaddresses",e)},processMailMerge:function(e){t.trigger("processmailmerge",e)},downloadAs:function(){t.trigger("downloadas")},processMouse:function(e){t.trigger("processmouse",e)},internalCommand:function(e){t.trigger("internalcommand",e)},resetFocus:function(e){t.trigger("resetfocus",e)}},r=function(e){window.parent&&window.JSON&&(e.frameEditorId=window.frameEditorId,window.parent.postMessage(window.JSON.stringify(e),"*"))},i=function(e){var t=e.data;if(Object.prototype.toString.apply(t)!=="[object String]"||!window.JSON)return;var r,i;try{r=window.JSON.parse(t)}catch(s){r=""}r&&(i=n[r.command],i&&i.call(this,r.data))},s=function(e){i(e)};return window.attachEvent?window.attachEvent("onmessage",s):window.addEventListener("message",s,!1),{ready:function(){r({event:"onReady"})},requestEditRights:function(){r({event:"onRequestEditRights"})},requestHistory:function(){r({event:"onRequestHistory"})},requestHistoryData:function(e){r({event:"onRequestHistoryData",data:e})},requestRestore:function(e,t){r({event:"onRequestRestore",data:{version:e,url:t}})},requestEmailAddresses:function(){r({event:"onRequestEmailAddresses"})},requestStartMailMerge:function(){r({event:"onRequestStartMailMerge"})},requestHistoryClose:function(e){r({event:"onRequestHistoryClose"})},reportError:function(e,t){r({event:"onError",data:{errorCode:e,errorDescription:t}})},sendInfo:function(e){r({event:"onInfo",data:e})},setDocumentModified:function(e){r({event:"onDocumentStateChange",data:e})},internalMessage:function(e,t){r({event:"onInternalMessage",data:{type:e,data:t}})},updateVersion:function(){r({event:"onOutdatedVersion"})},downloadAs:function(e){r({event:"onDownloadAs",data:e})},collaborativeChanges:function(){r({event:"onCollaborativeChanges"})},requestRename:function(e){r({event:"onRequestRename",data:e})},metaChange:function(e){r({event:"onMetaChange",data:e})},on:function(n,r){var i=function(t,n){r.call(e,n)};t.on(n,i)}}},define("gateway",["jquery"],function(){});if(Common===undefined)var Common={};Common.Locale=new function(){var l10n={},_createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_applyLocalization=function(){try{for(var e in l10n){var t=e.split(".");if(t&&t.length>2){var n=window;for(var r=0;r/im,a=/]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.10",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}d.isBuild=i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i.indexOf("")===0&&(i=i.substring(1)),t(i)}catch(s){r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("text!common/main/lib/template/Header.template",[],function(){return'
\n \n
<%= headerCaption %>
\n
<%= documentCaption %>
\n
<%= textBack %>
\n
'});if(Common===undefined)var Common={};define("common/main/lib/component/BaseView",["backbone"],function(e){"use strict";Common.UI=_.extend(Common.UI||{},{Keys:{BACKSPACE:8,TAB:9,RETURN:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,HOME:36,END:35,SPACE:32,PAGEUP:33,PAGEDOWN:34,INSERT:45,NUM_PLUS:107,NUM_MINUS:109,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,EQUALITY:187,MINUS:189},BaseView:e.View.extend({isSuspendEvents:!1,initialize:function(e){this.options=this.options?_({}).extend(this.options,e):e},setVisible:function(e){return this[e?"show":"hide"]()},isVisible:function(){return $(this.el).is(":visible")},suspendEvents:function(){this.isSuspendEvents=!0},resumeEvents:function(){this.isSuspendEvents=!1}}),getId:function(e){return _.uniqueId(e||"asc-gen")}})});if(Common===undefined)var Common={};define("common/main/lib/component/Window",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Window=Common.UI.BaseView.extend(_.extend(function(){function n(){var e=$(".modals-mask");return e.length==0&&(e=$("
").appendTo(document.body).hide(),e.attr("counter",0)),e}function r(e){if(!this.isLocked()&&this.isVisible()&&this.initConfig.enableKeyEvents)switch(e.keyCode){case Common.UI.Keys.ESC:if($(".asc-loadmask").length<1)return e.preventDefault(),e.stopPropagation(),this.initConfig.closable!==!1&&(this.initConfig.toolclose=="hide"?this.hide():this.close()),!1;break;case Common.UI.Keys.RETURN:if(this.$window.find(".btn.primary").length&&$(".asc-loadmask").length<1&&(this.initConfig.onprimary||this.onPrimary).call(this)===!1)return e.preventDefault(),!1}}function i(){if(window.innerHeight==undefined)var e=document.documentElement.offsetWidth,t=document.documentElement.offsetHeight;else e=Common.Utils.innerWidth(),t=Common.Utils.innerHeight();if(this.initConfig.height=="auto"){var n=parseInt(this.$window.find(".body").css("height"));this.initConfig.header&&(n+=parseInt(this.$window.find(".header").css("height")))}else n=this.initConfig.height;var r=this.initConfig.width=="auto"?parseInt(this.$window.find(".body").css("width")):this.initConfig.width,i=Math.floor((parseInt(t)-parseInt(n))/2*.9),s=Math.floor((parseInt(e)-parseInt(r))/2);this.$window.css("left",s),this.$window.css("top",i)}function s(e){return{"-webkit-transition":"0.3s opacity","-moz-transition":"0.3s opacity","-ms-transition":"0.3s opacity","-o-transition":"0.3s opacity",opacity:e}}function o(e){if($(e.target).hasClass("close"))return;Common.UI.Menu.Manager.hideAll();var t=e instanceof jQuery.Event?Common.Utils.zoom():1;this.dragging.enabled=!0,this.dragging.initx=e.pageX*t-parseInt(this.$window.css("left")),this.dragging.inity=e.pageY*t-parseInt(this.$window.css("top"));if(window.innerHeight==undefined)var n=document.documentElement.offsetWidth,r=document.documentElement.offsetHeight;else n=Common.Utils.innerWidth(),r=Common.Utils.innerHeight();this.dragging.maxx=n-parseInt(this.$window.css("width")),this.dragging.maxy=r-parseInt(this.$window.css("height")),$(document).on("mousemove",this.binding.drag),$(document).on("mouseup",this.binding.dragStop),this.fireEvent("drag",[this,"start"])}function u(){$(document).off("mousemove",this.binding.drag),$(document).off("mouseup",this.binding.dragStop),this.dragging.enabled=!1,this.fireEvent("drag",[this,"end"])}function a(e){if(this.dragging.enabled){var t=e instanceof jQuery.Event?Common.Utils.zoom():1,n=e.pageX*t-this.dragging.initx,r=e.pageY*t-this.dragging.inity;n<0?n=0:n>this.dragging.maxx&&(n=this.dragging.maxx),r<0?r=0:r>this.dragging.maxy&&(r=this.dragging.maxy),this.$window.css({left:n,top:r})}}function f(e){Common.UI.Menu.Manager.hideAll();var t=$(e.target),n=parseInt(this.$window.css("left")),r=parseInt(this.$window.css("top"));this.resizing.enabled=!0,this.resizing.initpage_x=e.pageX*Common.Utils.zoom(),this.resizing.initpage_y=e.pageY*Common.Utils.zoom(),this.resizing.initx=this.resizing.initpage_x-n,this.resizing.inity=this.resizing.initpage_y-r,this.resizing.initw=parseInt(this.$window.css("width")),this.resizing.inith=parseInt(this.$window.css("height")),this.resizing.type=[t.hasClass("left")?-1:t.hasClass("right")?1:0,t.hasClass("top")?-1:t.hasClass("bottom")?1:0];var i=window.innerHeight==undefined?document.documentElement.offsetWidth:Common.Utils.innerWidth(),s=window.innerHeight==undefined?document.documentElement.offsetHeight:Common.Utils.innerHeight(),o=this.initConfig.maxwidth?this.initConfig.maxwidth:i,u=this.initConfig.maxheight?this.initConfig.maxheight:s;this.resizing.type[0]>0?(this.resizing.maxx=Math.min(i,n+o),this.resizing.minx=n+this.initConfig.minwidth):this.resizing.type[0]<0&&(this.resizing.maxx=n+this.resizing.initw-this.initConfig.minwidth,this.resizing.minx=Math.max(0,n+this.resizing.initw-o)),this.resizing.type[1]>0?(this.resizing.maxy=Math.min(s,r+u),this.resizing.miny=r+this.initConfig.minheight):this.resizing.type[1]<0&&(this.resizing.maxy=r+this.resizing.inith-this.initConfig.minheight,this.resizing.miny=Math.max(0,r+this.resizing.inith-u)),$(document.body).css("cursor",t.css("cursor")),this.$window.find(".resize-border").addClass("resizing"),this.$window.find(".header").addClass("resizing"),$(document).on("mousemove",this.binding.resize),$(document).on("mouseup",this.binding.resizeStop),this.fireEvent("resize",[this,"start"])}function l(e){if(this.resizing.enabled){var t=!1,n=e instanceof jQuery.Event?Common.Utils.zoom():1,r=e.pageX*n,i=e.pageY*n;this.resizing.type[0]&&rthis.resizing.minx&&(this.resizing.type[0]<0&&this.$window.css({left:r-this.resizing.initx}),this.setWidth(this.resizing.initw+(r-this.resizing.initpage_x)*this.resizing.type[0]),t=!0),this.resizing.type[1]&&ithis.resizing.miny&&(this.resizing.type[1]<0&&this.$window.css({top:i-this.resizing.inity}),this.setHeight(this.resizing.inith+(i-this.resizing.initpage_y)*this.resizing.type[1]),t=!0),t&&this.fireEvent("resizing")}}function c(){$(document).off("mousemove",this.binding.resize),$(document).off("mouseup",this.binding.resizeStop),$(document.body).css("cursor","auto"),this.$window.find(".resize-border").removeClass("resizing"),this.$window.find(".header").removeClass("resizing"),this.resizing.enabled=!1,this.fireEvent("resize",[this,"end"])}var e={closable:!0,header:!0,modal:!0,width:"auto",height:"auto",title:"Title",alias:"Window",cls:"",toolclose:"close",maxwidth:undefined,maxheight:undefined,minwidth:0,minheight:0,enableKeyEvents:!0},t='
<%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;"><% if (header==true) { %>
<% if (closable!==false) %>
<% %><%= title %>
<% } %>
<%= tpl %>
';return Common.UI.alert=function(e){function u(t){var n=t.getChild(".info-box"),r=t.getChild(".info-box span"),i=t.getChild(".footer"),s=t.getChild(".header"),o=t.getChild(".body"),u=t.getChild(".icon"),a=t.getChild(".info-box .dont-show-checkbox");e.dontshow||o.css("padding-bottom","10px"),e.maxwidth&&e.width=="auto"&&r.position().left+r.width()+parseInt(n.css("padding-right"))>e.maxwidth&&(e.width=e.maxwidth),e.width=="auto"?(n.height(Math.max(r.height()+(a.length>0?a.height()+parseInt(a.css("margin-top")):0),u.height())),o.height(parseInt(n.css("height"))+parseInt(i.css("height"))),t.setSize(r.position().left+r.width()+parseInt(n.css("padding-right")),parseInt(o.css("height"))+parseInt(s.css("height")))):(r.css("white-space","normal"),t.setWidth(e.width),n.height(Math.max(r.height()+(a.length>0?a.height()+parseInt(a.css("margin-top")):0),u.height())),o.height(parseInt(n.css("height"))+parseInt(i.css("height"))),t.setHeight(parseInt(o.css("height"))+parseInt(s.css("height")))),r.height() .body").css("height"));this.initConfig.header&&(i+=parseInt(this.$window.find("> .header").css("height"))),this.$window.height(i)}else this.$window.css("height",this.initConfig.height);this.initConfig.resizable&&this.setResizable(this.initConfig.resizable);var s=this;return Common.NotificationCenter.on("window:close",function(){s.$window&&s.isVisible()&&s.close()}),this.fireEvent("render:after",this),this},show:function(e,t){if(this.initConfig.modal){var r=n();if(this.options.animate!==!1){var o=r.css("opacity");r.css("opacity",0),r.attr("counter",parseInt(r.attr("counter"))+1),r.show(),setTimeout(function(){r.css(s(o))},1)}else r.attr("counter",parseInt(r.attr("counter"))+1),r.show();Common.NotificationCenter.trigger("modal:show",this),this.$lastmodal=$(".asc-window.modal:not(.dethrone):visible").first().addClass("dethrone")}this.$window?this.$window.is(":visible")||(this.$window.css({opacity:0}),this.$window.show()):(this.render(),_.isNumber(e)&&_.isNumber(t)?(this.$window.css("left",Math.floor(e)),this.$window.css("top",Math.floor(t))):i.call(this)),$(document).on("keydown."+this.cid,this.binding.keydown);var u=this;setTimeout(function(){u.fireEvent("animate:before",u)},10),this.options.animate!==!1?(this.$window.css({"-webkit-transform":"scale(0.8)","-moz-transform":"scale(0.8)","-ms-transform":"scale(0.8)","-o-transform":"scale(0.8)",opacity:0}),setTimeout(function(){u.$window.css({"-webkit-transition":"0.2s opacity, 0.2s -webkit-transform","-webkit-transform":"scale(1)","-moz-transition":"0.2s opacity, 0.2s -moz-transform","-moz-transform":"scale(1)","-ms-transition":"0.2s opacity, 0.2s -ms-transform","-ms-transform":"scale(1)","-o-transition":"0.2s opacity, 0.2s -o-transform","-o-transform":"scale(1)",opacity:"1"})},1),setTimeout(function(){u.$window.addClass("notransform"),u.fireEvent("show",u)},this.initConfig.modal?1e3:350)):(this.$window.css({opacity:1}),this.$window.addClass("notransform"),this.fireEvent("show",this)),Common.NotificationCenter.trigger("window:show")},close:function(e){$(document).off("keydown."+this.cid),this.initConfig.header&&this.$window.find(".header").off("mousedown",this.binding.dragStart);if(this.initConfig.modal){var t=n(),r=!0;t.attr("counter",parseInt(t.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),r=!this.$lastmodal.hasClass("modal")||!this.$lastmodal.is(":visible"));if(r)if(this.options.animate!==!1){var i=t.css("opacity");t.css(s(0)),setTimeout(function(){t.css("opacity",i),parseInt(t.attr("counter"))<1&&(t.hide(),t.attr("counter",0))},300)}else parseInt(t.attr("counter"))<1&&(t.hide(),t.attr("counter",0));Common.NotificationCenter.trigger("modal:close",this)}this.$window.remove(),e!==!0&&this.fireEvent("close",this)},hide:function(){$(document).off("keydown."+this.cid);if(this.$window){if(this.initConfig.modal){var e=n(),t=!0;e.attr("counter",parseInt(e.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),t=!this.$lastmodal.hasClass("modal")||!this.$lastmodal.is(":visible"));if(t)if(this.options.animate!==!1){var r=e.css("opacity");e.css(s(0)),setTimeout(function(){e.css("opacity",r),parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0))},300)}else parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0));Common.NotificationCenter.trigger("modal:hide",this)}this.$window.hide(),this.$window.removeClass("notransform"),this.fireEvent("hide",this)}},isLocked:function(){return this.$window.hasClass("dethrone")||!this.options.modal&&this.$window.parent().find(".asc-window.modal:visible").length},getChild:function(e){return e?this.$window.find(e):this.$window},setWidth:function(e){if(e>=0){var t=parseInt(this.$window.css("min-width"));e=0){var t=parseInt(this.$window.css("min-height"));e .header").css("height"))),this.$window.find("> .body").css("height",e)}},getHeight:function(){return parseInt(this.$window.css("height"))},setSize:function(e,t){this.setWidth(e),this.setHeight(t)},getSize:function(){return[this.getWidth(),this.getHeight()]},setTitle:function(e){this.$window.find("> .header > .title").text(e)},getTitle:function(){return this.$window.find("> .header > .title").text()},isVisible:function(){return this.$window&&this.$window.is(":visible")},setResizable:function(e,t,n){if(e!==this.resizable){if(e){var r='
'+'
'+'
'+'
'+'
'+'
'+'
'+'
';this.initConfig.header&&(r+='
'),this.$window.append(_.template(r)),this.binding.resize=_.bind(l,this),this.binding.resizeStop=_.bind(c,this),this.binding.resizeStart=_.bind(f,this),t&&t.length>1&&(this.initConfig.minwidth=t[0]),t&&t.length>1&&(this.initConfig.minheight=t[1]),n&&n.length>1&&(this.initConfig.maxwidth=n[0]),n&&n.length>1&&(this.initConfig.maxheight=n[1]),this.$window.find(".resize-border").on("mousedown",this.binding.resizeStart)}else this.$window.find(".resize-border").remove();this.resizable=e}},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(e){_.extend(this.options,e||{}),this.template=['
','
',"","
",'
',"
",'"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this;e.inputName=new Common.UI.InputField({el:$("#id-dlg-newname"),style:"width: 100%;",validateOnBlur:!1,validation:function(t){return/[\t*\+:\"<>?|\\\\/]/gim.test(t)?e.txtInvalidName+'*+:"<>?|/':!0}});var t=this.getChild();t.find(".btn").on("click",_.bind(this.onBtnClick,this)),e.inputNameEl=t.find("input"),e.inputNameEl.on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.inputName.setValue(e.options.filename),e.inputNameEl.focus().select()},100)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputName.checkValidate()!==!0){this.inputNameEl.focus();return}this.options.handler.call(this,e,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||{}))});if(Common===undefined)var Common={};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(e,t){"use strict";Common.Views.Header=e.View.extend(_.extend({options:{branding:{},headerCaption:"Default Caption",documentCaption:"",canBack:!1},el:"#header",template:_.template(t),events:{"click #header-logo":function(e){var t=!this.branding||!this.branding.logo||!this.branding.logo.url?"http://www.onlyoffice.com":this.branding.logo.url,n=window.open(t);n&&n.focus()}},initialize:function(e){this.options=this.options?_({}).extend(this.options,e):e,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 e=(new Common.UI.MenuItem({caption:this.openNewTabText})).on("click",function(e,t){Common.NotificationCenter.trigger("goback",!0),Common.component.Analytics.trackEvent("Back to Folder")});this.gotoDocsMenu=new Common.UI.Menu({style:"min-width: 100px;",items:[e]})},setVisible:function(e){e?this.show():this.hide()},setBranding:function(e){var t;this.branding=e,e&&e.logo&&e.logo.image&&(t=$("#header-logo"),t&&(t.html(''),t.css({"background-image":"none",width:"auto"})))},setHeaderCaption:function(e){this.headerCaption=e;var t=$("#header-caption > div");return t&&t.html(e),e},getHeaderCaption:function(){return this.headerCaption},setDocumentCaption:function(e,t){t!==undefined&&(this.isModified=t),this.documentCaption=e,e||(e=""),this.isModified&&(e+="*");var n=$("#header-documentcaption div");return n&&n.html(Common.Utils.String.htmlEncode(e)),e},getDocumentCaption:function(){return this.documentCaption},setCanBack:function(e){this.canBack=e;var t=$("#header-back");t&&(t.off("mouseup"),t.css("display",e?"table-cell":"none"),e&&t.on("mouseup",_.bind(this.onBackClick,this)))},getCanBack:function(){return this.canBack},onBackClick:function(e){if(e.which==3){Common.UI.Menu.Manager.hideAll();var t=this,n=[e.pageX*Common.Utils.zoom(),e.pageY*Common.Utils.zoom()],r=$(this.el).find(Common.Utils.String.format("#menu-container-{0}",this.gotoDocsMenu.id));this.gotoDocsMenu.rendered||(r.length<1&&(r=$(Common.Utils.String.format('',this.gotoDocsMenu.id)),$(this.el).append(r)),this.gotoDocsMenu.render(r),this.gotoDocsMenu.cmpEl.attr({tabindex:"-1"})),_.delay(function(){r.css({left:n[0]-t.gotoDocsMenu.cmpEl.width(),top:n[1]+3}),t.gotoDocsMenu.show()},10)}else Common.NotificationCenter.trigger("goback",e.which==2),Common.component.Analytics.trackEvent("Back to Folder")},setCanRename:function(e){var t=$("#header-documentcaption div");if(e){var n=this;t.tooltip({title:n.txtRename,placement:"cursor"}),t.on("click",function(e){(new Common.Views.RenameDialog({filename:n.documentCaption,handler:function(e,t){e=="ok"&&!_.isEmpty(t.trim())&&n.documentCaption!==t.trim()&&Common.Gateway.requestRename(t),Common.NotificationCenter.trigger("edit:complete",n)}})).show(t.position().left-1,20)})}else{var r=t.data("bs.tooltip");r&&(r.options.title="",r.setContent()),t.off("click")}t.css("cursor",e?"pointer":"default"),t.toggleClass("renamed",e)},textBack:"Go to Documents",openNewTabText:"Open in New Tab",txtRename:"Rename"},Common.Views.Header||{}))}),define("text!spreadsheeteditor/main/app/template/Viewport.template",[],function(){return'
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n'});if(Common===undefined)var Common={};define("common/main/lib/component/Layout",["backbone"],function(){"use strict";var e=function(e){this.box=null,this.panels=[],this.splitters=[],_.extend(this,e||{})},t=function(){return{width:null,height:null,resize:!1,stretch:!1,rely:!1}};_.extend(e.prototype,Backbone.Events,{initialize:function(e){this.$parent=this.box.parent(),this.resize={eventMove:_.bind(this.resizeMove,this),eventStop:_.bind(this.resizeStop,this)};var n,r,i=!1;e.items.forEach(function(e){e.el instanceof HTMLElement&&(e.el=$(e.el)),n=_.extend(new t,e),n.stretch&&(i=!0,n.rely=!1,n.resize=!1),this.panels.push(n),n.resize&&(r={isresizer:!0,minpos:n.resize.min||0,maxpos:n.resize.max||0,fmin:n.resize.fmin,fmax:n.resize.fmax,behaviour:n.behaviour,index:this.splitters.length},i?(n.resize.el=r.el=n.el.before('
').prev(),this.panels.splice(this.panels.length-1,0,r)):(n.resize.el=r.el=n.el.after('
').next(),this.panels.push(r)),this.splitters.push({resizer:r}),n.resize.hidden&&r.el.hide())},this),this.freeze=e.freeze,this.freeze&&this.freezePanels(this.freeze)},doLayout:function(){},getElementHeight:function(e){return parseInt(e.css("height"))},getElementWidth:function(e){return parseInt(e.css("width"))},onSelectStart:function(e){return e.preventDefault&&e.preventDefault(),!1},addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},clearSelection:function(){if(window.getSelection){var e=window.getSelection();e.empty?e.empty():e.removeAllRanges&&e.removeAllRanges()}else document.selection&&document.selection.empty()},resizeStart:function(e){this.clearSelection(),this.addHandler(window.document,"selectstart",this.onSelectStart),$(document).on({mousemove:this.resize.eventMove,mouseup:this.resize.eventStop}),Common.NotificationCenter.on({"frame:mousemove":this.resize.eventMove,"frame:mouseup":this.resize.eventStop});var t=e.data.panel;this.resize.type=e.data.type,this.resize.$el=t.el,this.resize.min=t.minpos,this.resize.fmin=t.fmin,this.resize.fmax=t.fmax,this.resize.behaviour=t.behaviour,this.resize.$el.addClass("move"),e.data.type=="vertical"?(this.resize.height=parseInt(this.resize.$el.css("height")),this.resize.max=(t.maxpos>0?t.maxpos:this.resize.$el.parent().height()+t.maxpos)-this.resize.height,this.resize.inity=e.pageY*Common.Utils.zoom()-parseInt(e.currentTarget.style.top)):e.data.type=="horizontal"&&(this.resize.width=parseInt(this.resize.$el.css("width")),this.resize.max=(t.maxpos>0?t.maxpos:this.resize.$el.parent().height()+t.maxpos)-this.resize.width,this.resize.initx=e.pageX*Common.Utils.zoom()-parseInt(e.currentTarget.style.left)),Common.NotificationCenter.trigger("layout:resizestart")},resizeMove:function(e){var t=e instanceof jQuery.Event?Common.Utils.zoom():1;if(this.resize.type=="vertical")var n="top",r=e.pageY*t-this.resize.inity;else this.resize.type=="horizontal"&&(n="left",r=e.pageX*t-this.resize.initx);this.resize.fmin&&this.resize.fmax?!(rthis.resize.fmax())&&(this.resize.$el[0].style[n]=r+"px"):!(rthis.resize.max)&&(this.resize.$el[0].style[n]=r+"px")},resizeStop:function(e){this.removeHandler(window.document,"selectstart",this.onSelectStart),$(document).off({mousemove:this.resize.eventMove,mouseup:this.resize.eventStop}),Common.NotificationCenter.off({"frame:mousemove":this.resize.eventMove,"frame:mouseup":this.resize.eventStop});if(!this.resize.$el)return;var t=e instanceof jQuery.Event?Common.Utils.zoom():1;if(this.resize.type=="vertical")var n="height",r=e.pageY*t-this.resize.inity;else this.resize.type=="horizontal"&&(n="width",r=e.pageX*t-this.resize.initx);this.resize.fmin&&this.resize.fmax?(rthis.resize.fmax()&&(r=this.resize.fmax())):(rthis.resize.max&&(r=this.resize.max));var i=null,s=null,o=0;this.resize.$el.hasClass("after")?(i=this.resize.$el.prev(),s=this.resize.$el.next(),o=parseInt(i.css(n))):(i=this.resize.$el.next(),s=this.resize.$el.next(),o=parseInt(i.css(n)),r=i.parent()[n]()-(r+this.resize[n])),this.resize.type=="vertical"&&(r-=i.position().top),this.resize.type=="horizontal"&&(r-=i.position().left),i.css(n,r+"px"),this.resize.behaviour&&s.css(n,parseInt(s.css(n))-(r-o)),this.resize.$el.removeClass("move"),delete this.resize.$el,this.resize.value!=r&&(this.doLayout(),this.trigger("layout:resizedrag",this)),Common.NotificationCenter.trigger("layout:resizestop")},freezePanels:function(e){this.panels.forEach(function(t){!t.stretch&&t.resize&&$(t.resize.el).css("cursor",e?"default":"")}),this.freeze=e},setResizeValue:function(e,t){if(e>=this.splitters.length)return;var n=null,r=null,i=0,s=this.splitters[e].resizer,o="height";ts.fmax()&&(t=s.fmax()),s.el.hasClass("after")?(n=s.el.prev(),r=s.el.next(),i=parseInt(n.css(o))):(n=s.el.next(),t=n.parent()[o]()-(t+s[o]),r=s.el.next(),i=parseInt(n.css(o))),t-=n.position().top,n.css(o,t+"px"),s.behaviour&&r.css(o,parseInt(r.css(o))-(t-i)),s.value!=t&&this.doLayout()}}),!Common.UI&&(Common.UI={}),Common.UI.VBoxLayout=function(t){e.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.VBoxLayout.prototype=_.extend(new e,{initialize:function(t){e.prototype.initialize.call(this,t),this.panels.forEach(function(e){!e.stretch&&!e.height&&(e.height=this.getElementHeight(e.el)),e.isresizer&&e.el.on("mousedown",{type:"vertical",panel:e},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)},doLayout:function(){var e=0,t,n;this.panels.forEach(function(r){r.stretch?t=r:(n=r.el.is(":visible"),n&&(e+=r.rely!==!0?r.height:this.getElementHeight(r.el)),r.resize&&r.resize.autohide!==!1&&r.resize.el&&(n?(r.resize.el.show(),t&&(e+=r.resize.height)):(r.resize.el.hide(),t&&(e-=r.resize.height))))},this),t&&(t.height=this.$parent.height()-e),e=0,this.panels.forEach(function(t){t.el.is(":visible")&&(n={top:e},t.rely!==!0&&(n.height=t.height),t.el.css(n),e+=this.getElementHeight(t.el))},this)}}),Common.UI.HBoxLayout=function(t){e.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.HBoxLayout.prototype=_.extend(new e,{initialize:function(t){e.prototype.initialize.call(this,t),this.panels.forEach(function(e){!e.stretch&&!e.width&&(e.width=this.getElementWidth(e.el)),e.isresizer&&e.el.on("mousedown",{type:"horizontal",panel:e},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)},doLayout:function(e){var t=0,n,r;this.panels.forEach(function(e){e.stretch?n=e:(r=e.el.is(":visible"),r&&(t+=e.rely!==!0?e.width:this.getElementWidth(e.el)),e.resize&&e.resize.autohide!==!1&&e.resize.el&&(r?(e.resize.el.show(),n&&(t-=e.resize.width)):(e.resize.el.hide(),n&&(t-=e.resize.width))))},this),n&&(n.width=this.$parent.width()-t),t=0,this.panels.forEach(function(e){e.el.is(":visible")&&(r={left:t},e.rely!==!0&&(r.width=e.width),e.el.css(r),t+=this.getElementWidth(e.el))},this)}}),Common.UI.VBoxLayout.prototype.constructor=Common.UI.VBoxLayout,Common.UI.HBoxLayout.prototype.constructor=Common.UI.HBoxLayout}),define("spreadsheeteditor/main/app/view/Viewport",["text!spreadsheeteditor/main/app/template/Viewport.template","jquery","underscore","backbone","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(e,t,n,r){"use strict";SSE.Views.Viewport=r.View.extend({el:"#viewport",template:n.template(e),events:{},initialize:function(){},render:function(){var e=t(this.el);e.html(this.template({})),Common.Utils.isSafari?(t("body").addClass("safari"),t("body").mousewheel(function(e){e.preventDefault(),e.stopPropagation()})):Common.Utils.isChrome&&t("body").addClass("chrome");var n=t("#viewport-vbox-layout",e),r=n.find(" > .layout-item");return this.vlayout=new Common.UI.VBoxLayout({box:n,items:[{el:r[0],rely:!0},{el:r[1],height:5},{el:r[2],rely:!0},{el:r[3],stretch:!0},{el:r[4],height:25}]}),n=t("#viewport-hbox-layout",e),r=n.find(" > .layout-item"),this.hlayout=new Common.UI.HBoxLayout({box:n,items:[{el:r[0],rely:!0,resize:{hidden:!0,autohide:!1,min:300,max:600}},{el:r[1],stretch:!0},{el:t(r[2]).hide(),rely:!0}]}),n=n.find(".layout-ct.vbox"),r=n.find(" > .layout-item"),this.celayout=new Common.UI.VBoxLayout({box:n,items:[{el:r[0],rely:!0,resize:{min:19,max:-100}},{el:r[1],stretch:!0}]}),this},applyEditorMode:function(){var e=this,t=SSE.getController("Toolbar").getView("Toolbar"),n=SSE.getController("RightMenu").getView("RightMenu");e._toolbar=t.render(this.mode),e._rightMenu=n.render()},setMode:function(e,t){e.isDisconnected?(n.isUndefined(this.mode)&&(this.mode={}),this.mode.canCoAuthoring=!1):(this.mode=e,this.vlayout&&e.isDesktopApp&&!e.isEdit&&this.vlayout.items[1].el.css("display","block"))}})}),define("spreadsheeteditor/main/app/controller/Viewport",["core","common/main/lib/view/Header","spreadsheeteditor/main/app/view/Viewport"],function(e){"use strict";SSE.Controllers.Viewport=Backbone.Controller.extend({models:[],collections:[],views:["Viewport","Common.Views.Header"],initialize:function(){this.addListeners({Viewport:{}})},setApi:function(e){this.api=e},onLaunch:function(){this.viewport=this.createView("Viewport").render(),this.header=this.createView("Common.Views.Header",{headerCaption:"Spreadsheet Editor"}).render(),Common.NotificationCenter.on("layout:changed",_.bind(this.onLayoutChanged,this)),$(window).on("resize",_.bind(this.onWindowResize,this)),this.viewport.celayout.on("layout:resizedrag",function(){this.viewport.fireEvent("layout:resizedrag",[this,"cell:edit"]),this.api.asc_Resize()},this);var e=$("#left-menu");this.viewport.hlayout.on("layout:resizedrag",function(){this.api.asc_Resize(),Common.localStorage.setItem("sse-mainmenu-width",e.width())},this),this.boxSdk=$("#editor_sdk"),this.boxFormula=$("#cell-editing-box"),this.boxSdk.css("border-left","none"),this.boxFormula.css("border-left","none")},onLayoutChanged:function(e){switch(e){default:this.viewport.vlayout.doLayout(),this.viewport.celayout.doLayout();case"rightmenu":this.viewport.hlayout.doLayout();break;case"leftmenu":var t=this.viewport.hlayout.items[0];t.resize.el&&(t.el.width()>40?(this.boxSdk.css("border-left",""),this.boxFormula.css("border-left",""),t.resize.el.show()):(t.resize.el.hide(),this.boxSdk.css("border-left","none"),this.boxFormula.css("border-left","none"))),this.viewport.hlayout.doLayout();break;case"header":case"toolbar":case"status":this.viewport.vlayout.doLayout(),this.viewport.celayout.doLayout();break;case"celleditor":arguments[1]&&this.boxSdk.css("border-top",arguments[1]=="hidden"?"none":""),this.viewport.celayout.doLayout()}this.api.asc_Resize()},onWindowResize:function(e){this.onLayoutChanged("window"),Common.NotificationCenter.trigger("window:resize")}})});if(Common===undefined)var Common={};Common.Utils===undefined&&(Common.Utils={}),Common.Utils=_.extend(new function(){var e=navigator.userAgent.toLowerCase(),t=function(t){return t.test(e)},n=document.compatMode=="CSS1Compat",r=function(t,n){var r;return t&&(r=n.exec(e))?parseFloat(r[1]):0},i=document.documentMode,s=t(/opera/),o=s&&t(/version\/10\.5/),u=t(/\bchrome\b/),a=t(/webkit/),f=!u&&t(/safari/),l=f&&t(/applewebkit\/4/),c=f&&t(/version\/3/),h=f&&t(/version\/4/),p=f&&t(/version\/5\.0/),d=f&&t(/version\/5/),v=!s&&(t(/msie/)||t(/trident/)),m=v&&(t(/msie 7/)&&i!=8&&i!=9&&i!=10||i==7),g=v&&(t(/msie 8/)&&i!=7&&i!=9&&i!=10||i==8),y=v&&(t(/msie 9/)&&i!=7&&i!=8&&i!=10||i==9),b=v&&(t(/msie 10/)&&i!=7&&i!=8&&i!=9||i==10),w=v&&(t(/trident\/7\.0/)&&i!=7&&i!=8&&i!=9&&i!=10||i==11),E=v&&t(/msie 6/),S=!a&&!v&&t(/gecko/),x=S&&t(/rv:1\.9/),T=S&&t(/rv:2\.0/),N=S&&t(/rv:5\./),C=S&&t(/rv:10\./),k=x&&t(/rv:1\.9\.0/),L=x&&t(/rv:1\.9\.1/),A=x&&t(/rv:1\.9\.2/),O=t(/windows|win32/),M=t(/macintosh|mac os x/),_=t(/linux/),D=r(!0,/\bchrome\/(\d+\.\d+)/),P=r(!0,/\bfirefox\/(\d+\.\d+)/),H=r(v,/msie (\d+\.\d+)/),B=r(s,/version\/(\d+\.\d+)/),j=r(f,/version\/(\d+\.\d+)/),F=r(a,/webkit\/(\d+\.\d+)/),I=/^https/i.test(window.location.protocol),q=/^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,R=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/i,U=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,z=/^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,W=/(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,X=/(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,V=/((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,J={Paragraph:0,Table:1,Image:2,Header:3,TextArt:4,Shape:5,Slide:6,Chart:7,MailMerge:8},K=/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent||navigator.vendor||window.opera),Q=this,G=function(){Q.zoom=1;if(u&&!s&&!K&&document&&document.firstElementChild&&document.body)if(window.devicePixelRatio>.1){if(window.devicePixelRatio<1.99){var e=1;Q.zoom=window.devicePixelRatio/e}else{var e=2;Q.zoom=window.devicePixelRatio/e}document.firstElementChild.style.zoom=1/Q.zoom}else document.firstElementChild.style.zoom="normal";Q.innerWidth=window.innerWidth*Q.zoom,Q.innerHeight=window.innerHeight*Q.zoom};return Q.zoom=1,Q.innerWidth=window.innerWidth,Q.innerHeight=window.innerHeight,G(),$(window).on("resize",G),{userAgent:e,isStrict:n,isIEQuirks:v&&!n&&(E||m||g||y),isOpera:s,isOpera10_5:o,isWebKit:a,isChrome:u,isSafari:f,isSafari3:c,isSafari4:h,isSafari5:d,isSafari5_0:p,isSafari2:l,isIE:v,isIE6:E,isIE7:m,isIE7m:E||m,isIE7p:v&&!E,isIE8:g,isIE8m:E||m||g,isIE8p:v&&!E&&!m,isIE9:y,isIE9m:E||m||g||y,isIE9p:v&&!(E||m||g),isIE10:b,isIE10m:E||m||g||y||b,isIE10p:v&&!(E||m||g||y),isIE11:w,isIE11m:E||m||g||y||b||w,isIE11p:v&&!(E||m||g||y||b),isGecko:S,isGecko3:x,isGecko4:T,isGecko5:N,isGecko10:C,isFF3_0:k,isFF3_5:L,isFF3_6:A,isFF4:4<=P&&P<5,isFF5:5<=P&&P<6,isFF10:10<=P&&P<11,isLinux:_,isWindows:O,isMac:M,chromeVersion:D,firefoxVersion:P,ieVersion:H,operaVersion:B,safariVersion:j,webKitVersion:F,isSecure:I,emailRe:q,ipRe:R,hostnameRe:U,localRe:z,emailStrongRe:W,ipStrongRe:X,hostnameStrongRe:V,documentSettingsType:J,zoom:function(){return Q.zoom},innerWidth:function(){return Q.innerWidth},innerHeight:function(){return Q.innerHeight}}},Common.Utils||{}),Common.Utils.ThemeColor=new function(){return{ThemeValues:[6,15,7,16,0,1,2,3,4,5],setColors:function(e,t){var n,r,i;if(t&&t.length>0){var s=[];for(n=0;n>16),n.put_g((t&65280)>>8),n.put_b(t&255),n.put_a(255),e.effectId!==undefined&&n.put_value(e.effectId),n},colorValue2EffectId:function(e){if(typeof e=="object"&&e.effectValue!==undefined&&this.effectcolors)for(var t=0;t255?255:t,n=n<0||isNaN(n)?0:n>255?255:n,r=r<0||isNaN(r)?0:r>255?255:r;var l=function(e){return t==e.r&&n==e.g&&r==e.b},c=function(){return"rgb("+t+", "+n+", "+r+")"},h=function(e){return e===undefined&&(e=1),"rgba("+t+", "+n+", "+r+", "+e+")"},p=function(){var e=t.toString(16),i=n.toString(16),s=r.toString(16);return e.length==1&&(e="0"+e),i.length==1&&(i="0"+i),s.length==1&&(s="0"+s),"#"+e+i+s},d=function(){var e={h:0,s:0,b:0},i=Math.min(t,n,r),s=Math.max(t,n,r),o=s-i;return e.b=s,e.s=s!=0?255*o/s:0,e.s!=0?t==s?e.h=0+(n-r)/o:n==s?e.h=2+(r-t)/o:e.h=4+(t-n)/o:e.h=0,e.h*=60,e.h<0&&(e.h+=360),e.s*=100/255,e.b*=100/255,e.h=parseInt(e.h),e.s=parseInt(e.s),e.b=parseInt(e.b),e};return{r:t,g:n,b:r,isEqual:l,toRGB:c,toRGBA:h,toHex:p,toHSB:d}},Common.Utils.String=new function(){return{format:function(e){var t=_.toArray(arguments).slice(1);return e.replace(/\{(\d+)\}/g,function(e,n){return t[n]})},htmlEncode:function(e){return _.escape(e)},htmlDecode:function(e){return _.unescape(e)},ellipsis:function(e,t,n){if(e&&e.length>t){if(n){var r=e.substr(0,t-2),i=Math.max(r.lastIndexOf(" "),r.lastIndexOf("."),r.lastIndexOf("!"),r.lastIndexOf("?"));if(i!==-1&&i>=t-15)return r.substr(0,i)+"..."}return e.substr(0,t-3)+"..."}return e},platformKey:function(e,t,n){return _.isEmpty(t)&&(t=" ({0})"),Common.Utils.isMac?(_.isFunction(n)&&(e=n.call(this,e)),Common.Utils.String.format(t,e.replace(/\+(?=\S)/g,"").replace(/Ctrl|ctrl/g,"⌘").replace(/Alt|alt/g,"⌥").replace(/Shift|shift/g,"⇧"))):Common.Utils.String.format(t,e)}}},Common.Utils.isBrowserSupported=function(){return!(Common.Utils.ieVersion!=0&&Common.Utils.ieVersion<9||Common.Utils.safariVersion!=0&&Common.Utils.safariVersion<5||Common.Utils.firefoxVersion!=0&&Common.Utils.firefoxVersion<4||Common.Utils.chromeVersion!=0&&Common.Utils.chromeVersion<7||Common.Utils.operaVersion!=0&&Common.Utils.operaVersion<10.5)},Common.Utils.showBrowserRestriction=function(){var e=window.DE?"Document":window.SSE?"Spreadsheet":window.PE?"Presentation":"that",t=document.createElement("div");t.innerHTML='
Your browser is not supported.
Sorry, '+e+" Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.
"+"
"+"
"+'
'+"
",document.body.appendChild(t),$("#loading-mask").hide().remove(),$("#viewport").hide().remove()},Common.Utils.applyCustomization=function(e,t){for(var n in e){var r;if(!!t[n]){r=$(t[n]);if(r.length){var i=e[n];i===!1||i.visible===!1?r.hide():(!i.text||r.text(i.text),i.visible===!1&&r.hide())}}}},Common.Utils.applyCustomizationPlugins=function(plugins){if(!plugins||plugins.length<1)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_getPluginCode=function(url){if(!url)return"";try{var xhrObj=_createXMLHTTPObject();xhrObj&&url&&(xhrObj.open("GET",url,!1),xhrObj.send(""),xhrObj.status==200&&eval(xhrObj.responseText))}catch(e){}return null};plugins.forEach(function(e){e&&_getPluginCode(e)})},Common.Utils.fillUserInfo=function(e,t,n){var r=e||{};return!r.id&&(r.id="uid-"+Date.now()),_.isEmpty(r.name)?(_.isEmpty(r.firstname)&&_.isEmpty(r.lastname)&&(r.firstname=n),_.isEmpty(r.firstname)?r.fullname=r.lastname:_.isEmpty(r.lastname)?r.fullname=r.firstname:r.fullname=/^ru/.test(t)?r.lastname+" "+r.firstname:r.firstname+" "+r.lastname):r.fullname=r.name,r},String.prototype.strongMatch=function(e){if(e&&e instanceof RegExp){var t=this.toString().match(e);return!!(t&&t.length>0&&t[0].length==this.length)}return!1},define("common/main/lib/util/utils",function(){});if(Common===undefined)var Common={};define("common/main/lib/view/CopyWarningDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.CopyWarningDialog=Common.UI.Window.extend(_.extend({options:{width:500,height:325,cls:"modal-dlg copy-warning"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['
','

'+this.textMsg+"

",'
',"
",'

'+Common.Utils.String.platformKey("Ctrl+C","{0}")+"

",'

'+this.textToCopy+"

","
","
",'

'+Common.Utils.String.platformKey("Ctrl+X","{0}")+"

",'

'+this.textToCut+"

","
","
",'

'+Common.Utils.String.platformKey("Ctrl+V","{0}")+"

",'

'+this.textToPaste+"

","
","
",'
',"
",'
','"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.chDontShow=new Common.UI.CheckBox({el:$("#copy-warning-checkbox"),labelText:this.textDontShow}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this)),this.autoSize()},autoSize:function(){var e=this.getChild(".box"),t=this.getChild(".footer"),n=this.getChild(".header"),r=this.getChild(".body");r.height(parseInt(e.height())+parseInt(t.css("height"))),this.setHeight(parseInt(r.css("height"))+parseInt(n.css("height")))},onBtnClick:function(e){this.options.handler&&this.options.handler.call(this,this.chDontShow.getValue()=="checked"),this.close()},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&(this.options.handler&&this.options.handler.call(this,this.chDontShow.getValue()=="checked"),this.close())},getSettings:function(){return this.chDontShow.getValue()=="checked"},textTitle:"Copy, Cut and Paste Actions",textMsg:"Copy, cut and paste actions using the editor toolbar buttons and context menu actions will be performed within this editor tab only.

.To copy or paste to or from applications outside the editor tab use the following keyboard combinations:",textToCopy:"for Copy",textToPaste:"for Paste",textToCut:"for Cut",textDontShow:"Don't show this message again"},Common.Views.CopyWarningDialog||{}))}),$(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api","[data-toggle=dropdown], [role=menu]",onDropDownKeyDown),function(){function n(e){(e.which==1||e.which==undefined)&&clearMenus(/form-control/.test(e.target.className))}var e=$._data($(document).get(0),"events"),t;e&&e.click&&e.click.every(function(e,n,r){return/click/.test(e.type)&&!e.selector&&/bs\..+\.dropdown/.test(e.namespace)&&(t=e.handler),!t}),!t||$(document).off("click.bs.dropdown.data-api",t).on("click.bs.dropdown.data-api",n)}(),define("common/main/lib/extend/Bootstrap",function(){});if(Common===undefined)var Common={};define("common/main/lib/component/ToggleManager",["common/main/lib/component/BaseView"],function(){"use strict";function t(t,n){var r,i,s;if(n){r=e[t.toggleGroup];for(i=0,s=r.length;i tabindex="-1" type="menuitem" <% }; if(!_.isUndefined(options.stopPropagation)) { %> data-stopPropagation="true" <% }; %> >',"<% if (!_.isEmpty(iconCls)) { %>",'',"<% } %>","<%= caption %>",""].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.caption=t.options.caption,this.menu=t.options.menu||null,this.checkable=t.options.checkable,this.checked=t.options.checked,t.allowDepress=t.options.allowDepress,this.disabled=t.options.disabled,this.value=t.options.value,this.toggleGroup=t.options.toggleGroup,this.template=t.options.template||this.template,this.iconCls=t.options.iconCls,this.rendered=!1,this.menu!==null&&!(this.menu instanceof Common.UI.Menu)&&(this.menu=new Common.UI.Menu(_.extend({},t.options.menu))),t.options.el&&this.render()},render:function(){var e=this,t=$(this.el);e.trigger("render:before",e);if(e.caption==="--")t.addClass("divider");else if(!this.rendered){t.off("click"),Common.UI.ToggleManager.unregister(e),$(this.el).html(this.template({id:e.id,caption:e.caption,iconCls:e.iconCls,style:e.style,options:e.options})),e.menu&&(t.addClass("dropdown-submenu"),e.menu.render($(this.el)),t.mouseenter(_.bind(e.menu.alignPosition,e.menu)),t.focusout(_.bind(e.onBlurItem,e)),t.hover(_.bind(e.onHoverItem,e),_.bind(e.onUnHoverItem,e)));var n=t.children(":first");this.checkable&&n&&(n.toggleClass("checkable",this.checkable),n.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||n.css("background-image","none")),this.disabled&&$(this.el).toggleClass("disabled",this.disabled),t.on("click",_.bind(this.onItemClick,this)),t.on("mousedown",_.bind(this.onItemMouseDown,this)),Common.UI.ToggleManager.register(e)}return e.cmpEl=$(this.el),e.rendered=!0,e.trigger("render:after",e),this},setCaption:function(e,t){this.caption=e,this.rendered&&(this.cmpEl.find("a").contents().last()[0].textContent=t?e:Common.Utils.String.htmlEncode(e))},setChecked:function(e,t){this.toggle(e,t)},isChecked:function(){return this.checked},setDisabled:function(e){this.disabled=!!e,this.rendered&&this.cmpEl.toggleClass("disabled",this.disabled)},isDisabled:function(){return this.disabled},toggle:function(e,t){var n=e===undefined?!this.checked:!!e;if(this.checkable){this.checked=n;if(this.rendered){var r=this.cmpEl.children(":first");r&&(r.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||r.css("background-image","none"))}t||this.trigger("toggle",this,n)}},onItemMouseDown:function(e){if(e.which!=1)return e.preventDefault(),e.stopPropagation(),!1},onItemClick:function(e){if(!(e.which==1||e.which===undefined&&!this.menu))return!1;!this.disabled&&(this.allowDepress||!this.checked||!this.toggleGroup)&&!this.menu&&this.setChecked(!this.checked);if(this.menu){if(e.target.id==this.id)return!1;this.menu.isOver||this.cmpEl.removeClass("over");return}if(!!this.disabled)return!1;this.trigger("click",this,e)},onHoverItem:function(e){this._doHover(e)},onUnHoverItem:function(e){this._doUnHover(e)},onBlurItem:function(e){this._doUnHover(e)},_doHover:function(e){var t=this;t.menu&&!t.disabled&&(clearTimeout(t.hideMenuTimer),t.cmpEl.trigger("show.bs.dropdown"),t.expandMenuTimer=_.delay(function(){t.cmpEl.addClass("over"),t.cmpEl.trigger("shown.bs.dropdown")},200))},_doUnHover:function(e){var t=this;if(t.cmpEl.hasClass("dropdown-submenu")&&t.cmpEl.hasClass("over")&&(e&&e.relatedTarget&&t.cmpEl.find(e.relatedTarget).length>0||t.cmpEl.hasClass("focused-submenu"))){t.cmpEl.removeClass("focused-submenu");return}if(t.menu&&!t.disabled){clearTimeout(t.expandMenuTimer),t.hideMenuTimer=_.delay(function(){t.menu.isOver||t.cmpEl.removeClass("over")},200);if(e&&e.type!=="focusout"){var n=t.cmpEl.children(":focus");n.length>0&&(n.blur(),t.cmpEl.closest("ul").focus())}}}}),Common.UI.MenuItemSeparator=function(e){return e=e||{},e.caption="--",new Common.UI.MenuItem(e)}}),function(e){typeof define=="function"&&define.amd?define("jmousewheel",["jquery"],e):typeof exports=="object"?module.exports=e:e(jQuery)}(function(e){function a(t){var n=t||window.event,o=r.call(arguments,1),u=0,a=0,c=0,h=0;t=e.event.fix(n),t.type="mousewheel","detail"in n&&(c=n.detail*-1),"wheelDelta"in n&&(c=n.wheelDelta),"wheelDeltaY"in n&&(c=n.wheelDeltaY),"wheelDeltaX"in n&&(a=n.wheelDeltaX*-1),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(a=c*-1,c=0),u=c===0?a:c,"deltaY"in n&&(c=n.deltaY*-1,u=c),"deltaX"in n&&(a=n.deltaX,c===0&&(u=a*-1));if(c===0&&a===0)return;if(n.deltaMode===1){var p=e.data(this,"mousewheel-line-height");u*=p,c*=p,a*=p}else if(n.deltaMode===2){var d=e.data(this,"mousewheel-page-height");u*=d,c*=d,a*=d}h=Math.max(Math.abs(c),Math.abs(a));if(!s||h=1?"floor":"ceil"](u/s),a=Math[a>=1?"floor":"ceil"](a/s),c=Math[c>=1?"floor":"ceil"](c/s),t.deltaX=a,t.deltaY=c,t.deltaFactor=s,t.deltaMode=0,o.unshift(t,u,a,c),i&&clearTimeout(i),i=setTimeout(f,200),(e.event.dispatch||e.event.handle).apply(this,o)}function f(){s=null}function l(e,t){return u.settings.adjustOldDeltas&&e.type==="mousewheel"&&t%120===0}var t=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],n="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r=Array.prototype.slice,i,s;if(e.event.fixHooks)for(var o=t.length;o;)e.event.fixHooks[t[--o]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var t=n.length;t;)this.addEventListener(n[--t],a,!1);else this.onmousewheel=a;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=n.length;e;)this.removeEventListener(n[--e],a,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"use strict";typeof define=="function"&&define.amd?define("perfectscrollbar",["jquery"],e):typeof exports=="object"?e(require("jquery")):e(jQuery)}(function(e){"use strict";var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1,includeMargin:!0},n=function(){var e=0;return function(){var t=e;return e+=1,".perfect-scrollbar-"+t}}();e.fn.perfectScrollbar=function(r,i){return this.each(function(){var s=e.extend(!0,{},t),o=e(this);typeof r=="object"?e.extend(!0,s,r):i=r;if(i==="update")return o.data("perfect-scrollbar-update")&&o.data("perfect-scrollbar-update")(),o;if(i==="destroy")return o.data("perfect-scrollbar-destroy")&&o.data("perfect-scrollbar-destroy")(),o;if(o.data("perfect-scrollbar"))return o.data("perfect-scrollbar");o.addClass("ps-container");var u=e("
").appendTo(o),a=e("
").appendTo(o),f=e("
").appendTo(u),l=e("
").appendTo(a),c,h,p,d,v,m,g,y,b=parseInt(u.css("bottom"),10),w,E,S=parseInt(a.css("right"),10),x,T=n(),N=function(e,t){var n=e+t,r=x-w;n<0?E=0:n>r?E=r:E=n;var i=parseInt(E*(m-d)/(x-w),10);o.scrollTop(i),u.css({bottom:b-i})},C=function(e,t){var n=e+t,r=p-g;n<0?y=0:n>r?y=r:y=n;var i=parseInt(y*(v-p)/(p-g),10);o.scrollLeft(i),a.css({right:S-i})},k=function(e){return s.minScrollbarLength&&(e=Math.max(e,s.minScrollbarLength)),e},L=function(){u.css({left:o.scrollLeft(),bottom:b-o.scrollTop(),width:p,display:c?"inherit":"none"}),a.hasClass("in-scrolling")?a.css({right:S-o.scrollLeft(),height:x,display:h?"inherit":"none"}):a.css({top:o.scrollTop(),right:S-o.scrollLeft(),height:x,display:h?"inherit":"none"}),f.css({left:y,width:g}),l.css({top:E,height:w})},A=function(){p=s.includePadding?o.innerWidth():o.width(),d=s.includePadding?o.innerHeight():o.height(),x=d-(s.includeMargin?parseInt(a.css("margin-top"))+parseInt(a.css("margin-bottom")):0),v=o.prop("scrollWidth"),m=o.prop("scrollHeight"),!s.suppressScrollX&&p+s.scrollXMarginOffset=x-w&&(E=x-w),y>=p-g&&(y=p-g),L(),s.onChange&&s.onChange(this)},O=function(){var t,n;f.bind("mousedown"+T,function(e){n=e.pageX,t=f.position().left,u.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+T,function(e){u.hasClass("in-scrolling")&&(C(t,e.pageX-n),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+T,function(e){u.hasClass("in-scrolling")&&u.removeClass("in-scrolling")}),t=n=null},M=function(){var t,n;l.bind("mousedown"+T,function(e){n=e.pageY,t=l.position().top,a.addClass("in-scrolling");var r=parseInt(a.css("margin-top")),i=a[0].getBoundingClientRect();a.css({position:"fixed",left:i.left,top:i.top-r}),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+T,function(e){a.hasClass("in-scrolling")&&(N(t,e.pageY-n),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+T,function(e){a.hasClass("in-scrolling")&&(a.removeClass("in-scrolling"),a.css({position:"",left:"",top:""}),L())}),t=n=null},_=function(e,t){var n=o.scrollTop();if(e===0){if(!h)return!1;if(n===0&&t>0||n>=m-d&&t<0)return!s.wheelPropagation}var r=o.scrollLeft();if(t===0){if(!c)return!1;if(r===0&&e<0||r>=v-p&&e>0)return!s.wheelPropagation}return!0},D=function(){s.wheelSpeed/=10;var t=!1;o.bind("mousewheel"+T,function(n,r,i,u){var a=n.deltaX*n.deltaFactor||i,f=n.deltaY*n.deltaFactor||u;if(n&&n.target&&(n.target.type==="textarea"||n.target.type==="input")){n.stopImmediatePropagation(),n.preventDefault();var l=e(n.target).scrollTop(),p=0;n.originalEvent?n.originalEvent.wheelDelta?p=n.originalEvent.wheelDelta:n.originalEvent.deltaY?p=-n.originalEvent.deltaY*40:n.originalEvent.detail&&(p=n.originalEvent.detail):p=n.wheelDelta!==undefined?n.wheelDelta:n.deltaY,e(n.target).scrollTop(l-p);return}t=!1,s.useBothWheelAxes?h&&!c?(f?o.scrollTop(o.scrollTop()-f*s.wheelSpeed):o.scrollTop(o.scrollTop()+a*s.wheelSpeed),t=!0):c&&!h&&(a?o.scrollLeft(o.scrollLeft()+a*s.wheelSpeed):o.scrollLeft(o.scrollLeft()-f*s.wheelSpeed),t=!0):(o.scrollTop(o.scrollTop()-f*s.wheelSpeed),o.scrollLeft(o.scrollLeft()+a*s.wheelSpeed)),A(),t=t||_(a,f),t&&(n.stopPropagation(),n.preventDefault())}),o.bind("MozMousePixelScroll"+T,function(e){t&&e.preventDefault()})},P=function(){var t=!1;o.bind("mouseenter"+T,function(e){t=!0}),o.bind("mouseleave"+T,function(e){t=!1});var n=!1;e(document).bind("keydown"+T,function(r){if(!t||e(document.activeElement).is(":input,[contenteditable]"))return;var i=0,s=0;switch(r.which){case 37:i=-30;break;case 38:s=30;break;case 39:i=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}o.scrollTop(o.scrollTop()-s),o.scrollLeft(o.scrollLeft()+i),n=_(i,s),n&&r.preventDefault()})},H=function(){var e=function(e){e.stopPropagation()};l.bind("click"+T,e),a.bind("click"+T,function(e){var t=parseInt(w/2,10),n=e.pageY-a.offset().top-t,r=x-w,i=n/r;i<0?i=0:i>1&&(i=1),o.scrollTop((m-d)*i)}),f.bind("click"+T,e),u.bind("click"+T,function(e){var t=parseInt(g/2,10),n=e.pageX-u.offset().left-t,r=p-g,i=n/r;i<0?i=0:i>1&&(i=1),o.scrollLeft((v-p)*i)})},B=function(){var t=function(e,t){o.scrollTop(o.scrollTop()-t),o.scrollLeft(o.scrollLeft()-e),A()},n={},r=0,i={},s=null,u=!1;e(window).bind("touchstart"+T,function(e){u=!0}),e(window).bind("touchend"+T,function(e){u=!1}),o.bind("touchstart"+T,function(e){var t=e.originalEvent.targetTouches[0];n.pageX=t.pageX,n.pageY=t.pageY,r=(new Date).getTime(),s!==null&&clearInterval(s),e.stopPropagation()}),o.bind("touchmove"+T,function(e){if(!u&&e.originalEvent.targetTouches.length===1){var s=e.originalEvent.targetTouches[0],o={};o.pageX=s.pageX,o.pageY=s.pageY;var a=o.pageX-n.pageX,f=o.pageY-n.pageY;t(a,f),n=o;var l=(new Date).getTime(),c=l-r;c>0&&(i.x=a/c,i.y=f/c,r=l),e.preventDefault()}}),o.bind("touchend"+T,function(e){clearInterval(s),s=setInterval(function(){if(Math.abs(i.x)<.01&&Math.abs(i.y)<.01){clearInterval(s);return}t(i.x*30,i.y*30),i.x*=.8,i.y*=.8},10)})},j=function(){o.bind("scroll"+T,function(e){A()})},F=function(){o.unbind(T),e(window).unbind(T),e(document).unbind(T),o.data("perfect-scrollbar",null),o.data("perfect-scrollbar-update",null),o.data("perfect-scrollbar-destroy",null),f.remove(),l.remove(),u.remove(),a.remove(),f=l=p=d=v=m=g=y=b=w=E=S=null},I=function(t){o.addClass("ie").addClass("ie"+t);var n=function(){var t=function(){e(this).addClass("hover")},n=function(){e(this).removeClass("hover")};o.bind("mouseenter"+T,t).bind("mouseleave"+T,n),u.bind("mouseenter"+T,t).bind("mouseleave"+T,n),a.bind("mouseenter"+T,t).bind("mouseleave"+T,n),f.bind("mouseenter"+T,t).bind("mouseleave"+T,n),l.bind("mouseenter"+T,t).bind("mouseleave"+T,n)},r=function(){L=function(){f.css({left:y+o.scrollLeft(),bottom:b,width:g}),l.css({top:E+o.scrollTop(),right:S,height:w}),f.hide().show(),l.hide().show()}};t===6&&(n(),r())},q="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,R=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&e[1]==="msie"&&I(parseInt(e[2],10)),A(),j(),O(),M(),H(),q&&B(),o.mousewheel&&D(),s.useKeyboard&&P(),o.data("perfect-scrollbar",o),o.data("perfect-scrollbar-update",A),o.data("perfect-scrollbar-destroy",F)};return R(),o})}});if(Common===undefined)var Common={};define("common/main/lib/component/Scroller",["jmousewheel","perfectscrollbar","common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Scroller=function(){var e;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(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.options.el&&this.render()},render:function(){var e=this;return e.cmpEl=$(this.el),e.rendered||(e.cmpEl.perfectScrollbar(_.extend({},e.options)),e.rendered=!0,this.setAlwaysVisibleX(e.options.alwaysVisibleX),this.setAlwaysVisibleY(e.options.alwaysVisibleY)),this},remove:function(){this.destroy(),Backbone.View.prototype.remove.call(this)},update:function(t){var n=this.options;t?(this.destroy(),n=_.extend(this.options,t),this.cmpEl.perfectScrollbar(n)):this.cmpEl.perfectScrollbar("update"),this.setAlwaysVisibleX(n.alwaysVisibleX),this.setAlwaysVisibleY(n.alwaysVisibleY);var r=function(t){e=!0;var n=function(t){$(document).unbind("mouseup",n),_.delay(function(){e=!1},10)};$(document).mouseup(n)};$(".ps-scrollbar-x-rail, .ps-scrollbar-y-rail, .ps-scrollbar-x, .ps-scrollbar-y",this.cmpEl).off("mousedown",r).on("mousedown",r)},destroy:function(){this.cmpEl.perfectScrollbar("destroy")},scrollLeft:function(e){this.cmpEl.scrollLeft(e),this.update()},scrollTop:function(e){this.cmpEl.scrollTop(e),this.update()},getScrollTop:function(){return this.cmpEl.scrollTop()},getScrollLeft:function(){return this.cmpEl.scrollLeft()},setAlwaysVisibleX:function(e){e?($(this.el).find(".ps-scrollbar-x-rail").addClass("always-visible-x"),$(this.el).find(".ps-scrollbar-x").addClass("always-visible-x")):($(this.el).find(".ps-scrollbar-x-rail").removeClass("always-visible-x"),$(this.el).find(".ps-scrollbar-x").addClass("always-visible-x"))},setAlwaysVisibleY:function(e){e?($(this.el).find(".ps-scrollbar-y-rail").addClass("always-visible-y"),$(this.el).find(".ps-scrollbar-y").addClass("always-visible-y")):($(this.el).find(".ps-scrollbar-y-rail").removeClass("always-visible-y"),$(this.el).find(".ps-scrollbar-y").addClass("always-visible-y"))}}),{isMouseCapture:function(){return e}})}()});if(Common===undefined)var Common={};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 e=function(){var e=[],t={};return{register:function(n){t[n.id]=n,n.on("show:after",function(t){e.push(t)}).on("hide:after",function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)})},unregister:function(n){var r=e.indexOf(n);delete t[n.id],r>-1&&e.splice(r,1),n.off("show:after").off("hide:after")},hideAll:function(){return Common.NotificationCenter.trigger("menumanager:hideall"),e&&e.length>0?(_.each(e,function(e){e&&e.hide()}),!0):!1}}}();return _.extend(Common.UI.BaseView.extend({options:{cls:"",style:"",itemTemplate:null,items:[],menuAlign:"tl-bl",menuAlignEl:null,offset:[0,0],cyclic:!0},template:_.template([''].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var n=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(e){e instanceof Common.UI.MenuItem?n.items.push(e):n.items.push(new Common.UI.MenuItem(_.extend({tagName:"li",template:n.itemTemplate},e)))}),this.options.el&&this.render(),e.register(this)},remove:function(){e.unregister(this),Common.UI.BaseView.prototype.remove.call(this)},render:function(e){var t=this;this.trigger("render:before",this),this.cmpEl=$(this.el),e?(this.setElement(e,!1),t.rendered||(this.cmpEl=$(this.template({options:t.options})),e.append(this.cmpEl))):t.rendered||(this.cmpEl=this.template({options:t.options}),$(this.el).append(this.cmpEl));var n=this.cmpEl.parent(),r=n.attr("role")==="menu"?n:n.find("[role=menu]");return r&&(t.rendered||_.each(t.items||[],function(e){r.append(e.render().el),e.on("click",_.bind(t.onItemClick,t)),e.on("toggle",_.bind(t.onItemToggle,t))}),r.css({"max-height":t.options.maxHeight||"none",position:"fixed",right:"auto",left:-1e3,top:-1e3}),this.parentEl=r.parent(),this.parentEl.on("show.bs.dropdown",_.bind(t.onBeforeShowMenu,t)),this.parentEl.on("shown.bs.dropdown",_.bind(t.onAfterShowMenu,t)),this.parentEl.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),this.parentEl.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t)),this.parentEl.on("keydown.after.bs.dropdown",_.bind(t.onAfterKeydownMenu,t)),r.on("scroll",_.bind(t.onScroll,t)),r.hover(function(e){t.isOver=!0},function(e){t.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(e,t){var n=this,r=this.cmpEl;t instanceof Common.UI.MenuItem||(t=new Common.UI.MenuItem(_.extend({tagName:"li",template:n.itemTemplate},t))),e<0||e>=n.items.length?n.items.push(t):n.items.splice(e,0,t);if(this.rendered){var i=r.attr("role")==="menu"?r:r.find("[role=menu]");i&&(e<0?i.append(t.render().el):e===0?i.prepend(t.render().el):$("li:nth-child("+(e+1)+")",i).before(t.render().el),t.on("click",_.bind(n.onItemClick,n)),t.on("toggle",_.bind(n.onItemToggle,n)))}},doLayout:function(){if(this.options.maxHeight>0){if(!this.rendered){this.mustLayout=!0;return}var e=this,t=this.cmpEl,n=t.attr("role")==="menu"?t:t.find("[role=menu]");if(!n.is(":visible")){var r=[n.css("left"),n.css("top")];n.css({left:"-1000px",top:"-1000px",display:"block"})}var i=n.find("li");if(i.height()*i.length>this.options.maxHeight){var s='';n.prepend(s),s='',n.append(s),n.css({"box-shadow":"none","overflow-y":"hidden","padding-top":"18px"}),n.find("> li:last-of-type").css("margin-bottom",18);var o=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},u=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";o(n[0],u,_.bind(this.onMouseWheel,this)),n.find(".menu-scroll").on("click",_.bind(this.onScrollClick,this))}r&&n.css({display:"",left:r[0],top:r[1]})}},addItem:function(e){this.insertItem(-1,e)},removeItem:function(e){var t=this,n=t.items.indexOf(e);n>-1&&(t.items.splice(n,1),e.off("click").off("toggle"),e.remove())},removeItems:function(e,t){if(e>this.items.length-1)return;e+t>this.items.length&&(t=this.items.length-e);for(var n=e;n ul > .menu-scroll").length){var t=this.$el.find("li .checked")[0];if(t){var n=t.offsetTop-this.options.maxHeight/2;this.scrollMenu(n<0?0:n)}}},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault()},onAfterHideMenu:function(e,t){this.trigger("hide:after",this,e,t),Common.NotificationCenter.trigger("menu:hide",this,t)},onAfterKeydownMenu:function(e){if(e.keyCode==Common.UI.Keys.RETURN){var t=$(e.target).closest("li");t.length<=0&&(t=$(e.target).parent().find("li .dataview")),t.length>0&&t.click(),t.hasClass("dropdown-submenu")||Common.UI.Menu.Manager.hideAll(),$(e.currentTarget).closest("li").hasClass("dropdown-submenu")&&e.stopPropagation()}else e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?this.fromKeyDown=!0:e.keyCode==Common.UI.Keys.ESC},onScroll:function(e,t){if(this.fromKeyDown){var n=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]");n.find(".menu-scroll.top").css("top",n.scrollTop()+"px"),n.find(".menu-scroll.bottom").css("bottom",-n.scrollTop()+"px")}},onItemClick:function(e,t){e.menu||(this.isOver=!1);if(e.options.stopPropagation){t.stopPropagation();var n=this;_.delay(function(){n.$el.parent().parent().find("[data-toggle=dropdown]").focus()},10);return}this.trigger("item:click",this,e,t)},onItemToggle:function(e,t,n){this.trigger("item:toggle",this,e,t,n)},onScrollClick:function(e){return this.scrollMenu(/top/.test(e.currentTarget.className)),!1},onMouseWheel:function(e){this.scrollMenu((e.detail&&-e.detail||e.wheelDelta)>0)},scrollMenu:function(e){this.fromKeyDown=!1;var t=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]"),n=typeof e=="boolean"?t.scrollTop()+(e?-20:20):e;t.scrollTop(n),t.find(".menu-scroll.top").css("top",t.scrollTop()+"px"),t.find(".menu-scroll.bottom").css("bottom",-t.scrollTop()+"px")},setOffset:function(e,t){this.offset[0]=_.isUndefined(e)?this.offset[0]:e,this.offset[1]=_.isUndefined(t)?this.offset[1]:t,this.alignPosition()},getOffset:function(){return this.offset},alignPosition:function(){var e=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]"),t=this.menuAlignEl||e.parent(),n=this.menuAlign.match(/^([a-z]+)-([a-z]+)/),r=t.offset(),i=Common.Utils.innerWidth(),s=Common.Utils.innerHeight()-10,o=e.outerWidth(),u=e.outerHeight(),a=t.outerWidth(),f=t.outerHeight(),l={tl:[0,0],bl:[0,u],tr:[o,0],br:[o,u]},c={tl:[0,0],tr:[a,0],bl:[0,f],br:[a,f]},h=r.left-l[n[1]][0]+c[n[2]][0]+this.offset[0],p=r.top-l[n[1]][1]+c[n[2]][1]+this.offset[1];h+o>i&&(t.is("li.dropdown-submenu")?h=r.left-o+2:h=i-o),p+u>s&&(p=s-u),p<0&&(p=0),this.options.additionalAlign?this.options.additionalAlign.call(this,e,h,p):e.css({left:h,top:p})}}),{Manager:function(){return e}()})}()}),define("spreadsheeteditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/component/Menu"],function(e,t,n,r){"use strict";SSE.Views.DocumentHolder=n.View.extend(t.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var e=this;this.setApi=function(t){return e.api=t,e}},render:function(){return this.fireEvent("render:before",this),this.cmpEl=e(this.el),this.fireEvent("render:after",this),this},focus:function(){var e=this;t.defer(function(){e.cmpEl.focus()},50)},createDelayedElements:function(){var t=this;t.pmiCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),t.pmiSelectTable=new Common.UI.MenuItem({caption:t.txtSelect,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.selectRowText,value:Asc.c_oAscChangeSelectionFormatTable.row},{caption:this.selectColumnText,value:Asc.c_oAscChangeSelectionFormatTable.column},{caption:this.selectDataText,value:Asc.c_oAscChangeSelectionFormatTable.data},{caption:this.selectTableText,value:Asc.c_oAscChangeSelectionFormatTable.all}]})}),t.pmiInsertEntire=new Common.UI.MenuItem({caption:t.txtInsert}),t.pmiInsertCells=new Common.UI.MenuItem({caption:t.txtInsert,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtShiftRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:t.txtShiftDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:t.txtRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:t.txtColumn,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),t.pmiInsertTable=new Common.UI.MenuItem({caption:t.txtInsert,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.insertRowAboveText,value:Asc.c_oAscInsertOptions.InsertTableRowAbove},{caption:t.insertRowBelowText,value:Asc.c_oAscInsertOptions.InsertTableRowBelow},{caption:t.insertColumnLeftText,value:Asc.c_oAscInsertOptions.InsertTableColLeft},{caption:t.insertColumnRightText,value:Asc.c_oAscInsertOptions.InsertTableColRight}]})}),t.pmiDeleteEntire=new Common.UI.MenuItem({caption:t.txtDelete}),t.pmiDeleteCells=new Common.UI.MenuItem({caption:t.txtDelete,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtShiftLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:t.txtShiftUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:t.txtRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:t.txtColumn,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),t.pmiDeleteTable=new Common.UI.MenuItem({caption:t.txtDelete,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.deleteRowText,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:this.deleteColumnText,value:Asc.c_oAscDeleteOptions.DeleteColumns},{caption:this.deleteTableText,value:Asc.c_oAscDeleteOptions.DeleteTable}]})}),t.pmiClear=new Common.UI.MenuItem({caption:t.txtClear,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtClearAll,value:Asc.c_oAscCleanOptions.All},{caption:t.txtClearText,value:Asc.c_oAscCleanOptions.Text},{caption:t.txtClearFormat,value:Asc.c_oAscCleanOptions.Format},{caption:t.txtClearComments,value:Asc.c_oAscCleanOptions.Comments},{caption:t.txtClearHyper,value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),t.pmiSortCells=new Common.UI.MenuItem({caption:t.txtSort,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtAscending,value:Asc.c_oAscSortOptions.Ascending},{caption:t.txtDescending,value:Asc.c_oAscSortOptions.Descending},{caption:t.txtSortCellColor,value:Asc.c_oAscSortOptions.ByColorFill},{caption:t.txtSortFontColor,value:Asc.c_oAscSortOptions.ByColorFont}]})}),t.pmiFilterCells=new Common.UI.MenuItem({caption:t.txtFilter,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtFilterValue,value:0},{caption:t.txtFilterCellColor,value:1},{caption:t.txtFilterFontColor,value:2}]})}),t.pmiReapply=new Common.UI.MenuItem({caption:t.txtReapply}),t.pmiInsFunction=new Common.UI.MenuItem({caption:t.txtFormula}),t.menuAddHyperlink=new Common.UI.MenuItem({caption:t.txtInsHyperlink,inCell:!0}),t.menuEditHyperlink=new Common.UI.MenuItem({caption:t.editHyperlinkText,inCell:!0}),t.menuRemoveHyperlink=new Common.UI.MenuItem({caption:t.removeHyperlinkText}),t.menuHyperlink=new Common.UI.MenuItem({caption:t.txtInsHyperlink,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuEditHyperlink,t.menuRemoveHyperlink]})}),t.pmiRowHeight=new Common.UI.MenuItem({caption:t.txtRowHeight,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtAutoRowHeight,value:"auto-row-height"},{caption:t.txtCustomRowHeight,value:"row-height"}]})}),t.pmiColumnWidth=new Common.UI.MenuItem({caption:t.txtColumnWidth,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtAutoColumnWidth,value:"auto-column-width"},{caption:t.txtCustomColumnWidth,value:"column-width"}]})}),t.pmiEntireHide=new Common.UI.MenuItem({caption:t.txtHide}),t.pmiEntireShow=new Common.UI.MenuItem({caption:t.txtShow}),t.pmiAddComment=new Common.UI.MenuItem({id:"id-context-menu-item-add-comment",caption:t.txtAddComment}),t.pmiCellMenuSeparator=new Common.UI.MenuItem({caption:"--"}),t.pmiAddNamedRange=new Common.UI.MenuItem({id:"id-context-menu-item-add-named-range",caption:t.txtAddNamedRange}),t.pmiFreezePanes=new Common.UI.MenuItem({caption:t.textFreezePanes}),t.pmiEntriesList=new Common.UI.MenuItem({caption:t.textEntriesList}),t.pmiSparklines=new Common.UI.MenuItem({caption:t.txtSparklines,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtClearSparklines,value:Asc.c_oAscCleanOptions.Sparklines},{caption:t.txtClearSparklineGroups,value:Asc.c_oAscCleanOptions.SparklineGroups}]})}),t.ssMenu=new Common.UI.Menu({id:"id-context-menu-cell",items:[t.pmiCut,t.pmiCopy,t.pmiPaste,{caption:"--"},t.pmiSelectTable,t.pmiInsertEntire,t.pmiInsertCells,t.pmiInsertTable,t.pmiDeleteEntire,t.pmiDeleteCells,t.pmiDeleteTable,t.pmiClear,{caption:"--"},t.pmiSparklines,t.pmiSortCells,t.pmiFilterCells,t.pmiReapply,{caption:"--"},t.pmiAddComment,t.pmiCellMenuSeparator,t.pmiEntriesList,t.pmiAddNamedRange,t.pmiInsFunction,t.menuAddHyperlink,t.menuHyperlink,t.pmiRowHeight,t.pmiColumnWidth,t.pmiEntireHide,t.pmiEntireShow,t.pmiFreezePanes]}),t.mnuGroupImg=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"mnu-group",type:"group",value:"grouping"}),t.mnuUnGroupImg=new Common.UI.MenuItem({caption:this.txtUngroup,iconCls:"mnu-ungroup",type:"group",value:"ungrouping"}),t.mnuShapeSeparator=new Common.UI.MenuItem({caption:"--"}),t.mnuShapeAdvanced=new Common.UI.MenuItem({caption:t.advancedShapeText}),t.mnuImgAdvanced=new Common.UI.MenuItem({caption:t.advancedImgText}),t.mnuChartEdit=new Common.UI.MenuItem({caption:t.chartText}),t.pmiImgCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiImgCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiImgPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),this.imgMenu=new Common.UI.Menu({items:[t.pmiImgCut,t.pmiImgCopy,t.pmiImgPaste,{caption:"--"},{caption:this.textArrangeFront,iconCls:"mnu-arrange-front",type:"arrange",value:Asc.c_oAscDrawingLayerType.BringToFront},{caption:this.textArrangeBack,iconCls:"mnu-arrange-back",type:"arrange",value:Asc.c_oAscDrawingLayerType.SendToBack},{caption:this.textArrangeForward,iconCls:"mnu-arrange-forward",type:"arrange",value:Asc.c_oAscDrawingLayerType.BringForward},{caption:this.textArrangeBackward,iconCls:"mnu-arrange-backward",type:"arrange",value:Asc.c_oAscDrawingLayerType.SendBackward},{caption:"--"},t.mnuGroupImg,t.mnuUnGroupImg,t.mnuShapeSeparator,t.mnuChartEdit,t.mnuShapeAdvanced,t.mnuImgAdvanced]}),this.menuParagraphVAlign=new Common.UI.MenuItem({caption:this.vertAlignText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuParagraphTop=new Common.UI.MenuItem({caption:t.topCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Top}),t.menuParagraphCenter=new Common.UI.MenuItem({caption:t.centerCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Center}),this.menuParagraphBottom=new Common.UI.MenuItem({caption:t.bottomCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Bottom})]})}),t.menuParagraphDirection=new Common.UI.MenuItem({caption:t.directionText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuParagraphDirectH=new Common.UI.MenuItem({caption:t.directHText,iconCls:"mnu-direct-horiz",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}),t.menuParagraphDirect90=new Common.UI.MenuItem({caption:t.direct90Text,iconCls:"mnu-direct-rdown",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}),t.menuParagraphDirect270=new Common.UI.MenuItem({caption:t.direct270Text,iconCls:"mnu-direct-rup",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270})]})}),t.menuAddHyperlinkShape=new Common.UI.MenuItem({caption:t.txtInsHyperlink}),t.menuEditHyperlinkShape=new Common.UI.MenuItem({caption:t.editHyperlinkText}),t.menuRemoveHyperlinkShape=new Common.UI.MenuItem({caption:t.removeHyperlinkText}),t.menuHyperlinkShape=new Common.UI.MenuItem({caption:t.txtInsHyperlink,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuEditHyperlinkShape,t.menuRemoveHyperlinkShape]})}),this.pmiTextAdvanced=new Common.UI.MenuItem({caption:t.txtTextAdvanced}),t.pmiTextCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiTextCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiTextPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),this.textInShapeMenu=new Common.UI.Menu({items:[t.pmiTextCut,t.pmiTextCopy,t.pmiTextPaste,{caption:"--"},t.menuParagraphVAlign,t.menuParagraphDirection,t.menuAddHyperlinkShape,t.menuHyperlinkShape,{caption:"--"},t.pmiTextAdvanced]}),this.entriesMenu=(new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]})).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0})}),this.funcMenu=(new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]})).on("render:after",function(t){t.cmpEl.removeAttr("oo_editor_input").attr("oo_editor_keyboard",!0),this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}),t.fireEvent("createdelayedelements",[t])},setMenuItemCommentCaptionMode:function(e,t){this.pmiAddComment.setCaption(e?this.txtAddComment:t?this.txtEditComment:this.txtShowComment,!0)},txtSort:"Sort",txtAscending:"Ascending",txtDescending:"Descending",txtFormula:"Insert Function",txtInsHyperlink:"Hyperlink",txtCut:"Cut",txtCopy:"Copy",txtPaste:"Paste",txtInsert:"Insert",txtDelete:"Delete",txtClear:"Clear",txtClearAll:"All",txtClearText:"Text",txtClearFormat:"Format",txtClearHyper:"Hyperlink",txtClearComments:"Comments",txtShiftRight:"Shift cells right",txtShiftLeft:"Shift cells left",txtShiftUp:"Shift cells up",txtShiftDown:"Shift cells down",txtRow:"Entire Row",txtColumn:"Entire Column",txtColumnWidth:"Set Column Width",txtRowHeight:"Set Row Height",txtWidth:"Width",txtHide:"Hide",txtShow:"Show",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtArrange:"Arrange",txtAddComment:"Add Comment",txtEditComment:"Edit Comment",txtUngroup:"Ungroup",txtGroup:"Group",topCellText:"Align Top",centerCellText:"Align Center",bottomCellText:"Align Bottom",vertAlignText:"Vertical Alignment",txtTextAdvanced:"Text Advanced Settings",editHyperlinkText:"Edit Hyperlink",removeHyperlinkText:"Remove Hyperlink",editChartText:"Edit Data",advancedShapeText:"Shape Advanced Settings",chartText:"Chart Advanced Settings",directionText:"Text Direction",directHText:"Horizontal",direct90Text:"Rotate at 90°",direct270Text:"Rotate at 270°",txtAddNamedRange:"Define Name",textFreezePanes:"Freeze Panes",textUnFreezePanes:"Unfreeze Panes",txtSelect:"Select",selectRowText:"Row",selectColumnText:"Entire Column",selectDataText:"Column Data",selectTableText:"Table",insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteRowText:"Row",deleteColumnText:"Column",deleteTableText:"Table",txtFilter:"Filter",txtFilterValue:"Filter by Selected cell's value",txtFilterCellColor:"Filter by cell's color",txtFilterFontColor:"Filter by font color",txtReapply:"Reapply",txtSortCellColor:"Selected Cell Color on top",txtSortFontColor:"Selected Font Color on top",txtAutoColumnWidth:"Auto Fit Column Width",txtAutoRowHeight:"Auto Fit Row Height",txtCustomColumnWidth:"Custom Column Width",txtCustomRowHeight:"Custom Row Height",textEntriesList:"Select from drop-down list",txtSparklines:"Sparklines",txtClearSparklines:"Clear Selected Sparklines",txtClearSparklineGroups:"Clear Selected Sparkline Groups",txtShowComment:"Show Comment",advancedImgText:"Image Advanced Settings"},SSE.Views.DocumentHolder||{}))});if(Common===undefined)var Common={};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(['','','','",""].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.menuCls=t.options.menuCls,this.menuStyle=t.options.menuStyle,this.template=t.options.template||t.template,this.itemsTemplate=t.options.itemsTemplate,this.hint=t.options.hint,this.editable=t.options.editable,this.disabled=t.options.disabled,this.store=t.options.store||new Common.UI.ComboBoxStore,this.displayField=t.options.displayField,this.valueField=t.options.valueField,this.scrollAlwaysVisible=t.options.scrollAlwaysVisible,t.rendered=t.options.rendered||!1,this.lastValue=null,t.store.add(t.options.data),t.options.el&&t.render()},render:function(e){var t=this;if(!t.rendered){var n=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:n,scope:t})),this.itemsTemplate&&this.cmpEl.find("ul").append($(this.itemsTemplate({items:n,scope:t}))),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl)}else this.cmpEl=$(this.el);if(!t.rendered){var r=this.cmpEl;this._input=r.find("input"),this._button=r.find(".btn"),r.on("click","a",_.bind(this.itemClicked,this)),r.on("mousedown","a",_.bind(this.itemMouseDown,this)),this.editable?(r.on("change","input",_.bind(this.onInputChanged,this)),r.on("keydown","input",_.bind(this.onInputKeyDown,this)),r.on("focusin","input",_.bind(this.onInputFocusIn,this)),r.on("click",".form-control",_.bind(this.onEditableInputClick,this))):(r.on("click",".form-control",_.bind(this.onInputClick,this)),this._input.attr("readonly","readonly"),this._input.attr("data-can-copy",!1)),t.options.hint&&(r.attr("data-toggle","tooltip"),r.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"})),r.on("show.bs.dropdown",_.bind(t.onBeforeShowMenu,t)),r.on("shown.bs.dropdown",_.bind(t.onAfterShowMenu,t)),r.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),r.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t)),r.on("keydown.after.bs.dropdown",_.bind(t.onAfterKeydownMenu,t)),Common.NotificationCenter.on("menumanager:hideall",_.bind(t.closeMenu,t)),this.setDefaultSelection(),this.listenTo(this.store,"reset",this.onResetItems)}return t.rendered=!0,t.disabled&&t.setDisabled(t.disabled),this},setData:function(e){this.store.reset([]),this.store.add(e),this.setRawValue(""),this.onResetItems()},openMenu:function(e){var t=this;this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),_.delay(function(){t.cmpEl.addClass("open")},e||0)},closeMenu:function(){this.cmpEl.removeClass("open")},isMenuOpen:function(){return this.cmpEl.hasClass("open")},onBeforeShowMenu:function(e){this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),Common.NotificationCenter.trigger("menu:show"),this.trigger("show:before",this,e);if(this.options.hint){var t=this.cmpEl.data("bs.tooltip");t&&(t.dontShow===undefined&&(t.dontShow=!0),t.hide())}},onAfterShowMenu:function(e){var t=$(this.el).find("ul"),n=t.find("> li.selected");if(n.length){var r=n.position().top,i=n.height(),s=t.height();(r<0||r+i>s)&&t.scrollTop(t.scrollTop()+r+i-s/2)}this.scroller&&this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible}),this.trigger("show:after",this,e)},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault()},onAfterHideMenu:function(e,t){this.cmpEl.find(".dropdown-toggle").blur(),this.trigger("hide:after",this,e,t),Common.NotificationCenter.trigger("menu:hide",this,t)},onAfterKeydownMenu:function(e){if(e.keyCode==Common.UI.Keys.RETURN){$(e.target).click();var t=this;return this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur()),!1}if(e.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this.closeMenu(),this.onAfterHideMenu(e),!1},onInputKeyDown:function(e){var t=this;e.keyCode==Common.UI.Keys.ESC?(this.closeMenu(),this.onAfterHideMenu(e)):e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?(this.isMenuOpen()||this.openMenu(),_.delay(function(){t._skipInputChange=!0,t.cmpEl.find("ul li:first a").focus()},10)):e.keyCode==Common.UI.Keys.RETURN&&$(e.target).val()===t.lastValue?this._input.trigger("change",{reapply:!0}):t._skipInputChange=!1},onInputFocusIn:function(e){this.trigger("combo:focusin",this,e)},onInputChanged:function(e,t){if(t&&t.synthetic)return;if(this._skipInputChange){this._skipInputChange=!1;return}var n=$(e.target).val(),r={};if(this.lastValue===n&&(!t||!t.reapply)){t&&t.onkeydown&&this.trigger("combo:blur",this,e);return}r[this.valueField]=n,this.trigger("changed:before",this,r,e);if(e.isDefaultPrevented())return;var i;this._selectedItem=this.store.findWhere((i={},i[this.displayField]=n,i)),this._selectedItem&&(r=this._selectedItem.toJSON(),$(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")),this.trigger("changed:after",this,r,e)},onInputClick:function(e){this._button&&this._button.dropdown("toggle"),e.preventDefault(),e.stopPropagation()},onEditableInputClick:function(e){if(this.options.hint){var t=this.cmpEl.data("bs.tooltip");t&&(t.dontShow===undefined&&(t.dontShow=!0),t.hide())}this.isMenuOpen()&&e.which==1&&e.stopPropagation()},setDefaultSelection:function(){if(!this.rendered)return;var e=this._input.val(),t;e&&(this._selectedItem=this.store.findWhere((t={},t[this.displayField]=e,t)),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")))},setDisabled:function(e){this.disabled=e;if(!this.rendered)return;e?this._input.attr("disabled",!0):this._input.removeAttr("disabled"),this.cmpEl.toggleClass("disabled",e),this._button.toggleClass("disabled",e)},isDisabled:function(){return this.disabled},setRawValue:function(e){this.rendered&&(this._input.val(e).trigger("change",{synthetic:!0}),this.lastValue=e!==null&&e!==undefined?e.toString():e)},getRawValue:function(){return this.rendered?this._input.val():null},setValue:function(e,t){if(!this.rendered)return;var n;this._selectedItem=this.store.findWhere((n={},n[this.valueField]=e,n)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem?(this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")):this.setRawValue(t!==undefined?t:e)},getValue:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?this._selectedItem.get(this.valueField):this._input.val():null},getDisplayValue:function(e){return Common.Utils.String.htmlEncode(e[this.displayField])},getSelectedRecord:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?_.extend({},this._selectedItem.toJSON()):null:null},selectRecord:function(e){if(!this.rendered||!e)return;this._selectedItem=e,$(".selected",$(this.el)).removeClass("selected"),this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")},itemClicked:function(e){var t=$(e.target).closest("li");this._selectedItem=this.store.findWhere({id:t.attr("id")}),this._selectedItem&&(this.lastValue=this._selectedItem.get(this.displayField),this._input.val(this.lastValue).trigger("change",{synthetic:!0}),$(".selected",$(this.el)).removeClass("selected"),t.addClass("selected"),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),e.preventDefault()),this._isMouseDownMenu=!1},itemMouseDown:function(e){if(e.which!=1)return e.preventDefault(),e.stopPropagation(),!1;this._isMouseDownMenu=!0},onResetItems:function(){this.itemsTemplate?$(this.el).find("ul").html($(this.itemsTemplate({items:this.store.toJSON(),scope:this}))):$(this.el).find("ul").html(_.template(["<% _.each(items, function(item) { %>",'
  • <%= scope.getDisplayValue(item) %>
  • ',"<% }); %>"].join(""),{items:this.store.toJSON(),scope:this})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))}}}())}),function(e){var t=e.fn.tooltip;t.prototype=e.fn.tooltip.Constructor.prototype,e.extend(e.fn.tooltip.Constructor.DEFAULTS,{container:"body",delay:{show:500},arrow:!1});var n=function(e,t){this.init("tooltip",e,t)};n.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:n,init:function(){t.prototype.init.apply(this,arguments),this.options.placement=="cursor"&&/hover/.exec(this.options.trigger)&&this.$element.on("mousemove.tooltip",this.options.selector,e.proxy(this.mousemove,this)),this.options.zIndex&&this.tip().css("z-index",this.options.zIndex);var n=this;Common.NotificationCenter.on({"layout:changed":function(e){!n.options.hideonclick&&n.tip().is(":visible")&&n.hide()}})},mousemove:function(e){this.targetXY=[e.clientX*Common.Utils.zoom(),e.clientY*Common.Utils.zoom()]},leave:function(e){t.prototype.leave.apply(this,arguments),this.dontShow=undefined},show:function(n){if(this.hasContent()&&this.enabled&&!this.dontShow){if(!this.$element.is(":visible")&&this.$element.closest("[role=menu]").length>0)return;var r=this.tip(),i=typeof this.options.placement=="function"?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement;this.options.arrow===!1&&r.addClass("arrow-free"),this.options.cls&&r.addClass(this.options.cls);var s=/^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(i);if(!n&&!s[2].length)t.prototype.show.apply(this,arguments);else{var o=e.Event("show.bs.tooltip");this.$element.trigger(o);if(o.isDefaultPrevented())return;this.setContent(),this.options.animation&&r.addClass("fade"),r.detach().css({top:0,left:0,display:"block"}),this.options.container?r.appendTo(this.options.container):r.insertAfter(this.$element);if(typeof n=="object"){var u={top:n[1]+15,left:n[0]+18},a=Common.Utils.innerWidth();u.left+r.width()>a&&(u.left=a-r.width()-30),r.offset(u).addClass("in")}else{var f=this.getPosition(),l=r[0].offsetWidth,c=r[0].offsetHeight;switch(s[1]){case"bottom":u={top:f.top+f.height+10};break;case"top":u={top:f.top-c-10}}switch(s[2]){case"left":u.left=f.left,this.$element.outerWidth()<=18&&(u.left-=4);break;case"right":u.left=f.left+f.width-l,this.$element.outerWidth()<=18&&(u.left+=4)}this.applyPlacement(u,s[1]),this.moveArrow(),r.addClass(s[1]).addClass(s[0])}this.$element.trigger("shown.bs.tooltip")}var h=this;clearTimeout(h.timeout),h.timeout=setTimeout(function(){h.hoverState=="in"&&h.hide(),h.dontShow=!1},5e3)}},moveArrow:function(){var e=this.tip().find(".tooltip-arrow, .arrow"),t=10;switch(this.options.placement){case"top-left":case"bottom-left":e.css("left",t);break;case"top-right":case"bottom-right":e.css("right",t)}},enter:function(t){if(t.type!=="mouseenter")return;var n=e(t.target);if(n.is("[role=menu]")||n.parentsUntil(t.currentTarget,"[role=menu]").length&&t.target!==t.currentTarget||this.tip().is(":visible"))return;var r=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs.tooltip");clearTimeout(r.timeout),r.hoverState="in",!r.options.delay||!r.options.delay.show?r.show():r.timeout=setTimeout(function(){r.hoverState=="in"&&r.show(r.options.placement=="cursor"?r.targetXY:undefined)},r.options.delay.show)},replaceArrow:function(e,n,r){this.options.arrow===!1?this.arrow().hide():t.prototype.replaceArrow.apply(this,arguments)},getCalculatedOffset:function(e,n,r,i){var s=t.prototype.getCalculatedOffset.apply(this,arguments);if(this.options.offset>0||this.options.offset<0)switch(/(bottom|top)/.exec(e)[1]){case"bottom":s.top+=this.options.offset;break;case"top":s.top-=this.options.offset}return s}});var r=e.fn.tooltip;e.fn.tooltip=function(t){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s=typeof t=="object"&&t;i||r.data("bs.tooltip",i=new n(this,s)),typeof t=="string"&&i[t]()})},e.fn.tooltip.Constructor=n,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(window.jQuery),define("tip",function(){}),define("common/main/lib/component/Tooltip",["tip","backbone"],function(){"use strict";var e=function(e){this.$element=this.placement=undefined,this.init.call(this,e)};_.extend(e.prototype,Backbone.Events,{init:function(e){this.$element=e.owner instanceof Backbone.View?e.owner.$el:$(e.owner),this.placement=e.placement,this.$element.data("bs.tooltip")&&this.$element.removeData("bs.tooltip"),this.$element.tooltip({title:e.title,trigger:"manual",placement:e.placement,offset:e.offset,cls:e.cls,html:e.html,hideonclick:e.hideonclick});if(e.hideonclick){var t=this.$element.data("bs.tooltip");t&&t.tip().on("click",function(){t.hide()})}this.$element.on("shown.bs.tooltip",_.bind(this.onTipShown,this)),this.$element.on("hidden.bs.tooltip",_.bind(this.onTipHidden,this))},show:function(e){this.getBSTip().show(e)},hide:function(e){this.getBSTip().hide(e)},setTitle:function(e){var t=this.getBSTip();t&&(t.options.title=e)},updateTitle:function(){var e=this.getBSTip();e.$tip.find(".tooltip-inner")[e.options.html?"html":"text"](e.options.title)},getBSTip:function(){return this.$element.data("bs.tooltip")},onTipShown:function(){this.trigger("tooltip:show",this)},onTipHidden:function(){this.trigger("tooltip:hide",this)},isVisible:function(){return this.getBSTip().tip().is(":visible")}}),Common.UI=Common.UI||{},Common.UI.Tooltip=e});if(Common===undefined)var Common={};define("common/main/lib/component/InputField",["common/main/lib/component/BaseView","common/main/lib/component/Tooltip"],function(){"use strict";Common.UI.InputField=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",value:"",type:"text",name:"",validation:null,allowBlank:!0,placeHolder:"",blankError:null,spellcheck:!1,maskExp:"",validateOnChange:!1,validateOnBlur:!0,disabled:!1},template:_.template(['
    ',"",'',"
    "].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.value=t.options.value,this.type=t.options.type,this.name=t.options.name,this.validation=t.options.validation,this.allowBlank=t.options.allowBlank,this.placeHolder=t.options.placeHolder,this.template=t.options.template||t.template,this.editable=t.options.editable||!0,this.disabled=t.options.disabled,this.spellcheck=t.options.spellcheck,this.blankError=t.options.blankError||"This field is required",this.validateOnChange=t.options.validateOnChange,this.validateOnBlur=t.options.validateOnBlur,this.maxLength=t.options.maxLength,t.rendered=t.options.rendered||!1,t.options.el&&t.render()},render:function(e){var t=this;t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,value:this.value,type:this.type,name:this.name,placeHolder:this.placeHolder,spellcheck:this.spellcheck,scope:t})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));if(!t.rendered){var n=this.cmpEl;this._input=this.cmpEl.find("input").andSelf().filter("input"),this.editable&&(this._input.on("blur",_.bind(this.onInputChanged,this)),this._input.on("keypress",_.bind(this.onKeyPress,this)),this._input.on("keyup",_.bind(this.onKeyUp,this)),this.validateOnChange&&this._input.on("input",_.bind(this.onInputChanging,this)),this.maxLength&&this._input.attr("maxlength",this.maxLength)),this.setEditable(this.editable),this.disabled&&this.setDisabled(this.disabled);if(this._input.closest(".asc-window").length>0)var r=function(){var e=n.find(".input-error").data("bs.tooltip");e&&e.tip().remove(),Common.NotificationCenter.off({"modal:close":r})};Common.NotificationCenter.on({"modal:close":r})}return t.rendered=!0,this},_doChange:function(e,t){if(t&&t.synthetic)return;var n=$(e.target).val(),r=this.value;this.trigger("changed:before",this,n,r,e);if(e.isDefaultPrevented())return;this.value=n,this.validateOnBlur&&this.checkValidate(),this.trigger("changed:after",this,n,r,e)},onInputChanged:function(e,t){this._doChange(e,t)},onInputChanging:function(e,t){var n=$(e.target).val(),r=this.value;if(e.isDefaultPrevented())return;this.value=n,this.validateOnBlur&&this.checkValidate(),this.trigger("changing",this,n,r,e)},onKeyPress:function(e){this.trigger("keypress:before",this,e);if(e.isDefaultPrevented())return;if(e.keyCode===Common.UI.Keys.RETURN)this._doChange(e);else if(this.options.maskExp&&!_.isEmpty(this.options.maskExp.source)){var t=String.fromCharCode(e.which);!this.options.maskExp.test(t)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&(e.preventDefault(),e.stopPropagation())}this.trigger("keypress:after",this,e)},onKeyUp:function(e){this.trigger("keyup:before",this,e);if(e.isDefaultPrevented())return;this.trigger("keyup:after",this,e)},setEditable:function(e){var t=this._input;this.editable=e,e&&t?(t.removeAttr("readonly"),t.removeAttr("data-can-copy")):(t.attr("readonly","readonly"),t.attr("data-can-copy",!1))},isEditable:function(){return this.editable},setDisabled:function(e){this.disabled=e,$(this.el).toggleClass("disabled",e),e?this._input.attr("disabled",!0):this._input.removeAttr("disabled")},isDisabled:function(){return this.disabled},setValue:function(e){this.value=e,this.rendered&&this._input.val(e)},getValue:function(){return this.value},focus:function(){this._input.focus()},checkValidate:function(){var e=this,t=[];!e.allowBlank&&_.isEmpty(e.value)&&t.push(e.blankError);if(_.isFunction(e.validation)){var n=e.validation.call(e,e.value);n!==!0&&(t=_.flatten(t.concat(n)))}if(!_.isEmpty(t)){if(e.cmpEl.hasClass("error")){var r=e.cmpEl.find(".input-error").data("bs.tooltip");return r&&(r.options.title=t.join("\n"),r.setContent()),t}e.cmpEl.addClass("error");var i=e.cmpEl.find(".input-error"),s=i.closest(".asc-window"),r=i.data("bs.tooltip");return r&&r.tip().remove(),i.attr("data-toggle","tooltip"),i.removeData("bs.tooltip"),i.tooltip({title:t.join("\n"),placement:"cursor"}),s.length>0&&i.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),t}return e.cmpEl.removeClass("error"),!0},showError:function(e){var t=this;if(!_.isEmpty(e)){t.cmpEl.addClass("error");var n=t.cmpEl.find(".input-error"),r=n.closest(".asc-window"),i=n.data("bs.tooltip");i&&i.tip().remove(),n.attr("data-toggle","tooltip"),n.removeData("bs.tooltip"),n.tooltip({title:e.join("\n"),placement:"cursor"}),r.length>0&&n.data("bs.tooltip").tip().css("z-index",parseInt(r.css("z-index"))+10)}else t.cmpEl.removeClass("error")}}}())});if(Common===undefined)var Common={};define("spreadsheeteditor/main/app/view/HyperlinkSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/ComboBox","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";SSE.Views.HyperlinkSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 230px;",cls:"modal-dlg"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['
    ','
    ',"","
    ",'",'",'",'
    ',"","
    ",'','
    ',"","
    ",'',"
    ",'"].join(""),this.options.tpl=_.template(this.template,this.options),this.api=this.options.api,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild(),t=this;t.cmbLinkType=(new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-type"),cls:"input-group-nr",editable:!1,menuStyle:"min-width: 100%;",data:[{displayValue:this.textInternalLink,value:Asc.c_oAscHyperlinkType.RangeLink},{displayValue:this.textExternalLink,value:Asc.c_oAscHyperlinkType.WebLink}]})).on("selected",function(e,t){$("#id-dlg-hyperlink-external")[t.value==Asc.c_oAscHyperlinkType.WebLink?"show":"hide"](),$("#id-dlg-hyperlink-internal")[t.value!=Asc.c_oAscHyperlinkType.WebLink?"show":"hide"]()}),t.cmbLinkType.setValue(Asc.c_oAscHyperlinkType.WebLink),t.cmbSheets=new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-sheet"),cls:"input-group-nr",editable:!1,menuStyle:"min-width: 100%;max-height: 150px;"}),t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-hyperlink-url"),allowBlank:!1,blankError:t.txtEmpty,validateOnBlur:!1,style:"width: 100%;",validation:function(e){var n=t.api.asc_getUrlType($.trim(e));return t.isEmail=n==2,n>0?!0:t.txtNotUrl}}),t.inputRange=new Common.UI.InputField({el:$("#id-dlg-hyperlink-range"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnChange:!0,validateOnBlur:!1,validation:function(e){var n=/^[A-Z]+[1-9]\d*:[A-Z]+[1-9]\d*$/.test(e);return n||(n=/^[A-Z]+[1-9]\d*$/.test(e)),n?!0:t.textInvalidRange}}),t.inputDisplay=new Common.UI.InputField({el:$("#id-dlg-hyperlink-display"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}),t.inputTip=new Common.UI.InputField({el:$("#id-dlg-hyperlink-tip"),style:"width: 100%;",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 e=this;_.delay(function(){e.focusedInput&&e.focusedInput.focus()},500)},setSettings:function(e){if(e){var t=this;this.cmbSheets.setData(e.sheets),e.props?(this.cmbLinkType.setValue(e.props.asc_getType()),this.cmbLinkType.setDisabled(!e.allowInternal),e.props.asc_getType()==Asc.c_oAscHyperlinkType.RangeLink?($("#id-dlg-hyperlink-external").hide(),$("#id-dlg-hyperlink-internal").show(),this.cmbSheets.setValue(e.props.asc_getSheet()),this.inputRange.setValue(e.props.asc_getRange()),this.focusedInput=this.inputRange.cmpEl.find("input")):(this.inputUrl.setValue(e.props.asc_getHyperlinkUrl().replace(new RegExp(" ","g"),"%20")),this.focusedInput=this.inputUrl.cmpEl.find("input"),this.cmbSheets.setValue(e.currentSheet)),this.inputDisplay.setValue(e.isLock?this.textDefault:e.props.asc_getText()),this.inputTip.setValue(e.props.asc_getTooltip())):(this.cmbLinkType.setValue(Asc.c_oAscHyperlinkType.WebLink),this.cmbLinkType.setDisabled(!e.allowInternal),this.inputDisplay.setValue(e.isLock?this.textDefault:e.text),this.focusedInput=this.inputUrl.cmpEl.find("input"),this.cmbSheets.setValue(e.currentSheet)),this.inputDisplay.setDisabled(e.isLock)}},getSettings:function(){var e=new Asc.asc_CHyperlink,t="";e.asc_setType(this.cmbLinkType.getValue());if(this.cmbLinkType.getValue()==Asc.c_oAscHyperlinkType.RangeLink)e.asc_setSheet(this.cmbSheets.getValue()),e.asc_setRange(this.inputRange.getValue()),t=this.cmbSheets.getValue()+"!"+this.inputRange.getValue();else{var n=this.inputUrl.getValue().replace(/^\s+|\s+$/g,"");/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(n)||(n=(this.isEmail?"mailto:":"http://")+n),n=n.replace(new RegExp("%20","g")," "),e.asc_setHyperlinkUrl(n),t=n}return this.inputDisplay.isDisabled()?e.asc_setText(null):(_.isEmpty(this.inputDisplay.getValue())&&this.inputDisplay.setValue(t),e.asc_setText(this.inputDisplay.getValue())),e.asc_setTooltip(this.inputTip.getValue()),e},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onKeyPress:function(e){if(e.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(e){if(this.options.handler){if(e=="ok"){var t=this.cmbLinkType.getValue()===Asc.c_oAscHyperlinkType.WebLink?this.inputUrl.checkValidate():!0,n=this.cmbLinkType.getValue()===Asc.c_oAscHyperlinkType.RangeLink?this.inputRange.checkValidate():!0,r=this.inputDisplay.checkValidate();if(t!==!0){this.inputUrl.cmpEl.find("input").focus();return}if(n!==!0){this.inputRange.cmpEl.find("input").focus();return}if(r!==!0){this.inputDisplay.cmpEl.find("input").focus();return}}this.options.handler.call(this,this,e)}this.close()},textTitle:"Hyperlink Settings",textInternalLink:"Internal Data Range",textExternalLink:"Web Link",textEmptyLink:"Enter link here",textEmptyDesc:"Enter caption here",textEmptyTooltip:"Enter tooltip here",strSheet:"Sheet",strRange:"Range",textLinkType:"Link Type",strDisplay:"Display",textTipText:"Screen Tip Text",strLinkTo:"Link To",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",txtNotUrl:'This field should be a URL in the format "http://www.example.com"',cancelButtonText:"Cancel",textDefault:"Selected range"},SSE.Views.HyperlinkSettingsDialog||{}))}),define("text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    '}),define("common/main/lib/view/AdvancedSettingsWindow",["common/main/lib/component/Window"],function(){"use strict";Common.Views.AdvancedSettingsWindow=Common.UI.Window.extend(_.extend({initialize:function(e){var t={};_.extend(t,{height:200,header:!0,cls:"advanced-settings-dlg",toggleGroup:"advanced-settings-group",contentTemplate:"",items:[]},e),this.template=e.template||['
    ','",'
    ','
    '+t.contentTemplate+"
    ","
    ",'
    ','"].join(""),t.tpl=_.template(this.template,t),this.handler=t.handler,this.toggleGroup=t.toggleGroup,this.contentWidth=t.contentWidth,this.storageName=t.storageName,Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this)),this.btnsCategory=[],_.each(t.find(".btn-category"),function(t,n){var r=$(t),i=new Common.UI.Button({el:r,enableToggle:!0,toggleGroup:e.toggleGroup,allowDepress:!1,contentTarget:r.attr("content-target")});i.on("click",_.bind(e.onCategoryClick,e)),e.btnsCategory.push(i)});var n=t.find(".content-panel");n.width(this.contentWidth),t.width(t.find(".menu-panel").width()+n.outerWidth()+2),this.content_panels=t.find(".settings-panel"),this.btnsCategory.length>0&&this.btnsCategory[0].toggle(!0,!0)},setHeight:function(e){Common.UI.Window.prototype.setHeight.call(this,e);var t=this.getChild(),n=t.find(".body > .box");n.css("height",e-85)},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;if(this.handler&&this.handler.call(this,t,t=="ok"?this.getSettings():undefined))return;this.close()},onCategoryClick:function(e,t){this.content_panels.filter(".active").removeClass("active"),$("#"+e.options.contentTarget).addClass("active")},getSettings:function(){return},onPrimary:function(){if(this.handler&&this.handler.call(this,"ok",this.getSettings()))return;return this.close(),!1},setActiveCategory:function(e){if(this.btnsCategory.length<1)return;var t=this.btnsCategory[e>=0&&e
    ',initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);n.addClass("spinner"),n.on("mousedown",".spinner-up",_.bind(this.onMouseDown,this,!0)),n.on("mousedown",".spinner-down",_.bind(this.onMouseDown,this,!1)),n.on("mouseup",".spinner-up",_.bind(this.onMouseUp,this,!0)),n.on("mouseup",".spinner-down",_.bind(this.onMouseUp,this,!1)),n.on("mouseover",".spinner-up, .spinner-down",_.bind(this.onMouseOver,this)),n.on("mouseout",".spinner-up, .spinner-down",_.bind(this.onMouseOut,this)),n.on("keydown",".form-control",_.bind(this.onKeyDown,this)),n.on("keyup",".form-control",_.bind(this.onKeyUp,this)),n.on("blur",".form-control",_.bind(this.onBlur,this)),n.on("input",".form-control",_.bind(this.onInput,this)),this.options.allowDecimal||n.on("keypress",".form-control",_.bind(this.onKeyPress,this)),this.switches={count:1,enabled:!0,fromKeyDown:!1},this.options.speed==="medium"?this.switches.speed=300:this.options.speed==="fast"?this.switches.speed=100:this.switches.speed=500,this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.value!==undefined&&(this.value=this.options.value),this.setRawValue(this.value),this.options.width&&$(this.el).width(this.options.width),this.options.defaultValue===undefined&&(this.options.defaultValue=this.options.minValue),this.oldValue=this.options.minValue,this.lastValue=null},render:function(){var e=$(this.el);return e.html(this.template),this.$input=e.find(".form-control"),this.rendered=!0,this.options.tabindex!=undefined&&this.$input.attr("tabindex",this.options.tabindex),this},setDisabled:function(e){var t=$(this.el);e!==this.disabled&&(t.find("button").toggleClass("disabled",e),t.toggleClass("disabled",e),e?this.$input.attr({disabled:e}):this.$input.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},setDefaultUnit:function(e){if(this.options.defaultUnit!=e){var t=this.options.defaultUnit;this.options.defaultUnit=e,this.setMinValue(this._recalcUnits(this.options.minValue,t)),this.setMaxValue(this._recalcUnits(this.options.maxValue,t)),this.setValue(this._recalcUnits(this.getNumberValue(),t),!0)}},setMinValue:function(e){this.options.minValue=e},setMaxValue:function(e){this.options.maxValue=e},setStep:function(e){this.options.step=e},getNumberValue:function(){return this.options.allowAuto&&this.value==this.options.autoText?-1:parseFloat(this.value)},getUnitValue:function(){return this.options.defaultUnit},getValue:function(){return this.value},setRawValue:function(e){this.$input&&this.$input.val(e)},getRawValue:function(){return this.$input.val()},setValue:function(e,t){var n=!1;this._fromKeyDown=!1,this.lastValue=this.value;if(typeof e=="undefined"||e==="")this.value="";else if(this.options.allowAuto&&(Math.abs(parseFloat(e)+1)<1e-4||e==this.options.autoText))this.value=this.options.autoText;else{var r=this._add(parseFloat(e),0,this.options.allowDecimal?3:0);if(typeof e=="undefined"||isNaN(r))r=this.oldValue,n=!0;var i=this.options.defaultUnit;if(typeof e.match!="undefined"){var s=e.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i);null!==s&&s[0]!=="undefined"&&(i=s[0].toLowerCase())}this.options.defaultUnit!==i&&!n&&(r=this._recalcUnits(r,i)),r>this.options.maxValue&&(r=this.options.maxValue,n=!0),r<%= labelText %>'),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var n=this,r=$(this.el);this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.value!==undefined&&this.setValue(this.options.value,!0),this.$chk.on("click",t.bind(this.onItemCheck,this))},render:function(){var e=$(this.el);return e.html(this.template({labelText:this.options.labelText})),this.$chk=e.find("input[type=button]"),this.$label=e.find("label"),this.rendered=!0,this},setDisabled:function(e){e=e===!0,e!==this.disabled&&(this.$label.toggleClass("disabled",e),e?this.$chk.attr({disabled:e}):this.$chk.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},onItemCheck:function(e){this.disabled||(this.indeterminate?(this.indeterminate=!1,this.setValue(!1)):this.setValue(!this.checked))},setRawValue:function(e){this.checked=e===!0||e==="true"||e==="1"||e===1||e==="checked",this.indeterminate=e==="indeterminate",this.$chk.toggleClass("checked",this.checked),this.$chk.toggleClass("indeterminate",this.indeterminate),this.value=this.indeterminate?"indeterminate":this.checked?"checked":"unchecked"},setValue:function(e,t){this.rendered?(this.lastValue=this.value,this.setRawValue(e),t!==!0&&this.lastValue!==e&&this.trigger("change",this,this.value,this.lastValue)):this.options.value=e},getValue:function(){return this.value},isChecked:function(){return this.checked},setCaption:function(e){this.$label.find("span").text(e)}})});if(Common===undefined)var Common={};define("common/main/lib/component/RadioBox",["common/main/lib/component/BaseView","underscore"],function(e,t){"use strict";Common.UI.RadioBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,template:t.template(''),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var n=this,r=$(this.el);this.name=this.options.name||Common.UI.getId(),this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.checked!==undefined&&this.setValue(this.options.checked,!0),this.$radio.on("click",t.bind(this.onItemCheck,this))},render:function(){var e=$(this.el);return e.html(this.template({labelText:this.options.labelText,name:this.name})),this.$radio=e.find("input[type=button]"),this.rendered=!0,this},setDisabled:function(e){e!==this.disabled&&(this.$radio.toggleClass("disabled",e),e?this.$radio.attr({disabled:e}):this.$radio.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},onItemCheck:function(e){this.disabled||this.setValue(!0)},setRawValue:function(e){var e=e===!0||e==="true"||e==="1"||e===1;$("input[type=button][name="+this.name+"]").removeClass("checked"),this.$radio.toggleClass("checked",e)},setValue:function(e,t){if(this.rendered){var n=this.$radio.hasClass("checked");this.setRawValue(e),t!==!0&&n!==e&&this.trigger("change",this,this.$radio.hasClass("checked"))}else this.options.checked=e},getValue:function(){return this.$radio.hasClass("checked")}})});if(Common===undefined)var Common={};define("common/main/lib/component/DataView",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.DataViewGroupModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),caption:"",inline:!1,headername:undefined}}}),Common.UI.DataViewGroupStore=Backbone.Collection.extend({model:Common.UI.DataViewGroupModel}),Common.UI.DataViewModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),selected:!1,allowSelected:!0,value:null,disabled:!1}}}),Common.UI.DataViewStore=Backbone.Collection.extend({model:Common.UI.DataViewModel}),Common.UI.DataViewItem=Common.UI.BaseView.extend({options:{},template:_.template(['
    <%= value %>
    '].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.template=t.options.template||t.template,t.listenTo(t.model,"change",t.render),t.listenTo(t.model,"change:selected",t.onSelectChange),t.listenTo(t.model,"remove",t.remove)},render:function(){if(_.isUndefined(this.model.id))return this;var e=$(this.el);return e.html(this.template(this.model.toJSON())),e.addClass("item"),e.toggleClass("selected",this.model.get("selected")&&this.model.get("allowSelected")),e.off("click").on("click",_.bind(this.onClick,this)),e.off("dblclick").on("dblclick",_.bind(this.onDblClick,this)),e.off("contextmenu").on("contextmenu",_.bind(this.onContextMenu,this)),e.toggleClass("disabled",this.model.get("disabled")),_.isUndefined(this.model.get("cls"))||e.addClass(this.model.get("cls")),this.trigger("change",this,this.model),this},remove:function(){this.stopListening(this.model),this.trigger("remove",this,this.model),Common.UI.BaseView.prototype.remove.call(this)},onClick:function(e){if(this.model.get("disabled"))return!1;this.trigger("click",this,this.model,e)},onDblClick:function(e){if(this.model.get("disabled"))return!1;this.trigger("dblclick",this,this.model,e)},onContextMenu:function(e){this.trigger("contextmenu",this,this.model,e)},onSelectChange:function(e,t){this.trigger("select",this,e,t)}}),Common.UI.DataView=Common.UI.BaseView.extend({options:{multiSelect:!1,handleSelect:!0,enableKeyEvents:!0,keyMoveDirection:"both",restoreHeight:0,emptyText:"",listenStoreEvents:!0,allowScrollbar:!0,showLast:!0,useBSKeydown:!1},template:_.template(['
    ',"<% _.each(groups, function(group) { %>","<% if (group.headername !== undefined) { %>",'
    <%= group.headername %>
    ',"<% } %>",'
    ',"<% if (!_.isEmpty(group.caption)) { %>",'
    ',"<%= group.caption %>","
    ","<% } %>",'
    ',"
    ","
    ","<% }); %>","
    "].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.template=t.options.template||t.template,t.store=t.options.store||new Common.UI.DataViewStore,t.groups=t.options.groups||null,t.itemTemplate=t.options.itemTemplate||null,t.multiSelect=t.options.multiSelect,t.handleSelect=t.options.handleSelect,t.parentMenu=t.options.parentMenu,t.enableKeyEvents=t.options.enableKeyEvents,t.useBSKeydown=t.options.useBSKeydown,t.showLast=t.options.showLast,t.style=t.options.style||"",t.emptyText=t.options.emptyText||"",t.listenStoreEvents=t.options.listenStoreEvents!==undefined?t.options.listenStoreEvents:!0,t.allowScrollbar=t.options.allowScrollbar!==undefined?t.options.allowScrollbar:!0,t.rendered=!1,t.dataViewItems=[],t.options.keyMoveDirection=="vertical"?t.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN]:t.options.keyMoveDirection=="horizontal"?t.moveKeys=[Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT]:t.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN,Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT],t.options.el&&t.render()},render:function(e){var t=this;this.trigger("render:before",this),this.cmpEl=$(this.el),e?(this.setElement(e,!1),this.cmpEl=$(this.template({groups:t.groups?t.groups.toJSON():null,style:t.style})),e.html(this.cmpEl)):this.cmpEl.html(this.template({groups:t.groups?t.groups.toJSON():null,style:t.style})),this.rendered||(this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)),this.onResetItems(),this.parentMenu&&(this.cmpEl.closest("li").css("height","100%"),this.cmpEl.css("height","100%"),this.parentMenu.on("show:after",_.bind(this.alignPosition,this))),this.enableKeyEvents&&this.parentMenu&&this.handleSelect&&(t.showLast||this.parentMenu.on("show:before",function(e){t.deselectAll()}),this.parentMenu.on("show:after",function(e){t.showLast&&t.showLastSelected(),Common.NotificationCenter.trigger("dataview:focus"),_.delay(function(){e.cmpEl.find(".dataview").focus()},10)}).on("hide:after",function(){Common.NotificationCenter.trigger("dataview:blur")}))),_.isUndefined(this.scroller)&&this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10}));var n=this.cmpEl.closest(".asc-window");return n.length>0&&(this.tipZIndex=parseInt(n.css("z-index"))+10),this.rendered=!0,this.cmpEl.on("click",function(e){if(/dataview/.test(e.target.className))return!1}),this.trigger("render:after",this),this},setStore:function(e){e&&(this.stopListening(this.store),this.store=e,this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)))},selectRecord:function(e,t){if(!this.handleSelect)return;t&&this.suspendEvents(),this.multiSelect?e&&e.set({selected:!e.get("selected")}):(_.each(this.store.where({selected:!0}),function(e){e.set({selected:!1})}),e&&e.set({selected:!0})),t&&this.resumeEvents()},selectByIndex:function(e,t){this.store.length>0&&e>-1&&e0){var s=this.groups.findWhere({id:e.get("group")});s&&(i=i.find("#"+s.id+" "+".group-items-container"))}if(i){n&&n.at==0?i.prepend(r.render().el):i.append(r.render().el),i.find(".empty-text").remove(),this.dataViewItems.push(r);if(e.get("tip")){var o=$(r.el);o.attr("data-toggle","tooltip"),o.tooltip({title:e.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}this.listenTo(r,"change",this.onChangeItem),this.listenTo(r,"remove",this.onRemoveItem),this.listenTo(r,"click",this.onClickItem),this.listenTo(r,"dblclick",this.onDblClickItem),this.listenTo(r,"select",this.onSelectItem),this.listenTo(r,"contextmenu",this.onContextMenuItem),this.isSuspendEvents||this.trigger("item:add",this,r,e)}}},onResetItems:function(){_.each(this.dataViewItems,function(e){var t=e.$el.data("bs.tooltip");t&&t.tip().remove()},this),$(this.el).html(this.template({groups:this.groups?this.groups.toJSON():null,style:this.style})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.store.length<1&&this.emptyText.length>0&&$(this.el).find(".inner").andSelf().filter(".inner").append('
    '+this.emptyText+"
    "),_.each(this.dataViewItems,function(e){this.stopListening(e),e.stopListening(e.model)},this),this.dataViewItems=[],this.store.each(this.onAddItem,this),this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10})),this.attachKeyEvents(),this.lastSelectedRec=null,this._layoutParams=undefined},onChangeItem:function(e,t){this.isSuspendEvents||this.trigger("item:change",this,e,t)},onRemoveItem:function(e,t){this.stopListening(e),e.stopListening();if(this.store.length<1&&this.emptyText.length>0){var n=$(this.el).find(".inner").andSelf().filter(".inner");n.find(".empty-text").length<=0&&n.append('
    '+this.emptyText+"
    ")}for(var r=0;r=0&&this.dataViewItems.length>r?$(this.dataViewItems[r].el):t.find("#"+e.get("id"));if(i.length<=0)return;var s=i.offset().top;if(sn+t.height())this.scroller&&this.allowScrollbar?this.scroller.scrollTop(t.scrollTop()+s-n,0):t.scrollTop(t.scrollTop()+s-n)},onKeyDown:function(e,t){if(this.disabled)return;t===undefined&&(t=e);if(_.indexOf(this.moveKeys,t.keyCode)>-1||t.keyCode==Common.UI.Keys.RETURN){t.preventDefault(),t.stopPropagation();var n=this.getSelectedRec()[0];this.lastSelectedRec===null&&(this.lastSelectedRec=n);if(t.keyCode==Common.UI.Keys.RETURN)this.lastSelectedRec=null,this.selectedBeforeHideRec&&(n=this.selectedBeforeHideRec),this.trigger("item:click",this,this,n,e),this.trigger("item:select",this,this,n,e),this.trigger("entervalue",this,n,e),this.parentMenu&&this.parentMenu.hide();else{var r=_.indexOf(this.store.models,n);if(r<0)if(t.keyCode==Common.UI.Keys.LEFT){var i=$(e.target).closest(".dropdown-submenu.over");i.length>0?(i.removeClass("over"),i.find("> a").focus()):r=0}else r=0;else if(this.options.keyMoveDirection=="both"){this._layoutParams===undefined&&this.fillIndexesArray();var s=this.dataViewItems[r].topIdx,o=this.dataViewItems[r].leftIdx;r=undefined;if(t.keyCode==Common.UI.Keys.LEFT)while(r===undefined){o--;if(o<0){var i=$(e.target).closest(".dropdown-submenu.over");if(i.length>0){i.removeClass("over"),i.find("> a").focus();break}o=this._layoutParams.columns-1}r=this._layoutParams.itemsIndexes[s][o]}else if(t.keyCode==Common.UI.Keys.RIGHT)while(r===undefined)o++,o>this._layoutParams.columns-1&&(o=0),r=this._layoutParams.itemsIndexes[s][o];else if(t.keyCode==Common.UI.Keys.UP)while(r===undefined)s--,s<0&&(s=this._layoutParams.rows-1),r=this._layoutParams.itemsIndexes[s][o];else while(r===undefined)s++,s>this._layoutParams.rows-1&&(s=0),r=this._layoutParams.itemsIndexes[s][o]}else r=t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.LEFT?Math.max(0,r-1):Math.min(this.store.length-1,r+1);r!==undefined&&r>=0&&(n=this.store.at(r)),n&&(this._fromKeyDown=!0,this.selectRecord(n),this._fromKeyDown=!1,this.scrollToRecord(n))}}else this.trigger("item:keydown",this,n,e)},attachKeyEvents:function(){if(this.enableKeyEvents&&this.handleSelect){var e=$(this.el).find(".inner").andSelf().filter(".inner");e.addClass("canfocused"),e.attr("tabindex","0"),e.on(this.parentMenu&&this.useBSKeydown?"dataview:keydown":"keydown",_.bind(this.onKeyDown,this))}},showLastSelected:function(){if(this.lastSelectedRec)this.selectRecord(this.lastSelectedRec,!0),this.scrollToRecord(this.lastSelectedRec),this.lastSelectedRec=null;else{var e=this.getSelectedRec()[0];e&&this.scrollToRecord(e)}},setDisabled:function(e){this.disabled=e,$(this.el).find(".inner").andSelf().filter(".inner").toggleClass("disabled",e)},isDisabled:function(){return this.disabled},setEmptyText:function(e){this.emptyText=e},alignPosition:function(){var e=this.parentMenu.cmpEl.attr("role")==="menu"?this.parentMenu.cmpEl:this.parentMenu.cmpEl.find("[role=menu]"),t=$(this.el).find(".inner").andSelf().filter(".inner"),n=Common.Utils.innerHeight(),r=e.outerHeight(),i=parseInt(e.css("top"));r>n?(t.css("max-height",n-parseInt(e.css("padding-top"))-parseInt(e.css("padding-bottom"))-5+"px"),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40})):t.height()n&&e.css("top",0),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40}))},fillIndexesArray:function(){if(this.dataViewItems.length<=0)return;this._layoutParams={itemsIndexes:[],columns:0,rows:0};var e=$(this.dataViewItems[0].el),t=e.outerWidth()+parseInt(e.css("margin-left"))+parseInt(e.css("margin-right")),n=this.$el.offset().left,r=-1,i=0,s=0;for(var o=0;or&&(r=u,this._layoutParams.itemsIndexes.push([]),i=this._layoutParams.itemsIndexes.length-1),this._layoutParams.itemsIndexes[i][s]=o,this.dataViewItems[o].topIdx=i,this.dataViewItems[o].leftIdx=s,this._layoutParams.columns<%= value %>
    ')},template:_.template(['
    '].join("")),onResetItems:function(){this.innerEl=null,Common.UI.DataView.prototype.onResetItems.call(this)},onAddItem:function(e,t){var n=new Common.UI.DataViewItem({template:this.itemTemplate,model:e});this.innerEl||(this.innerEl=$(this.el).find(".inner"),this.innerEl.find(".empty-text").remove());if(n&&this.innerEl){if(this.options.simpleAddMode)this.innerEl.append(n.render().el);else{var r=_.indexOf(this.store.models,e),i=this.innerEl.find("> div");r>0?$(i.get(r-1)).after(n.render().el):i.length>0?$(i[r]).before(n.render().el):this.innerEl.append(n.render().el)}this.dataViewItems.push(n),this.listenTo(n,"change",this.onChangeItem),this.listenTo(n,"remove",this.onRemoveItem),this.listenTo(n,"click",this.onClickItem),this.listenTo(n,"dblclick",this.onDblClickItem),this.listenTo(n,"select",this.onSelectItem),this.isSuspendEvents||this.trigger("item:add",this,n,e)}}}}())}),define("spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(e){"use strict";SSE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:320,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"sse-para-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-paragraph-indents",panelCaption:this.strParagraphIndents},{panelId:"id-adv-paragraph-font",panelCaption:this.strParagraphFont},{panelId:"id-adv-paragraph-tabs",panelCaption:this.strTabs}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.spinners=[],this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.numFirstLine=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-first-line"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numFirstLine.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getInd()===null||this._changedProps.asc_getInd()===undefined)&&this._changedProps.asc_putInd(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().asc_putFirstLine(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numFirstLine),this.numIndentsLeft=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-left"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numIndentsLeft.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getInd()===null||this._changedProps.asc_getInd()===undefined)&&this._changedProps.asc_putInd(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().asc_putLeft(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numIndentsLeft),this.numIndentsRight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-right"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numIndentsRight.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getInd()===null||this._changedProps.asc_getInd()===undefined)&&this._changedProps.asc_putInd(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().asc_putRight(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.chStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-strike"),labelText:this.strStrike}),this.chStrike.on("change",_.bind(this.onStrikeChange,this)),this.chDoubleStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-double-strike"),labelText:this.strDoubleStrike}),this.chDoubleStrike.on("change",_.bind(this.onDoubleStrikeChange,this)),this.chSuperscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-superscript"),labelText:this.strSuperscript}),this.chSuperscript.on("change",_.bind(this.onSuperscriptChange,this)),this.chSubscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-subscript"),labelText:this.strSubscript}),this.chSubscript.on("change",_.bind(this.onSubscriptChange,this)),this.chSmallCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-small-caps"),labelText:this.strSmallCaps}),this.chSmallCaps.on("change",_.bind(this.onSmallCapsChange,this)),this.chAllCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-all-caps"),labelText:this.strAllCaps}),this.chAllCaps.on("change",_.bind(this.onAllCapsChange,this)),this.numSpacing=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing"),step:.01,width:100,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numSpacing.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()));if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},this)),this.spinners.push(this.numSpacing),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:180,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numTab),this.numDefaultTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-default-tab"),step:.1,width:107,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_putDefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()).toFixed(1)))},this)),this.spinners.push(this.numDefaultTab),this.tabList=new Common.UI.ListView({el:$("#paraadv-list-tabs"),emptyText:this.noTabs,store:new Common.UI.DataViewStore}),this.tabList.store.comparator=function(e){return e.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var t=function(){e._noApply||(e._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",t),this.listenTo(this.tabList.store,"remove",t),this.listenTo(this.tabList.store,"reset",t),this.radioLeft=new Common.UI.RadioBox({el:$("#paragraphadv-radio-left"),labelText:this.textTabLeft,name:"asc-radio-tab",checked:!0}),this.radioCenter=new Common.UI.RadioBox({el:$("#paragraphadv-radio-center"),labelText:this.textTabCenter,name:"asc-radio-tab"}),this.radioRight=new Common.UI.RadioBox({el:$("#paragraphadv-radio-right"),labelText:this.textTabRight,name:"asc-radio-tab"}),this.btnAddTab=new Common.UI.Button({el:$("#paraadv-button-add-tab")}),this.btnAddTab.on("click",_.bind(this.addTab,this)),this.btnRemoveTab=new Common.UI.Button({el:$("#paraadv-button-remove-tab")}),this.btnRemoveTab.on("click",_.bind(this.removeTab,this)),this.btnRemoveAll=new Common.UI.Button({el:$("#paraadv-button-remove-all")}),this.btnRemoveAll.on("click",_.bind(this.removeAllTabs,this)),this.on("show",function(e){e.getChild(".footer .primary").focus()}),this.afterRender()},getSettings:function(){return this._tabListChanged&&((this._changedProps.asc_getTabs()===null||this._changedProps.asc_getTabs()===undefined)&&this._changedProps.asc_putTabs(new Asc.asc_CParagraphTabs),this.tabList.store.each(function(e,t){var n=new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(e.get("tabPos")),e.get("tabAlign"));this._changedProps.asc_getTabs().add_Tab(n)},this)),{paragraphProps:this._changedProps}},_setDefaults:function(e){if(e){this._originalProps=new Asc.asc_CParagraphProperty(e),this.numFirstLine.setValue(e.asc_getInd()!==null&&e.asc_getInd().asc_getFirstLine()!==null?Common.Utils.Metric.fnRecalcFromMM(e.asc_getInd().asc_getFirstLine()):"",!0),this.numIndentsLeft.setValue(e.asc_getInd()!==null&&e.asc_getInd().asc_getLeft()!==null?Common.Utils.Metric.fnRecalcFromMM(e.asc_getInd().asc_getLeft()):"",!0),this.numIndentsRight.setValue(e.asc_getInd()!==null&&e.asc_getInd().asc_getRight()!==null?Common.Utils.Metric.fnRecalcFromMM(e.asc_getInd().asc_getRight()):"",!0),this._noApply=!0,this.chStrike.setValue(e.asc_getStrikeout()!==null&&e.asc_getStrikeout()!==undefined?e.asc_getStrikeout():"indeterminate",!0),this.chDoubleStrike.setValue(e.asc_getDStrikeout()!==null&&e.asc_getDStrikeout()!==undefined?e.asc_getDStrikeout():"indeterminate",!0),this.chSubscript.setValue(e.asc_getSubscript()!==null&&e.asc_getSubscript()!==undefined?e.asc_getSubscript():"indeterminate",!0),this.chSuperscript.setValue(e.asc_getSuperscript()!==null&&e.asc_getSuperscript()!==undefined?e.asc_getSuperscript():"indeterminate",!0),this.chSmallCaps.setValue(e.asc_getSmallCaps()!==null&&e.asc_getSmallCaps()!==undefined?e.asc_getSmallCaps():"indeterminate",!0),this.chAllCaps.setValue(e.asc_getAllCaps()!==null&&e.asc_getAllCaps()!==undefined?e.asc_getAllCaps():"indeterminate",!0),this.numSpacing.setValue(e.asc_getTextSpacing()!==null&&e.asc_getTextSpacing()!==undefined?Common.Utils.Metric.fnRecalcFromMM(e.asc_getTextSpacing()):"",!0),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(e.asc_getDefaultTab()!==null&&e.asc_getDefaultTab()!==undefined?Common.Utils.Metric.fnRecalcFromMM(parseFloat(e.asc_getDefaultTab().toFixed(1))):"",!0);var t=this.tabList.store,n=e.asc_getTabs();if(n){var r=[],i=n.asc_getCount();for(var s=0;s0){var r=this.tabList.store,i=_.indexOf(r.models,n[0]);r.remove(n[0]),i>r.length-1&&(i=r.length-1),r.length>0&&(this.tabList.selectByIndex(i),this.tabList.scrollToRecord(r.at(i)))}},removeAllTabs:function(e,t){this.tabList.store.reset()},onSelectTab:function(e,t,n){var r={},i=_.isFunction(n.toJSON);if(i){if(!n.get("selected"))return;r=n.toJSON()}else r=n;this.numTab.setValue(r.tabPos),r.tabAlign==1?this.radioLeft.setValue(!0):r.tabAlign==3?this.radioCenter.setValue(!0):this.radioRight.setValue(!0)},textTitle:"Paragraph - Advanced Settings",strIndentsFirstLine:"First line",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Placement",strParagraphFont:"Font",cancelButtonText:"Cancel",okButtonText:"Ok",textEffects:"Effects",textCharacterSpacing:"Character Spacing",strDoubleStrike:"Double strikethrough",strStrike:"Strikethrough",strSuperscript:"Superscript",strSubscript:"Subscript",strSmallCaps:"Small caps",strAllCaps:"All caps",strTabs:"Tab",textSet:"Specify",textRemove:"Remove",textRemoveAll:"Remove All",textTabLeft:"Left",textTabRight:"Right",textTabCenter:"Center",textAlign:"Alignment",textTabPosition:"Tab Position",textDefault:"Default Tab",noTabs:"The specified tabs will appear in this field"},SSE.Views.ParagraphSettingsAdvanced||{}))}),define("text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template",[],function(){return'
    \n
    \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n \n \n
    \n \n
    \n
    \n
    '}),define("spreadsheeteditor/main/app/view/ImageSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(e){"use strict";SSE.Views.ImageSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"image-adv-settings-group",properties:null,storageName:"sse-image-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.imageProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.inputAltTitle=(new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e){var t=e.asc_getTitle();this.inputAltTitle.setValue(t?t:""),t=e.asc_getDescription(),this.textareaAltDescription.val(t?t:""),this._changedProps=new Asc.asc_CImgProperty}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),{imageProps:this._changedProps}},textTitle:"Image - Advanced Settings",cancelButtonText:"Cancel",okButtonText:"Ok",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},SSE.Views.ImageSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/SetValueDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";SSE.Views.SetValueDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['
    ','
    ','
    ',"
    ",'"].join(""),this.options.tpl=_.template(this.template,this.options),this.startvalue=this.options.startvalue,this.maxvalue=this.options.maxvalue,this.defaultUnit=this.options.defaultUnit,this.step=this.options.step,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnSize=new Common.UI.MetricSpinner({el:$("#id-spin-set-value"),width:182,step:this.step,defaultUnit:this.defaultUnit,minValue:0,maxValue:this.maxvalue,value:this.startvalue!==null?this.startvalue+" "+this.defaultUnit:""});if(this.startvalue!==null){var e=this;setTimeout(function(){var t=e.spnSize.$input[0];document.selection?e.spnSize.$input.select():(t.selectionStart=0,t.selectionEnd=e.startvalue.toString().length)},10)}var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.spnSize.on("entervalue",_.bind(this.onPrimary,this)),this.spnSize.on("change",_.bind(this.onChange,this)),this.spnSize.$el.find("input").focus()},_handleInput:function(e){this.options.handler&&this.options.handler.call(this,this,e),this.close()},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onChange:function(){var e=this.spnSize.getNumberValue();e/=this.step,e=(e|e)*this.step,this.spnSize.setValue(e,!0)},getSettings:function(){return this.spnSize.getNumberValue()},onPrimary:function(){this._handleInput("ok")},cancelButtonText:"Cancel",okButtonText:"Ok",txtMinText:"The minimum value for this field is {0}",txtMaxText:"The maximum value for this field is {0}"},SSE.Views.SetValueDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ColorPaletteExt",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.ColorPaletteExt=Common.UI.BaseView.extend({options:{dynamiccolors:10,allowReselect:!0,cls:"",style:""},template:_.template(['
    ',"<% var me = this; %>","<% $(colors).each(function(num, item) { %>","<% if (me.isColor(item)) { %>",'
    ',' ',"
    ","<% } else if (me.isTransparent(item)) { %>",'
    ',' ',"
    ","<% } else if (me.isEffect(item)) { %>",'
    ',' ',"
    ","<% } %>","<% }); %>","
    "].join("")),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.id=this.options.id,this.cls=this.options.cls,this.style=this.options.style,this.colors=this.options.colors||[],this.value=this.options.value,this.options.el&&this.render(),this.options.value&&this.select(this.options.value,!0)},render:function(e){var t=this;return t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl),this.cmpEl.on("click",_.bind(this.handleClick,this))),t.rendered=!0,this},isColor:function(e){return typeof e=="string"&&/[0-9A-F]{6}/.test(e)},isTransparent:function(e){return typeof e=="string"&&e=="transparent"},isEffect:function(e){return typeof e=="object"&&e.effectId!==undefined},getColor:function(){return this.value},handleClick:function(e){var t=this,n=$(e.target).closest("div.palette-color-item"),r,i;if(n.length==0)return;if(n.hasClass("color-transparent"))$(t.el).find("div."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),t.value="transparent",t.trigger("select",t,"transparent");else{if(!/^[a-fA-F0-9]{6}$/.test(t.value)||_.indexOf(t.colors,t.value)<0)t.value=!1;$(t.el).find("div."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),r=n[0].className.match(t.colorRe)[1];if(n.hasClass("palette-color-effect")){var s=parseInt(n.attr("effectid"));r&&(t.value=r.toUpperCase(),t.trigger("select",t,{color:r,effectId:s}))}else/#?[a-fA-F0-9]{6}/.test(r)&&(r=/#?([a-fA-F0-9]{6})/.exec(r)[1].toUpperCase(),t.value=r,t.trigger("select",t,r))}},select:function(e,t){var n=$(this.el);n.find("div."+this.selectedCls).removeClass(this.selectedCls);if(!e)return;if(typeof e=="object"){var r;e.effectId!==undefined?(r=n.find('div[effectid="'+e.effectId+'"]').first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):e.effectValue!==undefined&&(r=n.find('div[effectvalue="'+e.effectValue+'"].color-'+e.color.toUpperCase()).first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else{/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),this.value=e);if(/^[a-fA-F0-9]{6}|transparent$/.test(e)&&_.indexOf(this.colors,e)>=0){_.indexOf(this.colors,this.value)<0&&(this.value=!1);if(e!=this.value||this.options.allowReselect)e=="transparent"?n.find("div.color-transparent").addClass(this.selectedCls):n.find("div.palette-color.color-"+e).first().addClass(this.selectedCls),this.value=e,t!==!0&&this.fireEvent("select",this,e)}else{var i=n.find("#"+e).first();i.length==0&&(i=n.find('div[color="'+e+'"]').first()),i.length>0&&(i.addClass(this.selectedCls),this.value=e.toUpperCase())}}},updateColors:function(e){if(e===undefined)return;this.colors=e,this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),$(this.el).html(this.cmpEl),this.cmpEl.on("click",_.bind(this.handleClick,this))},clearSelection:function(e){$(this.el).find("div."+this.selectedCls).removeClass(this.selectedCls),this.value=undefined}})}),define("spreadsheeteditor/main/app/view/AutoFilterDialog",["common/main/lib/component/Window","common/main/lib/component/ColorPaletteExt"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.DigitalFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t=this,n={};_.extend(n,{width:501,height:230,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:t.txtTitle,items:[]},e),this.template=e.template||['
    ','
    ','",'
    ','
    ','
    ',"
    ","
    ",'
    ','
    ',"
    ",'
    ','
    ','
    ',"
    ","
    ","
    ",'
    ','"].join(""),this.api=e.api,this.handler=e.handler,this.type=e.type||"number",n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this),this.conditions=[{value:Asc.c_oAscCustomAutoFilter.equals,displayValue:this.capCondition1},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,displayValue:this.capCondition2},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,displayValue:this.capCondition3},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,displayValue:this.capCondition4},{value:Asc.c_oAscCustomAutoFilter.isLessThan,displayValue:this.capCondition5},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,displayValue:this.capCondition6}],this.type=="text"&&(this.conditions=this.conditions.concat([{value:Asc.c_oAscCustomAutoFilter.beginsWith,displayValue:this.capCondition7},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,displayValue:this.capCondition8},{value:Asc.c_oAscCustomAutoFilter.endsWith,displayValue:this.capCondition9},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,displayValue:this.capCondition10},{value:Asc.c_oAscCustomAutoFilter.contains,displayValue:this.capCondition11},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,displayValue:this.capCondition12}])),this.cmbCondition1=new Common.UI.ComboBox({el:$("#id-search-begin-digital-combo",this.$window),menuStyle:"min-width: 225px;max-height: 135px;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1}),this.cmbCondition1.setValue(Asc.c_oAscCustomAutoFilter.equals),this.conditions.splice(0,0,{value:0,displayValue:this.textNoFilter}),this.cmbCondition2=new Common.UI.ComboBox({el:$("#id-search-end-digital-combo",this.$window),menuStyle:"min-width: 225px;max-height: 135px;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1}),this.cmbCondition2.setValue(0),this.rbAnd=new Common.UI.RadioBox({el:$("#id-and-radio",this.$window),labelText:this.capAnd,name:"asc-radio-filter-tab",checked:!0}),this.rbOr=new Common.UI.RadioBox({el:$("#id-or-radio",this.$window),labelText:this.capOr,name:"asc-radio-filter-tab"}),this.cmbValue1=new Common.UI.ComboBox({el:$("#id-sd-cell-search-begin",this.$window),cls:"input-group-nr",menuStyle:"min-width: 225px;max-height: 135px;",scrollAlwaysVisible:!0,data:[]}),this.cmbValue2=new Common.UI.ComboBox({el:$("#id-sd-cell-search-end",this.$window),cls:"input-group-nr",menuStyle:"min-width: 225px;max-height: 135px;",scrollAlwaysVisible:!0,data:[]});var e=function(e,t){var n=e.get("intval"),r=t.get("intval"),i=n!==undefined,s=r!==undefined;return i!==s?i?-1:1:(!i&&(n=e.get("value").toLowerCase())&&(r=t.get("value").toLowerCase()),n==r?0:r==""||n!==""&&n1?r[1].asc_getOperator()||0:0),this.cmbValue1.setValue(null===r[0].asc_getVal()?"":r[0].asc_getVal()),this.cmbValue2.setValue(r.length>1?null===r[1].asc_getVal()?"":r[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.rbOr&&this.rbAnd&&this.cmbCondition1&&this.cmbCondition2&&this.cmbValue1&&this.cmbValue2){var e=this.properties.asc_getFilterObj();e.asc_setFilter(new Asc.CustomFilters),e.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var t=e.asc_getFilter();t.asc_setCustomFilters(this.cmbCondition2.getValue()==0?[new Asc.CustomFilter]:[new Asc.CustomFilter,new Asc.CustomFilter]);var n=t.asc_getCustomFilters();t.asc_setAnd(this.rbAnd.getValue()),n[0].asc_setOperator(this.cmbCondition1.getValue()),n[0].asc_setVal(this.cmbValue1.getValue()),this.cmbCondition2.getValue()!==0&&(n[1].asc_setOperator(this.cmbCondition2.getValue()||undefined),n[1].asc_setVal(this.cmbValue2.getValue())),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},cancelButtonText:"Cancel",capAnd:"And",capCondition1:"equals",capCondition10:"does not end with",capCondition11:"contains",capCondition12:"does not contain",capCondition2:"does not equal",capCondition3:"is greater than",capCondition4:"is greater than or equal to",capCondition5:"is less than",capCondition6:"is less than or equal to",capCondition7:"begins with",capCondition8:"does not begin with",capCondition9:"ends with",capOr:"Or",textNoFilter:"no filter",textShowRows:"Show rows where",textUse1:"Use ? to present any single character",textUse2:"Use * to present any series of character",txtTitle:"Custom Filter"},SSE.Views.DigitalFilterDialog||{})),SSE.Views.Top10FilterDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t=this,n={};_.extend(n,{width:318,height:160,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:t.txtTitle,items:[]},e),this.template=e.template||['
    ','
    ','
    ','",'
    ',"
    ",'
    ','','
    ',"
    ",'
    ','','
    ',"
    ","
    ","
    ",'
    ','"].join(""),this.api=e.api,this.handler=e.handler,n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this),this.cmbType=new Common.UI.ComboBox({el:$("#id-top10-type-combo",this.$window),style:"width: 85px;",menuStyle:"min-width: 85px;",cls:"input-group-nr",data:[{value:!0,displayValue:this.txtTop},{value:!1,displayValue:this.txtBottom}],editable:!1}),this.cmbType.setValue(!0),this.cmbItem=new Common.UI.ComboBox({el:$("#id-top10-item-combo",this.$window),style:"width: 85px;",menuStyle:"min-width: 85px;",cls:"input-group-nr",data:[{value:!1,displayValue:this.txtItems},{value:!0,displayValue:this.txtPercent}],editable:!1}),this.cmbItem.setValue(!1),this.cmbItem.on("selected",_.bind(function(e,t){this.spnCount.setDefaultUnit(t.value?"%":"")},this)),this.spnCount=new Common.UI.MetricSpinner({el:$("#id-top10-count-spin"),step:1,width:85,defaultUnit:"",value:"10",maxValue:500,minValue:1}),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this);var e=this;_.defer(function(){e.spnCount&&e.spnCount.$input.focus()},500)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(e){e.currentTarget.attributes&&e.currentTarget.attributes.result&&("ok"===e.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(e){this.properties=e},loadDefaults:function(){if(this.properties){var e=this.properties.asc_getFilterObj();if(e.asc_getType()==Asc.c_oAscAutoFilterTypes.Top10){var t=e.asc_getFilter(),n=t.asc_getTop(),r=t.asc_getPercent();this.cmbType.setValue(n||n===null),this.cmbItem.setValue(r||r===null),this.spnCount.setDefaultUnit(r||r===null?"%":""),this.spnCount.setValue(t.asc_getVal())}}},save:function(){if(this.api&&this.properties){var e=this.properties.asc_getFilterObj();e.asc_setFilter(new Asc.Top10),e.asc_setType(Asc.c_oAscAutoFilterTypes.Top10);var t=e.asc_getFilter();t.asc_setTop(this.cmbType.getValue()),t.asc_setPercent(this.cmbItem.getValue()),t.asc_setVal(this.spnCount.getNumberValue()),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},cancelButtonText:"Cancel",okButtonText:"OK",txtTitle:"Top 10 AutoFilter",textType:"Show",txtTop:"Top",txtBottom:"Bottom",txtItems:"Item",txtPercent:"Percent"},SSE.Views.Top10FilterDialog||{})),SSE.Views.AutoFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t=this,n={};_.extend(n,{width:450,height:265,contentWidth:400,header:!1,cls:"filter-dlg",contentTemplate:"",title:t.txtTitle,modal:!1,animate:!1,items:[]},e),this.template=e.template||['
    ','
    ','
    ','','
    ','
    ',"
    ","
    ",'","
    ",'
    ','","
    "].join(""),this.api=e.api,this.handler=e.handler,this.throughIndexes=[],this.filteredIndexes=[],n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){var e=this;Common.UI.Window.prototype.render.call(this),this.$window.find(".btn").on("click",_.bind(this.onBtnClick,this)),this.btnOk=new Common.UI.Button({cls:"btn normal dlg-btn primary",caption:this.okButtonText,style:"margin-right:10px;",enableToggle:!1,allowDepress:!1}),this.btnOk&&(this.btnOk.render($("#id-apply-filter",this.$window)),this.btnOk.on("click",_.bind(this.onApplyFilter,this))),this.miSortLow2High=new Common.UI.MenuItem({caption:this.txtSortLow2High,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortLow2High.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),this.miSortHigh2Low=new Common.UI.MenuItem({caption:this.txtSortHigh2Low,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortHigh2Low.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),this.miSortCellColor=new Common.UI.MenuItem({caption:this.txtSortCellColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
    ')}]})}),this.miSortFontColor=new Common.UI.MenuItem({caption:this.txtSortFontColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
    ')}]})}),this.miNumFilter=new Common.UI.MenuItem({caption:this.txtNumFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10},{value:Asc.c_oAscDynamicAutoFilter.aboveAverage,caption:this.txtAboveAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:Asc.c_oAscDynamicAutoFilter.belowAverage,caption:this.txtBelowAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})});var t=this.miNumFilter.menu.items;for(var n=0;n
    ')}]})}),this.miFilterFontColor=new Common.UI.MenuItem({caption:this.txtFilterFontColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
    ')}]})}),this.miClear=new Common.UI.MenuItem({caption:this.txtClear,checkable:!1}),this.miClear.on("click",_.bind(this.onClear,this)),this.miReapply=new Common.UI.MenuItem({caption:this.txtReapply,checkable:!1}),this.miReapply.on("click",_.bind(this.onReapply,this)),this.filtersMenu=new Common.UI.Menu({items:[this.miSortLow2High,this.miSortHigh2Low,this.miSortCellColor,this.miSortFontColor,{caption:"--"},this.miNumFilter,this.miTextFilter,this.miFilterCellColor,this.miFilterFontColor,this.miClear,{caption:"--"},this.miReapply]});var r=this.$window.find("#menu-container-filters");this.filtersMenu.render(r),this.filtersMenu.cmpEl.attr({tabindex:"-1"}),this.mnuSortColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-cells-color"),colors:[]}),this.mnuSortColorCellsPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFill)),this.mnuSortColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-font-color"),colors:[]}),this.mnuSortColorFontPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFont)),this.mnuFilterColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-cells-color"),colors:[]}),this.mnuFilterColorCellsPicker.on("select",_.bind(this.onFilterColorSelect,this,!0)),this.mnuFilterColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-font-color"),colors:[]}),this.mnuFilterColorFontPicker.on("select",_.bind(this.onFilterColorSelect,this,!1)),this.input=(new Common.UI.InputField({el:$("#id-sd-cell-search",this.$window),allowBlank:!0,placeHolder:this.txtEmpty,validateOnChange:!0,validation:function(){return!0}})).on("changing",function(t,n){n.length?(n=n.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),e.filter=new RegExp(n,"ig")):e.filter=undefined,e.setupDataCells()}),this.cells=new Common.UI.DataViewStore,this.filterExcludeCells=new Common.UI.DataViewStore,this.cells&&(this.cellsList=new Common.UI.ListView({el:$("#id-dlg-filter-values",this.$window),store:this.cells,simpleAddMode:!0,template:_.template(['
    '].join("")),itemTemplate:_.template(["
    ",'",'
    <%= Common.Utils.String.htmlEncode(value) %>
    ',"
    "].join(""))}),this.cellsList.store.comparator=function(e,t){if("0"==e.get("groupid"))return-1;if("0"==t.get("groupid"))return 1;if("2"==e.get("groupid"))return-1;if("2"==t.get("groupid"))return 1;var n=e.get("intval"),r=t.get("intval"),i=n!==undefined,s=r!==undefined;return i!==s?i?-1:1:(!i&&(n=e.get("cellvalue").toLowerCase())&&(r=t.get("cellvalue").toLowerCase()),n==r?0:r==""||n!==""&&n1?a[1].asc_getOperator()||0:0,n=null===a[0].asc_getVal()?"":a[0].asc_getVal(),r=a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():""}if(e.value!==-1){var f=new Asc.CustomFilters;f.asc_setCustomFilters(e.value==-2?[new Asc.CustomFilter,new Asc.CustomFilter]:[new Asc.CustomFilter]);var l=f.asc_getCustomFilters();f.asc_setAnd(!0),l[0].asc_setOperator(e.value==-2?Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:e.value),e.value==-2?(l[0].asc_setVal(i==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&s==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo?n:""),l[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),l[1].asc_setVal(i==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&s==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo?r:"")):l[0].asc_setVal(e.value==i?n:""),t.asc_setFilter(f),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var c=this,h=(new SSE.Views.DigitalFilterDialog({api:this.api,type:"number"})).on({close:function(){c.close()}});this.close(),h.setSettings(this.configTo),h.show()},onTextFilterMenuClick:function(e,t){var n=this.configTo.asc_getFilterObj(),r="",i="",s=Asc.c_oAscCustomAutoFilter.equals,o=0,u=!0;if(n.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var a=n.asc_getFilter(),f=a.asc_getCustomFilters();u=a.asc_getAnd(),s=f[0].asc_getOperator(),o=f.length>1?f[1].asc_getOperator()||0:0,r=null===f[0].asc_getVal()?"":f[0].asc_getVal(),i=f.length>1?null===f[1].asc_getVal()?"":f[1].asc_getVal():""}if(t.value!==-1){var l=new Asc.CustomFilters;l.asc_setCustomFilters([new Asc.CustomFilter]);var c=l.asc_getCustomFilters();l.asc_setAnd(!0),c[0].asc_setOperator(t.value),c[0].asc_setVal(t.value==s?r:""),n.asc_setFilter(l),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var h=this,p=(new SSE.Views.DigitalFilterDialog({api:this.api,type:"text"})).on({close:function(){h.close()}});this.close(),p.setSettings(this.configTo),p.show()},onNumDynamicFilterItemClick:function(e){var t=this.configTo.asc_getFilterObj();t.asc_getType()!==Asc.c_oAscAutoFilterTypes.DynamicFilter&&(t.asc_setFilter(new Asc.DynamicFilter),t.asc_setType(Asc.c_oAscAutoFilterTypes.DynamicFilter)),t.asc_getFilter().asc_setType(e.value),this.api.asc_applyAutoFilter(this.configTo),this.close()},onTop10FilterItemClick:function(e,t){var n=this,r=(new SSE.Views.Top10FilterDialog({api:this.api})).on({close:function(){n.close()}});this.close(),r.setSettings(this.configTo),r.show()},onFilterColorSelect:function(e,t,n){var r=this.configTo.asc_getFilterObj();r.asc_getType()!==Asc.c_oAscAutoFilterTypes.ColorFilter&&(r.asc_setFilter(new Asc.ColorFilter),r.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter));var i=r.asc_getFilter();i.asc_setCellColor(e?null:!1),i.asc_setCColor(e&&n=="transparent"||!e&&n=="#000000"?null:Common.Utils.ThemeColor.getRgbColor(n)),this.api.asc_applyAutoFilter(this.configTo),this.close()},onSortColorSelect:function(e,t,n){if(this.api&&this.configTo){var r=e==Asc.c_oAscSortOptions.ByColorFill;this.api.asc_sortColFilter(e,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName(),r&&n=="transparent"||!r&&n=="#000000"?null:Common.Utils.ThemeColor.getRgbColor(n))}this.close()},onCellCheck:function(e,t,n){if(this.checkCellTrigerBlock)return;var r="",i="",s=!1,o=null,u=window.event?window.event:window._event;if(u){i=u.target.type,r=$(u.currentTarget).find(".list-item");if(r.length){o=r.get(0).getBoundingClientRect();var a=u.clientX*Common.Utils.zoom(),f=u.clientY*Common.Utils.zoom();o.left1&&(i[parseInt(e.get("throughIndex"))]=n))});else{t.set("check",n),i[parseInt(t.get("throughIndex"))]=n;var s=n;for(var o=0;o0;this.miSortFontColor.setVisible(f),this.miFilterFontColor.setVisible(f);if(f){var l=[];o.forEach(function(e,t){e?l.push(Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()).toLocaleUpperCase()):l.push("000000")}),this.mnuSortColorFontPicker.updateColors(l),this.mnuFilterColorFontPicker.updateColors(l),this.miFilterFontColor.setChecked(!1,!0),this.miSortFontColor.setChecked(u==Asc.c_oAscSortOptions.ByColorFont,!0),u==Asc.c_oAscSortOptions.ByColorFont&&this.mnuSortColorFontPicker.select(a?a:"000000",!0)}f=s&&s.length>0,this.miSortCellColor.setVisible(f),this.miFilterCellColor.setVisible(f);if(f){var l=[];s.forEach(function(e,t){e?l.push(Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()).toLocaleUpperCase()):l.push("transparent")}),this.mnuSortColorCellsPicker.updateColors(l),this.mnuFilterColorCellsPicker.updateColors(l),this.miFilterCellColor.setChecked(!1,!0),this.miSortCellColor.setChecked(u==Asc.c_oAscSortOptions.ByColorFill,!0),u==Asc.c_oAscSortOptions.ByColorFill&&this.mnuSortColorCellsPicker.select(a?a:"transparent",!0)}if(t){var c=e.asc_getFilter(),h=c.asc_getCustomFilters(),p=c.asc_getAnd(),d=h[0].asc_getOperator(),v=h.length>1?h[1].asc_getOperator()||0:0,m=i?this.miTextFilter.menu.items:this.miNumFilter.menu.items,g=!0;h.length==1?m.forEach(function(e){var t=e.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters&&e.value==d;e.setChecked(t,!0),t&&(g=!1)}):!i&&(d==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&v==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo||d==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo&&v==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo)&&(m[6].setChecked(!0,!0),g=!1),g&&m[m.length-1].setChecked(!0,!0)}else if(this.initialFilterType===Asc.c_oAscAutoFilterTypes.ColorFilter){var y=e.asc_getFilter(),b=y.asc_getCColor();b&&(b=Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b()).toLocaleUpperCase()),y.asc_getCellColor()===null?(this.miFilterCellColor.setChecked(!0,!0),this.mnuFilterColorCellsPicker.select(b?b:"transparent",!0)):y.asc_getCellColor()===!1&&(this.miFilterFontColor.setChecked(!0,!0),this.mnuFilterColorFontPicker.select(b?b:"000000",!0))}else if(n||r){var w=n?e.asc_getFilter().asc_getType():null,m=this.miNumFilter.menu.items;m.forEach(function(e){e.setChecked(n&&e.options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter&&e.value==w||r&&e.options.type==Asc.c_oAscAutoFilterTypes.Top10,!0)})}this.miClear.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.miReapply.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.btnOk.setDisabled(this.initialFilterType!==Asc.c_oAscAutoFilterTypes.Filters&&this.initialFilterType!==Asc.c_oAscAutoFilterTypes.None)},setupDataCells:function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}var t=this,n,r,i=0,s=2,o=!0,u=!1,a=0,f=[],l=[],c=t.filter?t.filteredIndexes:t.throughIndexes;this.configTo.asc_getValues().forEach(function(u){r=u.asc_getText(),n=e(r),o=!0,t.filter?(null===r.match(t.filter)&&(o=!1),c[s]=o):c[s]==undefined&&(c[s]=u.asc_getVisible()),o?(f.push(new Common.UI.DataViewModel({id:++i,selected:!1,allowSelected:!0,cellvalue:r,value:n?r:r.length>0?r:t.textEmptyItem,intval:n?parseFloat(r):undefined,strval:n?"":r,groupid:"1",check:c[s],throughIndex:s})),c[s]&&a++):l.push(new Common.UI.DataViewModel({cellvalue:r})),++s}),a==f.length?u=!0:a>0&&(u="indeterminate");if(t.filter||c[0]==undefined)c[0]=!0;(!t.filter||f.length>0)&&f.unshift(new Common.UI.DataViewModel({id:++i,selected:!1,allowSelected:!0,value:t.filter?this.textSelectAllResults:this.textSelectAll,groupid:"0",check:c[0],throughIndex:0})),t.filter&&f.length>1&&(c[1]==undefined&&(c[1]=!1),f.splice(1,0,new Common.UI.DataViewModel({id:++i,selected:!1,allowSelected:!0,value:this.textAddSelection,groupid:"2",check:c[1],throughIndex:1}))),this.cells.reset(f),this.filterExcludeCells.reset(l),this.cells.length&&(this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",u),this.checkCellTrigerBlock=undefined),this.btnOk.setDisabled(this.cells.length<1),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})},testFilter:function(){var e=this,t=!1;return this.cells&&(this.filter&&this.filteredIndexes[1]?t=!0:this.cells.forEach(function(e){if("1"==e.get("groupid")&&e.get("check"))return t=!0,!0})),t||(e._skipCheckDocumentClick=!0,Common.UI.warning({title:this.textWarning,msg:this.warnNoSelected,callback:function(){e._skipCheckDocumentClick=!1,_.delay(function(){e.input.$el.find("input").focus()},100,this)}})),t},save:function(){if(this.api&&this.configTo&&this.cells&&this.filterExcludeCells){var e=this.configTo.asc_getValues(),t=!1;if(this.filter&&this.filteredIndexes[1])this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters&&e.forEach(function(e,t){e.asc_setVisible(!0)}),this.cells.each(function(t){"1"==t.get("groupid")&&e[parseInt(t.get("throughIndex"))-2].asc_setVisible(t.get("check"))}),e.forEach(function(e,n){if(e.asc_getVisible())return t=!0,!0});else{var n=this.filter?this.filteredIndexes:this.throughIndexes;e.forEach(function(e,t){e.asc_setVisible(n[t+2])}),t=!0}t&&(this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),this.api.asc_applyAutoFilter(this.configTo))}},onPrimary:function(){return this.save(),this.close(),!1},okButtonText:"Ok",btnCustomFilter:"Custom Filter",textSelectAll:"Select All",txtTitle:"Filter",warnNoSelected:"You must choose at least one value",textWarning:"Warning",cancelButtonText:"Cancel",textEmptyItem:"{Blanks}",txtEmpty:"Enter cell's filter",txtSortLow2High:"Sort Lowest to Highest",txtSortHigh2Low:"Sort Highest to Lowest",txtSortCellColor:"Sort by cells color",txtSortFontColor:"Sort by font color",txtNumFilter:"Number filter",txtTextFilter:"Text filter",txtFilterCellColor:"Filter by cells color",txtFilterFontColor:"Filter by font color",txtClear:"Clear",txtReapply:"Reapply",txtEquals:"Equals...",txtNotEquals:"Does not equal...",txtGreater:"Greater than...",txtGreaterEquals:"Greater than or equal to...",txtLess:"Less than...",txtLessEquals:"Less than or equal to...",txtBetween:"Between...",txtTop10:"Top 10",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with...",txtNotBegins:"Does not begin with...",txtEnds:"Ends with...",txtNotEnds:"Does not end with...",txtContains:"Contains...",txtNotContains:"Does not contain...",textSelectAllResults:"Select All Search Results",textAddSelection:"Add current selection to filter"},SSE.Views.AutoFilterDialog||{}))}),define("spreadsheeteditor/main/app/controller/DocumentHolder",["core","common/main/lib/util/utils","common/main/lib/view/CopyWarningDialog","spreadsheeteditor/main/app/view/DocumentHolder","spreadsheeteditor/main/app/view/HyperlinkSettingsDialog","spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced","spreadsheeteditor/main/app/view/ImageSettingsAdvanced","spreadsheeteditor/main/app/view/SetValueDialog","spreadsheeteditor/main/app/view/AutoFilterDialog"],function(){"use strict";SSE.Controllers.DocumentHolder=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["DocumentHolder"],initialize:function(){var e=this;e.tooltips={hyperlink:{},comment:{},coauth:{ttHeight:20},row_column:{ttHeight:20}},e.mouse={},e.popupmenu=!1,e.rangeSelectionMode=!1,e.namedrange_locked=!1,e._currentMathObj=undefined,e._currentParaObjDisabled=!1,this.wrapEvents={apiHideComment:_.bind(this.onApiHideComment,this)},this.addListeners({DocumentHolder:{createdelayedelements:this.onCreateDelayedElements}});var t={};this.hkComments="alt+h",t[this.hkComments]=function(){e.onAddComment()},Common.util.Shortcuts.delegateShortcuts({shortcuts:t})},onLaunch:function(){var e=this;e.documentHolder=this.createView("DocumentHolder"),e.documentHolder.render(),e.documentHolder.el.tabIndex=-1,$(document).on("mousewheel",_.bind(e.onDocumentWheel,e)),$(document).on("mousedown",_.bind(e.onDocumentRightDown,e)),$(document).on("mouseup",_.bind(e.onDocumentRightUp,e)),$(document).on("keydown",_.bind(e.onDocumentKeyDown,e)),$(window).on("resize",_.bind(e.onDocumentResize,e));var t=SSE.getController("Viewport").getView("Viewport");t.hlayout.on("layout:resizedrag",_.bind(e.onDocumentResize,e)),Common.NotificationCenter.on({"window:show":function(t){e.hideHyperlinkTip()},"modal:show":function(t){e.hideCoAuthTips()},"layout:changed":function(t){e.hideHyperlinkTip(),e.hideCoAuthTips(),e.onDocumentResize()},"cells:range":function(t){e.onCellsRange(t)}})},onCreateDelayedElements:function(e){var t=this;e.pmiCut.on("click",_.bind(t.onCopyPaste,t)),e.pmiCopy.on("click",_.bind(t.onCopyPaste,t)),e.pmiPaste.on("click",_.bind(t.onCopyPaste,t)),e.pmiImgCut.on("click",_.bind(t.onCopyPaste,t)),e.pmiImgCopy.on("click",_.bind(t.onCopyPaste,t)),e.pmiImgPaste.on("click",_.bind(t.onCopyPaste,t)),e.pmiTextCut.on("click",_.bind(t.onCopyPaste,t)),e.pmiTextCopy.on("click",_.bind(t.onCopyPaste,t)),e.pmiTextPaste.on("click",_.bind(t.onCopyPaste,t)),e.pmiInsertEntire.on("click",_.bind(t.onInsertEntire,t)),e.pmiDeleteEntire.on("click",_.bind(t.onDeleteEntire,t)),e.pmiInsertCells.menu.on("item:click",_.bind(t.onInsertCells,t)),e.pmiDeleteCells.menu.on("item:click",_.bind(t.onDeleteCells,t)),e.pmiSparklines.menu.on("item:click",_.bind(t.onClear,t)),e.pmiSortCells.menu.on("item:click",_.bind(t.onSortCells,t)),e.pmiFilterCells.menu.on("item:click",_.bind(t.onFilterCells,t)),e.pmiReapply.on("click",_.bind(t.onReapply,t)),e.pmiClear.menu.on("item:click",_.bind(t.onClear,t)),e.pmiSelectTable.menu.on("item:click",_.bind(t.onSelectTable,t)),e.pmiInsertTable.menu.on("item:click",_.bind(t.onInsertTable,t)),e.pmiDeleteTable.menu.on("item:click",_.bind(t.onDeleteTable,t)),e.pmiInsFunction.on("click",_.bind(t.onInsFunction,t)),e.menuAddHyperlink.on("click",_.bind(t.onInsHyperlink,t)),e.menuEditHyperlink.on("click",_.bind(t.onInsHyperlink,t)),e.menuRemoveHyperlink.on("click",_.bind(t.onDelHyperlink,t)),e.pmiRowHeight.menu.on("item:click",_.bind(t.onSetSize,t)),e.pmiColumnWidth.menu.on("item:click",_.bind(t.onSetSize,t)),e.pmiEntireHide.on("click",_.bind(t.onEntireHide,t)),e.pmiEntireShow.on("click",_.bind(t.onEntireShow,t)),e.pmiFreezePanes.on("click",_.bind(t.onFreezePanes,t)),e.pmiEntriesList.on("click",_.bind(t.onEntriesList,t)),e.pmiAddComment.on("click",_.bind(t.onAddComment,t)),e.pmiAddNamedRange.on("click",_.bind(t.onAddNamedRange,t)),e.imgMenu.on("item:click",_.bind(t.onImgMenu,t)),e.menuParagraphVAlign.menu.on("item:click",_.bind(t.onParagraphVAlign,t)),e.menuParagraphDirection.menu.on("item:click",_.bind(t.onParagraphDirection,t)),e.menuAddHyperlinkShape.on("click",_.bind(t.onInsHyperlink,t)),e.menuEditHyperlinkShape.on("click",_.bind(t.onInsHyperlink,t)),e.menuRemoveHyperlinkShape.on("click",_.bind(t.onRemoveHyperlinkShape,t)),e.pmiTextAdvanced.on("click",_.bind(t.onTextAdvanced,t)),e.mnuShapeAdvanced.on("click",_.bind(t.onShapeAdvanced,t)),e.mnuChartEdit.on("click",_.bind(t.onChartEdit,t)),e.mnuImgAdvanced.on("click",_.bind(t.onImgAdvanced,t));var n=e.cmpEl;if(n){n.on({keydown:function(e){e.keyCode==e.F10&&e.shiftKey&&(e.stopEvent(),t.showObjectMenu(e))},mousedown:function(e){e.target.localName=="canvas"&&e.button!=2&&Common.UI.Menu.Manager.hideAll()},click:function(e){t.api&&(t.api.isTextAreaBlur=!1,e.target.localName=="canvas"&&!t.isEditFormula&&n.focus())}});var r=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},i=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";r(e.el,i,_.bind(this.onDocumentWheel,this)),t.cellEditor=$("#ce-cell-content")}},loadConfig:function(e){this.editorConfig=e.config},setMode:function(e){this.permissions=e,this.permissions.canCoAuthoring&&this.permissions.isEdit&&this.permissions.canComments?Common.util.Shortcuts.resumeEvents(this.hkComments):Common.util.Shortcuts.suspendEvents(this.hkComments)},setApi:function(e){return this.api=e,this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onApiContextMenu,this)),this.api.asc_registerCallback("asc_onMouseMove",_.bind(this.onApiMouseMove,this)),this.api.asc_registerCallback("asc_onHideComment",this.wrapEvents.apiHideComment),this.api.asc_registerCallback("asc_onHyperlinkClick",_.bind(this.onApiHyperlinkClick,this)),this.api.asc_registerCallback("asc_onSetAFDialog",_.bind(this.onApiAutofilter,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),this.api.asc_registerCallback("asc_onEntriesListMenu",_.bind(this.onEntriesListMenu,this)),this.api.asc_registerCallback("asc_onFormulaCompleteMenu",_.bind(this.onFormulaCompleteMenu,this)),this.api.asc_registerCallback("asc_onShowSpecialPasteOptions",_.bind(this.onShowSpecialPasteOptions,this)),this.api.asc_registerCallback("asc_onHideSpecialPasteOptions",_.bind(this.onHideSpecialPasteOptions,this)),this},resetApi:function(e){this.api.asc_unregisterCallback("asc_onHideComment",this.wrapEvents.apiHideComment),this.api.asc_registerCallback("asc_onHideComment",this.wrapEvents.apiHideComment)},onCopyPaste:function(e){var t=this;if(t.api){var n=e.value=="cut"?t.api.asc_Cut():e.value=="copy"?t.api.asc_Copy():t.api.asc_Paste();if(!n){var r=Common.localStorage.getItem("sse-hide-copywarning");(!r||parseInt(r)!=1)&&(new Common.Views.CopyWarningDialog({handler:function(e){e&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",t.documentHolder)}})).show()}else Common.component.Analytics.trackEvent("ToolBar","Copy Warning")}Common.NotificationCenter.trigger("edit:complete",t.documentHolder)},onInsertEntire:function(e){if(this.api){switch(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()){case Asc.c_oAscSelectionType.RangeRow:this.api.asc_insertCells(Asc.c_oAscInsertOptions.InsertRows);break;case Asc.c_oAscSelectionType.RangeCol:this.api.asc_insertCells(Asc.c_oAscInsertOptions.InsertColumns)}Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert Entire")}},onInsertCells:function(e,t){this.api&&(this.api.asc_insertCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert Cells"))},onDeleteEntire:function(e){if(this.api){switch(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()){case Asc.c_oAscSelectionType.RangeRow:this.api.asc_deleteCells(Asc.c_oAscDeleteOptions.DeleteRows);break;case Asc.c_oAscSelectionType.RangeCol:this.api.asc_deleteCells(Asc.c_oAscDeleteOptions.DeleteColumns)}Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete Entire")}},onDeleteCells:function(e,t){this.api&&(this.api.asc_deleteCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete Cells"))},onSortCells:function(e,t){if(this.api){var n=this.api.asc_sortCellsRangeExpand();if(n){var r={width:500,title:this.txtSorting,msg:this.txtExpandSort,buttons:[{caption:this.txtExpand,primary:!0,value:"expand"},{caption:this.txtSortSelected,primary:!0,value:"sort"},"cancel"],callback:_.bind(function(e){(e=="expand"||e=="sort")&&this.api.asc_sortColFilter(t.value,"",undefined,t.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,e=="expand"),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")},this)};Common.UI.alert(r)}else this.api.asc_sortColFilter(t.value,"",undefined,t.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,n!==null),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")}},onFilterCells:function(e,t){if(this.api){var n=new Asc.AutoFiltersOptions,r=new Asc.AutoFilterObj;if(t.value>0){r.asc_setFilter(new Asc.ColorFilter),r.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var i=r.asc_getFilter();i.asc_setCellColor(t.value==1?null:!1),i.asc_setCColor(t.value==1?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{r.asc_setFilter(new Asc.CustomFilters),r.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var s=r.asc_getFilter();s.asc_setCustomFilters([new Asc.CustomFilter]),s.asc_setAnd(!0);var o=s.asc_getCustomFilters();o[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}n.asc_setFilterObj(r),this.api.asc_applyAutoFilterByType(n),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(e,t){this.api&&(this.api.asc_emptyCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(e,t){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(e,t){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(e,t){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(e){var t=this.getApplication().getController("FormulaDialog");t&&this.api&&t.showDialog()},onInsHyperlink:function(e){var t=this,n,r;if(t.api){var i=t.api.asc_getWorksheetsCount(),s=-1,o=[];while(++s0;o--)switch(e[o-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:t=o;break;case Asc.c_oAscMouseMoveType.Comment:n=o;break;case Asc.c_oAscMouseMoveType.LockedObject:r=o;break;case Asc.c_oAscMouseMoveType.ResizeColumn:i=o;break;case Asc.c_oAscMouseMoveType.ResizeRow:s=o}var u=this,a=[0,0],f=u.tooltips.coauth,l=u.tooltips.comment,c=u.tooltips.hyperlink,h=u.tooltips.row_column,p=[u.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),u.documentHolder.cmpEl.offset().top-$(window).scrollTop()];c.isHidden=!1,h.isHidden=!1;var d=function(e){var t=SSE.getCollection("Common.Collections.Users");if(t){var n=t.findUser(e);if(n)return n.get("username")}return u.guestText};if(t){var v=e[t-1],m=v.asc_getHyperlink();if(m.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var g=m.asc_getTooltip();g?g=Common.Utils.String.htmlEncode(g)+"
    "+u.textCtrlClick+"":g=m.asc_getHyperlinkUrl()+"
    "+u.textCtrlClick+""}else g=m.asc_getTooltip()||m.asc_getLocation();c.ref&&c.ref.isVisible()&&c.text!=g&&(c.ref.hide(),c.isHidden=!0);if(!c.ref||!c.ref.isVisible())c.text=g,c.ref=(new Common.UI.Tooltip({owner:u.documentHolder,html:!0,title:g})).on("tooltip:hide",function(e){c.ref=undefined,c.text=""}),c.ref.show([-1e4,-1e4]),c.isHidden=!1;a=[v.asc_getX(),v.asc_getY()],a[0]+=p[0]+6,a[1]+=p[1]-20,a[1]-=c.ref.getBSTip().$tip.height();var y=c.ref.getBSTip().$tip.width();a[0]+y>u.tooltips.coauth.bodyWidth&&(a[0]=u.tooltips.coauth.bodyWidth-y),c.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else u.hideHyperlinkTip();if(i!==undefined||s!==undefined){var v=e[i!==undefined?i-1:s-1],b=Common.Utils.String.format(i!==undefined?this.textChangeColumnWidth:this.textChangeRowHeight,v.asc_getSizeCCOrPt().toFixed(2),v.asc_getSizePx().toFixed());h.ref&&h.ref.isVisible()&&h.text!=b&&(h.text=b,h.ref.setTitle(b),h.ref.updateTitle());if(!h.ref||!h.ref.isVisible()){h.text=b,h.ref=(new Common.UI.Tooltip({owner:u.documentHolder,html:!0,title:b})).on("tooltip:hide",function(e){h.ref=undefined,h.text=""}),h.ref.show([-1e4,-1e4]),h.isHidden=!1,a=[v.asc_getX(),v.asc_getY()],a[0]+=p[0]+6,a[1]+=p[1]-20-h.ttHeight;var y=h.ref.getBSTip().$tip.width();a[0]+y>u.tooltips.coauth.bodyWidth&&(a[0]=u.tooltips.coauth.bodyWidth-y-20),h.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}}else!h.isHidden&&h.ref&&(h.ref.hide(),h.isHidden=!0);if(u.permissions.isEdit){if(n&&!this.popupmenu){v=e[n-1];if(!l.editCommentId&&l.moveCommentId!=v.asc_getCommentIndexes()[0]){l.moveCommentId=v.asc_getCommentIndexes()[0],l.moveCommentTimer&&clearTimeout(l.moveCommentTimer);var w=v.asc_getCommentIndexes(),E=v.asc_getX(),S=v.asc_getY(),x=v.asc_getReverseX();l.moveCommentTimer=setTimeout(function(){if(l.moveCommentId&&!l.editCommentId){l.viewCommentId=l.moveCommentId;var e=u.getApplication().getController("Common.Controllers.Comments");e&&(e.isSelectedComment||e.onApiShowComment(w,E,S,x,!1,!0))}},400)}}else{l.moveCommentId=undefined;if(l.viewCommentId!=undefined){l={};var T=this.getApplication().getController("Common.Controllers.Comments");T&&(this.permissions.canCoAuthoring&&this.permissions.canComments?setTimeout(function(){T.onApiHideComment(!0)},200):T.onApiHideComment(!0))}}if(r){v=e[r-1],f.XY||u.onDocumentResize();if(f.x_point!=v.asc_getX()||f.y_point!=v.asc_getY()){u.hideCoAuthTips(),f.x_point=v.asc_getX(),f.y_point=v.asc_getY();var N=$(document.createElement("div")),C=v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;f.ref=N,N.addClass("username-tip"),N.css({height:f.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(N),a=[C?f.x_point+f.rightMenuWidth:f.bodyWidth-(f.x_point+f.XY[0]),f.y_point+f.XY[1]],a[1]>f.XY[1]&&a[1]+f.ttHeight0){var t=window.open(e,"_blank");t&&t.focus()}},onApiAutofilter:function(e){var t=this;if(t.permissions.isEdit&&!t.dlgFilter){t.dlgFilter=(new SSE.Views.AutoFilterDialog({api:this.api})).on({close:function(){t.api&&t.api.asc_enableKeyEvents(!0),t.dlgFilter=undefined}}),t.api&&t.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),t.dlgFilter.setSettings(e);var n=t.documentHolder.cmpEl.offset(),r=e.asc_getCellCoord(),i=r.asc_getX()+r.asc_getWidth()+n.left,s=r.asc_getY()+r.asc_getHeight()+n.top,o=Common.Utils.innerWidth(),u=Common.Utils.innerHeight();i+t.dlgFilter.options.width>o&&(i=o-t.dlgFilter.options.width-5),s+t.dlgFilter.options.height>u&&(s=u-t.dlgFilter.options.height-5),t.dlgFilter.show(i,s)}},onApiContextMenu:function(e){var t=this;_.delay(function(){t.showObjectMenu.call(t,e)},10)},onAfterRender:function(e){},onDocumentResize:function(e){var t=this;t.documentHolder&&(t.tooltips.coauth.XY=[t.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),t.documentHolder.cmpEl.offset().top-$(window).scrollTop()],t.tooltips.coauth.apiHeight=t.documentHolder.cmpEl.height(),t.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),t.tooltips.coauth.bodyWidth=$(window).width())},onDocumentWheel:function(e){if(this.api&&!this.isEditCell){var t=_.isUndefined(e.originalEvent)?e.wheelDelta:e.originalEvent.wheelDelta;_.isUndefined(t)&&(t=e.deltaY);if((e.ctrlKey||e.metaKey)&&!e.altKey){var n=this.api.asc_getZoom();t<0?(n=Math.ceil(n*10)/10,n-=.1,n<.5||this.api.asc_setZoom(n)):t>0&&(n=Math.floor(n*10)/10,n+=.1,n>0&&!(n>2)&&this.api.asc_setZoom(n)),e.preventDefault(),e.stopPropagation()}}},onDocumentKeyDown:function(e){if(this.api){var t=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(t===Common.UI.Keys.NUM_PLUS||t===Common.UI.Keys.EQUALITY||Common.Utils.isOpera&&t==43){if(!this.api.isCellEdited){var n=Math.floor(this.api.asc_getZoom()*10)/10;return n+=.1,n>0&&!(n>2)&&this.api.asc_setZoom(n),e.preventDefault(),e.stopPropagation(),!1}}else if(t===Common.UI.Keys.NUM_MINUS||t===Common.UI.Keys.MINUS||Common.Utils.isOpera&&t==45)if(!this.api.isCellEdited)return n=Math.ceil(this.api.asc_getZoom()*10)/10,n-=.1,n<.5||this.api.asc_setZoom(n),e.preventDefault(),e.stopPropagation(),!1}else if(t==Common.UI.Keys.F10&&e.shiftKey)return this.showObjectMenu(e),e.preventDefault(),e.stopPropagation(),!1}},onDocumentRightDown:function(e){e.button==0&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(e){e.button==0&&(this.mouse.isLeftButtonDown=!1)},showObjectMenu:function(e){this.api&&this.permissions.isEdit&&!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.fillMenuProps(this.api.asc_getCellInfo(),!0,e)},onSelectionChanged:function(e){this.permissions.isEdit&&!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&this.fillMenuProps(e)},fillMenuProps:function(e,t,n){var r,i,s,o,u,a,f,l,c,h=this.documentHolder,p=e.asc_getFlags().asc_getSelectionType(),d=e.asc_getLocked(),v=e.asc_getLockedTable()===!0,m=!1,g=this.getApplication().getController("Common.Controllers.Comments"),y=!1,b=!1;if(this.permissions.isEditMailMerge)b=p==Asc.c_oAscSelectionType.RangeCells;else if(this.permissions.isEditDiagram)y=p==Asc.c_oAscSelectionType.RangeCells;else switch(p){case Asc.c_oAscSelectionType.RangeCells:r=!0;break;case Asc.c_oAscSelectionType.RangeRow:i=!0;break;case Asc.c_oAscSelectionType.RangeCol:s=!0;break;case Asc.c_oAscSelectionType.RangeMax:o=!0;break;case Asc.c_oAscSelectionType.RangeImage:a=!0;break;case Asc.c_oAscSelectionType.RangeShape:l=!0;break;case Asc.c_oAscSelectionType.RangeChart:u=!0;break;case Asc.c_oAscSelectionType.RangeChartText:c=!0;break;case Asc.c_oAscSelectionType.RangeShapeText:f=!0}if(a||l||u){if(!t&&!h.imgMenu.isVisible())return;a=l=u=!1;var w=!1,E=this.api.asc_getGraphicObjectProps();for(var S=0;S
    ',e.id)),i.cmpEl.append(o)),e.render(o),e.cmpEl.attr({tabindex:"-1"}));if(n.button!==2){var u=r.api.asc_getActiveCellCoord(),a={left:0,top:0};s[0]=u.asc_getX()+u.asc_getWidth()+a.left,s[1]=(u.asc_getY()<0?0:u.asc_getY())+u.asc_getHeight()+a.top}o.css({left:s[0],top:s[1]}),_.isFunction(e.options.initMenu)&&(e.options.initMenu(t),e.alignPosition()),_.delay(function(){e.cmpEl.focus()},10),e.show(),r.currentMenu=e}},onEntriesListMenu:function(e){if(e&&e.length>0){var t=this,n=t.documentHolder,r=n.entriesMenu,i=n.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",r.id));for(var s=0;s
    ',r.id)),n.cmpEl.append(i)),r.render(i),r.cmpEl.attr({tabindex:"-1"}));var o=t.api.asc_getActiveCellCoord(),u={left:0,top:0},a=[o.asc_getX()+u.left,(o.asc_getY()<0?0:o.asc_getY())+o.asc_getHeight()+u.top];i.css({left:a[0],top:a[1]}),r.show(),r.alignPosition(),_.delay(function(){r.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(e){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onFormulaCompleteMenu:function(e){if(e){var t=this,n=t.documentHolder,r=n.funcMenu,i=n.cmpEl.find("#menu-formula-selection");for(var s=0;s
    ')),n.cmpEl.append(i)),r.onAfterKeydownMenu=function(e){if(e.keyCode==Common.UI.Keys.RETURN&&(e.ctrlKey||e.altKey))return;var t;arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(e=arguments[1]);if(i.hasClass("open"))if(e.keyCode==Common.UI.Keys.TAB||e.keyCode==Common.UI.Keys.RETURN&&!e.ctrlKey&&!e.altKey)t=i.find("a.focus").closest("li");else if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN){var n=r.cmpEl,s=n.offset().top,o=i.find("a.focus").closest("li"),u=o.offset().top;if(us+n.height())r.scroller?r.scroller.scrollTop(n.scrollTop()+u-s,0):n.scrollTop(n.scrollTop()+u-s)}t&&(t.length>0&&t.click(),Common.UI.Menu.Manager.hideAll())},r.render(i),r.cmpEl.attr({tabindex:"-1"}));var o=t.api.asc_getActiveCellCoord(),u={left:0,top:0},a=[o.asc_getX()+u.left,(o.asc_getY()<0?0:o.asc_getY())+o.asc_getHeight()+u.top];i.css({left:a[0],top:a[1]}),r.alignPosition();var f=t.cellEditor.is(":focus");r.isVisible()||Common.UI.Menu.Manager.hideAll(),_.delay(function(){r.isVisible()||r.show(),r.scroller&&(r.scroller.update({alwaysVisibleY:!0}),r.scroller.scrollTop(0)),f&&t.cellEditor.focus(),r.cmpEl.toggleClass("from-cell-edit",f),_.delay(function(){r.cmpEl.find("li:first a").addClass("focus")},10),f||_.delay(function(){r.cmpEl.focus()},10)},1)}else this.documentHolder.funcMenu.hide()},onShowSpecialPasteOptions:function(e){var t=this,n=t.documentHolder,r=e.asc_getCellCoord(),i=n.cmpEl.find("#special-paste-container"),s=e.asc_getOptions();i.length<1&&(t._arrSpecialPaste=[],t._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=t.txtPaste,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=t.txtPasteFormulas,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=t.txtPasteFormulaNumFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=t.txtPasteKeepSourceFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=t.txtPasteBorders,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=t.txtPasteColWidths,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=t.txtPasteMerge,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=t.txtPasteValues,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=t.txtPasteValNumFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=t.txtPasteValFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=t.txtPasteFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=t.txtPasteTranspose,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=t.txtPasteLink,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=t.txtPastePicture,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=t.txtPasteLinkPicture,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=t.txtPasteSourceFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=t.txtPasteDestFormat,i=$('
    '),n.cmpEl.append(i),t.btnSpecialPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),t.btnSpecialPaste.render($("#id-document-holder-btn-special-paste")));if(s.length>0){var o=t.btnSpecialPaste.menu;for(var u=0;u9?2:1;a!==r&&a>=0&&o.addItem(new Common.UI.MenuItem({caption:"--"})),a=r;var i=(new Common.UI.MenuItem({caption:t._arrSpecialPaste[e],value:e,checkable:!0,toggleGroup:"specialPasteGroup"})).on("click",function(e,n){var r=new Asc.SpecialPasteProps;r.asc_setProps(e.value),t.api.asc_SpecialPaste(r),setTimeout(function(){o.hide()},100)});o.addItem(i)}),o.items.length>0&&o.items[0].setChecked(!0,!0)}if(r.asc_getX()<0||r.asc_getY()<0)i.is(":visible")&&i.hide();else{var f=[r.asc_getX()+r.asc_getWidth()+3,r.asc_getY()+r.asc_getHeight()+3];i.css({left:f[0],top:f[1]}),i.show()}},onHideSpecialPasteOptions:function(){var e=this.documentHolder.cmpEl.find("#special-paste-container");e.is(":visible")&&e.hide()},onCellsRange:function(e){this.rangeSelectionMode=e!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(e){this.isEditFormula=e==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=e!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(e){this.namedrange_locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},initEquationMenu:function(){if(!this._currentMathObj)return;var e=this,t=e._currentMathObj.get_Type(),n=e._currentMathObj,r,i=[];switch(t){case Asc.c_oAscMathInterfaceType.Accent:r=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_AccentCharacter"}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.BorderBox:r=new Common.UI.MenuItem({caption:e.txtBorderProps,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.get_HideTop()?e.txtAddTop:e.txtHideTop,equationProps:{type:t,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:t,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:t,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:t,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:t,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:t,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:t,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:t,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Bar:r=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_Bar"}}),i.push(r),r=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();if(s==Asc.c_oAscMathInterfaceScript.PreSubSup)r=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),i.push(r);else{s==Asc.c_oAscMathInterfaceScript.SubSup&&(r=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),i.push(r));if(s==Asc.c_oAscMathInterfaceScript.SubSup||s==Asc.c_oAscMathInterfaceScript.Sub)r=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),i.push(r);if(s==Asc.c_oAscMathInterfaceScript.SubSup||s==Asc.c_oAscMathInterfaceScript.Sup)r=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),i.push(r)}break;case Asc.c_oAscMathInterfaceType.Fraction:var o=n.get_FractionType();if(o==Asc.c_oAscMathInterfaceFraction.Skewed||o==Asc.c_oAscMathInterfaceFraction.Linear)r=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.Linear)r=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.Skewed)r=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.NoBar)r=new Common.UI.MenuItem({caption:o==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:o==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Limit:r=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Matrix:r=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),i.push(r),r=new Common.UI.MenuItem({caption:e.insertText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.insertRowAboveText,equationProps:{type:t,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:t,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:t,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:t,callback:"insert_MatrixColumn",value:!1}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:e.deleteText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.deleteRowText,equationProps:{type:t,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:t,callback:"delete_MatrixColumn"}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtMatrixAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top,equationProps:{type:t,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:t,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:t,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtColumnAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.leftText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left,equationProps:{type:t,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:t,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:t,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.EqArray:r=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_Equation",value:!0}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_Equation",value:!1}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"delete_Equation"}}),i.push(r),r=new Common.UI.MenuItem({caption:e.alignmentText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top,equationProps:{type:t,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:t,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:t,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.LargeOperator:r=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),i.push(r),n.get_HideUpper()!==undefined&&(r=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideUpper",value:!n.get_HideUpper()}}),i.push(r)),n.get_HideLower()!==undefined&&(r=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideLower",value:!n.get_HideLower()}}),i.push(r));break;case Asc.c_oAscMathInterfaceType.Delimiter:r=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_DelimiterArgument",value:!0}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_DelimiterArgument",value:!1}}),i.push(r),n.can_DeleteArgument()&&(r=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"delete_DelimiterArgument"}}),i.push(r)),r=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_DelimiterCharacters"}}),i.push(r),r=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),i.push(r),r=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:t,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtMatchBrackets,equation:!0,disabled:!n.get_StretchBrackets()||e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets()&&n.get_MatchBrackets(),equationProps:{type:t,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(r=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),i.push(r));break;case Asc.c_oAscMathInterfaceType.Radical:n.get_HideDegree()!==undefined&&(r=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideDegree",value:!n.get_HideDegree()}}),i.push(r)),r=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_Radical"}}),i.push(r)}return n.can_IncreaseArgumentSize()&&(r=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"increase_ArgumentSize"}}),i.push(r)),n.can_DecreaseArgumentSize()&&(r=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"decrease_ArgumentSize"}}),i.push(r)),n.can_InsertManualBreak()&&(r=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_ManualBreak"}}),i.push(r)),n.can_DeleteManualBreak()&&(r=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"delete_ManualBreak"}}),i.push(r)),n.can_AlignToCharacter()&&(r=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"align_ToCharacter"}}),i.push(r)),i},addEquationMenu:function(e){var t=this;t.clearEquationMenu(e);var n=t.documentHolder.textInShapeMenu,r=t.initEquationMenu();return r.length>0&&_.each(r,function(r,i){r.menu?_.each(r.menu.items,function(e){e.on("click",_.bind(t.equationCallback,t,e.options.equationProps))}):r.on("click",_.bind(t.equationCallback,t,r.options.equationProps)),n.insertItem(e,r),e++}),r.length},clearEquationMenu:function(e){var t=this,n=t.documentHolder.textInShapeMenu;for(var r=e;rOnly text values from the column can be selected for replacement.",txtExpandSort:"The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",txtExpand:"Expand and sort",txtSorting:"Sorting",txtSortSelected:"Sort selected",txtPaste:"Paste",txtPasteFormulas:"Paste only formula",txtPasteFormulaNumFormat:"Formula + number format",txtPasteKeepSourceFormat:"Formula + all formatting",txtPasteBorders:"Formula without borders",txtPasteColWidths:"Formula + column width",txtPasteMerge:"Merge conditional formatting",txtPasteTranspose:"Transpose",txtPasteValues:"Paste only value",txtPasteValNumFormat:"Value + number format",txtPasteValFormat:"Value + all formatting",txtPasteFormat:"Paste only formatting",txtPasteLink:"Paste Link",txtPastePicture:"Picture",txtPasteLinkPicture:"Linked Picture",txtPasteSourceFormat:"Source formatting",txtPasteDestFormat:"Destination formatting"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.template",[],function(){return'
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(e){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(e),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e)},render:function(){$(this.el).html(this.template()),this.btnNamedRanges=new Common.UI.Button({menu:(new Common.UI.Menu({style:"min-width: 70px;max-width:400px;",maxHeight:250,items:[{caption:this.textManager,value:"manager"},{caption:"--"}]})).on("render:after",function(e){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0})})}),this.btnNamedRanges.render($("#ce-cell-name-menu")),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-55),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var e=this;return this.$cellname.on("focusin",function(t){e.$cellname.select().one("mouseup",function(e){e.preventDefault()})}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(e){e&&this.$cellname.val(typeof e=="string"?e:e.asc_getName())},cellNameDisabled:function(e){e?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(e)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    '}),define("spreadsheeteditor/main/app/view/NameManagerDlg",["text!spreadsheeteditor/main/app/template/NameManagerDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/ListView","common/main/lib/component/InputField"],function(e){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:510,height:353},initialize:function(t){var n=this;_.extend(this.options,{title:this.txtTitle,template:['
    ','
    '+_.template(e)({scope:this})+"
    ","
    ",'
    ','"].join("")},t),this.api=t.api,this.handler=t.handler,this.sheets=t.sheets||[],this.sheetNames=t.sheetNames||[],this.ranges=t.ranges||[],this.props=t.props,this.sort=t.sort||{type:"name",direction:1},this.locked=t.locked||!1,this.userTooltip=!0,this.currentNamedRange=undefined,this.rangesStore=new Common.UI.DataViewStore,this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.cmbFilter=(new Common.UI.ComboBox({el:$("#name-manager-combo-filter"),menuStyle:"min-width: 100%;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textFilterAll},{value:1,displayValue:this.textFilterDefNames},{value:2,displayValue:this.textFilterTableNames},{value:3,displayValue:this.textFilterSheet},{value:4,displayValue:this.textFilterWorkbook}]})).on("selected",function(t,n){e.refreshRangeList(null,0)}),this.cmbFilter.setValue(0),this.rangeList=new Common.UI.ListView({el:$("#name-manager-range-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,emptyText:this.textEmpty,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    ','
    <%= name %>
    ','
    <%= scopeName %>
    ','
    <%= range %>
    ',"<% if (lock) { %>",'
    <%=lockuser%>
    ',"<% } %>","
    "].join(""))}),this.rangeList.store.comparator=function(t,n){var r=t.get(e.sort.type).toLowerCase(),i=n.get(e.sort.type).toLowerCase();return r==i?0:r0?this.textnoNames:this.textEmpty)}var o=this,u=this.rangeList.store,a=this.rangesStore.models,f=this.cmbFilter.getValue(),l=f<3?f==2:-1,c=f>2?f==4:-1;f>0&&(a=this.rangesStore.filter(function(e){return l!==-1?l===e.get("isTable"):c!==-1?c===(e.get("scope")===null):!1})),u.reset(a,{silent:!1}),f=u.length,this.btnEditRange.setDisabled(!f),this.btnDeleteRange.setDisabled(!f);if(f>0){if(t===undefined||t===null)t=0;if(_.isNumber(t))t>f-1&&(t=f-1),this.rangeList.selectByIndex(t),setTimeout(function(){o.rangeList.scrollToRecord(u.at(t))},50);else if(t){var h=u.findWhere({name:t.asc_getName(),scope:t.asc_getScope()});h&&(this.rangeList.selectRecord(h),setTimeout(function(){o.rangeList.scrollToRecord(h)},50))}this.userTooltip===!0&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(o.onMouseOverLock,o)).on("mouseout",_.bind(o.onMouseOutLock,o))}_.delay(function(){o.rangeList.cmpEl.find(".listview").focus(),o.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(e,t,n){if(this.userTooltip===!0&&$(e.target).hasClass("lock-user")){var r=this,i=$(e.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=i.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),i.show(),setTimeout(function(){r.userTipHide()},5e3)}},userTipHide:function(){typeof this.userTooltip=="object"&&(this.userTooltip.remove(),this.userTooltip=undefined,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(e,t,n){typeof this.userTooltip=="object"&&this.userTipHide()},onEditRange:function(e){if(this.locked){Common.NotificationCenter.trigger("namedrange:locked");return}var t=this,n=t.$window.offset(),r=this.rangeList.getSelectedRec(),i=_.indexOf(this.rangeList.store.models,r[0]),s=e&&r.length>0?new Asc.asc_CDefName(r[0].get("name"),r[0].get("range"),r[0].get("scope"),r[0].get("isTable")):null,o=(new SSE.Views.NamedRangeEditDlg({api:t.api,sheets:this.sheets,props:e?s:this.props,isEdit:e,handler:function(n,r){n=="ok"&&r&&(e?(t.currentNamedRange=r,t.api.asc_editDefinedNames(s,r)):(t.cmbFilter.setValue(0),t.currentNamedRange=r,t.api.asc_setDefinedNames(r)))}})).on("close",function(){t.show(),_.delay(function(){t.rangeList.cmpEl.find(".listview").focus()},100,t)});t.hide(),o.show(n.left+65,n.top+77)},onDeleteRange:function(){var e=this.rangeList.getSelectedRec();e.length>0&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,e[0]),this.api.asc_delDefinedNames(new Asc.asc_CDefName(e[0].get("name"),e[0].get("range"),e[0].get("scope"),e[0].get("isTable"))))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(e){this.handler&&this.handler.call(this,e.currentTarget.attributes.result.value),this.close()},onSortNames:function(e){e!==this.sort.type?(this.sort={type:e,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var t=e=="name"?this.spanSortName:this.spanSortScope;this.sort.direction>0?t.removeClass("sort-desc"):t.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(e){var t=SSE.getCollection("Common.Collections.Users");if(t){var n=t.findUser(e);if(n)return n.get("username")}return this.guestText},onSelectRangeItem:function(e,t,n){this.userTipHide();var r={},i=_.isFunction(n.toJSON);if(i){if(!n.get("selected"))return;r=n.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,n),this.btnEditRange.setDisabled(r.lock),this.btnDeleteRange.setDisabled(r.lock||r.isTable)}},hide:function(){this.userTipHide(),Common.UI.Window.prototype.hide.call(this)},close:function(){this.userTipHide(),this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},onKeyDown:function(e,t,n){n.keyCode==Common.UI.Keys.DELETE&&!this.btnDeleteRange.isDisabled()&&this.onDeleteRange()},onDblClickItem:function(e,t,n){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(e){this.locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},txtTitle:"Name Manager",closeButtonText:"Close",okButtonText:"Ok",textDataRange:"Data Range",textNew:"New",textEdit:"Edit",textDelete:"Delete",textRanges:"Named Ranges",textScope:"Scope",textFilter:"Filter",textEmpty:"No named ranges have been created yet.
    Create at least one named range and it will appear in this field.",textnoNames:"No named ranges matching your filter could be found.",textFilterAll:"All",textFilterDefNames:"Defined names",textFilterTableNames:"Table names",textFilterSheet:"Names Scoped to Sheet",textFilterWorkbook:"Names Scoped to Workbook",textWorkbook:"Workbook",guestText:"Guest",tipIsLocked:"This element is being edited by another user."},SSE.Views.NameManagerDlg||{}))}),define("spreadsheeteditor/main/app/controller/CellEditor",["core","spreadsheeteditor/main/app/view/CellEditor","spreadsheeteditor/main/app/view/NameManagerDlg"],function(e){"use strict";SSE.Controllers.CellEditor=Backbone.Controller.extend({views:["CellEditor"],events:function(){return{"keyup input#ce-cell-name":_.bind(this.onCellName,this),"keyup textarea#ce-cell-content":_.bind(this.onKeyupCellEditor,this),"blur textarea#ce-cell-content":_.bind(this.onBlurCellEditor,this),"click button#ce-btn-expand":_.bind(this.expandEditorField,this),"click button#ce-func-label":_.bind(this.onInsertFunction,this)}},initialize:function(){this.addListeners({CellEditor:{},Viewport:{"layout:resizedrag":_.bind(this.onLayoutResize,this)}})},setApi:function(e){return this.api=e,this.api.isCEditorFocused=!1,this.api.asc_registerCallback("asc_onSelectionNameChanged",_.bind(this.onApiCellSelection,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onInputKeyDown",_.bind(this.onInputKeyDown,this)),this},setMode:function(e){this.mode=e,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge)},onInputKeyDown:function(e){if(Common.UI.Keys.UP===e.keyCode||Common.UI.Keys.DOWN===e.keyCode||Common.UI.Keys.TAB===e.keyCode||Common.UI.Keys.RETURN===e.keyCode||Common.UI.Keys.ESC===e.keyCode||Common.UI.Keys.LEFT===e.keyCode||Common.UI.Keys.RIGHT===e.keyCode){var t=$("#menu-formula-selection");t.hasClass("open")&&t.find(".dropdown-menu").trigger("keydown",e)}},onLaunch:function(){this.editor=this.createView("CellEditor",{el:"#cell-editing-box"}).render(),this.bindViewEvents(this.editor,this.events),this.editor.$el.parent().find(".after").css({zIndex:"4"}),this.editor.btnNamedRanges.menu.on("item:click",_.bind(this.onNamedRangesMenu,this)).on("show:before",_.bind(this.onNameBeforeShow,this)),this.namedrange_locked=!1},onApiEditCell:function(e){e==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):e==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",e==Asc.c_oAscCellEditorState.editText)},onApiCellSelection:function(e){this.editor.updateCellInfo(e)},onApiDisconnect:function(){this.mode.isEdit=!1;var e=this.getApplication().getController("FormulaDialog");e&&e.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(e){this.editor.cellNameDisabled(e!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",e!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(e,t){t=="cell:edit"&&(this.editor.$el.height()>19?this.editor.$btnexpand.hasClass("btn-collapse")||this.editor.$btnexpand.addClass("btn-collapse"):this.editor.$btnexpand.removeClass("btn-collapse"))},onCellName:function(e){if(e.keyCode==Common.UI.Keys.RETURN){var t=this.editor.$cellname.val();t&&t.length&&this.api.asc_findCell(t),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){this.api.isCEditorFocused=="clear"?this.api.isCEditorFocused=undefined:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(e){e.keyCode==Common.UI.Keys.RETURN&&!e.altKey&&(this.api.isCEditorFocused="clear")},expandEditorField:function(){this.editor.$el.height()>19?(this.editor.keep_height=this.editor.$el.height(),this.editor.$el.height(19),this.editor.$btnexpand.removeClass("btn-collapse")):(this.editor.$el.height(this.editor.keep_height||74),this.editor.$btnexpand.addClass("btn-collapse")),Common.NotificationCenter.trigger("layout:changed","celleditor"),Common.NotificationCenter.trigger("edit:complete",this.editor,{restorefocus:!0})},onInsertFunction:function(){if(this.mode.isEdit&&!this.editor.$btnfunc.hasClass("disabled")){var e=this.getApplication().getController("FormulaDialog");e&&($("#ce-func-label",this.editor.el).blur(),e.showDialog())}},onNamedRangesMenu:function(e,t){var n=this;if(t.options.value=="manager"){var r=this.api.asc_getWorksheetsCount(),i=-1,s=[],o=[];while(++i2)},onLockDefNameManager:function(e){this.namedrange_locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager}})}),define("common/main/lib/view/ImageFromUrlDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ImageFromUrlDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg"},initialize:function(e){_.extend(this.options,e||{}),this.template=['
    ','
    ',"","
    ",'
    ',"
    ",'"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this;e.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:e.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(t){return/((^https?)|(^ftp)):\/\/.+/i.test(t)?!0:e.txtNotUrl}});var t=this.getChild();t.find(".btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.getChild("input").focus()},500)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputUrl.checkValidate()!==!0){this.inputUrl.cmpEl.find("input").focus();return}this.options.handler.call(this,e,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",cancelButtonText:"Cancel",okButtonText:"Ok",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/util/define",[],function(){"use strict";Common.define={},Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521}}),define("text!spreadsheeteditor/main/app/template/Toolbar.template",[],function(){return'
    \n \n \n \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n \n \n \n \n \n \n
    \n
    \n
    \n \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    '});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(e){"use strict";Common.Models.Font=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(e){"use strict";Common.Collections.Fonts=e.Collection.extend({model:Common.Models.Font,comparator:function(e,t){var n=e.get("name").toLowerCase(),r=t.get("name").toLowerCase();return n==r?0:n",'","<% } else if (split == false) {%>",'
    ','","
    ","<% } else { %>",'
    ','",'","
    ","<% } %>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.id=t.options.id||Common.UI.getId(),t.hint=t.options.hint,t.enableToggle=t.options.enableToggle,t.allowDepress=t.options.allowDepress,t.cls=t.options.cls,t.iconCls=t.options.iconCls,t.menu=t.options.menu,t.split=t.options.split,t.toggleGroup=t.options.toggleGroup,t.disabled=t.options.disabled,t.pressed=t.options.pressed,t.caption=t.options.caption,t.template=t.options.template||t.template,t.style=t.options.style,t.rendered=!1,t.options.el&&t.render()},render:function(e){var t=this;t.trigger("render:before",t),t.cmpEl=$(t.el),e&&(t.setElement(e,!1),t.rendered||(t.cmpEl=$(this.template({id:t.id,cls:t.cls,iconCls:t.iconCls,menu:t.menu,split:t.split,disabled:t.disabled,pressed:t.pressed,caption:t.caption,style:t.style})),t.menu&&_.isObject(t.menu)&&_.isFunction(t.menu.render)&&t.menu.render(t.cmpEl),e.html(t.cmpEl)));if(!t.rendered){var n=t.cmpEl,r=n.hasClass("btn-group"),i=n.hasClass("split");if(t.options.hint){var s=t.cmpEl.closest(".asc-window");t.cmpEl.attr("data-toggle","tooltip"),t.cmpEl.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"}),s.length>0&&t.cmpEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10)}_.isString(t.toggleGroup)&&(t.enableToggle=!0);var o=function(e){if(!t.disabled&&e.which==1){t.doToggle();if(t.options.hint){var n=t.cmpEl.data("bs.tooltip");n&&(n.dontShow===undefined&&(n.dontShow=!0),n.hide())}t.trigger("click",t,e)}},u=function(e,r){if(!e){var s=!1;_.each($("button",n),function(e){if($(e).is(":hover"))return s=!0,!1}),s||(n.removeClass("over"),$("button",n).removeClass("over"))}if(!e&&t.enableToggle&&t.allowDepress&&t.pressed)return;if(e&&!i&&t.enableToggle&&t.allowDepress&&!t.pressed){r.preventDefault();return}$("button:first",n).toggleClass("active",e),$("[data-toggle^=dropdown]",n).toggleClass("active",e),n.toggleClass("active",e)},a=function(e){if(!t.disabled&&e.which==1&&i){if(t.options.hint){var r=t.cmpEl.data("bs.tooltip");r&&(r.dontShow===undefined&&(r.dontShow=!0),r.hide())}var s=n.hasClass("open");u(!s,e)}},f=function(e,t){i?u(t,e):(n.toggleClass("active",t),$("button",n).toggleClass("active",t))},l=function(e){u(!0,e),$(document).on("mouseup",c)},c=function(e){u(!1,e),$(document).off("mouseup",c)},h=function(e,n){t.cmpEl.find(".dropdown-toggle").blur(),t.cmpEl.hasClass("active")!==t.pressed&&t.cmpEl.trigger("button.internal.active",[t.pressed])};r?(i&&($("[data-toggle^=dropdown]",n).on("mousedown",_.bind(a,this)),$("button",n).on("mousedown",_.bind(l,this))),n.on("hide.bs.dropdown",_.bind(u,t,!1)),n.on("show.bs.dropdown",_.bind(u,t,!0)),n.on("hidden.bs.dropdown",_.bind(h,t)),$("button:first",n).on("click",o)):n.on("click",o),n.on("button.internal.active",_.bind(f,t)),n.on("mouseover",function(e){t.disabled||(t.cmpEl.addClass("over"),t.trigger("mouseover",t,e))}),n.on("mouseout",function(e){t.disabled||(t.cmpEl.removeClass("over"),t.trigger("mouseout",t,e))}),Common.UI.ToggleManager.register(t)}return t.rendered=!0,t.pressed&&t.toggle(t.pressed,!0),t.disabled&&t.setDisabled(!(t.disabled=!1)),t.trigger("render:after",t),this},doToggle:function(){var e=this;e.enableToggle&&(e.allowDepress!==!1||!e.pressed)&&e.toggle()},toggle:function(e,t){var n=e===undefined?!this.pressed:!!e;this.pressed=n,this.cmpEl&&this.cmpEl.trigger("button.internal.active",[n]),t||this.trigger("toggle",this,n)},isActive:function(){return this.enableToggle?this.pressed:this.cmpEl.hasClass("active")},setDisabled:function(e){if(this.rendered&&this.disabled!=e){var t=this.cmpEl,n=t.hasClass("btn-group"),r=this;e=e===!0;if(e!==t.hasClass("disabled")){var i=function(t){t.toggleClass("disabled",e),r.options.allowMouseEventsOnDisabled||(e?t.attr({disabled:e}):t.removeAttr("disabled"))};i(t),n&&i(t.children("button"))}if(e||!Common.Utils.isGecko){var s=this.cmpEl.data("bs.tooltip");s&&(e&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!e))}}this.disabled=e},isDisabled:function(){return this.disabled},setIconCls:function(e){var t=$(this.el).find("span.btn-icon"),n=this.iconCls;this.iconCls=e,t.removeClass(n),t.addClass(e||"")},setVisible:function(e){this.cmpEl&&this.cmpEl.toggleClass("hidden",!e)},updateHint:function(e){this.options.hint=e;if(!this.rendered)return;var t=this.cmpEl,n=t.closest(".asc-window");t.data("bs.tooltip")&&t.removeData("bs.tooltip"),t.attr("data-toggle","tooltip"),t.tooltip({title:e,placement:this.options.hintAnchor||"cursor"}),n.length>0&&t.data("bs.tooltip").tip().css("z-index",parseInt(n.css("z-index"))+10)},setCaption:function(e){if(this.caption!=e){this.caption=e;if(this.rendered){var t=this.cmpEl.find("button:first > .caption").andSelf().filter("button > .caption");t.length>0?t.text(e):this.cmpEl.find("button:first").andSelf().filter("button").text(e)}}},setMenu:function(e){e&&_.isObject(e)&&_.isFunction(e.render)&&(this.menu=e,this.rendered&&this.menu.render(this.cmpEl))}})});if(Common===undefined)var Common={};define("common/main/lib/component/ColorPalette",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.ColorPalette=Common.UI.BaseView.extend({options:{allowReselect:!0,cls:"",style:""},template:_.template(['
    ',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>","
    "].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;this.id=t.options.id,this.cls=t.options.cls,this.style=t.options.style,this.colors=t.options.colors||[],this.value=t.options.value,t.options.el&&t.render()},render:function(e){var t=this;t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));if(!t.rendered){var n=this.cmpEl;n.on("click","span.color-item",_.bind(this.itemClick,this))}return t.rendered=!0,this},itemClick:function(e){var t=$(e.target);this.select(t.attr("data-color"))},select:function(e,t){if(this.value!=e){var n=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=e,e&&/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),$("span[data-color="+e+"]",this.cmpEl).addClass("selected"),t||n.trigger("select",n,this.value))}}})}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n\r\n'});if(Common===undefined)var Common={};define("common/main/lib/component/HSBColorPicker",["common/main/lib/component/BaseView","common/main/lib/util/utils"],function(){"use strict";Common.UI.HSBColorPicker=Common.UI.BaseView.extend({template:_.template('
    <% if (this.showCurrentColor) { %>
    <% } %>
    <% if (this.changeSaturation) { %>
    <% } %>
    <% if (this.allowEmptyColor) { %>
    <%= this.textNoColor %>
    <% } %>
    '),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el),r,i,s,o,u,a,f,l,c=0,h=100,p=100;t.allowEmptyColor=t.options.allowEmptyColor,t.changeSaturation=t.options.changeSaturation,t.showCurrentColor=t.options.showCurrentColor;var d=function(e,n){var r=new Common.Utils.RGBColor("hsb("+e.h+","+e.s+","+e.b+")"),i=r.toHex();t.color=n?"transparent":i,v(),t.trigger("changecolor",t,t.color)},v=function(){u.length>0&&a.length>0&&(t.color=="transparent"?a.show():(u.css("background-color",t.color),a.hide())),s.length>0&&s.css("background-color",(new Common.Utils.RGBColor("hsb("+c+", 100, 100)")).toHex()),f.length>0&&(f[0].innerHTML=t.color=="transparent"?t.textNoColor:t.color.toUpperCase()),r.length>0&&i.length>0&&(r.css("left",h+"%"),r.css("top",100-p+"%"),i.css("top",parseInt(c*100/360)+"%"))},m=function(e,t,n){if(r.length>0&&s.length>0){var i=[Math.max(0,Math.min(100,parseInt((e.pageX*Common.Utils.zoom()-s.offset().left)/s.width()*100))),Math.max(0,Math.min(100,parseInt((e.pageY*Common.Utils.zoom()-s.offset().top)/s.height()*100)))];r.css("left",i[0]+"%"),r.css("top",i[1]+"%"),h=i[0],p=100-i[1],d({h:c,s:h,b:p})}},g=function(e,t,n){if(i&&o){var r=Math.max(0,Math.min(100,parseInt((e.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",r+"%"),c=parseInt(360*r/100),d({h:c,s:h,b:p})}},y=function(e,t,n){$(document).on("mouseup",b),$(document).on("mousemove",m)},b=function(e,t,n){$(document).off("mouseup",b),$(document).off("mousemove",m),m(e,t,n)},w=function(e,t,n){$(document).on("mouseup",E),$(document).on("mousemove",g),g(e,t,n)},E=function(e,t,n){$(document).off("mouseup",E),$(document).off("mousemove",g)},S=function(e){var n=(new Common.util.RGBColor(t.color)).toHSB();d(n,!0)},x=function(e){var n=$(t.el),d;n&&(r=n.find(".cnt-hb-arrow"),i=n.find(".cnt-sat-arrow"),s=n.find(".cnt-hb"),o=n.find(".cnt-sat"),u=n.find(".color-value"),f=n.find(".color-text"),l=n.find(".empty-color"),u.length>0&&(a=u.find(".transparent-color")),s.length>0&&(s.off("mousedown"),s.on("mousedown",y)),o.length>0&&(o.off("mousedown"),o.on("mousedown",w)),l.length>0&&(l.off("click"),l.on("click",S)),t.color=="transparent"?d={h:0,s:100,b:100}:d=(new Common.Utils.RGBColor(t.color)).toHSB(),c=d.h,h=d.s,p=d.b,c==h&&c==p&&c==0&&(h=100),v())};t.setColor=function(e){if(t.color==e)return;var n;e=="transparent"?n={h:0,s:100,b:100}:n=(new Common.Utils.RGBColor(e)).toHSB(),c=n.h,h=n.s,p=n.b,c==h&&c==p&&c==0&&(h=100),t.color=e,v()},t.getColor=function(){return t.color},t.on("render:after",x),t.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})});if(Common===undefined)var Common={};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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);n.addClass("masked-field user-select"),n.attr("maxlength",t.options.maxLength),n.on("keypress",function(e){var r=String.fromCharCode(e.which);!t.options.maskExp.test(r)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB&&(e.keyCode==Common.UI.Keys.RETURN&&t.trigger("changed",t,n.val()),e.preventDefault(),e.stopPropagation())}),n.on("input",function(e){t.trigger("change",t,n.val())}),n.on("blur",function(e){t.trigger("changed",t,n.val())})},render:function(){return this},setValue:function(e){this.options.maskExp.test(e)&&e.length<=this.options.maxLength&&$(this.el).val(e)},getValue:function(){$(this.el).val()}})});if(Common===undefined)var Common={};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(e){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(e),options:{},rendered:!1,initialize:function(e){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}),this.spinB=new Common.UI.MetricSpinner({el:$("#extended-spin-b"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:3,maskExp:/[0-9]/,allowDecimal:!1}),this.textColor=new Common.UI.MaskedField({el:$("#extended-text-color"),width:55,maskExp:/[a-fA-F0-9]/,maxLength:6}),this.spinR.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,1)),this.spinG.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,2)),this.spinB.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,3)),this.textColor.on("change",_.bind(this.onChangeMaskedField,this)),this.textColor.on("changed",_.bind(this.onChangedMaskedField,this)),this.textColor.$el.attr("tabindex",4),this.spinR.$el.find("input").attr("maxlength",3),this.spinG.$el.find("input").attr("maxlength",3),this.spinB.$el.find("input").attr("maxlength",3),this.on("close",function(){e.trigger("onmodalresult",0)}),$(this)[0].getChild(".footer .dlg-btn").on("click",t),this.rendered=!0,this.color!==undefined&&this.setColor(this.color),this},onChangeColor:function(e,t){this.colorNew.css({"background-color":t}),this.stopevents=!0;var n=t.match(this.hexRe);this.spinR.setValue(parseInt(n[1],16)),this.spinG.setValue(parseInt(n[2],16)),this.spinB.setValue(parseInt(n[3],16)),this.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),this.stopevents=!1},showColor:function(e,t){if(!this.stopevents){var n=this.spinR.getNumberValue(),r=n==null||n<0?0:n>255?255:n;t&&this.spinR.setValue(r,!0),r=r.toString(16),n=this.spinG.getNumberValue();var i=n==null||n<0?0:n>255?255:n;t&&this.spinG.setValue(i,!0),i=i.toString(16),n=this.spinB.getNumberValue();var s=n==null||n<0?0:n>255?255:n;t&&this.spinB.setValue(s,!0),s=s.toString(16);var o=(r.length==1?"0"+r:r)+(i.length==1?"0"+i:i)+(s.length==1?"0"+s:s);this.colorsPicker.setColor("#"+o),e!="hex"&&this.textColor.setValue(o.toUpperCase()),this.colorNew.css("background-color","#"+o)}},onChangingRGB:function(e,t,n,r){if(!this.stopevents){var i,s,o,u;n=_.isEmpty(n)||isNaN(parseInt(n))?parseInt(t.getValue()):parseInt(n);switch(e){case 1:i=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16),u=this.spinG.getNumberValue(),s=(u==null||u<0?0:u>255?255:u).toString(16),u=this.spinB.getNumberValue(),o=(u==null||u<0?0:u>255?255:u).toString(16);break;case 2:u=this.spinR.getNumberValue(),i=(u==null||u<0?0:u>255?255:u).toString(16),s=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16),u=this.spinB.getNumberValue(),o=(u==null||u<0?0:u>255?255:u).toString(16);break;case 3:u=this.spinR.getNumberValue(),i=(u==null||u<0?0:u>255?255:u).toString(16),u=this.spinG.getNumberValue(),s=(u==null||u<0?0:u>255?255:u).toString(16),o=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16)}var a=(i.length==1?"0"+i:i)+(s.length==1?"0"+s:s)+(o.length==1?"0"+o:o);this.colorsPicker.setColor("#"+a),this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangeMaskedField:function(e,t){t=/^[a-fA-F0-9]{0,6}$/.test(t)?t:"000000",t="000000"+t;var n=t.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(n[1],16)),this.spinG.setValue(parseInt(n[2],16)),this.spinB.setValue(parseInt(n[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(e,t){var n=this;(!/^[a-fA-F0-9]{0,6}$/.test(t)||_.isEmpty(t))&&e.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var e=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return e?e[1]:null},setColor:function(e){function r(){e=="transparent"?t.colorSaved.addClass("color-transparent"):(t.colorSaved.removeClass("color-transparent"),t.colorSaved.css("background-color","#"+e)),t.colorNew.css("background-color","#"+n)}var t=this;if(this.rendered!==!0){this.color=e;return}var n=/#?([a-fA-F0-9]{6})/.test(e)?e:"ff0000";t.colorsPicker.setColor("#"+n),r(),t.stopevents=!0;var i=t.hexRe.exec(n);t.spinR.setValue(parseInt(i[1],16)),t.spinG.setValue(parseInt(i[2],16)),t.spinB.setValue(parseInt(i[3],16)),t.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),t.stopevents=!1},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.getChild("#extended-text-color").focus()},50)},cancelButtonText:"Cancel",addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.
    Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.
    Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ThemeColorPalette",["common/main/lib/component/BaseView","common/main/lib/view/ExtendedColorDialog"],function(){"use strict";Common.UI.ThemeColorPalette=Common.UI.BaseView.extend(_.extend({options:{dynamiccolors:10,standardcolors:10,themecolors:10,effects:5,allowReselect:!0,transparent:!1,value:"000000"},template:_.template('
    <% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %>
    <% } else if (me.isSeparator(item)) { %>
    <% } else if (me.isColor(item)) { %>  <% } else if (me.isTransparent(item)) { %> <% } else if (me.isEffect(item)) { %> <% } else if (me.isCaption(item)) { %>
    <%=item%>
    <% } %><% }); %>
    <% if (me.options.dynamiccolors!==undefined) { %>
    <% for (var i=0; i <% } %><% } %>
    '),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.colors=t.options.colors||this.generateColorData(t.options.themecolors,t.options.effects,t.options.standardcolors,t.options.transparent),n.addClass("theme-colorpalette"),this.render(),this.options.updateColorsArr&&this.updateColors(this.options.updateColorsArr[0],this.options.updateColorsArr[1]),this.options.value&&this.select(this.options.value,!0),this.updateCustomColors(),n.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),n.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),n.on("click",_.bind(this.handleClick,this))},render:function(){return $(this.el).html(this.template({colors:this.colors})),this},isBlankSeparator:function(e){return typeof e=="string"&&e=="-"},isSeparator:function(e){return typeof e=="string"&&e=="--"},isColor:function(e){return typeof e=="string"&&/[0-9A-F]{6}/.test(e)},isTransparent:function(e){return typeof e=="string"&&e=="transparent"},isCaption:function(e){return typeof e=="string"&&e!="-"&&e!="--"&&!/[0-9A-F]{6}|transparent/.test(e)},isEffect:function(e){return typeof e=="object"&&e.effectId!==undefined},getColor:function(){return this.value},updateCustomColors:function(){var e=$(this.el);if(e){var t=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");t=t?t.split(","):[];var n=-1,r,i=t.lengththis.options.dynamiccolors&&n.shift(),Common.localStorage.setItem(t,n.join().toUpperCase())},addNewColor:function(e){var t=this,n=new Common.UI.ExtendedColorDialog({});n.on("onmodalresult",function(e){t._isdlgopen=!1,e==1&&(t.setCustomColor(n.getColor()),t.fireEvent("select",t,n.getColor()))}),t._isdlgopen=!0,n.setColor(t.value!==undefined&&t.value!==!1?t.value:e!==undefined?e:"000000"),n.show()},isDialogOpen:function(){return this._isdlgopen==1},select:function(e,t){var n=$(this.el);n.find("a."+this.selectedCls).removeClass(this.selectedCls);if(typeof e=="object"){var r;e.effectId!==undefined?(r=n.find('a[effectid="'+e.effectId+'"]').first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):e.effectValue!==undefined&&(r=n.find('a[effectvalue="'+e.effectValue+'"].color-'+e.color.toUpperCase()).first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else{/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),this.value=e);if(/^[a-fA-F0-9]{6}|transparent$/.test(e)&&_.indexOf(this.colors,e)>=0){_.indexOf(this.colors,this.value)<0&&(this.value=!1);if(e!=this.value||this.options.allowReselect)e=="transparent"?n.find("a.color-transparent").addClass(this.selectedCls):n.find("a.palette-color.color-"+e).first().addClass(this.selectedCls),this.value=e,t!==!0&&this.fireEvent("select",this,e)}else{var i=n.find("#"+e).first();i.length==0&&(i=n.find('a[color="'+e+'"]').first()),i.length>0&&(i.addClass(this.selectedCls),this.value=e.toUpperCase())}}},updateColors:function(e,t,n){if(e===undefined||t===undefined)return;var r=this,i=$(this.el);r.aColorElements===undefined&&(r.aColorElements=i.find("a.palette-color")),r.aEffectElements===undefined&&(r.aEffectElements=i.find("a.palette-color-effect"));var s,o=0,u=0;for(var a=0;a=t.length)continue;s=$(r.aColorElements[o]),s.removeClass("color-"+r.colors[a]),r.colors[a]=t[o].toUpperCase(),s.addClass("color-"+r.colors[a]),s.css({background:"#"+r.colors[a]}),s.find("span").first().css({background:"#"+r.colors[a]}),o++}else if(typeof r.colors[a]=="object"&&r.colors[a].effectId!==undefined){if(u>=e.length)continue;s=$(r.aEffectElements[u]),e[u].color=e[u].color.toUpperCase(),r.colors[a].color!==e[u].color&&(s.removeClass("color-"+r.colors[a].color),s.addClass("color-"+e[u].color),s.css({background:"#"+e[u].color}),s.find("span").first().css({background:"#"+e[u].color})),r.colors[a].effectId!==e[u].effectId&&s.attr("effectid",""+e[u].effectId),r.colors[a].effectValue!==e[u].effectValue&&s.attr("effectvalue",""+e[u].effectValue),r.colors[a]=e[u],u++}if(n)this.select(n,!0);else{var f=$(this.el).find("a."+this.selectedCls);f.length&&f.hasClass("palette-color-effect")&&(this.value=f[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=undefined},clearSelection:function(e){$(this.el).find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=undefined},generateColorData:function(e,t,n,r){var i=[],s=e>0&&t>0?e*t:0;if(e>0){i=[this.textThemeColors,"-"];for(var o=0;o0&&i.push("-");for(var o=0;o','
    0x0
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join("")),initialize:function(c){Common.UI.BaseView.prototype.initialize.call(this,c),e=this,t=$(this.el),e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,this.render(),t&&(n=t.find(".dimension-picker-mousecatcher"),r=t.find(".dimension-picker-unhighlighted"),i=t.find(".dimension-picker-highlighted"),s=t.find(".dimension-picker-status"),t.css({width:e.minColumns+"em"}),n.css("z-index",1),n.width(e.maxColumns+"em").height(e.maxRows+"em"),r.width(e.minColumns+"em").height(e.minRows+"em"),s.html(o+" x "+u),s.width(r.width())),n.on("mousemove",a),i.on("mousemove",a),r.on("mousemove",a),n.on("mouseleave",f),i.on("mouseleave",f),r.on("mouseleave",f),n.on("click",l),i.on("click",l),r.on("click",l)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(n,a,f){n>this.maxColumns&&(n=this.maxColumns),a>this.maxRows&&(a=this.maxRows);if(o!=n||u!=a)o=n,u=a,i.width(o+"em").height(u+"em"),r.width((oe.maxColumns?e.maxColumns:o+1)+"em").height((ue.maxRows?e.maxRows:u+1)+"em"),t.width(r.width()),s.html(o+" x "+u),s.width(r.width()),e.trigger("change",e,o,u,f)},getColumnsCount:function(){return o},getRowsCount:function(){return u}}}())});if(Common===undefined)var Common={};var FONT_TYPE_RECENT=4;define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var e=302,t=Asc.FONT_THUMBNAIL_HEIGHT||26,n=window.devicePixelRatio>1,r=document.createElement("canvas"),i=r.getContext("2d"),s="../../../../sdkjs/common/Images/fonts_thumbnail.png",o="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png",u=36;return typeof window["AscDesktopEditor"]=="object"&&(s=window.AscDesktopEditor.getFontsSprite(),o=window.AscDesktopEditor.getFontsSprite(!0)),r.height=n?t*2:t,r.width=n?e*2:e,{template:_.template(['
    ','','
    ','','","
    "].join("")),initialize:function(e){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(e,{displayField:"name",scroller:{alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(e.recent)?e.recent:3,Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(e){var t=null;return _.isUndefined(this._input)||(t=this._input.val()),Common.UI.ComboBox.prototype.render.call(this,e),this.setRawValue(t),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this},onAfterKeydownMenu:function(e){var t=this;if(e.keyCode==Common.UI.Keys.RETURN)return $(e.target).closest("input").length?this.lastValue!==this._input.val()&&this._input.trigger("change"):($(e.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur())),!1;if(e.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this._input.val(this.lastValue),setTimeout(function(){t.closeMenu(),t.onAfterHideMenu(e)},10),!1;(e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.BACKSPACE)&&this.isMenuOpen()&&(t._input.focus(),setTimeout(function(){t._input[0].selectionStart=t._input[0].selectionEnd=e.keyCode==Common.UI.Keys.HOME?0:t._input[0].value.length},10)),this.updateVisibleFontsTiles()},onInputKeyUp:function(e){if(e.keyCode!=Common.UI.Keys.RETURN&&e.keyCode!==Common.UI.Keys.SHIFT&&e.keyCode!==Common.UI.Keys.CTRL&&e.keyCode!==Common.UI.Keys.ALT&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB){e.stopPropagation(),this.selectCandidate(e.keyCode==Common.UI.Keys.DELETE||e.keyCode==Common.UI.Keys.BACKSPACE);if(this._selectedItem){var t=this;t._timerSelection===undefined&&(t._timerSelection=setInterval(function(){if(new Date-t._inInputKeyDown<100||!t._selectedItem)return;clearInterval(t._timerSelection),t._timerSelection=undefined;var e=t._input[0],n=t._selectedItem.get(t.displayField),r=e.value;if(t.rendered)if(document.selection)document.selection.createRange().text=n;else if(e.selectionStart||e.selectionStart=="0")e.value=n,e.selectionStart=r.length,e.selectionEnd=n.length},10))}}},onInputKeyDown:function(e){this._inInputKeyDown=new Date;var t=this;e.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){t.closeMenu(),t.onAfterHideMenu(e)},10)):e.keyCode!=Common.UI.Keys.RETURN&&e.keyCode!=Common.UI.Keys.CTRL&&e.keyCode!=Common.UI.Keys.SHIFT&&e.keyCode!=Common.UI.Keys.ALT&&(!this.isMenuOpen()&&!e.ctrlKey&&this.openMenu(),e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var n=e.keyCode==Common.UI.Keys.DOWN?t.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):t.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");n=n.length>0?n.eq(0):e.keyCode==Common.UI.Keys.DOWN?t.cmpEl.find("ul li:not(.divider):first"):t.cmpEl.find("ul li:not(.divider):last"),n=n.find("a"),t._skipInputChange=!0,n.focus(),t.updateVisibleFontsTiles()},10):t._skipInputChange=!1)},onInputChanged:function(e,t){if(t&&t.synthetic)return;if(this._skipInputChange){this._skipInputChange=!1;return}if(this._isMouseDownMenu){this._isMouseDownMenu=!1;return}var n=$(e.target).val(),r={};if(this.lastValue===n){t&&t.onkeydown&&this.trigger("combo:blur",this,e);return}r[this.valueField]=n,r[this.displayField]=n,this.trigger("changed:before",this,r,e);if(e.isDefaultPrevented())return;this._selectedItem?(r[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(r[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(r[this.valueField]),r.isNewFont=!0,this.trigger("selected",this,r,e),this.closeMenu()),this.trigger("changed:after",this,r,e)},getImageUri:function(s){if(s.cloneid){var o=$(this.el).find("ul > li#"+s.cloneid+" img");return o!=null?o[0].src:undefined}return n?(i.clearRect(0,0,e*2,t*2),i.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*2*s.imgidx)):(i.clearRect(0,0,e,t),i.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*s.imgidx)),r.toDataURL()},getImageWidth:function(){return e},getImageHeight:function(){return t},getListItemHeight:function(){return u},loadSprite:function(e){e&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=e,this.spriteThumbs.src=window.devicePixelRatio>1?o:s)},fillFonts:function(e,t){var n=this;this.loadSprite(function(){n.store.set(e.toJSON()),n.rendered=!1,n.render($(n.el)),n._fontsArray=n.store.toJSON(),n.recent>0&&(n.store.on("add",n.onInsertItem,n),n.store.on("remove",n.onRemoveItem,n))})},onApiChangeFont:function(e){var t=_.isFunction(e.get_Name)?e.get_Name():e.asc_getName();if(this.getRawValue()!==t){var n=this.store.findWhere({name:t});$(".selected",$(this.el)).removeClass("selected");if(n){this.setRawValue(n.get(this.displayField));var r=$("#"+n.get("id"),$(this.el)),i=$("ul.dropdown-menu",this.cmpEl);r&&i&&(r.addClass("selected"),this.recent<=0&&i.scrollTop(r.offset().top-i.offset().top))}else this.setRawValue(t)}},itemClicked:function(e){var t=$(e.target).closest("li"),n=this.store.findWhere({id:t.attr("id")});this.addItemToRecent(n),Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments)},onInsertItem:function(e){$(this.el).find("ul").prepend(_.template(['
  • ','',"
  • "].join(""),{item:e.attributes,scope:this}))},onRemoveItem:function(e,t,n){$(this.el).find("ul > li#"+e.id).remove()},onBeforeShowMenu:function(e){Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments);if(!this.getSelectedRecord()&&!!this.getRawValue()){var t=this.store.where({name:this.getRawValue()});t&&t.length&&this.selectRecord(t[t.length-1])}},onAfterShowMenu:function(e){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,e)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)},onAfterHideMenu:function(e){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(e){if(e.get("type")!=FONT_TYPE_RECENT&&!this.store.findWhere({name:e.get("name"),type:FONT_TYPE_RECENT})){var t=this.store.where({type:FONT_TYPE_RECENT});t.length0&&s.length>0){i.addClass("selected");var o=i.position().top,u=s.scrollTop();o!=0&&s.scrollTop(u+o)}}},updateVisibleFontsTiles:function(r,i){var s=this,o=0,a=s.store.length,f=0;s.tiles||(s.tiles=[]);if(a!==s.tiles.length)for(o=s.tiles.length;o=0;--e)this.tiles[e]&&(this.tiles[e].parentNode.removeChild(this.tiles[e]),this.tiles[e]=null)}}}())});if(Common===undefined)var Common={};define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0},template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),this.options.additionalMenuItems!=null&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(e){if(!this.rendered){var t=this;t.trigger("render:before",t),t.cmpEl=$(t.el);var n=t.template({id:t.id,cls:t.cls,style:t.style});e?(t.setElement(e,!1),t.cmpEl=$(n),e.html(t.cmpEl)):t.cmpEl.html(n),t.rootWidth=t.cmpEl.width(),t.rootHeight=t.cmpEl.height(),t.fieldPicker.render($(".view",t.cmpEl)),t.openButton.render($(".button",t.cmpEl)),t.menuPicker.render($(".menu-picker-container",t.cmpEl)),t.openButton.menu.cmpEl&&t.openButton.menu.cmpEl&&(t.openButton.menu.menuAlignEl=t.cmpEl,t.openButton.menu.cmpEl.css("min-width",t.itemWidth),t.openButton.menu.on("show:before",_.bind(t.onBeforeShowMenu,t)),t.openButton.menu.on("show:after",_.bind(t.onAfterShowMenu,t)),t.openButton.cmpEl.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),t.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t))),t.options.hint&&(t.cmpEl.attr("data-toggle","tooltip"),t.cmpEl.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"})),t.fieldPicker.on("item:select",_.bind(t.onFieldPickerSelect,t)),t.menuPicker.on("item:select",_.bind(t.onMenuPickerSelect,t)),t.fieldPicker.on("item:click",_.bind(t.onFieldPickerClick,t)),t.menuPicker.on("item:click",_.bind(t.onMenuPickerClick,t)),t.fieldPicker.on("item:contextmenu",_.bind(t.onPickerItemContextMenu,t)),t.menuPicker.on("item:contextmenu",_.bind(t.onPickerItemContextMenu,t)),t.fieldPicker.el.addEventListener("contextmenu",_.bind(t.onPickerComboContextMenu,t),!1),t.menuPicker.el.addEventListener("contextmenu",_.bind(t.onPickerComboContextMenu,t),!1),t.onResize(),t.rendered=!0,t.trigger("render:after",t)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var e=this,t=this.cmpEl.width(),n=this.cmpEl.height();if(this.rootWidth!=t||this.rootHeight!=n)this.rootWidth=t,this.rootHeight=n,setTimeout(function(){e.openButton.menu.cmpEl.outerWidth(),e.rootWidth=e.cmpEl.width()},10),this.onResize()}},onResize:function(){if(this.openButton){var e=$("button",this.openButton.cmpEl);e&&e.css({width:$(".button",this.cmpEl).width(),height:$(".button",this.cmpEl).height()}),this.openButton.menu.hide();var t=this.menuPicker;if(t){var n=t.getSelectedRec();n&&(n=n[0],this.fillComboView(n||t.store.at(0),!!n,!0)),t.onResize()}}this.isSuspendEvents||this.trigger("resize",this)},onBeforeShowMenu:function(e){var t=this;if(_.isFunction(t.beforeOpenHandler))t.beforeOpenHandler(t,e);else if(t.openButton.menu.cmpEl){var n=0;try{var r=$($(".dropdown-menu .dataview.inner .style",t.cmpEl)[0]);n=r?parseInt(r.css("margin-left"))+parseInt(r.css("margin-right")):0}catch(e){}t.openButton.menu.cmpEl.css({width:Math.round((t.cmpEl.width()+n*t.fieldPicker.store.length)/t.itemWidth-.2)*(t.itemWidth+n),"min-height":this.cmpEl.height()})}if(t.options.hint){var i=t.cmpEl.data("bs.tooltip");i&&(i.dontShow===undefined&&(i.dontShow=!0),i.hide())}this.menuPicker.selectedBeforeHideRec=null},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault();if(this.isStylesNotClosable)return!1},onAfterShowMenu:function(e){var t=this;t.menuPicker.scroller&&t.menuPicker.scroller.update({includePadding:!0,suppressScrollX:!0,alwaysVisibleY:!0})},onAfterHideMenu:function(e,t){this.menuPicker.selectedBeforeHideRec=this.menuPicker.getSelectedRec()[0],this.showLast?this.menuPicker.showLastSelected():this.menuPicker.deselectAll(),this.trigger("hide:after",this,e,t)},onFieldPickerSelect:function(e,t,n){},onMenuPickerSelect:function(e,t,n,r){this.needFillComboView=this.disabled;if(this.disabled||r===!0)return;this.fillComboView(n,!1),n&&!this.isSuspendEvents&&this.trigger("select",this,n)},onFieldPickerClick:function(e,t,n){if(this.disabled)return;this.isSuspendEvents||this.trigger("click",this,n);if(this.options.hint){var r=this.cmpEl.data("bs.tooltip");r&&(r.dontShow===undefined&&(r.dontShow=!0),r.hide())}this.showLast||this.fieldPicker.deselectAll()},onMenuPickerClick:function(e,t,n){if(this.disabled)return;this.isSuspendEvents||this.trigger("click",this,n)},onPickerItemContextMenu:function(e,t,n,r){if(this.disabled)return;return this.isSuspendEvents||this.trigger("contextmenu",this,n,r),r.preventDefault(),r.stopPropagation(),!1},onPickerComboContextMenu:function(e){if(this.disabled)return;this.isSuspendEvents||this.trigger("contextmenu",this,undefined,e)},setDisabled:function(e){this.disabled=e;if(!this.rendered)return;this.cmpEl.toggleClass("disabled",e),$("button",this.openButton.cmpEl).toggleClass("disabled",e),this.fieldPicker.setDisabled(e);if(this.needFillComboView&&!e){var t=this.menuPicker;if(t){var n=t.getSelectedRec();n&&(n=n[0],this.fillComboView(n||t.store.at(0),!1))}}},isDisabled:function(){return this.disabled},fillComboView:function(e,t,n){if(!_.isUndefined(e)&&e instanceof Backbone.Model){this.needFillComboView=!1;var r=this,i=r.menuPicker.store,s=$(r.fieldPicker.el);if(i){if(n||!r.fieldPicker.store.findWhere({id:e.get("id")})){if(r.itemMarginLeft===undefined){var o=$($(this.menuPicker.el).find(".inner > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);o.length>0&&(r.itemMarginLeft=parseInt(o.css("margin-left")),r.itemMarginRight=parseInt(o.css("margin-right")),r.itemPaddingLeft=parseInt(o.css("padding-left")),r.itemPaddingRight=parseInt(o.css("padding-right")),r.itemBorderLeft=parseInt(o.css("border-left-width")),r.itemBorderRight=parseInt(o.css("border-right-width")))}r.fieldPicker.store.reset([]);var u=i.indexOf(e),a=i.length,f=Math.floor(s.width()/(r.itemWidth+(r.itemMarginLeft||0)+(r.itemMarginRight||0)+(r.itemPaddingLeft||0)+(r.itemPaddingRight||0)+(r.itemBorderLeft||0)+(r.itemBorderRight||0))),l=[];s.height()/r.itemHeight>2&&(f*=Math.floor(s.height()/r.itemHeight));if(u<0)return;u=Math.floor(u/f)*f,a-u1?e/2:e)},setItemHeight:function(e){this.itemHeight!=e&&(this.itemHeight=window.devicePixelRatio>1?e/2:e)},removeTips:function(){var e=this.menuPicker;_.each(e.dataViewItems,function(e){var t=e.$el.data("bs.tooltip");t&&t.tip().remove()},e)}})});if(Common===undefined)var Common={};define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){var e;return{options:{target:$(document.body),text:"",placement:"right"},template:_.template(['
    ','
    ','
    ',"
    ",'
    <%= scope.text %>
    ','
    ',"
    ",'',"
    ","
    "].join("")),initialize:function(e){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,e),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.placement=this.options.placement},render:function(){return e=$(this.template({scope:this})),e.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),e.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this)),$(document.body).append(e),this.applyPlacement(),this},show:function(){e?(this.applyPlacement(),e.show()):this.render()},hide:function(){e&&e.hide()},applyPlacement:function(){var t=this.target.offset();this.placement=="top"?e.css({bottom:Common.Utils.innerHeight()-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"}):e.css({top:t.top+this.target.height()/2+"px",left:t.left+this.target.width()+"px"})},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
    Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("spreadsheeteditor/main/app/view/Toolbar",["jquery","underscore","backbone","text!spreadsheeteditor/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(e,t,n,r){"use strict";SSE.enumLock={editCell:"cell-editing",editFormula:"is-formula",editText:"is-text",selImage:"sel-image",selShape:"sel-shape",selShapeText:"sel-shape-txt",selChart:"sel-chart",selChartText:"sel-chart-txt",selRange:"sel-range",lostConnect:"disconnect",coAuth:"co-auth",coAuthText:"co-auth-text",ruleMerge:"rule-btn-merge",ruleFilter:"rule-filter",ruleDelFilter:"rule-clear-filter",menuFileOpen:"menu-file-open",cantPrint:"cant-print",multiselect:"is-multiselect",cantHyperlink:"cant-hyperlink"},SSE.Views.Toolbar=n.View.extend(t.extend({el:"#toolbar",template:t.template(r),events:{},initialize:function(){function i(){return{isDummy:!0,on:function(){}}}var n=this,r={};n.SchemeNames=[n.txtScheme1,n.txtScheme2,n.txtScheme3,n.txtScheme4,n.txtScheme5,n.txtScheme6,n.txtScheme7,n.txtScheme8,n.txtScheme9,n.txtScheme10,n.txtScheme11,n.txtScheme12,n.txtScheme13,n.txtScheme14,n.txtScheme15,n.txtScheme16,n.txtScheme17,n.txtScheme18,n.txtScheme19,n.txtScheme20,n.txtScheme21],n._state={hasCollaborativeChanges:undefined},n.btnSaveCls="btn-save",n.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),n.ascFormatOptions={General:"General",Number:"0.00",Currency:"$#,##0.00",Accounting:'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',DateShort:"m/d/yyyy",DateLong:"[$-F800]dddd, mmmm dd, yyyy",Time:"[$-F400]h:mm:ss AM/PM",Percentage:"0.00%",Percent:"0%",Fraction:"# ?/?",Scientific:"0.00E+00",Text:"@"},n.numFormatData=[{value:Asc.c_oAscNumFormatType.General,format:this.ascFormatOptions.General,displayValue:this.txtGeneral,exampleval:"100"},{value:Asc.c_oAscNumFormatType.Number,format:this.ascFormatOptions.Number,displayValue:this.txtNumber,exampleval:"100,00"},{value:Asc.c_oAscNumFormatType.Scientific,format:this.ascFormatOptions.Scientific,displayValue:this.txtScientific,exampleval:"1,00E+02"},{value:Asc.c_oAscNumFormatType.Accounting,format:this.ascFormatOptions.Accounting,displayValue:this.txtAccounting,exampleval:"100,00 $"},{value:Asc.c_oAscNumFormatType.Currency,format:this.ascFormatOptions.Currency,displayValue:this.txtCurrency,exampleval:"100,00 $"},{value:Asc.c_oAscNumFormatType.Date,format:"MM-dd-yyyy",displayValue:this.txtDate,exampleval:"04-09-1900"},{value:Asc.c_oAscNumFormatType.Time,format:"HH:MM:ss",displayValue:this.txtTime,exampleval:"00:00:00"},{value:Asc.c_oAscNumFormatType.Percent,format:this.ascFormatOptions.Percentage,displayValue:this.txtPercentage,exampleval:"100,00%"},{value:Asc.c_oAscNumFormatType.Fraction,format:this.ascFormatOptions.Fraction,displayValue:this.txtFraction,exampleval:"100"},{value:Asc.c_oAscNumFormatType.Text,format:this.ascFormatOptions.Text,displayValue:this.txtText,exampleval:"100"}];var s=SSE.enumLock;n.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:n.tipFontSize,lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"}]}),n.btnNewDocument=new Common.UI.Button({id:"id-toolbar-btn-newdocument",cls:"btn-toolbar",iconCls:"btn-newdocument",lock:[s.lostConnect]}),n.btnOpenDocument=new Common.UI.Button({id:"id-toolbar-btn-opendocument",cls:"btn-toolbar",iconCls:"btn-opendocument",lock:[s.lostConnect]}),n.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:n.tipFontName,lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],store:new Common.Collections.Fonts}),n.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print",lock:[s.editCell,s.cantPrint]}),n.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:n.btnSaveCls}),n.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),n.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste",lock:[s.coAuth,s.lostConnect]}),n.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo",disabled:!0,lock:[s.lostConnect]}),n.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo",disabled:!0,lock:[s.lostConnect]}),n.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"btn-incfont",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect]}),n.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"btn-decfont",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect]}),n.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],enableToggle:!0}),n.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],enableToggle:!0}),n.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],enableToggle:!0}),n.mnuTextColorPicker=i(),n.btnTextColor=(new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",split:!0,lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],menu:new Common.UI.Menu({items:[{template:t.template('
    ')},{template:t.template('
    '+n.textNewColor+"")}]})})).on("render:after",function(t){var r=e('
    ');e("button:first-child",t.cmpEl).append(r),r.css("background-color",t.currentColor||"transparent"),n.mnuTextColorPicker=new Common.UI.ThemeColorPalette({el:e("#id-toolbar-menu-fontcolor")})}),n.mnuBackColorPicker=i(),n.btnBackColor=(new Common.UI.Button({id:"id-toolbar-btn-fillparag",cls:"btn-toolbar",iconCls:"btn-fillparag",split:!0,lock:[s.selImage,s.editCell,s.coAuth,s.coAuthText,s.lostConnect],menu:new Common.UI.Menu({items:[{template:t.template('
    ')},{template:t.template(''+n.textNewColor+"")}]})})).on("render:after",function(t){var r=e('
    ');e("button:first-child",t.cmpEl).append(r),r.css("background-color",t.currentColor||"transparent"),n.mnuBackColorPicker=new Common.UI.ThemeColorPalette({el:e("#id-toolbar-menu-paracolor"),transparent:!0})}),n.btnBorders=new Common.UI.Button({id:"id-toolbar-btn-borders",cls:"btn-toolbar",iconCls:"btn-border-out",icls:"btn-border-out",borderId:"outer",borderswidth:"thin",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],split:!0,menu:!0}),n.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"btn-align-left",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"btn-align-center",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"btn-align-right",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"btn-align-just",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnMerge=new Common.UI.Button({id:"id-toolbar-rtn-merge",cls:"btn-toolbar",iconCls:"btn-merge",enableToggle:!0,allowDepress:!0,split:!0,lock:[s.editCell,s.selShape,s.selShapeText,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.ruleMerge],menu:new Common.UI.Menu({items:[{caption:n.txtMergeCenter,value:Asc.c_oAscMergeOptions.MergeCenter},{caption:n.txtMergeAcross,value:Asc.c_oAscMergeOptions.MergeAcross},{caption:n.txtMergeCells,value:Asc.c_oAscMergeOptions.Merge},{caption:n.txtUnmerge,value:Asc.c_oAscMergeOptions.None}]})}),n.btnAlignTop=new Common.UI.Button({id:"id-toolbar-rtn-valign-top",cls:"btn-toolbar",iconCls:"btn-valign-top",lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),n.btnAlignMiddle=new Common.UI.Button({id:"id-toolbar-rtn-valign-middle",cls:"btn-toolbar",iconCls:"btn-valign-middle",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"vAlignGroup"}),n.btnAlignBottom=new Common.UI.Button({id:"id-toolbar-rtn-valign-bottom",cls:"btn-toolbar",iconCls:"btn-valign-bottom",lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),n.btnWrap=new Common.UI.Button({id:"id-toolbar-rtn-wrap",cls:"btn-toolbar",iconCls:"btn-wrap",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],enableToggle:!0,allowDepress:!0}),n.btnTextOrient=new Common.UI.Button({id:"id-toolbar-rtn-textorient",cls:"btn-toolbar",iconCls:"btn-text-orient",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({items:[{caption:n.textHorizontal,iconCls:"mnu-direct-horiz",checkable:!0,toggleGroup:"textorientgroup",value:"horiz"},{caption:n.textCounterCw,iconCls:"mnu-direct-ccw",checkable:!0,toggleGroup:"textorientgroup",value:"countcw"},{caption:n.textClockwise,iconCls:"mnu-direct-cw",checkable:!0,toggleGroup:"textorientgroup",value:"clockwise"},{caption:n.textRotateUp,iconCls:"mnu-direct-rup",checkable:!0,toggleGroup:"textorientgroup",value:"rotateup"},{caption:n.textRotateDown,iconCls:"mnu-direct-rdown",checkable:!0,toggleGroup:"textorientgroup",value:"rotatedown"}]})}),n.btnInsertImage=new Common.UI.Button({id:"id-toolbar-btn-insertimage",cls:"btn-toolbar",iconCls:"btn-insertimage",lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({items:[{caption:n.mniImageFromFile,value:"file"},{caption:n.mniImageFromUrl,value:"url"}]})}),n.btnInsertHyperlink=new Common.UI.Button({id:"id-toolbar-btn-inserthyperlink",cls:"btn-toolbar",iconCls:"btn-inserthyperlink",lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.selShape,s.cantHyperlink,s.multiselect,s.lostConnect,s.coAuth]}),n.btnInsertChart=new Common.UI.Button({id:"id-toolbar-btn-insertchart",cls:"btn-toolbar",iconCls:"btn-insertchart",lock:[s.editCell,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:t.template('')}]})}),n.btnEditChart=new Common.UI.Button({id:"id-toolbar-rtn-edit-chart",cls:"btn-toolbar btn-text-value",caption:n.tipEditChart,lock:[s.lostConnect],style:"width: 120px;"}),n.btnInsertShape=new Common.UI.Button({id:"id-toolbar-btn-insertshape",cls:"btn-toolbar",iconCls:"btn-insertshape",enableToggle:!0,lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),n.btnInsertText=new Common.UI.Button({id:"id-toolbar-btn-inserttext",cls:"btn-toolbar",iconCls:"btn-text",lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],enableToggle:!0,split:!0,menu:new Common.UI.Menu({items:[{caption:this.textInsText,value:"text"},this.mnuInsertTextArt=new Common.UI.MenuItem({caption:this.textInsTextArt,value:"art",menu:new Common.UI.Menu({menuAlign:"tl-tr",cls:"menu-shapes",items:[{template:t.template('
    ')}]})})]})}),this.btnInsertEquation=new Common.UI.Button({id:"id-toolbar-btn-insertequation",cls:"btn-toolbar",iconCls:"btn-insertequation",split:!0,lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),n.btnSortDown=new Common.UI.Button({id:"id-toolbar-btn-sort-down",cls:"btn-toolbar",iconCls:"btn-sort-down",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter]}),n.btnSortUp=new Common.UI.Button({id:"id-toolbar-btn-sort-up",cls:"btn-toolbar",iconCls:"btn-sort-up",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter]}),n.btnSetAutofilter=new Common.UI.Button({id:"id-toolbar-btn-setautofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter],enableToggle:!0}),n.btnClearAutofilter=new Common.UI.Button({id:"id-toolbar-btn-clearfilter",cls:"btn-toolbar",iconCls:"btn-clear-filter",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleDelFilter]}),n.btnSearch=new Common.UI.Button({id:"id-toolbar-btn-search",cls:"btn-toolbar",iconCls:"btn-search",lock:[s.lostConnect]}),n.btnTableTemplate=new Common.UI.Button({id:"id-toolbar-btn-ttempl",cls:"btn-toolbar",iconCls:"btn-ttempl",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter,s.multiselect],menu:new Common.UI.Menu({items:[{template:t.template('
    ')}]})}),n.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",enableKeyEvents:!0,itemWidth:112,itemHeight:38,hint:this.tipCellStyle,menuMaxHeight:226,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],beforeOpenHandler:function(t){var n=this,r=n.openButton.menu,i=6;if(r.cmpEl){var s=e(n.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=-1,u=s.is(":visible")?parseInt(s.css("width")):n.itemWidth+parseInt(s.css("padding-left"))+parseInt(s.css("padding-right"))+parseInt(s.css("border-left-width"))+parseInt(s.css("border-right-width")),a=n.menuPicker.store.length>=i?i:n.menuPicker.store.length,f=Math.min(n.menuPicker.store.length,Math.round(e(".dataview",e(n.fieldPicker.el)).width()/(o+u)+.5));f=f",'
  • ','
    <%= scope.getDisplayValue(item) %>
    ','
    <%= item.exampleval ? item.exampleval : "" %>
    ',"
  • ","<% }); %>",'
  • ','
  • '+n.textMoreFormats+"
  • "].join(""));n.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:n.tipNumFormat,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.selRange,s.lostConnect,s.coAuth],itemsTemplate:o,editable:!1,data:n.numFormatData}),n.btnPercentStyle=new Common.UI.Button({id:"id-toolbar-btn-percent-style",cls:"btn-toolbar",iconCls:"btn-percent-style",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],styleName:"Percent"}),n.btnCurrencyStyle=new Common.UI.Button({id:"id-toolbar-btn-accounting-style",cls:"btn-toolbar",iconCls:"btn-currency-style",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],styleName:"Currency",split:!0,menu:new Common.UI.Menu({style:"min-width: 120px;",items:[{caption:n.txtDollar,value:1033},{caption:n.txtEuro,value:1031},{caption:n.txtPound,value:2057},{caption:n.txtRouble,value:1049},{caption:n.txtYen,value:1041}]})}),n.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth]}),n.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth]}),n.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[s.editText,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.selRange,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:"SUM",value:"SUM"},{caption:"MIN",value:"MIN"},{caption:"MAX",value:"MAX"},{caption:"COUNT",value:"COUNT"},{caption:"--"},{caption:n.txtAdditional,value:"more"}]})}),n.btnNamedRange=new Common.UI.Button({id:"id-toolbar-btn-insertrange",cls:"btn-toolbar",iconCls:"btn-named-range",lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.selRange],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:n.txtManageRange,lock:[s.editCell],value:"manage"},{caption:n.txtNewRange,lock:[s.editCell],value:"new"},{caption:n.txtPasteRange,value:"paste"}]})}),n.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clear",cls:"btn-toolbar",iconCls:"btn-clearstyle",lock:[s.lostConnect,s.coAuth,s.selRange],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:n.txtClearAll,value:Asc.c_oAscCleanOptions.All},{caption:n.txtClearText,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Text},{caption:n.txtClearFormat,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Format},{caption:n.txtClearComments,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Comments},{caption:n.txtClearHyper,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),n.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",lock:[s.editCell,s.lostConnect,s.coAuth,s.selChart],enableToggle:!0}),n.btnAddCell=new Common.UI.Button({id:"id-toolbar-btn-addcell",cls:"btn-toolbar",iconCls:"btn-addcell",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({items:[{caption:n.textInsRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:n.textInsDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:n.textEntireRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:n.textEntireCol,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),n.btnDeleteCell=new Common.UI.Button({id:"id-toolbar-btn-delcell",cls:"btn-toolbar",iconCls:"btn-delcell",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({items:[{caption:n.textDelLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:n.textDelUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:n.textEntireRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:n.textEntireCol,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),n.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],menu:(new Common.UI.Menu({items:[],maxHeight:600,restoreHeight:600})).on("show:before",function(t){this.scroller||(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0}))}).on("show:after",function(t,n){var r=e(this.el).find(".dropdown-menu "),i=Common.Utils.innerHeight(),s=r.outerHeight(),o=parseInt(r.css("top"));s>i?(r.css("max-height",i-parseInt(r.css("padding-top"))-parseInt(r.css("padding-bottom"))-5+"px"),this.scroller.update({minScrollbarLength:40})):r.height()i&&r.css("top",0),this.scroller.update({minScrollbarLength:40}))})}),n.mnuZoomIn=i(),n.mnuZoomOut=i();var u=function(e){var t={};for(var n in e)t[n]=typeof e[n]=="object"?u(e[n]):e[n];return t};this.mnuitemHideHeadings={conf:{checked:!1},setChecked:function(e){this.conf.checked=e},isChecked:function(){return this.conf.checked}},this.mnuitemHideGridlines=u(this.mnuitemHideHeadings),this.mnuitemFreezePanes=u(this.mnuitemHideHeadings),this.mnuZoom={options:{value:100}},n.btnShowMode=new Common.UI.Button({id:"id-toolbar-btn-showmode",cls:"btn-toolbar",iconCls:"btn-showmode",lock:[s.menuFileOpen,s.editCell],menu:!0}),n.btnSettings=new Common.UI.Button({id:"id-toolbar-btn-settings",cls:"btn-toolbar",iconCls:"btn-settings"}),n.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",lock:[s.editCell,s.selChart,s.selChartText,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({items:[{caption:n.tipAlignLeft,iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",checked:!0,value:"left"},{caption:n.tipAlignCenter,iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:"center"},{caption:n.tipAlignRight,iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:"right"},{caption:n.tipAlignJust,iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:"justify"}]})}),n.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",iconCls:"btn-valign-bottom",icls:"btn-valign-bottom",lock:[s.editCell,s.selChart,s.selChartText,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({items:[{caption:n.tipAlignTop,iconCls:"mnu-valign-top",icls:"btn-valign-top",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:"top"},{caption:n.tipAlignCenter,iconCls:"mnu-valign-middle",icls:"btn-valign-middle",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:"center"},{caption:n.tipAlignBottom,iconCls:"mnu-valign-bottom",icls:"btn-valign-bottom",checkable:!0,allowDepress:!0,checked:!0,toggleGroup:"valignGroup",value:"bottom"}]})}),n.btnAutofilter=new Common.UI.Button({id:"id-toolbar-btn-autofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter],menu:new Common.UI.Menu({items:[n.mnuitemSortAZ=new Common.UI.MenuItem({caption:n.txtSortAZ,iconCls:"mnu-sort-asc",lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleFilter],value:Asc.c_oAscSortOptions.Ascending}),n.mnuitemSortZA=new Common.UI.MenuItem({caption:n.txtSortZA,iconCls:"mnu-sort-desc",lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleFilter],value:Asc.c_oAscSortOptions.Descending}),n.mnuitemAutoFilter=new Common.UI.MenuItem({caption:n.txtFilter,iconCls:"mnu-filter-add",checkable:!0,lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleFilter],value:"set-filter"}),n.mnuitemClearFilter=new Common.UI.MenuItem({caption:n.txtClearFilter,iconCls:"mnu-filter-clear",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleDelFilter],value:"clear-filter"})]})}),n.lockControls=[n.cmbFontName,n.cmbFontSize,n.btnIncFontSize,n.btnDecFontSize,n.btnBold,n.btnItalic,n.btnUnderline,n.btnTextColor,n.btnHorizontalAlign,n.btnAlignLeft,n.btnAlignCenter,n.btnAlignRight,n.btnAlignJust,n.btnVerticalAlign,n.btnAlignTop,n.btnAlignMiddle,n.btnAlignBottom,n.btnWrap,n.btnTextOrient,n.btnBackColor,n.btnMerge,n.btnInsertFormula,n.btnNamedRange,n.btnIncDecimal,n.btnInsertShape,n.btnInsertEquation,n.btnInsertText,n.btnSortUp,n.btnSortDown,n.btnSetAutofilter,n.btnClearAutofilter,n.btnTableTemplate,n.btnPercentStyle,n.btnCurrencyStyle,n.btnDecDecimal,n.btnAddCell,n.btnDeleteCell,n.cmbNumberFormat,n.btnBorders,n.btnInsertImage,n.btnInsertHyperlink,n.btnInsertChart,n.btnColorSchemas,n.btnAutofilter,n.btnCopy,n.btnPaste,n.btnSettings,n.listStyles,n.btnPrint,n.btnShowMode,n.btnClearStyle,n.btnCopyStyle];var a=Common.localStorage.getItem("sse-hide-synch");n.showSynchTip=!a||parseInt(a)!=1,n.needShowSynchTip=!1;var f=[n.cmbFontName,n.cmbFontSize,n.btnAlignLeft,n.btnAlignCenter,n.btnAlignRight,n.btnAlignJust,n.btnAlignTop,n.btnAlignMiddle,n.btnAlignBottom,n.btnHorizontalAlign,n.btnVerticalAlign,n.btnInsertImage,n.btnInsertText,n.btnInsertShape,n.btnInsertEquation,n.btnIncFontSize,n.btnDecFontSize,n.btnBold,n.btnItalic,n.btnUnderline,n.btnTextColor,n.btnBackColor,n.btnInsertHyperlink,n.btnBorders,n.btnTextOrient,n.btnPercentStyle,n.btnCurrencyStyle,n.btnColorSchemas,n.btnSettings,n.btnInsertFormula,n.btnNamedRange,n.btnDecDecimal,n.btnIncDecimal,n.cmbNumberFormat,n.btnWrap,n.btnInsertChart,n.btnMerge,n.btnAddCell,n.btnDeleteCell,n.btnShowMode,n.btnPrint,n.btnAutofilter,n.btnSortUp,n.btnSortDown,n.btnTableTemplate,n.btnSetAutofilter,n.btnClearAutofilter,n.btnSave,n.btnClearStyle,n.btnCopyStyle,n.btnCopy,n.btnPaste];return t.each(f,function(e){e&&t.isFunction(e.setDisabled)&&e.setDisabled(!0)}),this},lockToolbar:function(e,n,r){function s(e,r){if(t.contains(e.options.lock,r)){var i=e.keepState.indexOf(r);n?i<0&&e.keepState.push(r):i<0||e.keepState.splice(i,1)}}!r&&(r={});var i=r.array||this.lockControls;r.merge&&(i=t.union(this.lockControls,i)),t.each(i,function(n){t.isFunction(n.setDisabled)&&(!n.keepState&&(n.keepState=[]),r.clear&&r.clear.length>0&&n.keepState.length>0&&(n.keepState=t.difference(n.keepState,r.clear)),t.isArray(e)?t.each(e,function(e){s(n,e)}):s(n,e),n.keepState.length>0?!n.isDisabled()&&n.setDisabled(!0):n.isDisabled()&&n.setDisabled(!1))})},render:function(t){var n=this,r=e(this.el),i=JSON.parse(Common.localStorage.getItem("sse-toolbar-compact"));return i=!!(i!==null&&parseInt(i)==1||i===null&&t.customization&&t.customization.compactToolbar),this.trigger("render:before",this),r.html(this.template({isEditDiagram:t.isEditDiagram,isEditMailMerge:t.isEditMailMerge,isCompactView:i})),n.rendererComponents(t.isEditDiagram?"diagram":t.isEditMailMerge?"merge":i?"short":"full"),this.trigger("render:after",this),this},rendererComponents:function(t){var n=function(t,n){var r=e(t),i=r.get(0);i&&(n.rendered?(n.el=document.getElementById(n.id),n.el&&i.appendChild(document.getElementById(n.id))):n.render(r))};n("#id-toolbar-"+t+"-placeholder-field-fontname",this.cmbFontName),n("#id-toolbar-"+t+"-placeholder-field-fontsize",this.cmbFontSize),n("#id-toolbar-"+t+"-placeholder-btn-newdocument",this.btnNewDocument),n("#id-toolbar-"+t+"-placeholder-btn-opendocument",this.btnOpenDocument),n("#id-toolbar-"+t+"-placeholder-btn-print",this.btnPrint),n("#id-toolbar-"+t+"-placeholder-btn-save",this.btnSave),n("#id-toolbar-"+t+"-placeholder-btn-undo",this.btnUndo),n("#id-toolbar-"+t+"-placeholder-btn-redo",this.btnRedo),n("#id-toolbar-"+t+"-placeholder-btn-copy",this.btnCopy),n("#id-toolbar-"+t+"-placeholder-btn-paste",this.btnPaste),n("#id-toolbar-"+t+"-placeholder-btn-incfont",this.btnIncFontSize),n("#id-toolbar-"+t+"-placeholder-btn-decfont",this.btnDecFontSize),n("#id-toolbar-"+t+"-placeholder-btn-bold",this.btnBold),n("#id-toolbar-"+t+"-placeholder-btn-italic",this.btnItalic),n("#id-toolbar-"+t+"-placeholder-btn-underline",this.btnUnderline),n("#id-toolbar-"+t+"-placeholder-btn-fontcolor",this.btnTextColor),n("#id-toolbar-"+t+"-placeholder-btn-fillparag",this.btnBackColor),n("#id-toolbar-"+t+"-placeholder-btn-borders",this.btnBorders),n("#id-toolbar-"+t+"-placeholder-btn-align-left",this.btnAlignLeft),n("#id-toolbar-"+t+"-placeholder-btn-align-center",this.btnAlignCenter),n("#id-toolbar-"+t+"-placeholder-btn-align-right",this.btnAlignRight),n("#id-toolbar-"+t+"-placeholder-btn-align-just",this.btnAlignJust),n("#id-toolbar-"+t+"-placeholder-btn-merge",this.btnMerge),n("#id-toolbar-"+t+"-placeholder-btn-top",this.btnAlignTop),n("#id-toolbar-"+t+"-placeholder-btn-middle",this.btnAlignMiddle),n("#id-toolbar-"+t+"-placeholder-btn-bottom",this.btnAlignBottom),n("#id-toolbar-"+t+"-placeholder-btn-wrap",this.btnWrap),n("#id-toolbar-"+t+"-placeholder-btn-text-orient",this.btnTextOrient),n("#id-toolbar-"+t+"-placeholder-btn-insertimage",this.btnInsertImage),n("#id-toolbar-"+t+"-placeholder-btn-inserthyperlink",this.btnInsertHyperlink),n("#id-toolbar-"+t+"-placeholder-btn-insertshape",this.btnInsertShape),n("#id-toolbar-"+t+"-placeholder-btn-text",this.btnInsertText),n("#id-toolbar-"+t+"-placeholder-btn-insertequation",this.btnInsertEquation),n("#id-toolbar-"+t+"-placeholder-btn-sortdesc",this.btnSortDown),n("#id-toolbar-"+t+"-placeholder-btn-sortasc",this.btnSortUp),n("#id-toolbar-"+t+"-placeholder-btn-setfilter",this.btnSetAutofilter),n("#id-toolbar-"+t+"-placeholder-btn-clear-filter",this.btnClearAutofilter),n("#id-toolbar-"+t+"-placeholder-btn-table-tpl",this.btnTableTemplate),n("#id-toolbar-"+t+"-placeholder-btn-format",this.cmbNumberFormat),n("#id-toolbar-"+t+"-placeholder-btn-percents",this.btnPercentStyle),n("#id-toolbar-"+t+"-placeholder-btn-currency",this.btnCurrencyStyle),n("#id-toolbar-"+t+"-placeholder-btn-digit-dec",this.btnDecDecimal),n("#id-toolbar-"+t+"-placeholder-btn-digit-inc",this.btnIncDecimal),n("#id-toolbar-"+t+"-placeholder-btn-formula",this.btnInsertFormula),n("#id-toolbar-"+t+"-placeholder-btn-named-range",this.btnNamedRange),n("#id-toolbar-"+t+"-placeholder-btn-clear",this.btnClearStyle),n("#id-toolbar-"+t+"-placeholder-btn-copystyle",this.btnCopyStyle),n("#id-toolbar-"+t+"-placeholder-btn-cell-ins",this.btnAddCell),n("#id-toolbar-"+t+"-placeholder-btn-cell-del",this.btnDeleteCell),n("#id-toolbar-"+t+"-placeholder-btn-colorschemas",this.btnColorSchemas),n("#id-toolbar-"+t+"-placeholder-btn-hidebars",this.btnShowMode),n("#id-toolbar-"+t+"-placeholder-btn-settings",this.btnSettings),n("#id-toolbar-"+t+"-placeholder-btn-search",this.btnSearch),n("#id-toolbar-"+t+"-placeholder-btn-insertchart",this.btnInsertChart),n("#id-toolbar-diagram-placeholder-btn-chart",this.btnEditChart),n("#id-toolbar-short-placeholder-btn-halign",this.btnHorizontalAlign),n("#id-toolbar-short-placeholder-btn-valign",this.btnVerticalAlign),n("#id-toolbar-short-placeholder-btn-filter",this.btnAutofilter),n("#id-toolbar-full-placeholder-field-styles",this.listStyles)},createDelayedElements:function(){var n=this;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.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),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.btnTextColor.updateHint(this.tipFontColor),this.btnBackColor.updateHint(this.tipPrColor),this.btnBorders.updateHint(this.tipBorders),this.btnAlignLeft.updateHint(this.tipAlignLeft),this.btnAlignCenter.updateHint(this.tipAlignCenter),this.btnAlignRight.updateHint(this.tipAlignRight),this.btnAlignJust.updateHint(this.tipAlignJust),this.btnMerge.updateHint(this.tipMerge),this.btnAlignTop.updateHint(this.tipAlignTop),this.btnAlignMiddle.updateHint(this.tipAlignMiddle),this.btnAlignBottom.updateHint(this.tipAlignBottom),this.btnWrap.updateHint(this.tipWrap),this.btnTextOrient.updateHint(this.tipTextOrientation),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChartSpark),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnSortDown.updateHint(this.txtSortAZ),this.btnSortUp.updateHint(this.txtSortZA),this.btnSetAutofilter.updateHint(this.txtFilter+" (Ctrl+Shift+L)"),this.btnClearAutofilter.updateHint(this.txtClearFilter),this.btnSearch.updateHint(this.txtSearch),this.btnTableTemplate.updateHint(this.txtTableTemplate),this.btnPercentStyle.updateHint(this.tipDigStylePercent),this.btnCurrencyStyle.updateHint(this.tipDigStyleAccounting),this.btnDecDecimal.updateHint(this.tipDecDecimal),this.btnIncDecimal.updateHint(this.tipIncDecimal),this.btnInsertFormula.updateHint(this.txtFormula),this.btnNamedRange.updateHint(this.txtNamedRange),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle),this.btnAddCell.updateHint(this.tipInsertOpt),this.btnDeleteCell.updateHint(this.tipDeleteOpt),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnShowMode.updateHint(this.tipViewSettings),this.btnSettings.updateHint(this.tipAdvSettings),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnVerticalAlign.updateHint(this.tipVAligh),this.btnAutofilter.updateHint(this.tipAutofilter);if(this.btnShowMode.rendered){this.btnShowMode.setMenu(new Common.UI.Menu({items:[this.mnuitemCompactToolbar=new Common.UI.MenuItem({caption:this.textCompactToolbar,checkable:!0,value:"compact"}),this.mnuitemHideTitleBar=new Common.UI.MenuItem({caption:this.textHideTBar,checkable:!0,value:"title"}),this.mnuitemHideFormulaBar=new Common.UI.MenuItem({caption:this.textHideFBar,checkable:!0,value:"formula"}),{caption:"--"},this.mnuitemHideHeadings=new Common.UI.MenuItem({caption:this.textHideHeadings,checkable:!0,checked:this.mnuitemHideHeadings.isChecked(),value:"headings"}),this.mnuitemHideGridlines=new Common.UI.MenuItem({caption:this.textHideGridlines,checkable:!0,checked:this.mnuitemHideGridlines.isChecked(),value:"gridlines"}),{caption:"--"},this.mnuitemFreezePanes=new Common.UI.MenuItem({caption:this.textFreezePanes,checkable:!0,checked:this.mnuitemFreezePanes.isChecked(),value:"freezepanes"}),{caption:"--"},this.mnuZoom=new Common.UI.MenuItem({template:t.template(['"].join("")),stopPropagation:!0,value:this.mnuZoom.options.value})]})),this.mnuZoomOut=new Common.UI.Button({el:e("#id-menu-zoom-out"),cls:"btn-toolbar"}),this.mnuZoomIn=new Common.UI.Button({el:e("#id-menu-zoom-in"),cls:"btn-toolbar"});var r={};JSON.parse(Common.localStorage.getItem("sse-hidden-title"))&&(r.title=!0),JSON.parse(Common.localStorage.getItem("sse-hidden-formula"))&&(r.formula=!0);var i=JSON.parse(Common.localStorage.getItem("sse-toolbar-compact"));i=!!(i!==null&&parseInt(i)==1||i===null&&this.mode.customization&&this.mode.customization.compactToolbar),this.mnuitemCompactToolbar.setChecked(i),this.mnuitemHideTitleBar.setChecked(!!r.title),this.mnuitemHideFormulaBar.setChecked(!!r.formula),this.mnuitemHideHeadings.setChecked(!!r.headings),(this.mode.isDesktopApp||this.mode.canBrandingExt&&this.mode.customization&&this.mode.customization.header===!1)&&this.mnuitemHideTitleBar.hide()}if(this.btnBorders.rendered){this.btnBorders.setMenu(new Common.UI.Menu({items:[{caption:this.textOutBorders,iconCls:"mnu-border-out",icls:"btn-border-out",borderId:"outer"},{caption:this.textAllBorders,iconCls:"mnu-border-all",icls:"btn-border-all",borderId:"all"},{caption:this.textTopBorders,iconCls:"mnu-border-top",icls:"btn-border-top",borderId:Asc.c_oAscBorderOptions.Top},{caption:this.textBottomBorders,iconCls:"mnu-border-bottom",icls:"btn-border-bottom",borderId:Asc.c_oAscBorderOptions.Bottom},{caption:this.textLeftBorders,iconCls:"mnu-border-left",icls:"btn-border-left",borderId:Asc.c_oAscBorderOptions.Left},{caption:this.textRightBorders,iconCls:"mnu-border-right",icls:"btn-border-right",borderId:Asc.c_oAscBorderOptions.Right},{caption:this.textNoBorders,iconCls:"mnu-border-no",icls:"btn-border-no",borderId:"none"},{caption:"--"},{caption:this.textInsideBorders,iconCls:"mnu-border-center",icls:"btn-border-center",borderId:"inner"},{caption:this.textCenterBorders,iconCls:"mnu-border-vmiddle",icls:"btn-border-vmiddle",borderId:Asc.c_oAscBorderOptions.InnerV},{caption:this.textMiddleBorders,iconCls:"mnu-border-hmiddle",icls:"btn-border-hmiddle",borderId:Asc.c_oAscBorderOptions.InnerH},{caption:this.textDiagUpBorder,iconCls:"mnu-border-diagup",icls:"btn-border-diagup",borderId:Asc.c_oAscBorderOptions.DiagU},{caption:this.textDiagDownBorder,iconCls:"mnu-border-diagdown",icls:"btn-border-diagdown",borderId:Asc.c_oAscBorderOptions.DiagD},{caption:"--"},{id:"id-toolbar-mnu-item-border-width",caption:this.textBordersStyle,iconCls:"mnu-icon-item mnu-border-width",template:t.template('<%= caption %>'),menu:function(){var e=t.template('
    ');return n.mnuBorderWidth=new Common.UI.Menu({style:"min-width: 100px;",menuAlign:"tl-tr",id:"toolbar-menu-borders-width",items:[{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thin,offsety:0,checked:!0},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Hair,offsety:20},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dotted,offsety:40},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dashed,offsety:60},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDot,offsety:80},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDotDot,offsety:100},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Medium,offsety:120},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashed,offsety:140},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDot,offsety:160},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDotDot,offsety:180},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thick,offsety:200}]}),n.mnuBorderWidth}()},this.mnuBorderColor=new Common.UI.MenuItem({id:"id-toolbar-mnu-item-border-color",caption:this.textBordersColor,iconCls:"mnu-icon-item mnu-border-color",template:t.template('<%= caption %>'),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:t.template('
    '),stopPropagation:!0},{template:t.template(''+this.textNewColor+""),stopPropagation:!0}]})})]}));var s=e('
    ');e("button:first-child",this.btnBorders.cmpEl).append(s),s.css("background-color",this.btnBorders.currentColor||"transparent"),this.mnuBorderColorPicker=new Common.UI.ThemeColorPalette({el:e("#id-toolbar-menu-bordercolor")})}this.mnuInsertChartPicker=new Common.UI.DataView({el:e("#id-toolbar-menu-insertchart"),parentMenu:this.btnInsertChart.menu,showLast:!1,restoreHeight:539,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:n.textColumn,headername:n.textCharts},{id:"menu-chart-group-line",caption:n.textLine},{id:"menu-chart-group-pie",caption:n.textPie},{id:"menu-chart-group-hbar",caption:n.textBar},{id:"menu-chart-group-area",caption:n.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:n.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:n.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,allowSelected:!0,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,allowSelected:!0,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,allowSelected:!0,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,allowSelected:!0,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,allowSelected:!0,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,allowSelected:!0,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,allowSelected:!0,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,allowSelected:!0,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,allowSelected:!0,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,allowSelected:!0,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,allowSelected:!0,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,allowSelected:!0,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,allowSelected:!0,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,allowSelected:!0,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,allowSelected:!0,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,allowSelected:!0,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,allowSelected:!0,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,allowSelected:!0,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,allowSelected:!0,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,allowSelected:!0,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,allowSelected:!0,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,allowSelected:!0,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,allowSelected:!0,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,allowSelected:!0,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,allowSelected:!0,iconCls:"stock-normal"}]),itemTemplate:t.template('
    ')})},setApi:function(e){return this.api=e,!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(this.api.asc_registerCallback("asc_onCollaborativeChanges",t.bind(this.onApiCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onSendThemeColorSchemes",t.bind(this.onApiSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",t.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",t.bind(this.onApiUsersChanged,this))),this},setMode:function(t){if(t.isDisconnected)this.lockToolbar(SSE.enumLock.lostConnect,!0),this.lockToolbar(SSE.enumLock.lostConnect,!0,{array:[this.btnEditChart,this.btnUndo,this.btnRedo,this.btnOpenDocument,this.btnNewDocument,this.btnSave]}),this.lockToolbar(SSE.enumLock.cantPrint,!t.canPrint||t.disableDownload,{array:[this.btnPrint]});else{this.mode=t;if(!t.nativeApp){var n=e(".toolbar-group-native");n&&n.hide()}t.isDesktopApp&&e(".toolbar-group-native").hide(),this.lockToolbar(SSE.enumLock.cantPrint,!t.canPrint,{array:[this.btnPrint]})}},onApiSendThemeColorSchemes:function(n){var r=this;this.mnuColorSchema=this.btnColorSchemas.menu,this.mnuColorSchema&&this.mnuColorSchema.items.length>0&&t.each(this.mnuColorSchema.items,function(e){e.remove()}),this.mnuColorSchema==null&&(this.mnuColorSchema=(new Common.UI.Menu({maxHeight:600,restoreHeight:600})).on("show:before",function(t){this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40})})),this.mnuColorSchema.items=[];var i=t.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));t.each(n,function(e,t){var n=e.get_colors(),s=[];for(var o=2;o<7;o++){var u="#"+Common.Utils.ThemeColor.getHexColor(n[o].get_r(),n[o].get_g(),n[o].get_b());s.push(u)}t==21?this.mnuColorSchema.addItem({caption:"--"}):this.mnuColorSchema.addItem({template:i,cls:"color-schemas-menu",colors:s,caption:t<21?r.SchemeNames[t]||e.get_name():e.get_name(),value:t})},this)},onApiCollaborativeChanges:function(){if(this._state.hasCollaborativeChanges)return;if(!this.btnSave.rendered){this.needShowSynchTip=!0;return}this._state.hasCollaborativeChanges=!0;var t=e(".btn-icon",this.btnSave.cmpEl);t.removeClass(this.btnSaveCls),t.addClass("btn-synch"),this.showSynchTip?(this.btnSave.updateHint(""),this.synchTooltip===undefined&&this.createSynchTip(),this.synchTooltip.show()):this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({target:e("#id-toolbar-btn-save")}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("sse-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnSave.rendered){var t=e(".btn-icon",this.btnSave.cmpEl);t.hasClass("btn-synch")&&(t.removeClass("btn-synch"),t.addClass(this.btnSaveCls),this.synchTooltip&&this.synchTooltip.hide(),this.btnSave.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!this.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(n){var r=[];t.each(n,function(e){e.asc_getView()||r.push(e)});var i=t.size(r),s=i>1?"btn-save-coauth":"btn-save";if(s!==this.btnSaveCls&&this.btnSave.rendered){this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S");var o=e(".btn-icon",this.btnSave.cmpEl);o.hasClass("btn-synch")||(o.removeClass(this.btnSaveCls),o.addClass(s),this.btnSave.updateHint(this.btnSaveTip)),this.btnSaveCls=s}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",tipFontName:"Font Name",tipFontSize:"Font Size",tipCellStyle:"Cell Style",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipFontColor:"Font color",tipPrColor:"Background color",tipClearStyle:"Clear",tipCopyStyle:"Copy Style",tipBack:"Back",tipHAligh:"Horizontal Align",tipVAligh:"Vertical Align",tipAlignLeft:"Align Left",tipAlignRight:"Align Right",tipAlignCenter:"Align Center",tipAlignJust:"Justified",textAlignTop:"Align text to the top",textAlignMiddle:"Align text to the middle",textAlignBottom:"Align text to the bottom",tipNumFormat:"Number Format",txtNumber:"Number",txtInteger:"Integer",txtGeneral:"General",txtCustom:"Custom",txtCurrency:"Currency",txtDollar:"$ Dollar",txtEuro:"€ Euro",txtRouble:"₽ Rouble",txtPound:"£ Pound",txtYen:"¥ Yen",txtAccounting:"Accounting",txtDate:"Date",txtTime:"Time",txtDateTime:"Date & Time",txtPercentage:"Percentage",txtFraction:"Fraction",txtScientific:"Scientific",txtText:"Text",tipBorders:"Borders",textOutBorders:"Outside Borders",textAllBorders:"All Borders",textTopBorders:"Top Borders",textBottomBorders:"Bottom Borders",textLeftBorders:"Left Borders",textRightBorders:"Right Borders",textNoBorders:"No Borders",textInsideBorders:"Inside Borders",textMiddleBorders:"Inside Horizontal Borders",textCenterBorders:"Inside Vertical Borders",textDiagDownBorder:"Diagonal Down Border",textDiagUpBorder:"Diagonal Up Border",tipWrap:"Wrap Text",txtClearAll:"All",txtClearText:"Text",txtClearFormat:"Format",txtClearFormula:"Formula",txtClearHyper:"Hyperlink",txtClearComments:"Comments",tipMerge:"Merge",txtMergeCenter:"Merge Center",txtMergeAcross:"Merge Across",txtMergeCells:"Merge Cells",txtUnmerge:"Unmerge Cells",tipIncDecimal:"Increase Decimal",tipDecDecimal:"Decrease Decimal",tipAutofilter:"Set Autofilter",tipInsertImage:"Insert Picture",tipInsertHyperlink:"Add Hyperlink",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",tipIncFont:"Increment font size",tipDecFont:"Decrement font size",tipInsertText:"Insert Text",tipInsertShape:"Insert Autoshape",tipDigStylePercent:"Percent Style",tipDigStyleAccounting:"Accounting Style",tipViewSettings:"View Settings",tipAdvSettings:"Advanced Settings",tipTextOrientation:"Orientation",tipInsertOpt:"Insert Cells",tipDeleteOpt:"Delete Cells",tipAlignTop:"Align Top",tipAlignMiddle:"Align Middle",tipAlignBottom:"Align Bottom",textBordersStyle:"Border Style",textBordersColor:"Borders Color",textAlignLeft:"Left align text",textAlignRight:"Right align text",textAlignCenter:"Center text",textAlignJust:"Justify",txtSort:"Sort",txtFormula:"Insert Function",txtNoBorders:"No borders",txtAdditional:"Additional",mniImageFromFile:"Picture from file",mniImageFromUrl:"Picture from url",textNewColor:"Add New Custom Color",tipInsertChart:"Insert Chart",tipEditChart:"Edit Chart",textPrint:"Print",textPrintOptions:"Print Options",tipColorSchemas:"Change Color Scheme",tipNewDocument:"New Document",tipOpenDocument:"Open Document",txtSortAZ:"Sort A to Z",txtSortZA:"Sort Z to A",txtFilter:"Filter",txtTableTemplate:"Format As Table Template",textHorizontal:"Horizontal Text",textCounterCw:"Angle Counterclockwise",textClockwise:"Angle Clockwise",textRotateUp:"Rotate Text Up",textRotateDown:"Rotate Text Down",textInsRight:"Shift Cells Right",textInsDown:"Shift Cells Down",textEntireRow:"Entire Row",textEntireCol:"Entire Column",textDelLeft:"Shift Cells Left",textDelUp:"Shift Cells Up",textZoom:"Zoom",textCompactToolbar:"Compact Toolbar",textHideTBar:"Hide Title Bar",textHideFBar:"Hide Formula Bar",textHideHeadings:"Hide Headings",textHideGridlines:"Hide Gridlines",textFreezePanes:"Freeze Panes",txtScheme1:"Office",txtScheme2:"Grayscale",txtScheme3:"Apex",txtScheme4:"Aspect",txtScheme5:"Civic",txtScheme6:"Concourse",txtScheme7:"Equity",txtScheme8:"Flow",txtScheme9:"Foundry",txtScheme10:"Median",txtScheme11:"Metro",txtScheme12:"Module",txtScheme13:"Opulent",txtScheme14:"Oriel",txtScheme15:"Origin",txtScheme16:"Paper",txtScheme17:"Solstice",txtScheme18:"Technic",txtScheme19:"Trek",txtScheme20:"Urban",txtScheme21:"Verve",txtClearFilter:"Clear Filter",tipSaveCoauth:"Save your changes for the other users to see them.",txtSearch:"Search",txtNamedRange:"Named Ranges",txtNewRange:"Define Name",txtManageRange:"Name manager",txtPasteRange:"Paste name",textInsText:"Insert text box",textInsTextArt:"Insert Text Art",textInsCharts:"Charts",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",tipInsertEquation:"Insert Equation",textCharts:"Charts",textSparks:"Sparklines",tipInsertChartSpark:"Insert Chart or Sparkline",textMoreFormats:"More formats"},SSE.Views.Toolbar||{}))}),define("spreadsheeteditor/main/app/model/TableTemplate",["backbone"],function(e){"use strict";SSE.Models=SSE.Models||{},SSE.Models.TableTemplate=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,caption:null,type:null,imageUrl:null}}})}),define("spreadsheeteditor/main/app/collection/TableTemplates",["backbone","spreadsheeteditor/main/app/model/TableTemplate"],function(e){"use strict";if(t===undefined)var t={};t.Collections=t.Collections||{},SSE.Collections.TableTemplates=e.Collection.extend({model:SSE.Models.TableTemplate})});if(Common===undefined)var Common={};define("spreadsheeteditor/main/app/view/TableOptionsDialog",["common/main/lib/component/ComboBox","common/main/lib/component/CheckBox","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";SSE.Views.TableOptionsDialog=Common.UI.Window.extend(_.extend({options:{width:350,cls:"modal-dlg",modal:!1},initialize:function(e){_.extend(this.options,{title:this.txtFormat},e),this.template=['
    ','
    ','
    ',"
    ",'"].join(""),this.options.tpl=_.template(this.template,this.options),this.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTable,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild(),t=this;t.inputRange=new Common.UI.InputField({el:$("#id-dlg-tableoptions-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),t.cbTitle=new Common.UI.CheckBox({el:$("#id-dlg-tableoptions-title"),labelText:this.txtTitle}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.inputRange.cmpEl.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(e){var t=this;if(e.api){t.api=e.api;if(e.range)t.cbTitle.setVisible(!1),t.setHeight(130),t.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTableChangeRange,t.inputRange.setValue(e.range),t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,e.range);else{var n=t.api.asc_getAddFormatTableOptions();t.inputRange.setValue(n.asc_getRange()),t.cbTitle.setValue(n.asc_getIsTitle()),t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,n.asc_getRange())}e.title&&t.setTitle(e.title),t.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(t.onApiRangeChanged,t)),t.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(t.onApiRangeChanged,t)),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.FormatTable)}t.inputRange.validation=function(e){var n=t.api.asc_checkDataRange(t.checkRangeType,e,!1);return n==Asc.c_oAscError.ID.DataRangeError?t.txtInvalidRange:!0}},getSettings:function(){if(this.checkRangeType==Asc.c_oAscSelectionDialogType.FormatTable){var e=this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());return e.asc_setIsTitle(this.cbTitle.checked),e}return this.inputRange.getValue()},onApiRangeChanged:function(e){this.inputRange.setValue(e),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error")},isRangeValid:function(){var e=this.api.asc_checkDataRange(this.checkRangeType,this.inputRange.getValue(),!0);return e==Asc.c_oAscError.ID.No?!0:(e==Asc.c_oAscError.ID.AutoFilterDataRangeError?Common.UI.warning({msg:this.errorAutoFilterDataRange}):e==Asc.c_oAscError.ID.FTChangeTableRangeError?Common.UI.warning({msg:this.errorFTChangeTableRangeError}):e==Asc.c_oAscError.ID.FTRangeIncludedOtherTables&&Common.UI.warning({msg:this.errorFTRangeIncludedOtherTables}),!1)},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onClose:function(e){this.api&&this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.None),Common.NotificationCenter.trigger("edit:complete",this),SSE.getController("RightMenu").SetDisabled(!1)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.isRangeValid()!==!0)return;this.options.handler.call(this,this,e)}this.close()},show:function(){Common.UI.Window.prototype.show.call(this),SSE.getController("RightMenu").SetDisabled(!0)},txtTitle:"Title",txtFormat:"Create table",textCancel:"Cancel",txtEmpty:"This field is required",txtInvalidRange:"ERROR! Invalid cells range",errorAutoFilterDataRange:"The operation could not be done for the selected range of cells.
    Select a uniform data range inside or outside the table and try again.",errorFTChangeTableRangeError:"Operation could not be completed for the selected cell range.
    Select a range so that the first table row was on the same row
    and the resulting table overlapped the current one.",errorFTRangeIncludedOtherTables:"Operation could not be completed for the selected cell range.
    Select a range which does not include other tables."},SSE.Views.TableOptionsDialog||{}))}),define("spreadsheeteditor/main/app/view/NamedRangeEditDlg",["common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/InputField"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NamedRangeEditDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NamedRangeEditDlg",contentWidth:380,height:250},initialize:function(e){var t=this;_.extend(this.options,{title:this.txtTitleNew,template:['
    ','
    ','
    ','',"",'","","",'","","","","","",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'","
    ','
    ',"
    ','","
    ","
    ","
    ","
    ",'
    ','"].join("")},e),this.api=e.api,this.handler=e.handler,this.isEdit=e.isEdit||!1,this.sheets=e.sheets||[],this.props=e.props,this.dataRangeValid="",this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.inputName=(new Common.UI.InputField({el:$("#named-range-txt-name"),allowBlank:!1,placeHolder:this.namePlaceholder,blankError:this.txtEmpty,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",validation:function(t){var n=e.api.asc_checkDefinedName(t,e.cmbScope.getValue()==-255?null:e.cmbScope.getValue());if(n.asc_getStatus()===!0)return!0;switch(n.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:return e.textIsLocked;case Asc.c_oAscDefinedNameReason.Existed:return e.isEdit&&e.props.asc_getName().toLowerCase()==t.toLowerCase()?!0:e.textExistName;case Asc.c_oAscDefinedNameReason.NameReserved:return e.isEdit?e.textReservedName:!0;default:return e.textInvalidName}}})).on("keypress:after",function(t,n){n.keyCode===Common.UI.Keys.RETURN&&e.onDlgBtnClick("ok")}),this.cmbScope=new Common.UI.ComboBox({el:$("#named-range-combo-scope"),style:"width: 100%;",menuStyle:"min-width: 100%;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.txtDataRange=(new Common.UI.InputField({el:$("#named-range-txt-range"),name:"range",style:"width: 100%;",allowBlank:!0,blankError:this.txtEmpty,validateOnChange:!0,validation:function(t){if(_.isEmpty(t))return!0;var n=e.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,t,!1);return n!==Asc.c_oAscError.ID.DataRangeError||e.isEdit&&e.props.asc_getRef().toLowerCase()==t.toLowerCase()?!0:e.textInvalidRange}})).on("keypress:after",function(t,n){n.keyCode===Common.UI.Keys.RETURN&&e.onDlgBtnClick("ok")}),this.btnSelectData=new Common.UI.Button({el:$("#named-range-btn-data")}),this.btnSelectData.on("click",_.bind(this.onSelectData,this)),this.afterRender()},afterRender:function(){this._setDefaults(this.props),this.setTitle(this.isEdit?this.txtTitleEdit:this.txtTitleNew),this.api.asc_registerCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_registerCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.inputName.cmpEl.find("input").focus()},200)},_setDefaults:function(e){this.cmbScope.setData([{value:-255,displayValue:this.strWorkbook}].concat(this.sheets));if(e){var t=e.asc_getScope();this.cmbScope.setValue(t===null?-255:t),t=e.asc_getName(),_.isEmpty(t)||this.inputName.setValue(t),t=e.asc_getRef(),this.txtDataRange.setValue(t?t:""),this.dataRangeValid=t,this.txtDataRange.setDisabled(this.isEdit&&e.asc_getIsTable()),this.btnSelectData.setDisabled(this.isEdit&&e.asc_getIsTable())}else this.cmbScope.setValue(-255);this.cmbScope.setDisabled(this.isEdit)},onSelectData:function(){var e=this;if(e.api){var t=function(t,n){n=="ok"&&(e.dataRangeValid=t.getSettings(),e.txtDataRange.setValue(e.dataRangeValid),e.txtDataRange.checkValidate())},n=(new SSE.Views.CellRangeDialog({handler:t})).on("close",function(){e.show()}),r=e.$window.offset();e.hide(),n.show(r.left+65,r.top+77),n.setSettings({api:e.api,range:!_.isEmpty(e.txtDataRange.getValue())&&e.txtDataRange.checkValidate()==1?e.txtDataRange.getValue():e.dataRangeValid,type:Asc.c_oAscSelectionDialogType.Chart})}},getSettings:function(){return new Asc.asc_CDefName(this.inputName.getValue(),this.txtDataRange.getValue(),this.cmbScope.getValue()==-255?null:this.cmbScope.getValue(),this.props.asc_getIsTable())},onPrimary:function(){return!0},onDlgBtnClick:function(e){var t=this,n=typeof e=="object"?e.currentTarget.attributes.result.value:e;if(n=="ok"){if(this.locked){Common.UI.alert({closable:!1,msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(e){t.close()}});return}var r=this.inputName.checkValidate(),i=this.txtDataRange.checkValidate();if(r!==!0){this.inputName.cmpEl.find("input").focus();return}if(i!==!0){this.txtDataRange.cmpEl.find("input").focus();return}this.handler&&this.handler.call(this,n,n=="ok"?this.getSettings():undefined)}this.close()},onLockDefNameManager:function(e){this.locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},onRefreshDefNameList:function(e){var t=Common.localStorage.getItem("sse-settings-coauthmode"),n=this;this.isEdit&&(t===null||parseInt(t)==1)&&e&&e.asc_getIsLock()&&e.asc_getName().toLowerCase()==this.props.asc_getName().toLowerCase()&&(e.asc_getScope()===null&&this.props.asc_getScope()===null||e.asc_getScope().toLowerCase()==this.props.asc_getScope().toLowerCase())&&!this._listRefreshed&&(this._listRefreshed=!0,Common.UI.alert({closable:!1,msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(e){n.close()}}))},close:function(){this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},txtTitleNew:"New Name",txtTitleEdit:"Edit Name",cancelButtonText:"Cancel",okButtonText:"Ok",textSelectData:"Select Data",textName:"Name",textScope:"Scope",textDataRange:"Data Range",namePlaceholder:"Defined name",strWorkbook:"Workbook",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",textInvalidName:"ERROR! Invalid range name",textExistName:"ERROR! Range with such a name already exists",textIsLocked:"This element is being edited by another user.",errorCreateDefName:"The existing named ranges cannot be edited and the new ones cannot be created
    at the moment as some of them are being edited.",notcriticalErrorTitle:"Warning",textReservedName:"The name you are trying to use is already referenced in cell formulas. Please use some other name."},SSE.Views.NamedRangeEditDlg||{}))}),define("spreadsheeteditor/main/app/view/NamedRangePasteDlg",["common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ListView"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NamedRangePasteDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NamedRangePasteDlg",contentWidth:250,height:282},initialize:function(e){var t=this;_.extend(this.options,{title:this.txtTitle,template:['
    ','
    ','
    ','',"",'","","
    ','",'
    ',"
    ","
    ","
    ","
    ",'
    ','"].join("")},e),this.handler=e.handler,this.ranges=e.ranges||[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.rangeList=new Common.UI.ListView({el:$("#named-range-paste-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    ','
    ','
    <%= name %>
    ',"
    ","
    "].join(""))}),this.rangeList.store.comparator=function(e,t){var n=e.get("name").toLowerCase(),r=t.get("name").toLowerCase();return n==r?0:n0&&this.rangeList.selectByIndex(0),this.rangeList.scroller.update({alwaysVisibleY:!0}),_.delay(function(){e.rangeList.cmpEl.find(".listview").focus()},100,this)}},getSettings:function(){var e=this.rangeList.getSelectedRec();return e.length>0?new Asc.asc_CDefName(e[0].get("name"),e[0].get("range"),e[0].get("scope"),e[0].get("isTable")):null},onPrimary:function(){return this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close(),!1},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,t,t=="ok"?this.getSettings():undefined),this.close()},onDblClickFunction:function(){this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close()},txtTitle:"Paste Name",cancelButtonText:"Cancel",okButtonText:"Ok",textNames:"Named Ranges"},SSE.Views.NamedRangePasteDlg||{}))}),define("spreadsheeteditor/main/app/view/FormatSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/MetricSpinner","common/main/lib/component/ComboBox","common/main/lib/view/AdvancedSettingsWindow"],function(){"use strict";SSE.Views.FormatSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:284,height:340},initialize:function(e){var t=this;t.numFormatData=[{value:Asc.c_oAscNumFormatType.General,displayValue:this.txtGeneral},{value:Asc.c_oAscNumFormatType.Number,displayValue:this.txtNumber},{value:Asc.c_oAscNumFormatType.Scientific,displayValue:this.txtScientific},{value:Asc.c_oAscNumFormatType.Accounting,displayValue:this.txtAccounting},{value:Asc.c_oAscNumFormatType.Currency,displayValue:this.txtCurrency},{value:Asc.c_oAscNumFormatType.Date,displayValue:this.txtDate},{value:Asc.c_oAscNumFormatType.Time,displayValue:this.txtTime},{value:Asc.c_oAscNumFormatType.Percent,displayValue:this.txtPercentage},{value:Asc.c_oAscNumFormatType.Fraction,displayValue:this.txtFraction},{value:Asc.c_oAscNumFormatType.Text,displayValue:this.txtText},{value:Asc.c_oAscNumFormatType.Custom,displayValue:this.txtCustom}],t.FractionData=[{displayValue:this.txtUpto1,value:"# ?/?"},{displayValue:this.txtUpto2,value:"# ??/??"},{displayValue:this.txtUpto3,value:"# ???/???"},{displayValue:this.txtAs2,value:"# ?/2"},{displayValue:this.txtAs4,value:"# ?/4"},{displayValue:this.txtAs8,value:"# ?/8"},{displayValue:this.txtAs16,value:"# ??/16"},{displayValue:this.txtAs10,value:"# ?/10"},{displayValue:this.txtAs100,value:"# ??/100"}],t.CurrencySymbolsData=null,t.langId=1033,_.extend(this.options,{title:this.textTitle,template:['
    ','
    ','
    ','',"",'","","",'","",'","",'','","",'','","",'','","",'','","",'','","",'','","","
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ","
    ","
    ","
    ",'
    ','"].join("")},e),this.api=e.api,this.handler=e.handler,this.props=e.props,this._state={hasDecimal:!1,hasNegative:!1,hasSeparator:!1,hasType:!1,hasSymbols:!1,hasCode:!1},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.FormatType=Asc.c_oAscNumFormatType.General,this.Format="General",this.CustomFormat=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.cmbFormat=new Common.UI.ComboBox({el:$("#format-settings-combo-format"),cls:"input-group-nr",menuStyle:"min-width: 264px;",editable:!1,data:this.numFormatData}),this.cmbFormat.setValue(this.FormatType),this.cmbFormat.on("selected",_.bind(this.onFormatSelect,this)),this.cmbNegative=new Common.UI.ComboBox({el:$("#format-settings-combo-negative"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbNegative.on("selected",_.bind(this.onNegativeSelect,this)),this.spnDecimal=new Common.UI.MetricSpinner({el:$("#format-settings-spin-decimal"),step:1,width:45,defaultUnit:"",value:2,maxValue:30,minValue:0,allowDecimal:!1}),this.spnDecimal.on("change",_.bind(this.onDecimalChange,this)),this.chSeparator=new Common.UI.CheckBox({el:$("#format-settings-checkbox-separator"),labelText:this.textSeparator}),this.chSeparator.on("change",_.bind(this.onSeparatorChange,this)),this.cmbSymbols=new Common.UI.ComboBox({el:$("#format-settings-combo-symbols"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbSymbols.on("selected",_.bind(this.onSymbolsSelect,this)),this.cmbType=new Common.UI.ComboBox({el:$("#format-settings-combo-type"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbType.on("selected",_.bind(this.onTypeSelect,this)),this.cmbCode=new Common.UI.ComboBox({el:$("#format-settings-combo-code"),cls:"input-group-nr",menuStyle:"min-width: 310px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbCode.on("selected",_.bind(this.onCodeSelect,this)),this._decimalPanel=this.$window.find(".format-decimal"),this._negativePanel=this.$window.find(".format-negative"),this._separatorPanel=this.$window.find(".format-separator"),this._typePanel=this.$window.find(".format-type"),this._symbolsPanel=this.$window.find(".format-symbols"),this._codePanel=this.$window.find(".format-code"),this.lblExample=this.$window.find("#format-settings-label-example"),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(e){if(e&&e.formatInfo){this.langId&&(this.langId=e.langId),this.cmbFormat.setValue(e.formatInfo.asc_getType(),this.txtCustom),e.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Custom&&e.format&&(this.CustomFormat=this.Format=e.format),this.onFormatSelect(this.cmbFormat,this.cmbFormat.getSelectedRecord(),null,e.formatInfo),this._state.hasDecimal&&this.spnDecimal.setValue(e.formatInfo.asc_getDecimalPlaces()),this._state.hasSeparator&&this.chSeparator.setValue(e.formatInfo.asc_getSeparator()),this._state.hasSymbols&&this.cmbSymbols.setValue(e.formatInfo.asc_getSymbol());if(e.format){if(this._state.hasNegative){var t=this.cmbNegative.store.findWhere({value:e.format});t?this.cmbNegative.selectRecord(t):this.cmbNegative.setValue(this.api.asc_getLocaleExample(e.format))}else if(this._state.hasType){var t=this.cmbType.store.findWhere({value:e.format});t?this.cmbType.selectRecord(t):e.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Fraction?this.cmbType.setValue(this.txtCustom):e.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Time?this.cmbType.setValue(this.api.asc_getLocaleExample(e.format,1.534)):this.cmbType.setValue(this.api.asc_getLocaleExample(e.format,38822))}this.Format=e.format,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))}}},getSettings:function(){return{format:this.Format}},onDlgBtnClick:function(e){var t=this,n=typeof e=="object"?e.currentTarget.attributes.result.value:e;n=="ok"&&this.handler&&this.handler.call(this,n,n=="ok"?this.getSettings():undefined),this.close()},onPrimary:function(){return!0},onNegativeSelect:function(e,t){this.Format=t.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSymbolsSelect:function(e,t){var n=this,r=new Asc.asc_CFormatCellsInfo;r.asc_setType(this.FormatType),r.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),r.asc_setSeparator(!1),r.asc_setSymbol(t.value);var i=this.api.asc_getFormatCells(r),s=[];i.forEach(function(e){s.push({value:e,displayValue:n.api.asc_getLocaleExample(e,-1234.1234567890124)})}),this.cmbNegative.setData(s),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"}),this.Format=i[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onDecimalChange:function(e,t,n,r){var i=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(e.getNumberValue()),s.asc_setSeparator(this.FormatType==Asc.c_oAscNumFormatType.Number?this.chSeparator.getValue()=="checked":!1),s.asc_setSymbol(this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting?this.cmbSymbols.getValue():!1);var o=this.api.asc_getFormatCells(s);if(this.FormatType==Asc.c_oAscNumFormatType.Number||this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting){var u=[];o.forEach(function(e){u.push({value:e,displayValue:i.api.asc_getLocaleExample(e,-1234.1234567890124)})}),this.cmbNegative.setData(u),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"}),this.Format=o[0]}else this.Format=o[0];this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSeparatorChange:function(e,t,n,r){var i=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),s.asc_setSeparator(e.getValue()=="checked");var o=this.api.asc_getFormatCells(s),u=[];o.forEach(function(e){u.push({value:e,displayValue:i.api.asc_getLocaleExample(e,-1234.1234567890124)})}),this.cmbNegative.setData(u),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"}),this.Format=o[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onTypeSelect:function(e,t){this.Format=t.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onCodeSelect:function(e,t){this.Format=t.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onFormatSelect:function(e,t,n,r){if(!t)return;this.FormatType=t.value;var i=t.value==Asc.c_oAscNumFormatType.Number||t.value==Asc.c_oAscNumFormatType.Scientific||t.value==Asc.c_oAscNumFormatType.Accounting||t.value==Asc.c_oAscNumFormatType.Currency||t.value==Asc.c_oAscNumFormatType.Percent,s=t.value==Asc.c_oAscNumFormatType.Number||t.value==Asc.c_oAscNumFormatType.Currency||t.value==Asc.c_oAscNumFormatType.Accounting,o=t.value==Asc.c_oAscNumFormatType.Number,u=t.value==Asc.c_oAscNumFormatType.Date||t.value==Asc.c_oAscNumFormatType.Time||t.value==Asc.c_oAscNumFormatType.Fraction,a=t.value==Asc.c_oAscNumFormatType.Accounting||t.value==Asc.c_oAscNumFormatType.Currency,f=t.value==Asc.c_oAscNumFormatType.Custom,l=this,c=r?r.asc_getDecimalPlaces():this.spnDecimal.getNumberValue(),h=r?r.asc_getSeparator():this.chSeparator.getValue()=="checked",p=r&&r.asc_getSymbol()?r.asc_getSymbol():this.langId;if(t.value!==Asc.c_oAscNumFormatType.Custom){var d=new Asc.asc_CFormatCellsInfo;d.asc_setType(t.value),d.asc_setDecimalPlaces(i?c:0),d.asc_setSeparator(o?h:!1);if(s||t.value==Asc.c_oAscNumFormatType.Date||t.value==Asc.c_oAscNumFormatType.Time){if(a){if(!l.CurrencySymbolsData){l.CurrencySymbolsData=[];var v=this.api.asc_getCurrencySymbols();for(var m in v)v.hasOwnProperty(m)&&l.CurrencySymbolsData.push({value:parseInt(m),displayValue:v[m]+" "+Common.util.LanguageInfo.getLocalLanguageName(m)[1]});this.cmbSymbols.setData(this.CurrencySymbolsData),this.cmbSymbols.setValue(p)}d.asc_setSymbol(this.cmbSymbols.getValue())}var g=this.api.asc_getFormatCells(d),y=[],b=t.value==Asc.c_oAscNumFormatType.Date?38822:t.value==Asc.c_oAscNumFormatType.Time?1.534:parseFloat("-1234.12345678901234567890");g.forEach(function(e){y.push({value:e,displayValue:l.api.asc_getLocaleExample(e,b)})}),s?(this.cmbNegative.setData(y),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"})):(this.cmbType.setData(y),this.cmbType.selectRecord(this.cmbType.store.at(0))),this.Format=g[0]}else t.value==Asc.c_oAscNumFormatType.Fraction?(this.cmbType.setData(this.FractionData),this.cmbType.selectRecord(this.cmbType.store.at(0)),this.Format=this.cmbType.getValue()):this.Format=this.api.asc_getFormatCells(d)[0]}else{var d=new Asc.asc_CFormatCellsInfo;d.asc_setType(Asc.c_oAscNumFormatType.None),d.asc_setSymbol(p);var g=this.api.asc_getFormatCells(d),y=[],w=this.CustomFormat?!0:!1;g.forEach(function(e){y.push({value:e,displayValue:e}),l.CustomFormat==e&&(w=!1)}),w&&y.push({value:this.CustomFormat,displayValue:this.CustomFormat}),this.cmbCode.setData(y),this.cmbCode.setValue(this.Format)}this.lblExample.text(this.api.asc_getLocaleExample(this.Format)),this._decimalPanel.toggleClass("hidden",!i),this._negativePanel.css("visibility",s?"":"hidden"),this._separatorPanel.toggleClass("hidden",!o),this._typePanel.toggleClass("hidden",!u),this._symbolsPanel.toggleClass("hidden",!a),this._codePanel.toggleClass("hidden",!f),this._state={hasDecimal:i,hasNegative:s,hasSeparator:o,hasType:u,hasSymbols:a,hasCode:f}},textTitle:"Number Format",textCategory:"Category",textDecimal:"Decimal",textSeparator:"Use 1000 separator",textFormat:"Format",textSymbols:"Symbols",textCancel:"Cancel",textOk:"OK",txtGeneral:"General",txtNumber:"Number",txtCustom:"Custom",txtCurrency:"Currency",txtAccounting:"Accounting",txtDate:"Date",txtTime:"Time",txtPercentage:"Percentage",txtFraction:"Fraction",txtScientific:"Scientific",txtText:"Text",txtUpto1:"Up to one digit (1/3)",txtUpto2:"Up to two digits (12/25)",txtUpto3:"Up to three digits (131/135)",txtAs2:"As halfs (1/2)",txtAs8:"As eighths (4/8)",txtAs4:"As fourths (2/4)",txtAs16:"As sixteenths (8/16)",txtAs10:"As tenths (5/10)",txtAs100:"As hundredths (50/100)",txtSample:"Sample:"},SSE.Views.FormatSettingsDialog||{}))}),define("spreadsheeteditor/main/app/controller/Toolbar",["core","common/main/lib/component/Window","common/main/lib/view/CopyWarningDialog","common/main/lib/view/ImageFromUrlDialog","common/main/lib/util/define","spreadsheeteditor/main/app/view/Toolbar","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/view/HyperlinkSettingsDialog","spreadsheeteditor/main/app/view/TableOptionsDialog","spreadsheeteditor/main/app/view/NamedRangeEditDlg","spreadsheeteditor/main/app/view/NamedRangePasteDlg","spreadsheeteditor/main/app/view/NameManagerDlg","spreadsheeteditor/main/app/view/FormatSettingsDialog"],function(){"use strict";SSE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){var e=this;this.addListeners({Statusbar:{"sheet:changed":_.bind(this.onApiSheetChanged,this)},LeftMenu:{"settings:apply":_.bind(this.applyFormulaSettings,this)}}),this.editMode=!0,this._isAddingShape=!1,this._state={prstyle:undefined,clrtext:undefined,pralign:undefined,clrback:undefined,valign:undefined,can_undo:undefined,can_redo:undefined,bold:undefined,italic:undefined,underline:undefined,wrap:undefined,merge:undefined,angle:undefined,controlsdisabled:{rows:undefined,cols:undefined,cells_right:undefined,cells_down:undefined,filters:undefined},selection_type:undefined,filter:undefined,filterapplied:!1,tablestylename:undefined,tablename:undefined,namedrange_locked:!1,fontsize:undefined,multiselect:!1,sparklines_disabled:!1,numformatinfo:undefined,numformattype:undefined,numformat:undefined,langId:undefined};var t=function(t,n){var r=$(t.target),i=r.closest("#editor_sdk"),s=r.closest("button").attr("id");s===undefined&&(s=r.closest(".btn-group").attr("id")),e.api&&e.api.asc_isAddAutoshape()&&(i.length<=0||n=="cancel")&&(e.toolbar.btnInsertText.pressed&&s!=e.toolbar.btnInsertText.id||e.toolbar.btnInsertShape.pressed&&s!=e.toolbar.btnInsertShape.id?(e._isAddingShape=!1,e._addAutoshape(!1),e.toolbar.btnInsertShape.toggle(!1,!0),e.toolbar.btnInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",e.toolbar)):e.toolbar.btnInsertShape.pressed&&s==e.toolbar.btnInsertShape.id&&_.defer(function(){e.api.asc_endAddShape(),Common.NotificationCenter.trigger("edit:complete",e.toolbar)},100))};this.checkInsertAutoshape=function(e){t({},e.action)},this._addAutoshape=function(e,n){this.api&&(e?(this.api.asc_startAddShape(n),$(document.body).on("mouseup",t)):(this.api.asc_endAddShape(),$(document.body).off("mouseup",t)))},this.onApiEndAddShape=function(){this.toolbar.btnInsertShape.pressed&&this.toolbar.btnInsertShape.toggle(!1,!0),this.toolbar.btnInsertText.pressed&&this.toolbar.btnInsertText.toggle(!1,!0),$(document.body).off("mouseup",t)}},onLaunch:function(){this.toolbar=this.createView("Toolbar")},onToolbarAfterRender:function(e){var t=this;e.btnNewDocument.on("click",_.bind(this.onNewDocument,this)),e.btnOpenDocument.on("click",_.bind(this.onOpenDocument,this)),e.btnPrint.on("click",_.bind(this.onPrint,this)),e.btnSave.on("click",_.bind(this.onSave,this)),e.btnUndo.on("click",_.bind(this.onUndo,this)),e.btnRedo.on("click",_.bind(this.onRedo,this)),e.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),e.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),e.btnIncFontSize.on("click",_.bind(this.onIncreaseFontSize,this)),e.btnDecFontSize.on("click",_.bind(this.onDecreaseFontSize,this)),e.btnBold.on("click",_.bind(this.onBold,this)),e.btnItalic.on("click",_.bind(this.onItalic,this)),e.btnUnderline.on("click",_.bind(this.onUnderline,this)),e.btnTextColor.on("click",_.bind(this.onTextColor,this)),e.btnBackColor.on("click",_.bind(this.onBackColor,this)),e.mnuTextColorPicker.on("select",_.bind(this.onTextColorSelect,this)),e.mnuBackColorPicker.on("select",_.bind(this.onBackColorSelect,this)),e.btnBorders.on("click",_.bind(this.onBorders,this)),e.btnBorders.rendered&&(e.btnBorders.menu.on("item:click",_.bind(this.onBordersMenu,this)),e.mnuBorderWidth.on("item:toggle",_.bind(this.onBordersWidth,this)),e.mnuBorderColorPicker.on("select",_.bind(this.onBordersColor,this))),e.btnAlignLeft.on("click",_.bind(this.onHorizontalAlign,this,"left")),e.btnAlignCenter.on("click",_.bind(this.onHorizontalAlign,this,"center")),e.btnAlignRight.on("click",_.bind(this.onHorizontalAlign,this,"right")),e.btnAlignJust.on("click",_.bind(this.onHorizontalAlign,this,"justify")),e.btnHorizontalAlign.menu.on("item:click",_.bind(this.onHorizontalAlignMenu,this)),e.btnVerticalAlign.menu.on("item:click",_.bind(this.onVerticalAlignMenu,this)),e.btnMerge.on("click",_.bind(this.onMergeCellsMenu,this,e.btnMerge.menu,e.btnMerge.menu.items[0])),e.btnMerge.menu.on("item:click",_.bind(this.onMergeCellsMenu,this)),e.btnAlignTop.on("click",_.bind(this.onVerticalAlign,this,"top")),e.btnAlignMiddle.on("click",_.bind(this.onVerticalAlign,this,"center")),e.btnAlignBottom.on("click",_.bind(this.onVerticalAlign,this,"bottom")),e.btnWrap.on("click",_.bind(this.onWrap,this)),e.btnTextOrient.menu.on("item:click",_.bind(this.onTextOrientationMenu,this)),e.btnInsertImage.menu.on("item:click",_.bind(this.onInsertImageMenu,this)),e.btnInsertHyperlink.on("click",_.bind(this.onHyperlink,this)),e.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),e.btnEditChart.on("click",_.bind(this.onEditChart,this)),e.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),e.btnInsertText.menu.on("item:click",_.bind(this.onInsertTextClick,this)),e.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),e.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),e.btnSortDown.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),e.btnSortUp.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),e.mnuitemSortAZ.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),e.mnuitemSortZA.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),e.btnSetAutofilter.on("click",_.bind(this.onAutoFilter,this)),e.mnuitemAutoFilter.on("click",_.bind(this.onAutoFilter,this)),e.btnClearAutofilter.on("click",_.bind(this.onClearFilter,this)),e.mnuitemClearFilter.on("click",_.bind(this.onClearFilter,this)),e.btnSearch.on("click",_.bind(this.onSearch,this)),e.btnTableTemplate.menu.on("show:after",_.bind(this.onTableTplMenuOpen,this)),e.btnPercentStyle.on("click",_.bind(this.onNumberFormat,this)),e.btnCurrencyStyle.on("click",_.bind(this.onNumberFormat,this)),e.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),e.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),e.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),e.btnSettings.on("click",_.bind(this.onAdvSettingsClick,this)),e.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),e.btnNamedRange.menu.on("item:click",_.bind(this.onNamedRangeMenu,this)),e.btnNamedRange.menu.on("show:after",_.bind(this.onNamedRangeMenuOpen,this)),e.btnClearStyle.menu.on("item:click",_.bind(this.onClearStyleMenu,this)),e.btnAddCell.menu.on("item:click",_.bind(this.onCellInsertMenu,this)),e.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),e.btnDeleteCell.menu.on("item:click",_.bind(this.onCellDeleteMenu,this)),e.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),e.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),e.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),e.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),e.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),e.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),e.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),e.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),e.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),e.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),e.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),e.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),e.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),e.mnuZoomIn&&e.mnuZoomIn.on("click",_.bind(this.onZoomInClick,this)),e.mnuZoomOut&&e.mnuZoomOut.on("click",_.bind(this.onZoomOutClick,this)),e.btnShowMode.rendered&&e.btnShowMode.menu.on("item:click",_.bind(this.onHideMenu,this)),e.listStyles.on("click",_.bind(this.onListStyleSelect,this)),e.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),e.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),e.cmbNumberFormat.cmpEl&&e.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),e.btnCurrencyStyle.menu.on("item:click",_.bind(this.onNumberFormatMenu,this)),e.mnuitemCompactToolbar&&e.mnuitemCompactToolbar.on("toggle",_.bind(this.onChangeViewMode,this)),$("#id-toolbar-menu-new-fontcolor").on("click",_.bind(this.onNewTextColor,this)),$("#id-toolbar-menu-new-paracolor").on("click",_.bind(this.onNewBackColor,this)),$("#id-toolbar-menu-new-bordercolor").on("click",_.bind(this.onNewBorderColor,this)),this.onSetupCopyStyleButton()},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this,!0)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onApiZoomChange,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this))},onNewDocument:function(e,t){this.api&&this.api.asc_openNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(e,t){this.api&&this.api.asc_loadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onPrint:function(e){Common.NotificationCenter.trigger("print",this.toolbar)},onSave:function(e){if(this.api){var t=this.api.asc_isDocumentCanSave(),n=$(".btn-icon",this.toolbar.btnSave.cmpEl).hasClass("btn-synch");if(!t&&!n&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onUndo:function(e,t){this.api&&this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(e,t){this.api&&this.api.asc_Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(e,t){var n=this;if(n.api){var r=e?n.api.asc_Copy():n.api.asc_Paste();if(!r){var i=Common.localStorage.getItem("sse-hide-copywarning");(!i||parseInt(i)!=1)&&(new Common.Views.CopyWarningDialog({handler:function(e){e&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",n.toolbar)}})).show()}else Common.component.Analytics.trackEvent("ToolBar","Copy Warning")}Common.NotificationCenter.trigger("edit:complete",n.toolbar)},onIncreaseFontSize:function(e){this.api&&this.api.asc_increaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecreaseFontSize:function(e){this.api&&this.api.asc_decreaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(e,t){this._state.bold=undefined,this.api&&this.api.asc_setCellBold(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(e,t){this._state.italic=undefined,this.api&&this.api.asc_setCellItalic(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(e,t){this._state.underline=undefined,this.api&&this.api.asc_setCellUnderline(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Underline")},onTextColor:function(){this.toolbar.mnuTextColorPicker.trigger("select",this.toolbar.mnuTextColorPicker,this.toolbar.mnuTextColorPicker.currentColor,!0)},onBackColor:function(){this.toolbar.mnuBackColorPicker.trigger("select",this.toolbar.mnuBackColorPicker,this.toolbar.mnuBackColorPicker.currentColor,!0)},onTextColorSelect:function(e,t,n){this._state.clrtext_asccolor=this._state.clrtext=undefined;var r=typeof t=="object"?t.color:t;this.toolbar.btnTextColor.currentColor=t,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+r),this.toolbar.mnuTextColorPicker.currentColor=t,this.api&&(this.toolbar.btnTextColor.ischanged=n!==!0,this.api.asc_setCellTextColor(Common.Utils.ThemeColor.getRgbColor(t)),this.toolbar.btnTextColor.ischanged=!1),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onBackColorSelect:function(e,t,n){this._state.clrshd_asccolor=this._state.clrback=undefined;var r=typeof t=="object"?t.color:t;this.toolbar.btnBackColor.currentColor=t,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color",r=="transparent"?"transparent":"#"+r),this.toolbar.mnuBackColorPicker.currentColor=t,this.api&&(this.toolbar.btnBackColor.ischanged=n!==!0,this.api.asc_setCellBackgroundColor(t=="transparent"?null:Common.Utils.ThemeColor.getRgbColor(t)),this.toolbar.btnBackColor.ischanged=!1),Common.component.Analytics.trackEvent("ToolBar","Background Color")},onNewTextColor:function(e,t){this.toolbar.mnuTextColorPicker.addNewColor()},onNewBackColor:function(e,t){this.toolbar.mnuBackColorPicker.addNewColor()},onNewBorderColor:function(e,t){this.toolbar.btnBorders.menu.hide(),this.toolbar.btnBorders.toggle(!1,!0),this.toolbar.mnuBorderColorPicker.addNewColor()},onBorders:function(e){var t;_.each(e.menu.items,function(n){if(e.options.borderId==n.options.borderId)return t=n,!1}),t&&this.onBordersMenu(e.menu,t)},onBordersMenu:function(e,t){var n=this;if(n.api&&!_.isUndefined(t.options.borderId)){var r=n.toolbar.btnBorders,i=[],s=r.options.borderswidth,o=r.options.borderscolor;if(r.rendered){var u=$(".btn-icon",r.cmpEl);u&&(u.removeClass(r.options.icls),r.options.icls=t.options.icls,u.addClass(r.options.icls))}r.options.borderId=t.options.borderId,t.options.borderId=="inner"?(i[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,o)):t.options.borderId=="all"?(i[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,o)):t.options.borderId=="outer"?(i[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,o)):t.options.borderId!="none"&&(i[t.options.borderId]=new Asc.asc_CBorder(s,o)),n.api.asc_setCellBorders(i),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Borders")}},onBordersWidth:function(e,t,n){n&&(this.toolbar.btnBorders.options.borderswidth=t.value,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Width"))},onBordersColor:function(e,t){$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+(typeof t=="object"?t.color:t)),this.toolbar.mnuBorderColor.onUnHoverItem(),this.toolbar.btnBorders.options.borderscolor=Common.Utils.ThemeColor.getRgbColor(t),this.toolbar.mnuBorderColorPicker.currentColor=t,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Color")},onHorizontalAlign:function(e,t,n){this._state.pralign=undefined,this.api&&(this.api.asc_setCellAlign(t.pressed?e:"none"),this.toolbar.btnWrap.allowDepress=e!="justify"),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal align")},onHorizontalAlignMenu:function(e,t){var n=this.toolbar.btnHorizontalAlign,r=$(".btn-icon",n.cmpEl);r&&(r.removeClass(n.options.icls),n.options.icls=t.checked?t.options.icls:"btn-align-left",r.addClass(n.options.icls)),this._state.pralign=undefined,this.api&&this.api.asc_setCellAlign(t.checked?t.value:"none"),this.toolbar.btnWrap.allowDepress=t.value!="justify",Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onVerticalAlignMenu:function(e,t){var n=this.toolbar.btnVerticalAlign,r=$(".btn-icon",n.cmpEl);r&&(r.removeClass(n.options.icls),n.options.icls=t.checked?t.options.icls:"btn-valign-bottom",r.addClass(n.options.icls)),this._state.valign=undefined,this.api&&this.api.asc_setCellVertAlign(t.checked?t.value:"bottom"),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical Align")},onVerticalAlign:function(e,t,n){this._state.valign=undefined,this.api&&this.api.asc_setCellVertAlign(t.pressed?e:"bottom"),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical align")},onMergeCellsMenu:function(e,t){function r(e){n._state.merge=undefined,n.api.asc_mergeCells(e),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge")}var n=this;if(n.api){var i=n.api.asc_getCellInfo().asc_getFlags().asc_getMerge();i!==Asc.c_oAscMergeOptions.Merge&&n.api.asc_mergeCellsDataLost(t.value)?Common.UI.warning({msg:n.warnMergeLostData,buttons:["yes","no"],primary:"yes",callback:function(e){e=="yes"?r(t.value):(n.toolbar.btnMerge.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge"))}}):r(t.value)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge cells")},onWrap:function(e,t){this._state.wrap=undefined,this.api&&this.api.asc_setCellTextWrap(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Wrap")},onTextOrientationMenu:function(e,t){var n=0;switch(t.value){case"countcw":n=45;break;case"clockwise":n=-45;break;case"rotateup":n=90;break;case"rotatedown":n=-90}this._state.angle=undefined,this.api&&this.api.asc_setCellAngle(n),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Text orientation")},onInsertImageMenu:function(e,t,n){if(t.value==="file")this.toolbar.fireEvent("insertimage",this.toolbar),this.api&&this.api.asc_addImage(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Image");else{var r=this;(new Common.Views.ImageFromUrlDialog({handler:function(e,t){if(e=="ok"){if(r.api){var n=t.replace(/\s/g,"");_.isEmpty(n)?Common.UI.warning({msg:this.textEmptyImgUrl}):(r.toolbar.fireEvent("insertimage",r.toolbar),r.api.asc_addImageDrawingObject(n),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",r.toolbar)}}})).show()}},onHyperlink:function(e){var t=this,n,r;if(t.api){var i=t.api.asc_getWorksheetsCount(),s=-1,o=[];while(++s0&&this.api.asc_setCellFormat(r[0])}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatSelect:function(e,t){t?this.api&&this.api.asc_setCellFormat(t.format):this.onCustomNumberFormat(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onCustomNumberFormat:function(){var e=this,t=Common.localStorage.getItem("sse-settings-reg-settings");t=t!==null?parseInt(t):e.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.toolbar.mode.lang)):1033,(new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,n){n&&e.api.asc_setCellFormat(n.format),Common.NotificationCenter.trigger("edit:complete",e.toolbar)},props:{format:e._state.numformat,formatInfo:e._state.numformatinfo,langId:t}})).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatOpenBefore:function(e){if(this.api){var t=this,n=Common.localStorage.getItem("sse-settings-reg-settings");n=n!==null?parseInt(n):this.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)):1033;if(this._state.langId!==n){this._state.langId=n;var r=new Asc.asc_CFormatCellsInfo;r.asc_setType(Asc.c_oAscNumFormatType.None),r.asc_setSymbol(this._state.langId);var i=this.api.asc_getFormatCells(r);t.toolbar.numFormatData.forEach(function(e,n){t.toolbar.numFormatData[n].format=i[n]})}t.toolbar.numFormatData.forEach(function(e,n){e.exampleval=t.api.asc_getLocaleExample(e.format)}),t.toolbar.cmbNumberFormat.setData(t.toolbar.numFormatData),t.toolbar.cmbNumberFormat.setValue(t._state.numformattype,t.toolbar.txtCustom)}},onDecrement:function(e){this.api&&this.api.asc_decreaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Decrement")},onIncrement:function(e){this.api&&this.api.asc_increaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Increment")},onInsertFormulaMenu:function(e,t,n){if(this.api)if(t.value==="more"){var r=this.getApplication().getController("FormulaDialog");r&&r.showDialog()}else t.value=t.value||"SUM",this.api.asc_insertFormula(this.api.asc_getFormulaLocaleName(t.value),Asc.c_oAscPopUpSelectorType.Func,!0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Insert formula")},onNamedRangeMenu:function(e,t,n){if(this.api){var r=this;if(t.value==="paste")(new SSE.Views.NamedRangePasteDlg({handler:function(e,t){e=="ok"&&t&&(r.api.asc_insertFormula(t.asc_getName(),t.asc_getIsTable()?Asc.c_oAscPopUpSelectorType.Table:Asc.c_oAscPopUpSelectorType.Range,!1),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range")),Common.NotificationCenter.trigger("edit:complete",r.toolbar)},ranges:r.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook)})).show(),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range");else{var i=r.api.asc_getWorksheetsCount(),s=-1,o=[],u=[];if(t.value==="new"){if(this._state.namedrange_locked){Common.NotificationCenter.trigger("namedrange:locked");return}while(++s409?409:i<1?1:Math.floor((i+.4)*2)/2,t.setRawValue(i),this._state.fontsize=undefined,this.api&&this.api.asc_setCellFontSize(i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onAdvSettingsClick:function(e,t){this.toolbar.fireEvent("file:settings",this),e.cmpEl.blur()},onZoomInClick:function(e){if(this.api){var t=Math.floor(this.api.asc_getZoom()*10)/10;t+=.1,t>0&&!(t>2)&&this.api.asc_setZoom(t)}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomOutClick:function(e){if(this.api){var t=Math.ceil(this.api.asc_getZoom()*10)/10;t-=.1,t<.5||this.api.asc_setZoom(t)}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideMenu:function(e,t){var n={},r;switch(t.value){case"title":n.title=t.checked,r="sse-hidden-title";break;case"formula":n.formula=t.checked,r="sse-hidden-formula";break;case"headings":n.headings=t.checked;break;case"gridlines":n.gridlines=t.checked;break;case"freezepanes":n.freezepanes=t.checked}this.hideElements(n),r&&Common.localStorage.setItem(r,t.checked),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onListStyleSelect:function(e,t){this._state.prstyle=undefined,this.api&&(this.api.asc_setCellStyle(t.get("name")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style"))},createDelayedElements:function(){var e=this;this.toolbar.createDelayedElements(),this.onToolbarAfterRender(this.toolbar),this.api.asc_registerCallback("asc_onShowChartDialog",_.bind(this.onApiChartDblClick,this)),this.api.asc_registerCallback("asc_onCanUndoChanged",_.bind(this.onApiCanRevert,this,"undo")),this.api.asc_registerCallback("asc_onCanRedoChanged",_.bind(this.onApiCanRevert,this,"redo")),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onStopFormatPainter",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onUpdateSheetViewSettings",_.bind(this.onApiSheetChanged,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+l,ctrl+l":function(t){if(e.editMode&&!e._state.multiselect){var n=e.api.asc_getCellInfo().asc_getFormatTableInfo();if(!n){_.isUndefined(e.toolbar.mnuTableTemplatePicker)&&e.onApiInitTableTemplates(e.api.asc_getTablePictures(n));var r=e.getCollection("TableTemplates");e._setTableFormat(r.at(23).get("name"))}}return!1},"command+shift+l,ctrl+shift+l":function(t){var n=e._state.filter;return e._state.filter=undefined,e.editMode&&e.api&&!e._state.multiselect&&(e._state.tablename||n?e.api.asc_changeAutoFilter(e._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!n):e.api.asc_addAutoFilter()),!1},"command+s,ctrl+s":function(t){e.onSave(),t.preventDefault(),t.stopPropagation()},"command+k,ctrl+k":function(t){e.editMode&&!e.toolbar.mode.isEditMailMerge&&!e.toolbar.mode.isEditDiagram&&!e.api.isCellEdited&&!e._state.multiselect&&e.onHyperlink(),t.preventDefault()},"command+1,ctrl+1":function(t){return e.editMode&&!e.toolbar.mode.isEditMailMerge&&!e.api.isCellEdited&&!e.toolbar.cmbNumberFormat.isDisabled()&&e.onCustomNumberFormat(),!1}}}),this.wrapOnSelectionChanged=_.bind(this.onApiSelectionChanged,this),this.api.asc_registerCallback("asc_onSelectionChanged",this.wrapOnSelectionChanged),this.onApiSelectionChanged(this.api.asc_getCellInfo()),this.api.asc_registerCallback("asc_onEditorSelectionChanged",_.bind(this.onApiEditorSelectionChanged,this)),this.attachToControlEvents(),this.onApiSheetChanged(),this.applyFormulaSettings(),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},onChangeViewMode:function(e,t){var n=this,r=$("#id-toolbar-full"),i=$("#id-toolbar-short");n.toolbar.isCompactView=t,r&&i&&(n.api.asc_unregisterCallback("asc_onSelectionChanged",n.wrapOnSelectionChanged),t?(i.css({display:"table"}),r.css({display:"none"}),i.parent().css({height:"41px"}),n.toolbar.rendererComponents("short")):(i.css({display:"none"}),r.css({display:"table"}),i.parent().css({height:"67px"}),n.toolbar.rendererComponents("full"),_.defer(function(){var e=n.toolbar.listStyles.rendered;n.toolbar.listStyles.menuPicker.store.length>0&&e&&n.toolbar.listStyles.fillComboView(n.toolbar.listStyles.menuPicker.getSelectedRec(),!0),n.toolbar.btnInsertText.rendered&&n.fillTextArt(),n.toolbar.btnTableTemplate.rendered&&n.fillTableTemplates(),n.toolbar.btnInsertEquation.rendered&&n.fillEquations()},100)),n._state.coauthdisable=undefined,n.api.asc_registerCallback("asc_onSelectionChanged",n.wrapOnSelectionChanged),n.onApiSelectionChanged(n.api.asc_getCellInfo()),Common.localStorage.setItem("sse-toolbar-compact",t?1:0),Common.NotificationCenter.trigger("layout:changed","toolbar"))},fillTableTemplates:function(){function t(t,n){var r=new Common.UI.DataView({el:t,parentMenu:n,restoreHeight:300,style:"max-height: 300px;",store:e.getCollection("TableTemplates"),itemTemplate:_.template('
    ')});return r.on("item:click",function(t,n,r){e.api&&(e._state.tablestylename=null,r||(r=t.store.at(23)),e._setTableFormat(r.get("name")),Common.NotificationCenter.trigger("edit:complete",e.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table Templates"))}),r.scroller&&r.scroller.update({alwaysVisibleY:!0}),r}if(!this.toolbar.btnTableTemplate.rendered)return;var e=this;_.isUndefined(this.toolbar.mnuTableTemplatePicker)&&(this.toolbar.mnuTableTemplatePicker=t($("#id-toolbar-menu-table-templates"),this.toolbar.btnTableTemplate.menu))},onTableTplMenuOpen:function(e){this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));var t=this.toolbar.mnuTableTemplatePicker.scroller;t&&(t.update({alwaysVisibleY:!0}),t.scrollTop(0));var n=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:this._state.tablestylename});n?this.toolbar.mnuTableTemplatePicker.selectRecord(n):this.toolbar.mnuTableTemplatePicker.deselectAll()},onSendThemeColors:function(){this.toolbar.btnTableTemplate.rendered&&this.toolbar.btnTableTemplate.cmpEl.hasClass("open")&&this.onTableTplMenuOpen()},onApiInitTableTemplates:function(e){var t=this.getCollection("TableTemplates");if(t){var n=[];_.each(e,function(e){n.push({name:e.asc_getName(),caption:e.asc_getDisplayName(),type:e.asc_getType(),imageUrl:e.asc_getImage(),allowSelected:!0,selected:!1,tip:e.asc_getDisplayName()})}),t.reset(),t.add(n)}this.fillTableTemplates()},onApiInitEditorStyles:function(e){window.styles_loaded=!1;var t=this,n=t.toolbar.listStyles;if(!n){t.styles=e;return}n.menuPicker.store.reset([]);var r=e.asc_getDefaultStyles().concat(e.asc_getDocStyles());_.each(r,function(e){n.menuPicker.store.add({imageUrl:e.asc_getImage(),name:e.asc_getName(),uid:Common.UI.getId()})}),n.menuPicker.store.length>0&&n.rendered&&(n.fillComboView(n.menuPicker.store.at(0),!0),n.selectByIndex(0)),window.styles_loaded=!0},onApiCoAuthoringDisconnect:function(e){this.toolbar.setMode({isDisconnected:!0,disableDownload:!!e}),this.editMode=!1},onApiChartDblClick:function(){this.onEditChart(this.btnInsertChart)},onApiCanRevert:function(e,t){e=="undo"?this._state.can_undo!==t&&(this.toolbar.btnUndo.setDisabled(!t),this._state.can_undo=t):this._state.can_redo!==t&&(this.toolbar.btnRedo.setDisabled(!t),this._state.can_redo=t)},setDisabledComponents:function(e,t){_.each([].concat(e),function(e){e.isDisabled()!==t&&e.setDisabled(t)})},onApiEditCell:function(e){var t=this.toolbar;if(t.mode.isEditDiagram||t.mode.isEditMailMerge)n=e==Asc.c_oAscCellEditorState.editStart,t.lockToolbar(SSE.enumLock.editCell,e==Asc.c_oAscCellEditorState.editStart,{array:[t.btnDecDecimal,t.btnIncDecimal,t.cmbNumberFormat]});else if(e==Asc.c_oAscCellEditorState.editStart||e==Asc.c_oAscCellEditorState.editEnd){t.lockToolbar(SSE.enumLock.editCell,e==Asc.c_oAscCellEditorState.editStart,{array:[t.btnClearStyle.menu.items[1],t.btnClearStyle.menu.items[2],t.btnClearStyle.menu.items[3],t.btnClearStyle.menu.items[4],t.mnuitemClearFilter,t.btnNamedRange.menu.items[0],t.btnNamedRange.menu.items[1]],merge:!0,clear:[SSE.enumLock.editFormula,SSE.enumLock.editText]});var n=e==Asc.c_oAscCellEditorState.editStart;n?Common.util.Shortcuts.suspendEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1"):Common.util.Shortcuts.resumeEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1"),n&&(t.listStyles.suspendEvents(),t.listStyles.menuPicker.selectRecord(null),t.listStyles.resumeEvents(),this._state.prstyle=undefined)}else{if(e==Asc.c_oAscCellEditorState.editText)var r=!0,i=!1;else e==Asc.c_oAscCellEditorState.editFormula?r=!(i=!0):e==Asc.c_oAscCellEditorState.editEmptyCell&&(r=i=!1);t.lockToolbar(SSE.enumLock.editFormula,i,{array:[t.cmbFontName,t.cmbFontSize,t.btnIncFontSize,t.btnDecFontSize,t.btnBold,t.btnItalic,t.btnUnderline,t.btnTextColor]}),t.lockToolbar(SSE.enumLock.editText,r,{array:[t.btnInsertFormula]})}this._state.coauthdisable=undefined,this._state.selection_type=undefined,this.checkInsertAutoshape({action:"cancel"})},onApiZoomChange:function(e,t){switch(t){case 1:case 2:case 0:default:this.toolbar.mnuZoom.options.value=Math.floor((e+.005)*100),$(".menu-zoom .zoom",this.toolbar.el).html(Math.floor((e+.005)*100)+"%")}},onApiSheetChanged:function(){if(this.api){var e=this.api.asc_getSheetViewSettings();this.toolbar.mnuitemHideHeadings.setChecked(!e.asc_getShowRowColHeaders()),this.toolbar.mnuitemHideGridlines.setChecked(!e.asc_getShowGridLines()),this.toolbar.mnuitemFreezePanes.setChecked(e.asc_getIsFreezePane())}},onApiEditorSelectionChanged:function(e){if(!this.editMode)return;var t=this.toolbar,n,r=e.asc_getName();r!=t.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",e),!t.mode.isEditMailMerge&&!t.mode.isEditDiagram&&(n=e.asc_getBold(),this._state.bold!==n&&(t.btnBold.toggle(n===!0,!0),this._state.bold=n),n=e.asc_getItalic(),this._state.italic!==n&&(t.btnItalic.toggle(n===!0,!0),this._state.italic=n),n=e.asc_getUnderline(),this._state.underline!==n&&(t.btnUnderline.toggle(n===!0,!0),this._state.underline=n));var i=e.asc_getSize();this._state.fontsize!==i&&(t.cmbFontSize.setValue(i!==undefined?i:""),this._state.fontsize=i);var s,o,u=this.toolbar.mnuTextColorPicker;if(!t.btnTextColor.ischanged&&!u.isDummy){o=e.asc_getColor(),o&&(o.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?s={color:Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()),effectValue:o.get_value()}:s=Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()));var a=typeof s,f=typeof this._state.clrtext;if(a!==f||a=="object"&&(s.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(s.color)<0)||a!="object"&&this._state.clrtext!==undefined&&this._state.clrtext.indexOf(s)<0){if(_.isObject(s)){var l=!1;for(var c=0;c<10;c++)if(Common.Utils.ThemeColor.ThemeValues[c]==s.effectValue){u.select(s,!0),l=!0;break}l||u.clearSelection()}else u.select(s,!0);this._state.clrtext=s}this._state.clrtext_asccolor=o}},onApiSelectionChanged:function(e){if(!this.editMode)return;var t=e.asc_getFlags().asc_getSelectionType(),n=!this.toolbar.mode.isEditMailMerge&&!this.toolbar.mode.isEditDiagram?e.asc_getLocked()===!0||e.asc_getLockedTable()===!0:!1,r=this._disableEditOptions(t,n),i=this,s=this.toolbar,o=e.asc_getFont(),u,a=!1,f=o.asc_getName();f!=s.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",o);var l=o.asc_getSize();this._state.fontsize!==l&&(s.cmbFontSize.setValue(l!==undefined?l:""),this._state.fontsize=l),s.lockToolbar(SSE.enumLock.cantHyperlink,t==Asc.c_oAscSelectionType.RangeShapeText&&this.api.asc_canAddShapeHyperlink()===!1,{array:[s.btnInsertHyperlink]});if(r)return;!s.mode.isEditMailMerge&&!s.mode.isEditDiagram&&(u=o.asc_getBold(),this._state.bold!==u&&(s.btnBold.toggle(u===!0,!0),this._state.bold=u),u=o.asc_getItalic(),this._state.italic!==u&&(s.btnItalic.toggle(u===!0,!0),this._state.italic=u),u=o.asc_getUnderline(),this._state.underline!==u&&(s.btnUnderline.toggle(u===!0,!0),this._state.underline=u));var c,h,p=this.toolbar.mnuTextColorPicker,d=this.toolbar.mnuBackColorPicker;if(!s.btnTextColor.ischanged&&!p.isDummy){h=o.asc_getColor(),h&&(h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?c={color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}:c=Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()));var v=typeof c,m=typeof this._state.clrtext;if(v!==m||v=="object"&&(c.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(c.color)<0)||v!="object"&&this._state.clrtext!==undefined&&this._state.clrtext.indexOf(c)<0){if(_.isObject(c)){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==c.effectValue){p.select(c,!0),g=!0;break}g||p.clearSelection()}else p.select(c,!0);this._state.clrtext=c}this._state.clrtext_asccolor=h}if(!s.btnBackColor.ischanged&&!d.isDummy){h=e.asc_getFill().asc_getColor(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?c={color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}:c=Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()):c="transparent",v=typeof c,m=typeof this._state.clrback;if(v!==m||v=="object"&&(c.effectValue!==this._state.clrback.effectValue||this._state.clrback.color.indexOf(c.color)<0)||v!="object"&&this._state.clrback!==undefined&&this._state.clrback.indexOf(c)<0){if(_.isObject(c)){var g=!1;for(y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==c.effectValue){d.select(c,!0),g=!0;break}g||d.clearSelection()}else d.select(c,!0);this._state.clrback=c}this._state.clrshd_asccolor=h}if(t==Asc.c_oAscSelectionType.RangeChart||t==Asc.c_oAscSelectionType.RangeChartText)return;if(!s.mode.isEditDiagram){var b=e.asc_getAutoFilterInfo(),w=e.asc_getFormatTableInfo();if(!s.mode.isEditMailMerge){f=e.asc_getHorAlign();if(this._state.pralign!==f){this._state.pralign=f;var E=-1,S;switch(f){case"left":E=0,S="btn-align-left";break;case"center":E=1,S="btn-align-center";break;case"right":E=2,S="btn-align-right";break;case"justify":E=3,S="btn-align-just";break;default:E=-255,S="btn-align-left"}E<0?E==-255&&(s.btnAlignRight.toggle(!1,!0),s.btnAlignLeft.toggle(!1,!0),s.btnAlignCenter.toggle(!1,!0),s.btnAlignJust.toggle(!1,!0),this._clearChecked(s.btnHorizontalAlign.menu)):(s.btnAlignRight.toggle(E===2,!0),s.btnAlignLeft.toggle(E===0,!0),s.btnAlignCenter.toggle(E===1,!0),s.btnAlignJust.toggle(E===3,!0),s.btnHorizontalAlign.menu.items[E].setChecked(!0,!1));var x=this.toolbar.btnHorizontalAlign;if(x.rendered){var T=$(".btn-icon",x.cmpEl);T&&(T.removeClass(x.options.icls),x.options.icls=S,T.addClass(x.options.icls))}s.btnTextOrient.menu.items[1].setDisabled(f=="justify"),s.btnTextOrient.menu.items[2].setDisabled(f=="justify")}f=e.asc_getVertAlign();if(this._state.valign!==f){this._state.valign=f,E=-1,S="";switch(f){case"top":E=0,S="btn-valign-top";break;case"center":E=1,S="btn-valign-middle";break;case"bottom":E=2,S="btn-valign-bottom"}if(E>-1){s.btnAlignTop.toggle(E===0,!0),s.btnAlignMiddle.toggle(E===1,!0),s.btnAlignBottom.toggle(E===2,!0),s.btnVerticalAlign.menu.items[E].setChecked(!0,!1);var N=this.toolbar.btnVerticalAlign;if(N.rendered){var C=$(".btn-icon",N.cmpEl);C&&(C.removeClass(N.options.icls),N.options.icls=S,C.addClass(N.options.icls))}}}a=this._state.controlsdisabled.filters||w!==null||b&&b.asc_getIsAutoFilter()===null,s.lockToolbar(SSE.enumLock.ruleMerge,a,{array:[s.btnMerge]}),u=e.asc_getFlags().asc_getMerge(),this._state.merge!==u&&(s.btnMerge.toggle(u===Asc.c_oAscMergeOptions.Merge,!0),this._state.merge=u),s.btnWrap.isDisabled()||(u=e.asc_getFlags().asc_getWrapText(),this._state.wrap!==u&&(s.btnWrap.toggle(u===!0,!0),this._state.wrap=u))}u=b?b.asc_getIsAutoFilter():null,this._state.filter!==u&&(s.btnSetAutofilter.toggle(u===!0,!0),s.mnuitemAutoFilter.setChecked(u===!0,!0),this._state.filter=u),a=this._state.controlsdisabled.filters||u===null,s.lockToolbar(SSE.enumLock.ruleFilter,a,{array:[s.btnSortDown,s.btnSortUp,s.mnuitemSortAZ,s.mnuitemSortZA,s.btnTableTemplate,s.btnSetAutofilter,s.mnuitemAutoFilter,s.btnAutofilter]}),u=w?w.asc_getTableStyleName():null,this._state.tablestylename!==u&&this.toolbar.mnuTableTemplatePicker&&(u=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:u}),u?(this.toolbar.mnuTableTemplatePicker.selectRecord(u),this._state.tablestylename=u.get("name")):(s.mnuTableTemplatePicker.deselectAll(),this._state.tablestylename=null)),a=this._state.controlsdisabled.filters||!b||b.asc_getIsApplyAutoFilter()!==!0,s.lockToolbar(SSE.enumLock.ruleDelFilter,a,{array:[s.btnClearAutofilter,s.mnuitemClearFilter]});var k=this._state.tablename;this._state.tablename=w?w.asc_getTableName():undefined;var L=this._state.filterapplied;this._state.filterapplied=this._state.filter&&b.asc_getIsApplyAutoFilter(),(this._state.tablename!==k||this._state.filterapplied!==L)&&this.getApplication().getController("Statusbar").onApiFilterInfo(!a),this._state.multiselect=e.asc_getFlags().asc_getMultiselect(),s.lockToolbar(SSE.enumLock.multiselect,this._state.multiselect,{array:[s.btnTableTemplate,s.btnInsertHyperlink]})}u=e.asc_getNumFormatInfo(),u&&(this._state.numformat=e.asc_getNumFormat(),this._state.numformatinfo=u,u=u.asc_getType(),this._state.numformattype!==u&&(s.cmbNumberFormat.setValue(u,s.txtCustom),this._state.numformattype=u)),u=e.asc_getAngle();if(this._state.angle!==u){this._clearChecked(s.btnTextOrient.menu);switch(u){case 45:s.btnTextOrient.menu.items[1].setChecked(!0,!0);break;case-45:s.btnTextOrient.menu.items[2].setChecked(!0,!0);break;case 90:s.btnTextOrient.menu.items[3].setChecked(!0,!0);break;case-90:s.btnTextOrient.menu.items[4].setChecked(!0,!0);break;default:s.btnTextOrient.menu.items[0].setChecked(!0,!0)}this._state.angle=u}u=e.asc_getStyleName();if(this._state.prstyle!=u&&!this.toolbar.listStyles.isDisabled()){var A=this.toolbar.listStyles,O=A.rendered;if(O){A.suspendEvents();var M=A.menuPicker.store.findWhere({name:u});this._state.prstyle=A.menuPicker.store.length>0?u:undefined,A.menuPicker.selectRecord(M),A.resumeEvents()}}u=t==Asc.c_oAscSelectionType.RangeRow,this._state.controlsdisabled.rows!==u&&(this._state.controlsdisabled.rows=u,s.btnAddCell.menu.items[3].setDisabled(u),s.btnDeleteCell.menu.items[3].setDisabled(u)),u=t==Asc.c_oAscSelectionType.RangeCol,this._state.controlsdisabled.cols!==u&&(this._state.controlsdisabled.cols=u,s.btnAddCell.menu.items[2].setDisabled(u),s.btnDeleteCell.menu.items[2].setDisabled(u)),u=b&&b.asc_getIsApplyAutoFilter(),this._state.controlsdisabled.cells_right!==(this._state.controlsdisabled.rows||u)&&(this._state.controlsdisabled.cells_right=this._state.controlsdisabled.rows||u,s.btnAddCell.menu.items[0].setDisabled(this._state.controlsdisabled.cells_right),s.btnDeleteCell.menu.items[0].setDisabled(this._state.controlsdisabled.cells_right)),this._state.controlsdisabled.cells_down!==(this._state.controlsdisabled.cols||u)&&(this._state.controlsdisabled.cells_down=this._state.controlsdisabled.cols||u,s.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down),s.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down))},onApiStyleChange:function(){this.toolbar.btnCopyStyle.toggle(!1,!0),this.modeAlwaysSetStyle=!1},updateThemeColors:function(){var e=function(e,t){if(e){var n,r=Common.Utils.ThemeColor.getEffectColors();for(var i=0;i
    ')}]})});e.toolbar.btnInsertShape.menu.addItem(i);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-shapegroup"+n),store:r.get("groupStore"),parentMenu:i.menu,showLast:!1,itemTemplate:_.template('
    ')});s.on("item:click",function(t,n,r,i){e.api&&(e._addAutoshape(!0,r.get("data").shapeType),e._isAddingShape=!0,e.toolbar.btnInsertText.pressed&&e.toolbar.btnInsertText.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertShape.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Shape"))})}},fillTextArt:function(){if(!this.toolbar.btnInsertText.rendered)return;var e=this;if(this.toolbar.mnuTextArtPicker){var t=this.getApplication().getCollection("Common.Collections.TextArt").models,n=this.toolbar.mnuTextArtPicker.store.length;if(n>0&&n==t.length){var r=this.toolbar.mnuTextArtPicker.store.models;_.each(t,function(e,t){r[t].set("imageUrl",e.get("imageUrl"))})}else this.toolbar.mnuTextArtPicker.store.reset(t)}else this.toolbar.mnuTextArtPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insart"),store:this.getApplication().getCollection("Common.Collections.TextArt"),parentMenu:this.toolbar.mnuInsertTextArt.menu,showLast:!1,itemTemplate:_.template('
    ')}),this.toolbar.mnuTextArtPicker.on("item:click",function(t,n,r,i){e.api&&(e.toolbar.fireEvent("inserttextart",e.toolbar),e.api.asc_addTextArt(r.get("data")),e.toolbar.btnInsertShape.pressed&&e.toolbar.btnInsertShape.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertText.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertText),Common.component.Analytics.trackEvent("ToolBar","Add Text Art"))})},fillEquations:function(){if(!this.toolbar.btnInsertEquation.rendered||this.toolbar.btnInsertEquation.menu.items.length>0)return;var e=this,t=this.getApplication().getCollection("EquationGroups");e.equationPickers=[],e.toolbar.btnInsertEquation.menu.removeAll();for(var n=0;n
    ')}]})});e.toolbar.btnInsertEquation.menu.addItem(i);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-equationgroup"+n),store:r.get("groupStore"),parentMenu:i.menu,showLast:!1,itemTemplate:_.template('
    ')});r.get("groupHeight").length&&(e.equationPickers.push(s),e.toolbar.btnInsertEquation.menu.on("show:after",function(){if(e.equationPickers.length){var t=$(this.el).find(".over").find(".menu-shape");if(t.length)for(var n=0;n0||!e&&t.length==0)return;var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",e),this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen,e,{array:[n.btnShowMode]});if(e){t=$("
    ").appendTo(n.$el);var r=n.isCompactView?75:n.mode.nativeApp?80:48;t.css("left",r+"px"),t.css("right",(n.isCompactView?0:45)+"px"),Common.util.Shortcuts.suspendEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1")}else t.remove(),Common.util.Shortcuts.resumeEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1")},applyFormulaSettings:function(){var e=this.toolbar.btnInsertFormula.menu.items;for(var t=0;tContinue?",textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.
    Please enter a numeric value between 1 and 409",textCancel:"Cancel",confirmAddFontName:"The font you are going to save is not available on the current device.
    The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
    Do you want to continue?",textSymbols:"Symbols",textFraction:"Fraction",textScript:"Script",textRadical:"Radical",textIntegral:"Integral",textLargeOperator:"Large Operator",textBracket:"Bracket",textFunction:"Function",textAccent:"Accent",textLimitAndLog:"Limit And Log",textOperator:"Operator",textMatrix:"Matrix",txtSymbol_pm:"Plus Minus",txtSymbol_infinity:"Infinity",txtSymbol_equals:"Equal",txtSymbol_neq:"Not Equal To",txtSymbol_about:"Approximately",txtSymbol_times:"Multiplication Sign",txtSymbol_div:"Division Sign",txtSymbol_factorial:"Factorial",txtSymbol_propto:"Proportional To",txtSymbol_less:"Less Than",txtSymbol_ll:"Much Less Than",txtSymbol_greater:"Greater Than",txtSymbol_gg:"Much Greater Than",txtSymbol_leq:"Less Than or Equal To",txtSymbol_geq:"Greater Than or Equal To",txtSymbol_mp:"Minus Plus",txtSymbol_cong:"Approximately Equal To",txtSymbol_approx:"Almost Equal To",txtSymbol_equiv:"Identical To",txtSymbol_forall:"For All",txtSymbol_additional:"Complement",txtSymbol_partial:"Partial Differential",txtSymbol_sqrt:"Radical Sign",txtSymbol_cbrt:"Cube Root",txtSymbol_qdrt:"Fourth Root",txtSymbol_cup:"Union",txtSymbol_cap:"Intersection",txtSymbol_emptyset:"Empty Set",txtSymbol_percent:"Percentage",txtSymbol_degree:"Degrees",txtSymbol_fahrenheit:"Degrees Fahrenheit",txtSymbol_celsius:"Degrees Celsius",txtSymbol_inc:"Increment",txtSymbol_nabla:"Nabla",txtSymbol_exists:"There Exist",txtSymbol_notexists:"There Does Not Exist",txtSymbol_in:"Element Of",txtSymbol_ni:"Contains as Member",txtSymbol_leftarrow:"Left Arrow",txtSymbol_uparrow:"Up Arrow",txtSymbol_rightarrow:"Right Arrow",txtSymbol_downarrow:"Down Arrow",txtSymbol_leftrightarrow:"Left-Right Arrow",txtSymbol_therefore:"Therefore",txtSymbol_plus:"Plus",txtSymbol_minus:"Minus",txtSymbol_not:"Not Sign",txtSymbol_ast:"Asterisk Operator",txtSymbol_bullet:"Bulet Operator",txtSymbol_vdots:"Vertical Ellipsis",txtSymbol_cdots:"Midline Horizontal Ellipsis",txtSymbol_rddots:"Up Right Diagonal Ellipsis",txtSymbol_ddots:"Down Right Diagonal Ellipsis",txtSymbol_aleph:"Alef",txtSymbol_beth:"Bet",txtSymbol_qed:"End of Proof",txtSymbol_alpha:"Alpha",txtSymbol_beta:"Beta",txtSymbol_gamma:"Gamma",txtSymbol_delta:"Delta",txtSymbol_varepsilon:"Epsilon Variant",txtSymbol_epsilon:"Epsilon",txtSymbol_zeta:"Zeta",txtSymbol_eta:"Eta",txtSymbol_theta:"Theta",txtSymbol_vartheta:"Theta Variant",txtSymbol_iota:"Iota",txtSymbol_kappa:"Kappa",txtSymbol_lambda:"Lambda",txtSymbol_mu:"Mu",txtSymbol_nu:"Nu",txtSymbol_xsi:"Xi",txtSymbol_o:"Omicron",txtSymbol_pi:"Pi",txtSymbol_varpi:"Pi Variant",txtSymbol_rho:"Rho",txtSymbol_varrho:"Rho Variant",txtSymbol_sigma:"Sigma",txtSymbol_varsigma:"Sigma Variant",txtSymbol_tau:"Tau",txtSymbol_upsilon:"Upsilon",txtSymbol_varphi:"Phi Variant",txtSymbol_phi:"Phi",txtSymbol_chi:"Chi",txtSymbol_psi:"Psi",txtSymbol_omega:"Omega",txtFractionVertical:"Stacked Fraction",txtFractionDiagonal:"Skewed Fraction",txtFractionHorizontal:"Linear Fraction",txtFractionSmall:"Small Fraction",txtFractionDifferential_1:"Differential",txtFractionDifferential_2:"Differential",txtFractionDifferential_3:"Differential",txtFractionDifferential_4:"Differential",txtFractionPi_2:"Pi Over 2",txtScriptSup:"Superscript",txtScriptSub:"Subscript",txtScriptSubSup:"Subscript-Superscript",txtScriptSubSupLeft:"Left Subscript-Superscript",txtScriptCustom_1:"Script",txtScriptCustom_2:"Script",txtScriptCustom_3:"Script",txtScriptCustom_4:"Script",txtRadicalSqrt:"Square Root",txtRadicalRoot_n:"Radical With Degree",txtRadicalRoot_2:"Square Root With Degree",txtRadicalRoot_3:"Cubic Root",txtRadicalCustom_1:"Radical",txtRadicalCustom_2:"Radical",txtIntegral:"Integral",txtIntegralSubSup:"Integral",txtIntegralCenterSubSup:"Integral",txtIntegralDouble:"Double Integral",txtIntegralDoubleSubSup:"Double Integral",txtIntegralDoubleCenterSubSup:"Double Integral",txtIntegralTriple:"Triple Integral",txtIntegralTripleSubSup:"Triple Integral",txtIntegralTripleCenterSubSup:"Triple Integral",txtIntegralOriented:"Contour Integral",txtIntegralOrientedSubSup:"Contour Integral",txtIntegralOrientedCenterSubSup:"Contour Integral",txtIntegralOrientedDouble:"Surface Integral",txtIntegralOrientedDoubleSubSup:"Surface Integral",txtIntegralOrientedDoubleCenterSubSup:"Surface Integral",txtIntegralOrientedTriple:"Volume Integral",txtIntegralOrientedTripleSubSup:"Volume Integral",txtIntegralOrientedTripleCenterSubSup:"Volume Integral",txtIntegral_dx:"Differential x",txtIntegral_dy:"Differential y",txtIntegral_dtheta:"Differential theta",txtLargeOperator_Sum:"Summation",txtLargeOperator_Sum_CenterSubSup:"Summation",txtLargeOperator_Sum_SubSup:"Summation",txtLargeOperator_Sum_CenterSub:"Summation",txtLargeOperator_Sum_Sub:"Summation",txtLargeOperator_Prod:"Product",txtLargeOperator_Prod_CenterSubSup:"Product",txtLargeOperator_Prod_SubSup:"Product",txtLargeOperator_Prod_CenterSub:"Product",txtLargeOperator_Prod_Sub:"Product",txtLargeOperator_CoProd:"Co-Product",txtLargeOperator_CoProd_CenterSubSup:"Co-Product",txtLargeOperator_CoProd_SubSup:"Co-Product",txtLargeOperator_CoProd_CenterSub:"Co-Product",txtLargeOperator_CoProd_Sub:"Co-Product",txtLargeOperator_Union:"Union",txtLargeOperator_Union_CenterSubSup:"Union",txtLargeOperator_Union_SubSup:"Union",txtLargeOperator_Union_CenterSub:"Union",txtLargeOperator_Union_Sub:"Union",txtLargeOperator_Intersection:"Intersection",txtLargeOperator_Intersection_CenterSubSup:"Intersection",txtLargeOperator_Intersection_SubSup:"Intersection",txtLargeOperator_Intersection_CenterSub:"Intersection",txtLargeOperator_Intersection_Sub:"Intersection",txtLargeOperator_Disjunction:"Vee",txtLargeOperator_Disjunction_CenterSubSup:"Vee",txtLargeOperator_Disjunction_SubSup:"Vee",txtLargeOperator_Disjunction_CenterSub:"Vee",txtLargeOperator_Disjunction_Sub:"Vee",txtLargeOperator_Conjunction:"Wedge",txtLargeOperator_Conjunction_CenterSubSup:"Wedge",txtLargeOperator_Conjunction_SubSup:"Wedge",txtLargeOperator_Conjunction_CenterSub:"Wedge",txtLargeOperator_Conjunction_Sub:"Wedge",txtLargeOperator_Custom_1:"Summation",txtLargeOperator_Custom_2:"Summation",txtLargeOperator_Custom_3:"Summation",txtLargeOperator_Custom_4:"Product",txtLargeOperator_Custom_5:"Union",txtBracket_Round:"Brackets",txtBracket_Square:"Brackets",txtBracket_Curve:"Brackets",txtBracket_Angle:"Brackets",txtBracket_LowLim:"Brackets",txtBracket_UppLim:"Brackets",txtBracket_Line:"Brackets",txtBracket_LineDouble:"Brackets",txtBracket_Square_OpenOpen:"Brackets",txtBracket_Square_CloseClose:"Brackets",txtBracket_Square_CloseOpen:"Brackets",txtBracket_SquareDouble:"Brackets",txtBracket_Round_Delimiter_2:"Brackets with Separators",txtBracket_Curve_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_3:"Brackets with Separators",txtBracket_Round_OpenNone:"Single Bracket",txtBracket_Round_NoneOpen:"Single Bracket",txtBracket_Square_OpenNone:"Single Bracket",txtBracket_Square_NoneOpen:"Single Bracket",txtBracket_Curve_OpenNone:"Single Bracket",txtBracket_Curve_NoneOpen:"Single Bracket",txtBracket_Angle_OpenNone:"Single Bracket",txtBracket_Angle_NoneOpen:"Single Bracket",txtBracket_LowLim_OpenNone:"Single Bracket",txtBracket_LowLim_NoneNone:"Single Bracket",txtBracket_UppLim_OpenNone:"Single Bracket",txtBracket_UppLim_NoneOpen:"Single Bracket",txtBracket_Line_OpenNone:"Single Bracket",txtBracket_Line_NoneOpen:"Single Bracket",txtBracket_LineDouble_OpenNone:"Single Bracket",txtBracket_LineDouble_NoneOpen:"Single Bracket",txtBracket_SquareDouble_OpenNone:"Single Bracket",txtBracket_SquareDouble_NoneOpen:"Single Bracket",txtBracket_Custom_1:"Case (Two Conditions)",txtBracket_Custom_2:"Cases (Three Conditions)",txtBracket_Custom_3:"Stack Object",txtBracket_Custom_4:"Stack Object",txtBracket_Custom_5:"Cases Example",txtBracket_Custom_6:"Binomial Coefficient",txtBracket_Custom_7:"Binomial Coefficient",txtFunction_Sin:"Sine Function",txtFunction_Cos:"Cosine Function",txtFunction_Tan:"Tangent Function",txtFunction_Csc:"Cosecant Function",txtFunction_Sec:"Secant Function",txtFunction_Cot:"Cotangent Function",txtFunction_1_Sin:"Inverse Sine Function",txtFunction_1_Cos:"Inverse Cosine Function",txtFunction_1_Tan:"Inverse Tangent Function",txtFunction_1_Csc:"Inverse Cosecant Function",txtFunction_1_Sec:"Inverse Secant Function",txtFunction_1_Cot:"Inverse Cotangent Function",txtFunction_Sinh:"Hyperbolic Sine Function",txtFunction_Cosh:"Hyperbolic Cosine Function",txtFunction_Tanh:"Hyperbolic Tangent Function",txtFunction_Csch:"Hyperbolic Cosecant Function",txtFunction_Sech:"Hyperbolic Secant Function",txtFunction_Coth:"Hyperbolic Cotangent Function",txtFunction_1_Sinh:"Hyperbolic Inverse Sine Function",txtFunction_1_Cosh:"Hyperbolic Inverse Cosine Function",txtFunction_1_Tanh:"Hyperbolic Inverse Tangent Function",txtFunction_1_Csch:"Hyperbolic Inverse Cosecant Function",txtFunction_1_Sech:"Hyperbolic Inverse Secant Function",txtFunction_1_Coth:"Hyperbolic Inverse Cotangent Function",txtFunction_Custom_1:"Sine theta",txtFunction_Custom_2:"Cos 2x",txtFunction_Custom_3:"Tangent formula",txtAccent_Dot:"Dot",txtAccent_DDot:"Double Dot",txtAccent_DDDot:"Triple Dot",txtAccent_Hat:"Hat",txtAccent_Check:"Check",txtAccent_Accent:"Acute",txtAccent_Grave:"Grave",txtAccent_Smile:"Breve",txtAccent_Tilde:"Tilde",txtAccent_Bar:"Bar",txtAccent_DoubleBar:"Double Overbar",txtAccent_CurveBracketTop:"Overbrace",txtAccent_CurveBracketBot:"Underbrace",txtAccent_GroupTop:"Grouping Character Above",txtAccent_GroupBot:"Grouping Character Below",txtAccent_ArrowL:"Leftwards Arrow Above",txtAccent_ArrowR:"Rightwards Arrow Above",txtAccent_ArrowD:"Right-Left Arrow Above",txtAccent_HarpoonL:"Leftwards Harpoon Above",txtAccent_HarpoonR:"Rightwards Harpoon Above",txtAccent_BorderBox:"Boxed Formula (With Placeholder)",txtAccent_BorderBoxCustom:"Boxed Formula (Example)",txtAccent_BarTop:"Overbar",txtAccent_BarBot:"Underbar",txtAccent_Custom_1:"Vector A",txtAccent_Custom_2:"ABC With Overbar",txtAccent_Custom_3:"x XOR y With Overbar",txtLimitLog_LogBase:"Logarithm",txtLimitLog_Log:"Logarithm",txtLimitLog_Lim:"Limit",txtLimitLog_Min:"Minimum",txtLimitLog_Max:"Maximum",txtLimitLog_Ln:"Natural Logarithm",txtLimitLog_Custom_1:"Limit Example",txtLimitLog_Custom_2:"Maximum Example",txtOperator_ColonEquals:"Colon Equal",txtOperator_EqualsEquals:"Equal Equal",txtOperator_PlusEquals:"Plus Equal",txtOperator_MinusEquals:"Minus Equal",txtOperator_Definition:"Equal to By Definition",txtOperator_UnitOfMeasure:"Measured By",txtOperator_DeltaEquals:"Delta Equal To",txtOperator_ArrowL_Top:"Leftwards Arrow Above",txtOperator_ArrowR_Top:"Rightwards Arrow Above",txtOperator_ArrowL_Bot:"Leftwards Arrow Below",txtOperator_ArrowR_Bot:"Rightwards Arrow Below",txtOperator_DoubleArrowL_Top:"Leftwards Arrow Above",txtOperator_DoubleArrowR_Top:"Rightwards Arrow Above",txtOperator_DoubleArrowL_Bot:"Leftwards Arrow Below",txtOperator_DoubleArrowR_Bot:"Rightwards Arrow Below",txtOperator_ArrowD_Top:"Right-Left Arrow Above",txtOperator_ArrowD_Bot:"Right-Left Arrow Above",txtOperator_DoubleArrowD_Top:"Right-Left Arrow Below",txtOperator_DoubleArrowD_Bot:"Right-Left Arrow Below",txtOperator_Custom_1:"Yileds",txtOperator_Custom_2:"Delta Yields",txtMatrix_1_2:"1x2 Empty Matrix",txtMatrix_2_1:"2x1 Empty Matrix",txtMatrix_1_3:"1x3 Empty Matrix",txtMatrix_3_1:"3x1 Empty Matrix",txtMatrix_2_2:"2x2 Empty Matrix",txtMatrix_2_3:"2x3 Empty Matrix",txtMatrix_3_2:"3x2 Empty Matrix",txtMatrix_3_3:"3x3 Empty Matrix",txtMatrix_Dots_Center:"Midline Dots",txtMatrix_Dots_Baseline:"Baseline Dots",txtMatrix_Dots_Vertical:"Vertical Dots",txtMatrix_Dots_Diagonal:"Diagonal Dots",txtMatrix_Identity_2:"2x2 Identity Matrix",txtMatrix_Identity_2_NoZeros:"3x3 Identity Matrix",txtMatrix_Identity_3:"3x3 Identity Matrix",txtMatrix_Identity_3_NoZeros:"3x3 Identity Matrix",txtMatrix_2_2_RoundBracket:"Empty Matrix with Brackets",txtMatrix_2_2_SquareBracket:"Empty Matrix with Brackets",txtMatrix_2_2_LineBracket:"Empty Matrix with Brackets",txtMatrix_2_2_DLineBracket:"Empty Matrix with Brackets",txtMatrix_Flat_Round:"Sparse Matrix",txtMatrix_Flat_Square:"Sparse Matrix",txtExpandSort:"The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",txtExpand:"Expand and sort",txtSorting:"Sorting",txtSortSelected:"Sort selected"},SSE.Controllers.Toolbar||{}))}),define("text!spreadsheeteditor/main/app/template/StatusBar.template",[],function(){return'\r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n