|
|
/*
|
|
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
|
|
*
|
|
|
* https://www.onlyoffice.com/
|
|
|
*
|
|
|
* Version: 0.0.0 (build:0)
|
|
|
*/
|
|
|
function onDropDownKeyDown(t){var e=$(this),i=e.parent(),n=jQuery.Event("keydown.before.bs.dropdown",{keyCode:t.keyCode}),o=jQuery.Event("keydown.after.bs.dropdown",{keyCode:t.keyCode});i.trigger(n),i.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),!/^(38|40|27|13|9|37|39)$/.test(t.keyCode)||t.ctrlKey||t.altKey||(patchDropDownKeyDownAdditional.call(this,t),/(37|39)/.test(t.keyCode)||(t.preventDefault(),t.stopPropagation()))):(patchDropDownKeyDown.call(this,t),t.preventDefault(),t.stopPropagation()),i.trigger(o)}function patchDropDownKeyDown(t){if(/(38|40|27|37|39)/.test(t.keyCode)){var e=$(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=getParent(e),n=i.hasClass("open")||i.hasClass("over");if(!n||n&&27==t.keyCode){if(27==t.which){if(o=$("[role=menu] li.dropdown-submenu.over:visible",i),o.length)return o.eq(o.length-1).removeClass("over"),!1;i.hasClass("dropdown-submenu")&&i.hasClass("over")?(i.removeClass("over"),i.find("> a").focus()):i.find("[data-toggle=dropdown]").focus()}return n?e.click():void 0}var o=$("> [role=menu] > li:not(.divider):not(.disabled):visible",i).find("> a");if(o.length){var s=o.index(o.filter(":focus"));if(39==t.keyCode){if(s<0)return;var a=o.eq(s).parent();a.hasClass("dropdown-submenu")&&!a.hasClass("over")&&(a.mouseenter(),a.addClass("focused-submenu"),_.delay(function(){var t=$("> [role=menu]",a),e=t.find("> li:not(.divider):not(.disabled):visible > a"),i=t.find("> li:not(.divider):not(.disabled):visible .dataview"),n=t.find("> li:not(.divider):not(.disabled):visible ul.internal-menu");e.length>0&&i.length<1&&n.length<1&&e.index(e.filter(":focus"))<0&&e.eq(0).focus()},250))}else 37==t.keyCode?i.hasClass("dropdown-submenu")&&i.hasClass("over")&&(i.removeClass("over"),i.find("> a").focus()):(38==t.keyCode?s>0?s--:s=e.hasClass("no-cyclic")?0:o.length-1:40==t.keyCode&&(s<o.length-1?s++:s=e.hasClass("no-cyclic")?o.length-1:0),~s||(s=0),i.hasClass("dropdown-submenu")&&i.hasClass("over")&&i.addClass("focused-submenu"),o.eq(s).focus())}}}}function patchDropDownKeyDownAdditional(t){if(/(38|40|27|37|39)/.test(t.keyCode)){var e=$(this);if(/(37|39)/.test(t.keyCode)||(t.preventDefault(),t.stopPropagation()),!e.is(".disabled, :disabled")){var i=getParent(e),n=i.hasClass("open")||i.hasClass("over");if(!n||n&&(27==t.keyCode||37==t.keyCode||39==t.keyCode))return n?e.click():void 0;var o=$("> [role=menu] > li:not(.divider):not(.disabled):visible",i).find("> a");if(o.length){var s=o.index(o.filter(".focus")),a=s;if(38==t.keyCode?s>0?s--:s=e.hasClass("no-cyclic")?0:o.length-1:40==t.keyCode&&(s<o.length-1?s++:s=e.hasClass("no-cyclic")?o.length-1:0),~s||(s=0),o.removeClass("focus"),o.eq(s).addClass("focus"),a!==s){var l=o.eq(a).parent().data("bs.tooltip");l&&l.hide(),l=o.eq(s).parent().data("bs.tooltip"),l&&l.show()}}}}}function getParent(t){var e=t.attr("data-target");e||(e=t.attr("href"),e=e&&/#/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i=e&&$(e);return i&&i.length?i:t.parent()}function clearMenus(t){$(".dropdown-toggle").each(function(e){var i=$(this).parent();if(i.hasClass("open")){if("prevent-canvas-click"==i.attr("data-value"))return void i.attr("data-value","");i.trigger(e=$.Event("hide.bs.dropdown")),e.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown",t)}})}function toggle(){$(".dropdown-backdrop").remove()}if(function(){var t="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this||{},e=t._,i=Array.prototype,n=Object.prototype,o="undefined"!=typeof Symbol?Symbol.prototype:null,s=i.push,a=i.slice,l=n.toString,r=n.hasOwnProperty,c=Array.isArray,h=Object.keys,d=Object.create,p=function(){},m=function(t){return t instanceof m?t:this instanceof m?void(this._wrapped=t):new m(t)};"undefined"==typeof exports||exports.nodeType?t._=m:("undefined"!=typeof module&&!module.nodeType&&module.exports&&(exports=module.exports=m),exports._=m),m.VERSION="1.8.3";var u,g=function(t,e,i){if(void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case null:case 3:return function(i,n,o){return t.call(e,i,n,o)};case 4:return function(i,n,o,s){return t.call(e,i,n,o,s)}}return function(){return t.apply(e,arguments)}},b=function(t,e,i){return m.iteratee!==u?m.iteratee(t,e):null==t?m.identity:m.isFunction(t)?g(t,e,i):m.isObject(t)&&!m.isArray(t)?m.matcher(t):m.property(t)};m.iteratee=u=function(t,e){return b(t,e,1/0)};var f=function(t,e){return e=null==e?t.length-1:+e,function(){for(var i=Math.max(arguments.length-e,0),n=Array(i),o=0;o<i;o++)n[o]=arguments[o+e];switch(e){case 0:return t.call(this,n);case 1:return t.call(this,arguments[0],n);case 2:return t.call(this,arguments[0],arguments[1],n)}var s=Array(e+1);for(o=0;o<e;o++)s[o]=arguments[o];return s[e]=n,t.apply(this,s)}},C=function(t){if(!m.isObject(t))return{};if(d)return d(t);p.prototype=t;var e=new p;return p.prototype=null,e},v=function(t){return function(e){return null==e?void 0:e[t]}},_=function(t,e){for(var i=e.length,n=0;n<i;n++){if(null==t)return;t=t[e[n]]}return i?t:void 0},y=Math.pow(2,53)-1,x=v("length"),w=function(t){var e=x(t);return"number"==typeof e&&e>=0&&e<=y};m.each=m.forEach=function(t,e,i){e=g(e,i);var n,o;if(w(t))for(n=0,o=t.length;n<o;n++)e(t[n],n,t);else{var s=m.keys(t);for(n=0,o=s.length;n<o;n++)e(t[s[n]],s[n],t)}return t},m.map=m.collect=function(t,e,i){e=b(e,i);for(var n=!w(t)&&m.keys(t),o=(n||t).length,s=Array(o),a=0;a<o;a++){var l=n?n[a]:a;s[a]=e(t[l],l,t)}return s};var S=function(t){var e=function(e,i,n,o){var s=!w(e)&&m.keys(e),a=(s||e).length,l=t>0?0:a-1;for(o||(n=e[s?s[l]:l],l+=t);l>=0&&l<a;l+=t){var r=s?s[l]:l;n=i(n,e[r],r,e)}return n};return function(t,i,n,o){var s=arguments.length>=3;return e(t,g(i,o,4),n,s)}};m.reduce=m.foldl=m.inject=S(1),m.reduceRight=m.foldr=S(-1),m.find=m.detect=function(t,e,i){var n=w(t)?m.findIndex:m.findKey,o=n(t,e,i);if(void 0!==o&&-1!==o)return t[o]},m.filter=m.select=function(t,e,i){var n=[];return e=b(e,i),m.each(t,function(t,i,o){e(t,i,o)&&n.push(t)}),n},m.reject=function(t,e,i){return m.filter(t,m.negate(b(e)),i)},m.every=m.all=function(t,e,i){e=b(e,i);for(var n=!w(t)&&m.keys(t),o=(n||t).length,s=0;s<o;s++){var a=n?n[s]:s;if(!e(t[a],a,t))return!1}return!0},m.some=m.any=function(t,e,i){e=b(e,i);for(var n=!w(t)&&m.keys(t),o=(n||t).length,s=0;s<o;s++){var a=n?n[s]:s;if(e(t[a],a,t))return!0}return!1},m.contains=m.includes=m.include=function(t,e,i,n){return w(t)||(t=m.values(t)),("number"!=typeof i||n)&&(i=0),m.indexOf(t,e,i)>=0},m.invoke=f(function(t,e,i){var n,o;return m.isFunction(e)?o=e:m.isArray(e)&&(n=e.slice(0,-1),e=e[e.length-1]),m.map(t,function(t){var s=o;if(!s){if(n&&n.length&&(t=_(t,n)),null==t)return;s=t[e]}return null==s?s:s.apply(t,i)})}),m.pluck=function(t,e){return m.map(t,m.property(e))},m.where=function(t,e){return m.filter(t,m.matcher(e))},m.findWhere=function(t,e){return m.find(t,m.matcher(e))},m.max=function(t,e,i){var n,o,s=-1/0,a=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t){t=w(t)?t:m.values(t);for(var l=0,r=t.length;l<r;l++)null!=(n=t[l])&&n>s&&(s=n)}else e=b(e,i),m.each(t,function(t,i,n){((o=e(t,i,n))>a||o===-1/0&&s===-1/0)&&(s=t,a=o)});return s},m.min=function(t,e,i){var n,o,s=1/0,a=1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t){t=w(t)?t:m.values(t);for(var l=0,r=t.length;l<r;l++)null!=(n=t[l])&&n<s&&(s=n)}else e=b(e,i),m.each(t,function(t,i,n){((o=e(t,i,n))<a||o===1/0&&s===1/0)&&(s=t,a=o)});return s},m.shuffle=function(t){return m.sample(t,1/0)},m.sample=function(t,e,i){if(null==e||i)return w(t)||(t=m.values(t)),t[m.random(t.length-1)];var n=w(t)?m.clone(t):m.values(t),o=x(n);e=Math.max(Math.min(e,o),0);for(var s=o-1,a=0;a<e;a++){var l=m.random(a,s),r=n[a];n[a]=n[l],n[l]=r}return n.slice(0,e)},m.sortBy=function(t,e,i){var n=0;return e=b(e,i),m.pluck(m.map(t,function(t,i,o){return{value:t,index:n++,criteria:e(t,i,o)}}).sort(function(t,e){var i=t.criteria,n=e.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(i<n||void 0===n)return-1}return t.index-e.index}),"value")};var A=function(t,e){return function(i,n,o){var s=e?[[],[]]:{};return n=b(n,o),m.each(i,function(e,o){var a=n(e,o,i);t(s,e,a)}),s}};m.groupBy=A(function(t,e,i){m.has(t,i)?t[i].push(e):t[i]=[e]}),m.indexBy=A(function(t,e,i){t[i]=e}),m.countBy=A(function(t,e,i){m.has(t,i)?t[i]++:t[i]=1});var k=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;m.toArray=function(t){return t?m.isArray(t)?a.call(t):m.isString(t)?t.match(k):w(t)?m.map(t,m.identity):m.values(t):[]},m.size=function(t){return null==t?0:w(t)?t.length:m.keys(t).length},m.partition=A(function(t,e,i){t[i?0:1].push(e)},!0),m.first=m.head=m.take=function(t,e,i){if(!(null==t||t.length<1))return null==e||i?t[0]:m.initial(t,t.length-e)},m.initial=function(t,e,i){return a.call(t,0,Math.max(0,t.length-(null==e||i?1:e)))},m.last=function(t,e,i){if(!(null==t||t.length<1))return null==e||i?t[t.length-1]:m.rest(t,Math.max(0,t.length-e))},m.rest=m.tail=m.drop=function(t,e,i){return a.call(t,null==e||i?1:e)},m.compact=function(t){return m.filter(t,Boolean)};var T=function(t,e,i,n){n=n||[];for(var o=n.length,s=0,a=x(t);s<a;s++){var l=t[s];if(w(l)&&(m.isArray(l)||m.isArguments(l)))if(e)for(var r=0,c=l.length;r<c;)n[o++]=l[r++];else T(l,e,i,n),o=n.length;else i||(n[o++]=l)}return n};m.flatten=function(t,e){return T(t,e,!1)},m.without=f(function(t,e){return m.difference(t,e)}),m.uniq=m.unique=function(t,e,i,n){m.isBoolean(e)||(n=i,i=e,e=!1),null!=i&&(i=b(i,n));for(var o=[],s=[],a=0,l=x(t);a<l;a++){var r=t[a],c=i?i(r,a,t):r;e?(a&&s===c||o.push(r),s=c):i?m.contains(s,c)||(s.push(c),o.push(r)):m.contains(o,r)||o.push(r)}return o},m.union=f(function(t){return m.uniq(T(t,!0,!0))}),m.intersection=function(t){for(var e=[],i=arguments.length,n=0,o=x(t);n<o;n++){var s=t[n];if(!m.contains(e,s)){var a;for(a=1;a<i&&m.contains(arguments[a],s);a++);a===i&&e.push(s)}}return e},m.difference=f(function(t,e){return e=T(e,!0,!0),m.filter(t,function(t){return!m.contains(e,t)})}),m.unzip=function(t){for(var e=t&&m.max(t,x).length||0,i=Array(e),n=0;n<e;n++)i[n]=m.pluck(t,n);return i},m.zip=f(m.unzip),m.object=function(t,e){for(var i={},n=0,o=x(t);n<o;n++)e?i[t[n]]=e[n]:i[t[n][0]]=t[n][1];return i};var I=function(t){return function(e,i,n){i=b(i,n);for(var o=x(e),s=t>0?0:o-1;s>=0&&s<o;s+=t)if(i(e[s],s,e))return s;return-1}};m.findIndex=I(1),m.findLastIndex=I(-1),m.sortedIndex=function(t,e,i,n){i=b(i,n,1);for(var o=i(e),s=0,a=x(t);s<a;){var l=Math.floor((s+a)/2);i(t[l])<o?s=l+1:a=l}return s};var E=function(t,e,i){return function(n,o,s){var l=0,r=x(n);if("number"==typeof s)t>0?l=s>=0?s:Math.max(s+r,l):r=s>=0?Math.min(s+1,r):s+r+1;else if(i&&s&&r)return s=i(n,o),n[s]===o?s:-1;if(o!==o)return s=e(a.call(n,l,r),m.isNaN),s>=0?s+l:-1;for(s=t>0?l:r-1;s>=0&&s<r;s+=t)if(n[s]===o)return s;return-1}};m.indexOf=E(1,m.findIndex,m.sortedIndex),m.lastIndexOf=E(-1,m.findLastIndex),m.range=function(t,e,i){null==e&&(e=t||0,t=0),i||(i=e<t?-1:1);for(var n=Math.max(Math.ceil((e-t)/i),0),o=Array(n),s=0;s<n;s++,t+=i)o[s]=t;return o},m.chunk=function(t,e){if(null==e||e<1)return[];for(var i=[],n=0,o=t.length;n<o;)i.push(a.call(t,n,n+=e));return i};var P=function(t,e,i,n,o){if(!(n instanceof e))return t.apply(i,o);var s=C(t.prototype),a=t.apply(s,o);return m.isObject(a)?a:s};m.bind=f(function(t,e,i){if(!m.isFunction(t))throw new TypeError("Bind must be called on a function");var n=f(function(o){return P(t,n,e,this,i.concat(o))});return n}),m.partial=f(function(t,e){var i=m.partial.placeholder,n=function(){for(var o=0,s=e.length,a=Array(s),l=0;l<s;l++)a[l]=e[l]===i?arguments[o++]:e[l];for(;o<arguments.length;)a.push(arguments[o++]);return P(t,n,this,this,a)};return n}),m.partial.placeholder=m,m.bindAll=f(function(t,e){e=T(e,!1,!1);var i=e.length;if(i<1)throw new Error("bindAll must be passed function names");for(;i--;){var n=e[i];t[n]=m.bind(t[n],t)}}),m.memoize=function(t,e){var i=function(n){var o=i.cache,s=""+(e?e.apply(this,arguments):n);return m.has(o,s)||(o[s]=t.apply(this,arguments)),o[s]};return i.cache={},i},m.delay=f(function(t,e,i){return setTimeout(function(){return t.apply(null,i)},e)}),m.defer=m.partial(m.delay,m,1),m.throttle=function(t,e,i){var n,o,s,a,l=0;i||(i={});var r=function(){l=!1===i.leading?0:m.now(),n=null,a=t.apply(o,s),n||(o=s=null)},c=function(){var c=m.now();l||!1!==i.leading||(l=c);var h=e-(c-l);return o=this,s=arguments,h<=0||h>e?(n&&(clearTimeout(n),n=null),l=c,a=t.apply(o,s),n||(o=s=null)):n||!1===i.trailing||(n=setTimeout(r,h)),a};return c.cancel=function(){clearTimeout(n),l=0,n=o=s=null},c},m.debounce=function(t,e,i){var n,o,s=function(e,i){n=null,i&&(o=t.apply(e,i))},a=f(function(a){if(n&&clearTimeout(n),i){var l=!n;n=setTimeout(s,e),l&&(o=t.apply(this,a))}else n=m.delay(s,e,this,a);return o});return a.cancel=function(){clearTimeout(n),n=null},a},m.wrap=function(t,e){return m.partial(e,t)},m.negate=function(t){return function(){return!t.apply(this,arguments)}},m.compose=function(){var t=arguments,e=t.length-1;return function(){for(var i=e,n=t[e].apply(this,arguments);i--;)n=t[i].call(this,n);return n}},m.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},m.before=function(t,e){var i;return function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=null),i}},m.once=m.partial(m.before,2),m.restArgs=f;var M=!{toString:null}.propertyIsEnumerable("toString"),D=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],F=function(t,e){var i=D.length,o=t.constructor,s=m.isFunction(o)&&o.prototype||n,a="constructor";for(m.has(t,a)&&!m.contains(e,a)&&e.push(a);i--;)(a=D[i])in t&&t[a]!==s[a]&&!m.contains(e,a)&&e.push(a)};m.keys=function(t){if(!m.isObject(t))return[];if(h)return h(t);var e=[];for(var i in t)m.has(t,i)&&e.push(i);return M&&F(t,e),e},m.allKeys=function(t){if(!m.isObject(t))return[];var e=[];for(var i in t)e.push(i);return M&&F(t,e),e},m.values=function(t){for(var e=m.keys(t),i=e.length,n=Array(i),o=0;o<i;o++)n[o]=t[e[o]];return n},m.mapObject=function(t,e,i){e=b(e,i);for(var n=m.keys(t),o=n.length,s={},a=0;a<o;a++){var l=n[a];s[l]=e(t[l],l,t)}return s},m.pairs=function(t){for(var e=m.keys(t),i=e.length,n=Array(i),o=0;o<i;o++)n[o]=[e[o],t[e[o]]];return n},m.invert=function(t){for(var e={},i=m.keys(t),n=0,o=i.length;n<o;n++)e[t[i[n]]]=i[n];return e},m.functions=m.methods=function(t){var e=[];for(var i in t)m.isFunction(t[i])&&e.push(i);return e.sort()};var U=function(t,e){return function(i){var n=arguments.length;if(e&&(i=Object(i)),n<2||null==i)return i;for(var o=1;o<n;o++)for(var s=arguments[o],a=t(s),l=a.length,r=0;r<l;r++){var c=a[r];e&&void 0!==i[c]||(i[c]=s[c])}return i}};m.extend=U(m.allKeys),m.extendOwn=m.assign=U(m.keys),m.findKey=function(t,e,i){e=b(e,i);for(var n,o=m.keys(t),s=0,a=o.length;s<a;s++)if(n=o[s],e(t[n],n,t))return n};var V=function(t,e,i){return e in i};m.pick=f(function(t,e){var i={},n=e[0];if(null==t)return i;m.isFunction(n)?(e.length>1&&(n=g(n,e[1])),e=m.allKeys(t)):(n=V,e=T(e,!1,!1),t=Object(t));for(var o=0,s=e.length;o<s;o++){var a=e[o],l=t[a];n(l,a,t)&&(i[a]=l)}return i}),m.omit=f(function(t,e){var i,n=e[0];return m.isFunction(n)?(n=m.negate(n),e.length>1&&(i=e[1])):(e=m.map(T(e,!1,!1),String),n=function(t,i){return!m.contains(e,i)}),m.pick(t,n,i)}),m.defaults=U(m.allKeys,!0),m.create=function(t,e){var i=C(t);return e&&m.extendOwn(i,e),i},m.clone=function(t){return m.isObject(t)?m.isArray(t)?t.slice():m.extend({},t):t},m.tap=function(t,e){return e(t),t},m.isMatch=function(t,e){var i=m.keys(e),n=i.length;if(null==t)return!n;for(var o=Object(t),s=0;s<n;s++){var a=i[s];if(e[a]!==o[a]||!(a in o))return!1}return!0};var R,B;R=function(t,e,i,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return!1;if(t!==t)return e!==e;var o=typeof t;return("function"===o||"object"===o||"object"==typeof e)&&B(t,e,i,n)},B=function(t,e,i,n){t instanceof m&&(t=t._wrapped),e instanceof m&&(e=e._wrapped);var s=l.call(t);if(s!==l.call(e))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return o.valueOf.call(t)===o.valueOf.call(e)}var a="[object Array]"===s;if(!a){if("object"!=typeof t||"object"!=typeof e)return!1;var r=t.constructor,c=e.constructor;if(r!==c&&!(m.isFunction(r)&&r instanceof r&&m.isFunction(c)&&c instanceof c)&&"constructor"in t&&"constructor"in e)return!1}i=i||[],n=n||[];for(var h=i.length;h--;)if(i[h]===t)return n[h]===e;if(i.push(t),n.push(e),a){if((h=t.length)!==e.length)return!1;for(;h--;)if(!R(t[h],e[h],i,n))return!1}else{var d,p=m.keys(t);if(h=p.length,m.keys(e).length!==h)return!1;for(;h--;)if(d=p[h],!m.has(e,d)||!R(t[d],e[d],i,n))return!1}return i.pop(),n.pop(),!0},m.isEqual=function(t,e){return R(t,e)},m.isEmpty=function(t){return null==t||(w(t)&&(m.isArray(t)||m.isString(t)||m.isArguments(t))?0===t.length:0===m.keys(t).length)},m.isElement=function(t){return!(!t||1!==t.nodeType)},m.isArray=c||function(t){return"[object Array]"===l.call(t)},m.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},m.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol","Map","WeakMap","Set","WeakSet"],function(t){m["is"+t]=function(e){return l.call(e)==="[object "+t+"]"}}),m.isArguments(arguments)||(m.isArguments=function(t){return m.has(t,"callee")});var L=t.document&&t.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof L&&(m.isFunction=function(t){return"function"==typeof t||!1}),m.isFinite=function(t){return!m.isSymbol(t)&&isFinite(t)&&!isNaN(parseFloat(t))},m.isNaN=function(t){return m.isNumber(t)&&isNaN(t)},m.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"===l.call(t)},m.isNull=function(t){return null===t},m.isUndefined=function(t){return void 0===t},m.has=function(t,e){if(!m.isArray(e))return null!=t&&r.call(t,e);for(var i=e.length,n=0;n<i;n++){var o=e[n];if(null==t||!r.call(t,o))return!1;t=t[o]}return!!i},m.noConflict=function(){return t._=e,this},m.identity=function(t){return t},m.constant=function(t){return function(){return t}},m.noop=function(){},m.property=function(t){return m.isArray(t)?function(e){return _(e,t)}:v(t)},m.propertyOf=function(t){return null==t?function(){}:function(e){return m.isArray(e)?_(t,e):t[e]}},m.matcher=m.matches=function(t){return t=m.extendOwn({},t),function(e){return m.isMatch(e,t)}},m.times=function(t,e,i){var n=Array(Math.max(0,t));e=g(e,i,1);for(var o=0;o<t;o++)n[o]=e(o);return n},m.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},m.now=Date.now||function(){return(new Date).getTime()};var N={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},O=m.invert(N),H=function(t){var e=function(e){return t[e]},i="(?:"+m.keys(t).join("|")+")",n=RegExp(i),o=RegExp(i,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(o,e):t}};m.escape=H(N),m.unescape=H(O),m.result=function(t,e,i){m.isArray(e)||(e=[e]);var n=e.length;if(!n)return m.isFunction(i)?i.call(t):i;for(var o=0;o<n;o++){var s=null==t?void 0:t[e[o]];void 0===s&&(s=i,o=n),t=m.isFunction(s)?s.call(t):s}return t};var $=0;m.uniqueId=function(t){var e=++$+"";return t?t+e:e},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var z=/(.)^/,G={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\u2028|\u2029/g,W=function(t){return"\\"+G[t]};m.template=function(t,e,i){!e&&i&&(e=i),e=m.defaults({},e,m.templateSettings);var n=RegExp([(e.escape||z).source,(e.interpolate||z).source,(e.evaluate||z).source].join("|")+"|$","g"),o=0,s="__p+='";t.replace(n,function(e,i,n,a,l){return s+=t.slice(o,l).replace(j,W),o=l+e.length,i?s+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":n?s+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(s+="';\n"+a+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";var a;try{a=new Function(e.variable||"obj","_",s)}catch(t){throw t.source=s,t}var l=function(t){return a.call(this,t,m)};return l.source="function("+(e.variable||"obj")+"){\n"+s+"}",l},m.chain=function(t){var e=m(t);return e._chain=!0,e};var q=function(t,e){return t._chain?m(e).chain():e};m.mixin=function(t){return m.each(m.functions(t),function(e){var i=m[e]=t[e];m.prototype[e]=function(){var t=[this._wrapped];return s.apply(t,arguments),q(this,i.apply(m,t))}}),m},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=i[t];m.prototype[t]=function(){var i=this._wrapped;return e.apply(i,arguments),"shift"!==t&&"splice"!==t||0!==i.length||delete i[0],q(this,i)}}),m.each(["concat","join","slice"],function(t){var e=i[t];m.prototype[t]=function(){return q(this,e.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}(),function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(t,e){function i(t,e){e=e||it;var i=e.createElement("script");i.text=t,e.head.appendChild(i).parentNode.removeChild(i)}function n(t){var e=!!t&&"length"in t&&t.length,i=ut.type(t);return"function"!==i&&!ut.isWindow(t)&&("array"===i||0===e||"number"==typeof e&&e>0&&e-1 in t)}function o(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function s(t,e,i){return ut.isFunction(e)?ut.grep(t,function(t,n){return!!e.call(t,n,t)!==i}):e.nodeType?ut.grep(t,function(t){return t===e!==i}):"string"!=typeof e?ut.grep(t,function(t){return lt.call(e,t)>-1!==i}):St.test(e)?ut.filter(e,t,i):(e=ut.filter(e,t),ut.grep(t,function(t){return lt.call(e,t)>-1!==i&&1===t.nodeType}))}function a(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function l(t){var e={};return ut.each(t.match(Et)||[],function(t,i){e[i]=!0}),e}function r(t){return t}function c(t){throw t}function h(t,e,i,n){var o;try{t&&ut.isFunction(o=t.promise)?o.call(t).done(e).fail(i):t&&ut.isFunction(o=t.then)?o.call(t,e,i):e.apply(void 0,[t].slice(n))}catch(t){i.apply(void 0,[t])}}function d(){it.removeEventListener("DOMContentLoaded",d),t.removeEventListener("load",d),ut.ready()}function p(){this.expando=ut.expando+p.uid++}function m(t){return"true"===t||"false"!==t&&("null"===t?null:t===+t+""?+t:Rt.test(t)?JSON.parse(t):t)}function u(t,e,i){var n;if(void 0===i&&1===t.nodeType)if(n="data-"+e.replace(Bt,"-$&").toLowerCase(),"string"==typeof(i=t.getAttribute(n))){try{i=m(i)}catch(t){}Vt.set(t,e,i)}else i=void 0;return i}function g(t,e,i,n){var o,s=1,a=20,l=n?function(){return n.cur()}:function(){return ut.css(t,e,"")},r=l(),c=i&&i[3]||(ut.cssNumber[e]?"":"px"),h=(ut.cssNumber[e]||"px"!==c&&+r)&&Nt.exec(ut.css(t,e));if(h&&h[3]!==c){c=c||h[3],i=i||[],h=+r||1;do{s=s||".5",h/=s,ut.style(t,e,h+c)}while(s!==(s=l()/r)&&1!==s&&--a)}return i&&(h=+h||+r||0,o=i[1]?h+(i[1]+1)*i[2]:+i[2],n&&(n.unit=c,n.start=h,n.end=o)),o}function b(t){var e,i=t.ownerDocument,n=t.nodeName,o=zt[n];return o||(e=i.body.appendChild(i.createElement(n)),o=ut.css(e,"display"),e.parentNode.removeChild(e),"none"===o&&(o="block"),zt[n]=o,o)}function f(t,e){for(var i,n,o=[],s=0,a=t.length;s<a;s++)n=t[s],n.style&&(i=n.style.display,e?("none"===i&&(o[s]=Ut.get(n,"display")||null,o[s]||(n.style.display="")),""===n.style.display&&Ht(n)&&(o[s]=b(n))):"none"!==i&&(o[s]="none",Ut.set(n,"display",i)));for(s=0;s<a;s++)null!=o[s]&&(t[s].style.display=o[s]);return t}function C(t,e){var i;return i=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&o(t,e)?ut.merge([t],i):i}function v(t,e){for(var i=0,n=t.length;i<n;i++)Ut.set(t[i],"globalEval",!e||Ut.get(e[i],"globalEval"))}function _(t,e,i,n,o){for(var s,a,l,r,c,h,d=e.createDocumentFragment(),p=[],m=0,u=t.length;m<u;m++)if((s=t[m])||0===s)if("object"===ut.type(s))ut.merge(p,s.nodeType?[s]:s);else if(Kt.test(s)){for(a=a||d.appendChild(e.createElement("div")),l=(jt.exec(s)||["",""])[1].toLowerCase(),r=qt[l]||qt._default,a.innerHTML=r[1]+ut.htmlPrefilter(s)+r[2],h=r[0];h--;)a=a.lastChild;ut.merge(p,a.childNodes),a=d.firstChild,a.textContent=""}else p.push(e.createTextNode(s));for(d.textContent="",m=0;s=p[m++];)if(n&&ut.inArray(s,n)>-1)o&&o.push(s);else if(c=ut.contains(s.ownerDocument,s),a=C(d.appendChild(s),"script"),c&&v(a),i)for(h=0;s=a[h++];)Wt.test(s.type||"")&&i.push(s);return d}function y(){return!0}function x(){return!1}function w(){try{return it.activeElement}catch(t){}}function S(t,e,i,n,o,s){var a,l;if("object"==typeof e){"string"!=typeof i&&(n=n||i,i=void 0);for(l in e)S(t,l,i,n,e[l],s);return t}if(null==n&&null==o?(o=i,n=i=void 0):null==o&&("string"==typeof i?(o=n,n=void 0):(o=n,n=i,i=void 0)),!1===o)o=x;else if(!o)return t;return 1===s&&(a=o,o=function(t){return ut().off(t),a.apply(this,arguments)},o.guid=a.guid||(a.guid=ut.guid++)),t.each(function(){ut.event.add(this,e,o,n,i)})}function A(t,e){return o(t,"table")&&o(11!==e.nodeType?e:e.firstChild,"tr")?ut(">tbody",t)[0]||t:t}function k(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function T(t){var e=ie.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function I(t,e){var i,n,o,s,a,l,r,c;if(1===e.nodeType){if(Ut.hasData(t)&&(s=Ut.access(t),a=Ut.set(e,s),c=s.events)){delete a.handle,a.events={};for(o in c)for(i=0,n=c[o].length;i<n;i++)ut.event.add(e,o,c[o][i])}Vt.hasData(t)&&(l=Vt.access(t),r=ut.extend({},l),Vt.set(e,r))}}function E(t,e){var i=e.nodeName.toLowerCase();"input"===i&&Gt.test(t.type)?e.checked=t.checked:"input"!==i&&"textarea"!==i||(e.defaultValue=t.defaultValue)}function P(t,e,n,o){e=st.apply([],e);var s,a,l,r,c,h,d=0,p=t.length,m=p-1,u=e[0],g=ut.isFunction(u);if(g||p>1&&"string"==typeof u&&!mt.checkClone&&ee.test(u))return t.each(function(i){var s=t.eq(i);g&&(e[0]=u.call(this,i,s.html())),P(s,e,n,o)});if(p&&(s=_(e,t[0].ownerDocument,!1,t,o),a=s.firstChild,1===s.childNodes.length&&(s=a),a||o)){for(l=ut.map(C(s,"script"),k),r=l.length;d<p;d++)c=s,d!==m&&(c=ut.clone(c,!0,!0),r&&ut.merge(l,C(c,"script"))),n.call(t[d],c,d);if(r)for(h=l[l.length-1].ownerDocument,ut.map(l,T),d=0;d<r;d++)c=l[d],Wt.test(c.type||"")&&!Ut.access(c,"globalEval")&&ut.contains(h,c)&&(c.src?ut._evalUrl&&ut._evalUrl(c.src):i(c.textContent.replace(ne,""),h))}return t}function M(t,e,i){for(var n,o=e?ut.filter(e,t):t,s=0;null!=(n=o[s]);s++)i||1!==n.nodeType||ut.cleanData(C(n)),n.parentNode&&(i&&ut.contains(n.ownerDocument,n)&&v(C(n,"script")),n.parentNode.removeChild(n));return t}function D(t,e,i){var n,o,s,a,l=t.style;return i=i||ae(t),i&&(a=i.getPropertyValue(e)||i[e],""!==a||ut.contains(t.ownerDocument,t)||(a=ut.style(t,e)),!mt.pixelMarginRight()&&se.test(a)&&oe.test(e)&&(n=l.width,o=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=a,a=i.width,l.width=n,l.minWidth=o,l.maxWidth=s)),void 0!==a?a+"":a}function F(t,e){return{get:function(){return t()?void delete this.get:(this.get=e).apply(this,arguments)}}}function U(t){if(t in pe)return t;for(var e=t[0].toUpperCase()+t.slice(1),i=de.length;i--;)if((t=de[i]+e)in pe)return t}function V(t){var e=ut.cssProps[t];return e||(e=ut.cssProps[t]=U(t)||t),e}function R(t,e,i){var n=Nt.exec(e);return n?Math.max(0,n[2]-(i||0))+(n[3]||"px"):e}function B(t,e,i,n,o){var s,a=0;for(s=i===(n?"border":"content")?4:"width"===e?1:0;s<4;s+=2)"margin"===i&&(a+=ut.css(t,i+Ot[s],!0,o)),n?("content"===i&&(a-=ut.css(t,"padding"+Ot[s],!0,o)),"margin"!==i&&(a-=ut.css(t,"border"+Ot[s]+"Width",!0,o))):(a+=ut.css(t,"padding"+Ot[s],!0,o),"padding"!==i&&(a+=ut.css(t,"border"+Ot[s]+"Width",!0,o)));return a}function L(t,e,i){var n,o=ae(t),s=D(t,e,o),a="border-box"===ut.css(t,"boxSizing",!1,o);return se.test(s)?s:(n=a&&(mt.boxSizingReliable()||s===t.style[e]),"auto"===s&&(s=t["offset"+e[0].toUpperCase()+e.slice(1)]),(s=parseFloat(s)||0)+B(t,e,i||(a?"border":"content"),n,o)+"px")}function N(t,e,i,n,o){return new N.prototype.init(t,e,i,n,o)}function O(){ue&&(!1===it.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(O):t.setTimeout(O,ut.fx.interval),ut.fx.tick())}function H(){return t.setTimeout(function(){me=void 0}),me=ut.now()}function $(t,e){var i,n=0,o={height:t};for(e=e?1:0;n<4;n+=2-e)i=Ot[n],o["margin"+i]=o["padding"+i]=t;return e&&(o.opacity=o.width=t),o}function z(t,e,i){for(var n,o=(W.tweeners[e]||[]).concat(W.tweeners["*"]),s=0,a=o.length;s<a;s++)if(n=o[s].call(i,e,t))return n}function G(t,e,i){var n,o,s,a,l,r,c,h,d="width"in e||"height"in e,p=this,m={},u=t.style,g=t.nodeType&&Ht(t),b=Ut.get(t,"fxshow");i.queue||(a=ut._queueHooks(t,"fx"),null==a.unqueued&&(a.unqueued=0,l=a.empty.fire,a.empty.fire=function(){a.unqueued||l()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ut.queue(t,"fx").length||a.empty.fire()})}));for(n in e)if(o=e[n],ge.test(o)){if(delete e[n],s=s||"toggle"===o,o===(g?"hide":"show")){if("show"!==o||!b||void 0===b[n])continue;g=!0}m[n]=b&&b[n]||ut.style(t,n)}if((r=!ut.isEmptyObject(e))||!ut.isEmptyObject(m)){d&&1===t.nodeType&&(i.overflow=[u.overflow,u.overflowX,u.overflowY],c=b&&b.display,null==c&&(c=Ut.get(t,"display")),h=ut.css(t,"display"),"none"===h&&(c?h=c:(f([t],!0),c=t.style.display||c,h=ut.css(t,"display"),f([t]))),("inline"===h||"inline-block"===h&&null!=c)&&"none"===ut.css(t,"float")&&(r||(p.done(function(){u.display=c}),null==c&&(h=u.display,c="none"===h?"":h)),u.display="inline-block")),i.overflow&&(u.overflow="hidden",p.always(function(){u.overflow=i.overflow[0],u.overflowX=i.overflow[1],u.overflowY=i.overflow[2]})),r=!1;for(n in m)r||(b?"hidden"in b&&(g=b.hidden):b=Ut.access(t,"fxshow",{display:c}),s&&(b.hidden=!g),g&&f([t],!0),p.done(function(){g||f([t]),Ut.remove(t,"fxshow");for(n in m)ut.style(t,n,m[n])})),r=z(g?b[n]:0,n,p),n in b||(b[n]=r.start,g&&(r.end=r.start,r.start=0))}}function j(t,e){var i,n,o,s,a;for(i in t)if(n=ut.camelCase(i),o=e[n],s=t[i],Array.isArray(s)&&(o=s[1],s=t[i]=s[0]),i!==n&&(t[n]=s,delete t[i]),(a=ut.cssHooks[n])&&"expand"in a){s=a.expand(s),delete t[n];for(i in s)i in t||(t[i]=s[i],e[i]=o)}else e[n]=o}function W(t,e,i){var n,o,s=0,a=W.prefilters.length,l=ut.Deferred().always(function(){delete r.elem}),r=function(){if(o)return!1;for(var e=me||H(),i=Math.max(0,c.startTime+c.duration-e),n=i/c.duration||0,s=1-n,a=0,r=c.tweens.length;a<r;a++)c.tweens[a].run(s);return l.notifyWith(t,[c,s,i]),s<1&&r?i:(r||l.notifyWith(t,[c,1,0]),l.resolveWith(t,[c]),!1)},c=l.promise({elem:t,props:ut.extend({},e),opts:ut.extend(!0,{specialEasing:{},easing:ut.easing._default},i),originalProperties:e,originalOptions:i,startTime:me||H(),duration:i.duration,tweens:[],createTween:function(e,i){var n=ut.Tween(t,c.opts,e,i,c.opts.specialEasing[e]||c.opts.easing);return c.tweens.push(n),n},stop:function(e){var i=0,n=e?c.tweens.length:0;if(o)return this;for(o=!0;i<n;i++)c.tweens[i].run(1);return e?(l.notifyWith(t,[c,1,0]),l.resolveWith(t,[c,e])):l.rejectWith(t,[c,e]),this}}),h=c.props;for(j(h,c.opts.specialEasing);s<a;s++)if(n=W.prefilters[s].call(c,t,h,c.opts))return ut.isFunction(n.stop)&&(ut._queueHooks(c.elem,c.opts.queue).stop=ut.proxy(n.stop,n)),n;return ut.map(h,z,c),ut.isFunction(c.opts.start)&&c.opts.start.call(t,c),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always),ut.fx.timer(ut.extend(r,{elem:t,anim:c,queue:c.opts.queue})),c}function q(t){return(t.match(Et)||[]).join(" ")}function K(t){return t.getAttribute&&t.getAttribute("class")||""}function Y(t,e,i,n){var o;if(Array.isArray(e))ut.each(e,function(e,o){
|
|
|
i||ke.test(t)?n(t,o):Y(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,i,n)});else if(i||"object"!==ut.type(e))n(t,e);else for(o in e)Y(t+"["+o+"]",e[o],i,n)}function X(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,o=0,s=e.toLowerCase().match(Et)||[];if(ut.isFunction(i))for(;n=s[o++];)"+"===n[0]?(n=n.slice(1)||"*",(t[n]=t[n]||[]).unshift(i)):(t[n]=t[n]||[]).push(i)}}function J(t,e,i,n){function o(l){var r;return s[l]=!0,ut.each(t[l]||[],function(t,l){var c=l(e,i,n);return"string"!=typeof c||a||s[c]?a?!(r=c):void 0:(e.dataTypes.unshift(c),o(c),!1)}),r}var s={},a=t===Le;return o(e.dataTypes[0])||!s["*"]&&o("*")}function Z(t,e){var i,n,o=ut.ajaxSettings.flatOptions||{};for(i in e)void 0!==e[i]&&((o[i]?t:n||(n={}))[i]=e[i]);return n&&ut.extend(!0,t,n),t}function Q(t,e,i){for(var n,o,s,a,l=t.contents,r=t.dataTypes;"*"===r[0];)r.shift(),void 0===n&&(n=t.mimeType||e.getResponseHeader("Content-Type"));if(n)for(o in l)if(l[o]&&l[o].test(n)){r.unshift(o);break}if(r[0]in i)s=r[0];else{for(o in i){if(!r[0]||t.converters[o+" "+r[0]]){s=o;break}a||(a=o)}s=s||a}if(s)return s!==r[0]&&r.unshift(s),i[s]}function tt(t,e,i,n){var o,s,a,l,r,c={},h=t.dataTypes.slice();if(h[1])for(a in t.converters)c[a.toLowerCase()]=t.converters[a];for(s=h.shift();s;)if(t.responseFields[s]&&(i[t.responseFields[s]]=e),!r&&n&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),r=s,s=h.shift())if("*"===s)s=r;else if("*"!==r&&r!==s){if(!(a=c[r+" "+s]||c["* "+s]))for(o in c)if(l=o.split(" "),l[1]===s&&(a=c[r+" "+l[0]]||c["* "+l[0]])){!0===a?a=c[o]:!0!==c[o]&&(s=l[0],h.unshift(l[1]));break}if(!0!==a)if(a&&t.throws)e=a(e);else try{e=a(e)}catch(t){return{state:"parsererror",error:a?t:"No conversion from "+r+" to "+s}}}return{state:"success",data:e}}var et=[],it=t.document,nt=Object.getPrototypeOf,ot=et.slice,st=et.concat,at=et.push,lt=et.indexOf,rt={},ct=rt.toString,ht=rt.hasOwnProperty,dt=ht.toString,pt=dt.call(Object),mt={},ut=function(t,e){return new ut.fn.init(t,e)},gt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,bt=/^-ms-/,ft=/-([a-z])/g,Ct=function(t,e){return e.toUpperCase()};ut.fn=ut.prototype={jquery:"3.2.1",constructor:ut,length:0,toArray:function(){return ot.call(this)},get:function(t){return null==t?ot.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=ut.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return ut.each(this,t)},map:function(t){return this.pushStack(ut.map(this,function(e,i){return t.call(e,i,e)}))},slice:function(){return this.pushStack(ot.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,i=+t+(t<0?e:0);return this.pushStack(i>=0&&i<e?[this[i]]:[])},end:function(){return this.prevObject||this.constructor()},push:at,sort:et.sort,splice:et.splice},ut.extend=ut.fn.extend=function(){var t,e,i,n,o,s,a=arguments[0]||{},l=1,r=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[l]||{},l++),"object"==typeof a||ut.isFunction(a)||(a={}),l===r&&(a=this,l--);l<r;l++)if(null!=(t=arguments[l]))for(e in t)i=a[e],n=t[e],a!==n&&(c&&n&&(ut.isPlainObject(n)||(o=Array.isArray(n)))?(o?(o=!1,s=i&&Array.isArray(i)?i:[]):s=i&&ut.isPlainObject(i)?i:{},a[e]=ut.extend(c,s,n)):void 0!==n&&(a[e]=n));return a},ut.extend({expando:"jQuery"+("3.2.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isFunction:function(t){return"function"===ut.type(t)},isWindow:function(t){return null!=t&&t===t.window},isNumeric:function(t){var e=ut.type(t);return("number"===e||"string"===e)&&!isNaN(t-parseFloat(t))},isPlainObject:function(t){var e,i;return!(!t||"[object Object]"!==ct.call(t))&&(!(e=nt(t))||"function"==typeof(i=ht.call(e,"constructor")&&e.constructor)&&dt.call(i)===pt)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?rt[ct.call(t)]||"object":typeof t},globalEval:function(t){i(t)},camelCase:function(t){return t.replace(bt,"ms-").replace(ft,Ct)},each:function(t,e){var i,o=0;if(n(t))for(i=t.length;o<i&&!1!==e.call(t[o],o,t[o]);o++);else for(o in t)if(!1===e.call(t[o],o,t[o]))break;return t},trim:function(t){return null==t?"":(t+"").replace(gt,"")},makeArray:function(t,e){var i=e||[];return null!=t&&(n(Object(t))?ut.merge(i,"string"==typeof t?[t]:t):at.call(i,t)),i},inArray:function(t,e,i){return null==e?-1:lt.call(e,t,i)},merge:function(t,e){for(var i=+e.length,n=0,o=t.length;n<i;n++)t[o++]=e[n];return t.length=o,t},grep:function(t,e,i){for(var n=[],o=0,s=t.length,a=!i;o<s;o++)!e(t[o],o)!==a&&n.push(t[o]);return n},map:function(t,e,i){var o,s,a=0,l=[];if(n(t))for(o=t.length;a<o;a++)null!=(s=e(t[a],a,i))&&l.push(s);else for(a in t)null!=(s=e(t[a],a,i))&&l.push(s);return st.apply([],l)},guid:1,proxy:function(t,e){var i,n,o;if("string"==typeof e&&(i=t[e],e=t,t=i),ut.isFunction(t))return n=ot.call(arguments,2),o=function(){return t.apply(e||this,n.concat(ot.call(arguments)))},o.guid=t.guid=t.guid||ut.guid++,o},now:Date.now,support:mt}),"function"==typeof Symbol&&(ut.fn[Symbol.iterator]=et[Symbol.iterator]),ut.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){rt["[object "+e+"]"]=e.toLowerCase()});var vt=function(t){function e(t,e,i,n){var o,s,a,l,r,h,p,m=e&&e.ownerDocument,u=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==u&&9!==u&&11!==u)return i;if(!n&&((e?e.ownerDocument||e:N)!==M&&P(e),e=e||M,F)){if(11!==u&&(r=gt.exec(t)))if(o=r[1]){if(9===u){if(!(a=e.getElementById(o)))return i;if(a.id===o)return i.push(a),i}else if(m&&(a=m.getElementById(o))&&B(e,a)&&a.id===o)return i.push(a),i}else{if(r[2])return X.apply(i,e.getElementsByTagName(t)),i;if((o=r[3])&&_.getElementsByClassName&&e.getElementsByClassName)return X.apply(i,e.getElementsByClassName(o)),i}if(_.qsa&&!G[t+" "]&&(!U||!U.test(t))){if(1!==u)m=e,p=t;else if("object"!==e.nodeName.toLowerCase()){for((l=e.getAttribute("id"))?l=l.replace(vt,_t):e.setAttribute("id",l=L),h=S(t),s=h.length;s--;)h[s]="#"+l+" "+d(h[s]);p=h.join(","),m=bt.test(t)&&c(e.parentNode)||e}if(p)try{return X.apply(i,m.querySelectorAll(p)),i}catch(t){}finally{l===L&&e.removeAttribute("id")}}}return k(t.replace(st,"$1"),e,i,n)}function i(){function t(i,n){return e.push(i+" ")>y.cacheLength&&delete t[e.shift()],t[i+" "]=n}var e=[];return t}function n(t){return t[L]=!0,t}function o(t){var e=M.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function s(t,e){for(var i=t.split("|"),n=i.length;n--;)y.attrHandle[i[n]]=e}function a(t,e){var i=e&&t,n=i&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(n)return n;if(i)for(;i=i.nextSibling;)if(i===e)return-1;return t?1:-1}function l(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&xt(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function r(t){return n(function(e){return e=+e,n(function(i,n){for(var o,s=t([],i.length,e),a=s.length;a--;)i[o=s[a]]&&(i[o]=!(n[o]=i[o]))})})}function c(t){return t&&void 0!==t.getElementsByTagName&&t}function h(){}function d(t){for(var e=0,i=t.length,n="";e<i;e++)n+=t[e].value;return n}function p(t,e,i){var n=e.dir,o=e.next,s=o||n,a=i&&"parentNode"===s,l=H++;return e.first?function(e,i,o){for(;e=e[n];)if(1===e.nodeType||a)return t(e,i,o);return!1}:function(e,i,r){var c,h,d,p=[O,l];if(r){for(;e=e[n];)if((1===e.nodeType||a)&&t(e,i,r))return!0}else for(;e=e[n];)if(1===e.nodeType||a)if(d=e[L]||(e[L]={}),h=d[e.uniqueID]||(d[e.uniqueID]={}),o&&o===e.nodeName.toLowerCase())e=e[n]||e;else{if((c=h[s])&&c[0]===O&&c[1]===l)return p[2]=c[2];if(h[s]=p,p[2]=t(e,i,r))return!0}return!1}}function m(t){return t.length>1?function(e,i,n){for(var o=t.length;o--;)if(!t[o](e,i,n))return!1;return!0}:t[0]}function u(t,i,n){for(var o=0,s=i.length;o<s;o++)e(t,i[o],n);return n}function g(t,e,i,n,o){for(var s,a=[],l=0,r=t.length,c=null!=e;l<r;l++)(s=t[l])&&(i&&!i(s,n,o)||(a.push(s),c&&e.push(l)));return a}function b(t,e,i,o,s,a){return o&&!o[L]&&(o=b(o)),s&&!s[L]&&(s=b(s,a)),n(function(n,a,l,r){var c,h,d,p=[],m=[],b=a.length,f=n||u(e||"*",l.nodeType?[l]:l,[]),C=!t||!n&&e?f:g(f,p,t,l,r),v=i?s||(n?t:b||o)?[]:a:C;if(i&&i(C,v,l,r),o)for(c=g(v,m),o(c,[],l,r),h=c.length;h--;)(d=c[h])&&(v[m[h]]=!(C[m[h]]=d));if(n){if(s||t){if(s){for(c=[],h=v.length;h--;)(d=v[h])&&c.push(C[h]=d);s(null,v=[],c,r)}for(h=v.length;h--;)(d=v[h])&&(c=s?Z(n,d):p[h])>-1&&(n[c]=!(a[c]=d))}}else v=g(v===a?v.splice(b,v.length):v),s?s(null,a,v,r):X.apply(a,v)})}function f(t){for(var e,i,n,o=t.length,s=y.relative[t[0].type],a=s||y.relative[" "],l=s?1:0,r=p(function(t){return t===e},a,!0),c=p(function(t){return Z(e,t)>-1},a,!0),h=[function(t,i,n){var o=!s&&(n||i!==T)||((e=i).nodeType?r(t,i,n):c(t,i,n));return e=null,o}];l<o;l++)if(i=y.relative[t[l].type])h=[p(m(h),i)];else{if(i=y.filter[t[l].type].apply(null,t[l].matches),i[L]){for(n=++l;n<o&&!y.relative[t[n].type];n++);return b(l>1&&m(h),l>1&&d(t.slice(0,l-1).concat({value:" "===t[l-2].type?"*":""})).replace(st,"$1"),i,l<n&&f(t.slice(l,n)),n<o&&f(t=t.slice(n)),n<o&&d(t))}h.push(i)}return m(h)}function C(t,i){var o=i.length>0,s=t.length>0,a=function(n,a,l,r,c){var h,d,p,m=0,u="0",b=n&&[],f=[],C=T,v=n||s&&y.find.TAG("*",c),_=O+=null==C?1:Math.random()||.1,x=v.length;for(c&&(T=a===M||a||c);u!==x&&null!=(h=v[u]);u++){if(s&&h){for(d=0,a||h.ownerDocument===M||(P(h),l=!F);p=t[d++];)if(p(h,a||M,l)){r.push(h);break}c&&(O=_)}o&&((h=!p&&h)&&m--,n&&b.push(h))}if(m+=u,o&&u!==m){for(d=0;p=i[d++];)p(b,f,a,l);if(n){if(m>0)for(;u--;)b[u]||f[u]||(f[u]=K.call(r));f=g(f)}X.apply(r,f),c&&!n&&f.length>0&&m+i.length>1&&e.uniqueSort(r)}return c&&(O=_,T=C),b};return o?n(a):a}var v,_,y,x,w,S,A,k,T,I,E,P,M,D,F,U,V,R,B,L="sizzle"+1*new Date,N=t.document,O=0,H=0,$=i(),z=i(),G=i(),j=function(t,e){return t===e&&(E=!0),0},W={}.hasOwnProperty,q=[],K=q.pop,Y=q.push,X=q.push,J=q.slice,Z=function(t,e){for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i;return-1},Q="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",tt="[\\x20\\t\\r\\n\\f]",et="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",it="\\["+tt+"*("+et+")(?:"+tt+"*([*^$|!~]?=)"+tt+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+et+"))|)"+tt+"*\\]",nt=":("+et+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+it+")*)|.*)\\)|)",ot=new RegExp(tt+"+","g"),st=new RegExp("^"+tt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+tt+"+$","g"),at=new RegExp("^"+tt+"*,"+tt+"*"),lt=new RegExp("^"+tt+"*([>+~]|"+tt+")"+tt+"*"),rt=new RegExp("="+tt+"*([^\\]'\"]*?)"+tt+"*\\]","g"),ct=new RegExp(nt),ht=new RegExp("^"+et+"$"),dt={ID:new RegExp("^#("+et+")"),CLASS:new RegExp("^\\.("+et+")"),TAG:new RegExp("^("+et+"|[*])"),ATTR:new RegExp("^"+it),PSEUDO:new RegExp("^"+nt),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+tt+"*(even|odd|(([+-]|)(\\d*)n|)"+tt+"*(?:([+-]|)"+tt+"*(\\d+)|))"+tt+"*\\)|)","i"),bool:new RegExp("^(?:"+Q+")$","i"),needsContext:new RegExp("^"+tt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+tt+"*((?:-\\d)?\\d*)"+tt+"*\\)|)(?=[^-]|$)","i")},pt=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,ut=/^[^{]+\{\s*\[native \w/,gt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,bt=/[+~]/,ft=new RegExp("\\\\([\\da-f]{1,6}"+tt+"?|("+tt+")|.)","ig"),Ct=function(t,e,i){var n="0x"+e-65536;return n!==n||i?e:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)},vt=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,_t=function(t,e){return e?"\0"===t?"<22>":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},yt=function(){P()},xt=p(function(t){return!0===t.disabled&&("form"in t||"label"in t)},{dir:"parentNode",next:"legend"});try{X.apply(q=J.call(N.childNodes),N.childNodes),q[N.childNodes.length].nodeType}catch(t){X={apply:q.length?function(t,e){Y.apply(t,J.call(e))}:function(t,e){for(var i=t.length,n=0;t[i++]=e[n++];);t.length=i-1}}}_=e.support={},w=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return!!e&&"HTML"!==e.nodeName},P=e.setDocument=function(t){var e,i,n=t?t.ownerDocument||t:N;return n!==M&&9===n.nodeType&&n.documentElement?(M=n,D=M.documentElement,F=!w(M),N!==M&&(i=M.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",yt,!1):i.attachEvent&&i.attachEvent("onunload",yt)),_.attributes=o(function(t){return t.className="i",!t.getAttribute("className")}),_.getElementsByTagName=o(function(t){return t.appendChild(M.createComment("")),!t.getElementsByTagName("*").length}),_.getElementsByClassName=ut.test(M.getElementsByClassName),_.getById=o(function(t){return D.appendChild(t).id=L,!M.getElementsByName||!M.getElementsByName(L).length}),_.getById?(y.filter.ID=function(t){var e=t.replace(ft,Ct);return function(t){return t.getAttribute("id")===e}},y.find.ID=function(t,e){if(void 0!==e.getElementById&&F){var i=e.getElementById(t);return i?[i]:[]}}):(y.filter.ID=function(t){var e=t.replace(ft,Ct);return function(t){var i=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return i&&i.value===e}},y.find.ID=function(t,e){if(void 0!==e.getElementById&&F){var i,n,o,s=e.getElementById(t);if(s){if((i=s.getAttributeNode("id"))&&i.value===t)return[s];for(o=e.getElementsByName(t),n=0;s=o[n++];)if((i=s.getAttributeNode("id"))&&i.value===t)return[s]}return[]}}),y.find.TAG=_.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):_.qsa?e.querySelectorAll(t):void 0}:function(t,e){var i,n=[],o=0,s=e.getElementsByTagName(t);if("*"===t){for(;i=s[o++];)1===i.nodeType&&n.push(i);return n}return s},y.find.CLASS=_.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&F)return e.getElementsByClassName(t)},V=[],U=[],(_.qsa=ut.test(M.querySelectorAll))&&(o(function(t){D.appendChild(t).innerHTML="<a id='"+L+"'></a><select id='"+L+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&U.push("[*^$]="+tt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||U.push("\\["+tt+"*(?:value|"+Q+")"),t.querySelectorAll("[id~="+L+"-]").length||U.push("~="),t.querySelectorAll(":checked").length||U.push(":checked"),t.querySelectorAll("a#"+L+"+*").length||U.push(".#.+[+~]")}),o(function(t){t.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var e=M.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&U.push("name"+tt+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&U.push(":enabled",":disabled"),D.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&U.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),U.push(",.*:")})),(_.matchesSelector=ut.test(R=D.matches||D.webkitMatchesSelector||D.mozMatchesSelector||D.oMatchesSelector||D.msMatchesSelector))&&o(function(t){_.disconnectedMatch=R.call(t,"*"),R.call(t,"[s!='']:x"),V.push("!=",nt)}),U=U.length&&new RegExp(U.join("|")),V=V.length&&new RegExp(V.join("|")),e=ut.test(D.compareDocumentPosition),B=e||ut.test(D.contains)?function(t,e){var i=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):t.compareDocumentPosition&&16&t.compareDocumentPosition(n)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},j=e?function(t,e){if(t===e)return E=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i||(i=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&i||!_.sortDetached&&e.compareDocumentPosition(t)===i?t===M||t.ownerDocument===N&&B(N,t)?-1:e===M||e.ownerDocument===N&&B(N,e)?1:I?Z(I,t)-Z(I,e):0:4&i?-1:1)}:function(t,e){if(t===e)return E=!0,0;var i,n=0,o=t.parentNode,s=e.parentNode,l=[t],r=[e];if(!o||!s)return t===M?-1:e===M?1:o?-1:s?1:I?Z(I,t)-Z(I,e):0;if(o===s)return a(t,e);for(i=t;i=i.parentNode;)l.unshift(i);for(i=e;i=i.parentNode;)r.unshift(i);for(;l[n]===r[n];)n++;return n?a(l[n],r[n]):l[n]===N?-1:r[n]===N?1:0},M):M},e.matches=function(t,i){return e(t,null,null,i)},e.matchesSelector=function(t,i){if((t.ownerDocument||t)!==M&&P(t),i=i.replace(rt,"='$1']"),_.matchesSelector&&F&&!G[i+" "]&&(!V||!V.test(i))&&(!U||!U.test(i)))try{var n=R.call(t,i);if(n||_.disconnectedMatch||t.document&&11!==t.document.nodeType)return n}catch(t){}return e(i,M,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==M&&P(t),B(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==M&&P(t);var i=y.attrHandle[e.toLowerCase()],n=i&&W.call(y.attrHandle,e.toLowerCase())?i(t,e,!F):void 0;return void 0!==n?n:_.attributes||!F?t.getAttribute(e):(n=t.getAttributeNode(e))&&n.specified?n.value:null},e.escape=function(t){return(t+"").replace(vt,_t)},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,i=[],n=0,o=0;if(E=!_.detectDuplicates,I=!_.sortStable&&t.slice(0),t.sort(j),E){for(;e=t[o++];)e===t[o]&&(n=i.push(o));for(;n--;)t.splice(i[n],1)}return I=null,t},x=e.getText=function(t){var e,i="",n=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)i+=x(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[n++];)i+=x(e);return i},y=e.selectors={cacheLength:50,createPseudo:n,match:dt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(ft,Ct),t[3]=(t[3]||t[4]||t[5]||"").replace(ft,Ct),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,i=!t[6]&&t[2];return dt.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":i&&ct.test(i)&&(e=S(i,!0))&&(e=i.indexOf(")",i.length-e)-i.length)&&(t[0]=t[0].slice(0,e),t[2]=i.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(ft,Ct).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=$[t+" "];return e||(e=new RegExp("(^|"+tt+")"+t+"("+tt+"|$)"))&&$(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,i,n){return function(o){var s=e.attr(o,t);return null==s?"!="===i:!i||(s+="","="===i?s===n:"!="===i?s!==n:"^="===i?n&&0===s.indexOf(n):"*="===i?n&&s.indexOf(n)>-1:"$="===i?n&&s.slice(-n.length)===n:"~="===i?(" "+s.replace(ot," ")+" ").indexOf(n)>-1:"|="===i&&(s===n||s.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,i,n,o){var s="nth"!==t.slice(0,3),a="last"!==t.slice(-4),l="of-type"===e;return 1===n&&0===o?function(t){return!!t.parentNode}:function(e,i,r){var c,h,d,p,m,u,g=s!==a?"nextSibling":"previousSibling",b=e.parentNode,f=l&&e.nodeName.toLowerCase(),C=!r&&!l,v=!1;if(b){if(s){for(;g;){for(p=e;p=p[g];)if(l?p.nodeName.toLowerCase()===f:1===p.nodeType)return!1;u=g="only"===t&&!u&&"nextSibling"}return!0}if(u=[a?b.firstChild:b.lastChild],a&&C){for(p=b,d=p[L]||(p[L]={}),h=d[p.uniqueID]||(d[p.uniqueID]={}),c=h[t]||[],m=c[0]===O&&c[1],v=m&&c[2],p=m&&b.childNodes[m];p=++m&&p&&p[g]||(v=m=0)||u.pop();)if(1===p.nodeType&&++v&&p===e){h[t]=[O,m,v];break}}else if(C&&(p=e,d=p[L]||(p[L]={}),h=d[p.uniqueID]||(d[p.uniqueID]={}),c=h[t]||[],m=c[0]===O&&c[1],v=m),!1===v)for(;(p=++m&&p&&p[g]||(v=m=0)||u.pop())&&((l?p.nodeName.toLowerCase()!==f:1!==p.nodeType)||!++v||(C&&(d=p[L]||(p[L]={}),h=d[p.uniqueID]||(d[p.uniqueID]={}),h[t]=[O,v]),p!==e)););return(v-=o)===n||v%n==0&&v/n>=0}}},PSEUDO:function(t,i){var o,s=y.pseudos[t]||y.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return s[L]?s(i):s.length>1?(o=[t,t,"",i],y.setFilters.hasOwnProperty(t.toLowerCase())?n(function(t,e){for(var n,o=s(t,i),a=o.length;a--;)n=Z(t,o[a]),t[n]=!(e[n]=o[a])}):function(t){return s(t,0,o)}):s}},pseudos:{not:n(function(t){var e=[],i=[],o=A(t.replace(st,"$1"));return o[L]?n(function(t,e,i,n){for(var s,a=o(t,null,n,[]),l=t.length;l--;)(s=a[l])&&(t[l]=!(e[l]=s))}):function(t,n,s){return e[0]=t,o(e,null,s,i),e[0]=null,!i.pop()}}),has:n(function(t){return function(i){return e(t,i).length>0}}),contains:n(function(t){return t=t.replace(ft,Ct),function(e){return(e.textContent||e.innerText||x(e)).indexOf(t)>-1}}),lang:n(function(t){return ht.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(ft,Ct).toLowerCase(),function(e){var i;do{if(i=F?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(i=i.toLowerCase())===t||0===i.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var i=t.location&&t.location.hash;return i&&i.slice(1)===e.id},root:function(t){return t===D},focus:function(t){return t===M.activeElement&&(!M.hasFocus||M.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:l(!1),disabled:l(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!y.pseudos.empty(t)},header:function(t){return mt.test(t.nodeName)},input:function(t){return pt.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:r(function(){return[0]}),last:r(function(t,e){return[e-1]}),eq:r(function(t,e,i){return[i<0?i+e:i]}),even:r(function(t,e){for(var i=0;i<e;i+=2)t.push(i);return t}),odd:r(function(t,e){for(var i=1;i<e;i+=2)t.push(i);return t}),lt:r(function(t,e,i){for(var n=i<0?i+e:i;--n>=0;)t.push(n);return t}),gt:r(function(t,e,i){for(var n=i<0?i+e:i;++n<e;)t.push(n);return t})}},y.pseudos.nth=y.pseudos.eq;for(v in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})y.pseudos[v]=function(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}(v);for(v in{submit:!0,reset:!0})y.pseudos[v]=function(t){return function(e){var i=e.nodeName.toLowerCase();return("input"===i||"button"===i)&&e.type===t}}(v);return h.prototype=y.filters=y.pseudos,y.setFilters=new h,S=e.tokenize=function(t,i){var n,o,s,a,l,r,c,h=z[t+" "];if(h)return i?0:h.slice(0);for(l=t,r=[],c=y.preFilter;l;){n&&!(o=at.exec(l))||(o&&(l=l.slice(o[0].length)||l),r.push(s=[])),n=!1,(o=lt.exec(l))&&(n=o.shift(),s.push({value:n,type:o[0].replace(st," ")}),l=l.slice(n.length));for(a in y.filter)!(o=dt[a].exec(l))||c[a]&&!(o=c[a](o))||(n=o.shift(),s.push({value:n,type:a,matches:o}),l=l.slice(n.length));if(!n)break}return i?l.length:l?e.error(t):z(t,r).slice(0)},A=e.compile=function(t,e){var i,n=[],o=[],s=G[t+" "];if(!s){for(e||(e=S(t)),i=e.length;i--;)s=f(e[i]),s[L]?n.push(s):o.push(s);s=G(t,C(o,n)),s.selector=t}return s},k=e.select=function(t,e,i,n){var o,s,a,l,r,h="function"==typeof t&&t,p=!n&&S(t=h.selector||t);if(i=i||[],1===p.length){if(s=p[0]=p[0].slice(0),s.length>2&&"ID"===(a=s[0]).type&&9===e.nodeType&&F&&y.relative[s[1].type]){if(!(e=(y.find.ID(a.matches[0].replace(ft,Ct),e)||[])[0]))return i;h&&(e=e.parentNode),t=t.slice(s.shift().value.length)}for(o=dt.needsContext.test(t)?0:s.length;o--&&(a=s[o],!y.relative[l=a.type]);)if((r=y.find[l])&&(n=r(a.matches[0].replace(ft,Ct),bt.test(s[0].type)&&c(e.parentNode)||e))){if(s.splice(o,1),!(t=n.length&&d(s)))return X.apply(i,n),i;break}}return(h||A(t,p))(n,e,!F,i,!e||bt.test(t)&&c(e.parentNode)||e),i},_.sortStable=L.split("").sort(j).join("")===L,_.detectDuplicates=!!E,P(),_.sortDetached=o(function(t){return 1&t.compareDocumentPosition(M.createElement("fieldset"))}),o(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||s("type|href|height|width",function(t,e,i){if(!i)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),_.attributes&&o(function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||s("value",function(t,e,i){if(!i&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),o(function(t){return null==t.getAttribute("disabled")})||s(Q,function(t,e,i){var n;if(!i)return!0===t[e]?e.toLowerCase():(n=t.getAttributeNode(e))&&n.specified?n.value:null}),e}(t);ut.find=vt,ut.expr=vt.selectors,ut.expr[":"]=ut.expr.pseudos,ut.uniqueSort=ut.unique=vt.uniqueSort,ut.text=vt.getText,ut.isXMLDoc=vt.isXML,ut.contains=vt.contains,ut.escapeSelector=vt.escape;var _t=function(t,e,i){for(var n=[],o=void 0!==i;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(o&&ut(t).is(i))break;n.push(t)}return n},yt=function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i},xt=ut.expr.match.needsContext,wt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,St=/^.[^:#\[\.,]*$/;ut.filter=function(t,e,i){var n=e[0];return i&&(t=":not("+t+")"),1===e.length&&1===n.nodeType?ut.find.matchesSelector(n,t)?[n]:[]:ut.find.matches(t,ut.grep(e,function(t){return 1===t.nodeType}))},ut.fn.extend({find:function(t){var e,i,n=this.length,o=this;if("string"!=typeof t)return this.pushStack(ut(t).filter(function(){for(e=0;e<n;e++)if(ut.contains(o[e],this))return!0}));for(i=this.pushStack([]),e=0;e<n;e++)ut.find(t,o[e],i);return n>1?ut.uniqueSort(i):i},filter:function(t){return this.pushStack(s(this,t||[],!1))},not:function(t){return this.pushStack(s(this,t||[],!0))},is:function(t){return!!s(this,"string"==typeof t&&xt.test(t)?ut(t):t||[],!1).length}});var At,kt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ut.fn.init=function(t,e,i){var n,o;if(!t)return this;if(i=i||At,"string"==typeof t){if(!(n="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:kt.exec(t))||!n[1]&&e)return!e||e.jquery?(e||i).find(t):this.constructor(e).find(t);if(n[1]){if(e=e instanceof ut?e[0]:e,ut.merge(this,ut.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:it,!0)),wt.test(n[1])&&ut.isPlainObject(e))for(n in e)ut.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}return o=it.getElementById(n[2]),o&&(this[0]=o,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):ut.isFunction(t)?void 0!==i.ready?i.ready(t):t(ut):ut.makeArray(t,this)}).prototype=ut.fn,At=ut(it);var Tt=/^(?:parents|prev(?:Until|All))/,It={children:!0,contents:!0,next:!0,prev:!0};ut.fn.extend({has:function(t){var e=ut(t,this),i=e.length;return this.filter(function(){for(var t=0;t<i;t++)if(ut.contains(this,e[t]))return!0})},closest:function(t,e){var i,n=0,o=this.length,s=[],a="string"!=typeof t&&ut(t);if(!xt.test(t))for(;n<o;n++)for(i=this[n];i&&i!==e;i=i.parentNode)if(i.nodeType<11&&(a?a.index(i)>-1:1===i.nodeType&&ut.find.matchesSelector(i,t))){s.push(i);break}return this.pushStack(s.length>1?ut.uniqueSort(s):s)},index:function(t){return t?"string"==typeof t?lt.call(ut(t),this[0]):lt.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(ut.uniqueSort(ut.merge(this.get(),ut(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),ut.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return _t(t,"parentNode")},parentsUntil:function(t,e,i){return _t(t,"parentNode",i)},next:function(t){return a(t,"nextSibling")},prev:function(t){return a(t,"previousSibling")},nextAll:function(t){return _t(t,"nextSibling")},prevAll:function(t){return _t(t,"previousSibling")},nextUntil:function(t,e,i){return _t(t,"nextSibling",i)},prevUntil:function(t,e,i){return _t(t,"previousSibling",i)},siblings:function(t){return yt((t.parentNode||{}).firstChild,t)},children:function(t){return yt(t.firstChild)},contents:function(t){return o(t,"iframe")?t.contentDocument:(o(t,"template")&&(t=t.content||t),ut.merge([],t.childNodes))}},function(t,e){ut.fn[t]=function(i,n){var o=ut.map(this,e,i);return"Until"!==t.slice(-5)&&(n=i),n&&"string"==typeof n&&(o=ut.filter(n,o)),this.length>1&&(It[t]||ut.uniqueSort(o),Tt.test(t)&&o.reverse()),this.pushStack(o)}});var Et=/[^\x20\t\r\n\f]+/g;ut.Callbacks=function(t){t="string"==typeof t?l(t):ut.extend({},t);var e,i,n,o,s=[],a=[],r=-1,c=function(){for(o=o||t.once,n=e=!0;a.length;r=-1)for(i=a.shift();++r<s.length;)!1===s[r].apply(i[0],i[1])&&t.stopOnFalse&&(r=s.length,i=!1);t.memory||(i=!1),e=!1,o&&(s=i?[]:"")},h={add:function(){return s&&(i&&!e&&(r=s.length-1,a.push(i)),function e(i){ut.each(i,function(i,n){ut.isFunction(n)?t.unique&&h.has(n)||s.push(n):n&&n.length&&"string"!==ut.type(n)&&e(n)})}(arguments),i&&!e&&c()),this},remove:function(){return ut.each(arguments,function(t,e){for(var i;(i=ut.inArray(e,s,i))>-1;)s.splice(i,1),i<=r&&r--}),this},has:function(t){return t?ut.inArray(t,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return o=a=[],s=i="",this},disabled:function(){return!s},lock:function(){return o=a=[],i||e||(s=i=""),this},locked:function(){return!!o},fireWith:function(t,i){return o||(i=i||[],i=[t,i.slice?i.slice():i],a.push(i),e||c()),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!n}};return h},ut.extend({Deferred:function(e){var i=[["notify","progress",ut.Callbacks("memory"),ut.Callbacks("memory"),2],["resolve","done",ut.Callbacks("once memory"),ut.Callbacks("once memory"),0,"resolved"],["reject","fail",ut.Callbacks("once memory"),ut.Callbacks("once memory"),1,"rejected"]],n="pending",o={state:function(){return n},always:function(){return s.done(arguments).fail(arguments),this},catch:function(t){return o.then(null,t)},pipe:function(){var t=arguments;return ut.Deferred(function(e){ut.each(i,function(i,n){var o=ut.isFunction(t[n[4]])&&t[n[4]];s[n[1]](function(){var t=o&&o.apply(this,arguments);t&&ut.isFunction(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[n[0]+"With"](this,o?[t]:arguments)})}),t=null}).promise()},then:function(e,n,o){function s(e,i,n,o){return function(){var l=this,h=arguments,d=function(){var t,d;if(!(e<a)){if((t=n.apply(l,h))===i.promise())throw new TypeError("Thenable self-resolution");d=t&&("object"==typeof t||"function"==typeof t)&&t.then,ut.isFunction(d)?o?d.call(t,s(a,i,r,o),s(a,i,c,o)):(a++,d.call(t,s(a,i,r,o),s(a,i,c,o),s(a,i,r,i.notifyWith))):(n!==r&&(l=void 0,h=[t]),(o||i.resolveWith)(l,h))}},p=o?d:function(){try{d()}catch(t){ut.Deferred.exceptionHook&&ut.Deferred.exceptionHook(t,p.stackTrace),e+1>=a&&(n!==c&&(l=void 0,h=[t]),i.rejectWith(l,h))}};e?p():(ut.Deferred.getStackHook&&(p.stackTrace=ut.Deferred.getStackHook()),t.setTimeout(p))}}var a=0;return ut.Deferred(function(t){i[0][3].add(s(0,t,ut.isFunction(o)?o:r,t.notifyWith)),i[1][3].add(s(0,t,ut.isFunction(e)?e:r)),i[2][3].add(s(0,t,ut.isFunction(n)?n:c))}).promise()},promise:function(t){return null!=t?ut.extend(t,o):o}},s={};return ut.each(i,function(t,e){var a=e[2],l=e[5];o[e[1]]=a.add,l&&a.add(function(){n=l},i[3-t][2].disable,i[0][2].lock),a.add(e[3].fire),s[e[0]]=function(){return s[e[0]+"With"](this===s?void 0:this,arguments),this},s[e[0]+"With"]=a.fireWith}),o.promise(s),e&&e.call(s,s),s},when:function(t){var e=arguments.length,i=e,n=Array(i),o=ot.call(arguments),s=ut.Deferred(),a=function(t){return function(i){n[t]=this,o[t]=arguments.length>1?ot.call(arguments):i,--e||s.resolveWith(n,o)}};if(e<=1&&(h(t,s.done(a(i)).resolve,s.reject,!e),"pending"===s.state()||ut.isFunction(o[i]&&o[i].then)))return s.then();for(;i--;)h(o[i],a(i),s.reject);return s.promise()}});var Pt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ut.Deferred.exceptionHook=function(e,i){
|
|
|
t.console&&t.console.warn&&e&&Pt.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,i)},ut.readyException=function(e){t.setTimeout(function(){throw e})};var Mt=ut.Deferred();ut.fn.ready=function(t){return Mt.then(t).catch(function(t){ut.readyException(t)}),this},ut.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--ut.readyWait:ut.isReady)||(ut.isReady=!0,!0!==t&&--ut.readyWait>0||Mt.resolveWith(it,[ut]))}}),ut.ready.then=Mt.then,"complete"===it.readyState||"loading"!==it.readyState&&!it.documentElement.doScroll?t.setTimeout(ut.ready):(it.addEventListener("DOMContentLoaded",d),t.addEventListener("load",d));var Dt=function(t,e,i,n,o,s,a){var l=0,r=t.length,c=null==i;if("object"===ut.type(i)){o=!0;for(l in i)Dt(t,e,l,i[l],!0,s,a)}else if(void 0!==n&&(o=!0,ut.isFunction(n)||(a=!0),c&&(a?(e.call(t,n),e=null):(c=e,e=function(t,e,i){return c.call(ut(t),i)})),e))for(;l<r;l++)e(t[l],i,a?n:n.call(t[l],l,e(t[l],i)));return o?t:c?e.call(t):r?e(t[0],i):s},Ft=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType};p.uid=1,p.prototype={cache:function(t){var e=t[this.expando];return e||(e={},Ft(t)&&(t.nodeType?t[this.expando]=e:Object.defineProperty(t,this.expando,{value:e,configurable:!0}))),e},set:function(t,e,i){var n,o=this.cache(t);if("string"==typeof e)o[ut.camelCase(e)]=i;else for(n in e)o[ut.camelCase(n)]=e[n];return o},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][ut.camelCase(e)]},access:function(t,e,i){return void 0===e||e&&"string"==typeof e&&void 0===i?this.get(t,e):(this.set(t,e,i),void 0!==i?i:e)},remove:function(t,e){var i,n=t[this.expando];if(void 0!==n){if(void 0!==e){Array.isArray(e)?e=e.map(ut.camelCase):(e=ut.camelCase(e),e=e in n?[e]:e.match(Et)||[]),i=e.length;for(;i--;)delete n[e[i]]}(void 0===e||ut.isEmptyObject(n))&&(t.nodeType?t[this.expando]=void 0:delete t[this.expando])}},hasData:function(t){var e=t[this.expando];return void 0!==e&&!ut.isEmptyObject(e)}};var Ut=new p,Vt=new p,Rt=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Bt=/[A-Z]/g;ut.extend({hasData:function(t){return Vt.hasData(t)||Ut.hasData(t)},data:function(t,e,i){return Vt.access(t,e,i)},removeData:function(t,e){Vt.remove(t,e)},_data:function(t,e,i){return Ut.access(t,e,i)},_removeData:function(t,e){Ut.remove(t,e)}}),ut.fn.extend({data:function(t,e){var i,n,o,s=this[0],a=s&&s.attributes;if(void 0===t){if(this.length&&(o=Vt.get(s),1===s.nodeType&&!Ut.get(s,"hasDataAttrs"))){for(i=a.length;i--;)a[i]&&(n=a[i].name,0===n.indexOf("data-")&&(n=ut.camelCase(n.slice(5)),u(s,n,o[n])));Ut.set(s,"hasDataAttrs",!0)}return o}return"object"==typeof t?this.each(function(){Vt.set(this,t)}):Dt(this,function(e){var i;if(s&&void 0===e){if(void 0!==(i=Vt.get(s,t)))return i;if(void 0!==(i=u(s,t)))return i}else this.each(function(){Vt.set(this,t,e)})},null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each(function(){Vt.remove(this,t)})}}),ut.extend({queue:function(t,e,i){var n;if(t)return e=(e||"fx")+"queue",n=Ut.get(t,e),i&&(!n||Array.isArray(i)?n=Ut.access(t,e,ut.makeArray(i)):n.push(i)),n||[]},dequeue:function(t,e){e=e||"fx";var i=ut.queue(t,e),n=i.length,o=i.shift(),s=ut._queueHooks(t,e),a=function(){ut.dequeue(t,e)};"inprogress"===o&&(o=i.shift(),n--),o&&("fx"===e&&i.unshift("inprogress"),delete s.stop,o.call(t,a,s)),!n&&s&&s.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return Ut.get(t,i)||Ut.access(t,i,{empty:ut.Callbacks("once memory").add(function(){Ut.remove(t,[e+"queue",i])})})}}),ut.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length<i?ut.queue(this[0],t):void 0===e?this:this.each(function(){var i=ut.queue(this,t,e);ut._queueHooks(this,t),"fx"===t&&"inprogress"!==i[0]&&ut.dequeue(this,t)})},dequeue:function(t){return this.each(function(){ut.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var i,n=1,o=ut.Deferred(),s=this,a=this.length,l=function(){--n||o.resolveWith(s,[s])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";a--;)(i=Ut.get(s[a],t+"queueHooks"))&&i.empty&&(n++,i.empty.add(l));return l(),o.promise(e)}});var Lt=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Nt=new RegExp("^(?:([+-])=|)("+Lt+")([a-z%]*)$","i"),Ot=["Top","Right","Bottom","Left"],Ht=function(t,e){return t=e||t,"none"===t.style.display||""===t.style.display&&ut.contains(t.ownerDocument,t)&&"none"===ut.css(t,"display")},$t=function(t,e,i,n){var o,s,a={};for(s in e)a[s]=t.style[s],t.style[s]=e[s];o=i.apply(t,n||[]);for(s in e)t.style[s]=a[s];return o},zt={};ut.fn.extend({show:function(){return f(this,!0)},hide:function(){return f(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Ht(this)?ut(this).show():ut(this).hide()})}});var Gt=/^(?:checkbox|radio)$/i,jt=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Wt=/^$|\/(?:java|ecma)script/i,qt={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};qt.optgroup=qt.option,qt.tbody=qt.tfoot=qt.colgroup=qt.caption=qt.thead,qt.th=qt.td;var Kt=/<|&#?\w+;/;!function(){var t=it.createDocumentFragment(),e=t.appendChild(it.createElement("div")),i=it.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),e.appendChild(i),mt.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",mt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Yt=it.documentElement,Xt=/^key/,Jt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Zt=/^([^.]*)(?:\.(.+)|)/;ut.event={global:{},add:function(t,e,i,n,o){var s,a,l,r,c,h,d,p,m,u,g,b=Ut.get(t);if(b)for(i.handler&&(s=i,i=s.handler,o=s.selector),o&&ut.find.matchesSelector(Yt,o),i.guid||(i.guid=ut.guid++),(r=b.events)||(r=b.events={}),(a=b.handle)||(a=b.handle=function(e){return void 0!==ut&&ut.event.triggered!==e.type?ut.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(Et)||[""],c=e.length;c--;)l=Zt.exec(e[c])||[],m=g=l[1],u=(l[2]||"").split(".").sort(),m&&(d=ut.event.special[m]||{},m=(o?d.delegateType:d.bindType)||m,d=ut.event.special[m]||{},h=ut.extend({type:m,origType:g,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&ut.expr.match.needsContext.test(o),namespace:u.join(".")},s),(p=r[m])||(p=r[m]=[],p.delegateCount=0,d.setup&&!1!==d.setup.call(t,n,u,a)||t.addEventListener&&t.addEventListener(m,a)),d.add&&(d.add.call(t,h),h.handler.guid||(h.handler.guid=i.guid)),o?p.splice(p.delegateCount++,0,h):p.push(h),ut.event.global[m]=!0)},remove:function(t,e,i,n,o){var s,a,l,r,c,h,d,p,m,u,g,b=Ut.hasData(t)&&Ut.get(t);if(b&&(r=b.events)){for(e=(e||"").match(Et)||[""],c=e.length;c--;)if(l=Zt.exec(e[c])||[],m=g=l[1],u=(l[2]||"").split(".").sort(),m){for(d=ut.event.special[m]||{},m=(n?d.delegateType:d.bindType)||m,p=r[m]||[],l=l[2]&&new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;s--;)h=p[s],!o&&g!==h.origType||i&&i.guid!==h.guid||l&&!l.test(h.namespace)||n&&n!==h.selector&&("**"!==n||!h.selector)||(p.splice(s,1),h.selector&&p.delegateCount--,d.remove&&d.remove.call(t,h));a&&!p.length&&(d.teardown&&!1!==d.teardown.call(t,u,b.handle)||ut.removeEvent(t,m,b.handle),delete r[m])}else for(m in r)ut.event.remove(t,m+e[c],i,n,!0);ut.isEmptyObject(r)&&Ut.remove(t,"handle events")}},dispatch:function(t){var e,i,n,o,s,a,l=ut.event.fix(t),r=new Array(arguments.length),c=(Ut.get(this,"events")||{})[l.type]||[],h=ut.event.special[l.type]||{};for(r[0]=l,e=1;e<arguments.length;e++)r[e]=arguments[e];if(l.delegateTarget=this,!h.preDispatch||!1!==h.preDispatch.call(this,l)){for(a=ut.event.handlers.call(this,l,c),e=0;(o=a[e++])&&!l.isPropagationStopped();)for(l.currentTarget=o.elem,i=0;(s=o.handlers[i++])&&!l.isImmediatePropagationStopped();)l.rnamespace&&!l.rnamespace.test(s.namespace)||(l.handleObj=s,l.data=s.data,void 0!==(n=((ut.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,r))&&!1===(l.result=n)&&(l.preventDefault(),l.stopPropagation()));return h.postDispatch&&h.postDispatch.call(this,l),l.result}},handlers:function(t,e){var i,n,o,s,a,l=[],r=e.delegateCount,c=t.target;if(r&&c.nodeType&&!("click"===t.type&&t.button>=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(s=[],a={},i=0;i<r;i++)n=e[i],o=n.selector+" ",void 0===a[o]&&(a[o]=n.needsContext?ut(o,this).index(c)>-1:ut.find(o,this,null,[c]).length),a[o]&&s.push(n);s.length&&l.push({elem:c,handlers:s})}return c=this,r<e.length&&l.push({elem:c,handlers:e.slice(r)}),l},addProp:function(t,e){Object.defineProperty(ut.Event.prototype,t,{enumerable:!0,configurable:!0,get:ut.isFunction(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(t){return t[ut.expando]?t:new ut.Event(t)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==w()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===w()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&o(this,"input"))return this.click(),!1},_default:function(t){return o(t.target,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}}},ut.removeEvent=function(t,e,i){t.removeEventListener&&t.removeEventListener(e,i)},ut.Event=function(t,e){if(!(this instanceof ut.Event))return new ut.Event(t,e);t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&!1===t.returnValue?y:x,this.target=t.target&&3===t.target.nodeType?t.target.parentNode:t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget):this.type=t,e&&ut.extend(this,e),this.timeStamp=t&&t.timeStamp||ut.now(),this[ut.expando]=!0},ut.Event.prototype={constructor:ut.Event,isDefaultPrevented:x,isPropagationStopped:x,isImmediatePropagationStopped:x,isSimulated:!1,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=y,t&&!this.isSimulated&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=y,t&&!this.isSimulated&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=y,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()}},ut.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(t){var e=t.button;return null==t.which&&Xt.test(t.type)?null!=t.charCode?t.charCode:t.keyCode:!t.which&&void 0!==e&&Jt.test(t.type)?1&e?1:2&e?3:4&e?2:0:t.which}},ut.event.addProp),ut.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){ut.event.special[t]={delegateType:e,bindType:e,handle:function(t){var i,n=this,o=t.relatedTarget,s=t.handleObj;return o&&(o===n||ut.contains(n,o))||(t.type=s.origType,i=s.handler.apply(this,arguments),t.type=e),i}}}),ut.fn.extend({on:function(t,e,i,n){return S(this,t,e,i,n)},one:function(t,e,i,n){return S(this,t,e,i,n,1)},off:function(t,e,i){var n,o;if(t&&t.preventDefault&&t.handleObj)return n=t.handleObj,ut(t.delegateTarget).off(n.namespace?n.origType+"."+n.namespace:n.origType,n.selector,n.handler),this;if("object"==typeof t){for(o in t)this.off(o,e,t[o]);return this}return!1!==e&&"function"!=typeof e||(i=e,e=void 0),!1===i&&(i=x),this.each(function(){ut.event.remove(this,t,i,e)})}});var Qt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,te=/<script|<style|<link/i,ee=/checked\s*(?:[^=]|=\s*.checked.)/i,ie=/^true\/(.*)/,ne=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;ut.extend({htmlPrefilter:function(t){return t.replace(Qt,"<$1></$2>")},clone:function(t,e,i){var n,o,s,a,l=t.cloneNode(!0),r=ut.contains(t.ownerDocument,t);if(!(mt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ut.isXMLDoc(t)))for(a=C(l),s=C(t),n=0,o=s.length;n<o;n++)E(s[n],a[n]);if(e)if(i)for(s=s||C(t),a=a||C(l),n=0,o=s.length;n<o;n++)I(s[n],a[n]);else I(t,l);return a=C(l,"script"),a.length>0&&v(a,!r&&C(t,"script")),l},cleanData:function(t){for(var e,i,n,o=ut.event.special,s=0;void 0!==(i=t[s]);s++)if(Ft(i)){if(e=i[Ut.expando]){if(e.events)for(n in e.events)o[n]?ut.event.remove(i,n):ut.removeEvent(i,n,e.handle);i[Ut.expando]=void 0}i[Vt.expando]&&(i[Vt.expando]=void 0)}}}),ut.fn.extend({detach:function(t){return M(this,t,!0)},remove:function(t){return M(this,t)},text:function(t){return Dt(this,function(t){return void 0===t?ut.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return P(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){A(this,t).appendChild(t)}})},prepend:function(){return P(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=A(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return P(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return P(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(ut.cleanData(C(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return ut.clone(this,t,e)})},html:function(t){return Dt(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!te.test(t)&&!qt[(jt.exec(t)||["",""])[1].toLowerCase()]){t=ut.htmlPrefilter(t);try{for(;i<n;i++)e=this[i]||{},1===e.nodeType&&(ut.cleanData(C(e,!1)),e.innerHTML=t);e=0}catch(t){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=[];return P(this,arguments,function(e){var i=this.parentNode;ut.inArray(this,t)<0&&(ut.cleanData(C(this)),i&&i.replaceChild(e,this))},t)}}),ut.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){ut.fn[t]=function(t){for(var i,n=[],o=ut(t),s=o.length-1,a=0;a<=s;a++)i=a===s?this:this.clone(!0),ut(o[a])[e](i),at.apply(n,i.get());return this.pushStack(n)}});var oe=/^margin/,se=new RegExp("^("+Lt+")(?!px)[a-z%]+$","i"),ae=function(e){var i=e.ownerDocument.defaultView;return i&&i.opener||(i=t),i.getComputedStyle(e)};!function(){function e(){if(l){l.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",l.innerHTML="",Yt.appendChild(a);var e=t.getComputedStyle(l);i="1%"!==e.top,s="2px"===e.marginLeft,n="4px"===e.width,l.style.marginRight="50%",o="4px"===e.marginRight,Yt.removeChild(a),l=null}}var i,n,o,s,a=it.createElement("div"),l=it.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",mt.clearCloneStyle="content-box"===l.style.backgroundClip,a.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.appendChild(l),ut.extend(mt,{pixelPosition:function(){return e(),i},boxSizingReliable:function(){return e(),n},pixelMarginRight:function(){return e(),o},reliableMarginLeft:function(){return e(),s}}))}();var le=/^(none|table(?!-c[ea]).+)/,re=/^--/,ce={position:"absolute",visibility:"hidden",display:"block"},he={letterSpacing:"0",fontWeight:"400"},de=["Webkit","Moz","ms"],pe=it.createElement("div").style;ut.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=D(t,"opacity");return""===i?"1":i}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(t,e,i,n){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var o,s,a,l=ut.camelCase(e),r=re.test(e),c=t.style;if(r||(e=V(l)),a=ut.cssHooks[e]||ut.cssHooks[l],void 0===i)return a&&"get"in a&&void 0!==(o=a.get(t,!1,n))?o:c[e];s=typeof i,"string"===s&&(o=Nt.exec(i))&&o[1]&&(i=g(t,e,o),s="number"),null!=i&&i===i&&("number"===s&&(i+=o&&o[3]||(ut.cssNumber[l]?"":"px")),mt.clearCloneStyle||""!==i||0!==e.indexOf("background")||(c[e]="inherit"),a&&"set"in a&&void 0===(i=a.set(t,i,n))||(r?c.setProperty(e,i):c[e]=i))}},css:function(t,e,i,n){var o,s,a,l=ut.camelCase(e);return re.test(e)||(e=V(l)),a=ut.cssHooks[e]||ut.cssHooks[l],a&&"get"in a&&(o=a.get(t,!0,i)),void 0===o&&(o=D(t,e,n)),"normal"===o&&e in he&&(o=he[e]),""===i||i?(s=parseFloat(o),!0===i||isFinite(s)?s||0:o):o}}),ut.each(["height","width"],function(t,e){ut.cssHooks[e]={get:function(t,i,n){if(i)return!le.test(ut.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?L(t,e,n):$t(t,ce,function(){return L(t,e,n)})},set:function(t,i,n){var o,s=n&&ae(t),a=n&&B(t,e,n,"border-box"===ut.css(t,"boxSizing",!1,s),s);return a&&(o=Nt.exec(i))&&"px"!==(o[3]||"px")&&(t.style[e]=i,i=ut.css(t,e)),R(t,i,a)}}}),ut.cssHooks.marginLeft=F(mt.reliableMarginLeft,function(t,e){if(e)return(parseFloat(D(t,"marginLeft"))||t.getBoundingClientRect().left-$t(t,{marginLeft:0},function(){return t.getBoundingClientRect().left}))+"px"}),ut.each({margin:"",padding:"",border:"Width"},function(t,e){ut.cssHooks[t+e]={expand:function(i){for(var n=0,o={},s="string"==typeof i?i.split(" "):[i];n<4;n++)o[t+Ot[n]+e]=s[n]||s[n-2]||s[0];return o}},oe.test(t)||(ut.cssHooks[t+e].set=R)}),ut.fn.extend({css:function(t,e){return Dt(this,function(t,e,i){var n,o,s={},a=0;if(Array.isArray(e)){for(n=ae(t),o=e.length;a<o;a++)s[e[a]]=ut.css(t,e[a],!1,n);return s}return void 0!==i?ut.style(t,e,i):ut.css(t,e)},t,e,arguments.length>1)}}),ut.Tween=N,N.prototype={constructor:N,init:function(t,e,i,n,o,s){this.elem=t,this.prop=i,this.easing=o||ut.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(ut.cssNumber[i]?"":"px")},cur:function(){var t=N.propHooks[this.prop];return t&&t.get?t.get(this):N.propHooks._default.get(this)},run:function(t){var e,i=N.propHooks[this.prop];return this.options.duration?this.pos=e=ut.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):N.propHooks._default.set(this),this}},N.prototype.init.prototype=N.prototype,N.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=ut.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){ut.fx.step[t.prop]?ut.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[ut.cssProps[t.prop]]&&!ut.cssHooks[t.prop]?t.elem[t.prop]=t.now:ut.style(t.elem,t.prop,t.now+t.unit)}}},N.propHooks.scrollTop=N.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ut.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},ut.fx=N.prototype.init,ut.fx.step={};var me,ue,ge=/^(?:toggle|show|hide)$/,be=/queueHooks$/;ut.Animation=ut.extend(W,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return g(i.elem,t,Nt.exec(e),i),i}]},tweener:function(t,e){ut.isFunction(t)?(e=t,t=["*"]):t=t.match(Et);for(var i,n=0,o=t.length;n<o;n++)i=t[n],W.tweeners[i]=W.tweeners[i]||[],W.tweeners[i].unshift(e)},prefilters:[G],prefilter:function(t,e){e?W.prefilters.unshift(t):W.prefilters.push(t)}}),ut.speed=function(t,e,i){var n=t&&"object"==typeof t?ut.extend({},t):{complete:i||!i&&e||ut.isFunction(t)&&t,duration:t,easing:i&&e||e&&!ut.isFunction(e)&&e};return ut.fx.off?n.duration=0:"number"!=typeof n.duration&&(n.duration in ut.fx.speeds?n.duration=ut.fx.speeds[n.duration]:n.duration=ut.fx.speeds._default),null!=n.queue&&!0!==n.queue||(n.queue="fx"),n.old=n.complete,n.complete=function(){ut.isFunction(n.old)&&n.old.call(this),n.queue&&ut.dequeue(this,n.queue)},n},ut.fn.extend({fadeTo:function(t,e,i,n){return this.filter(Ht).css("opacity",0).show().end().animate({opacity:e},t,i,n)},animate:function(t,e,i,n){var o=ut.isEmptyObject(t),s=ut.speed(e,i,n),a=function(){var e=W(this,ut.extend({},t),s);(o||Ut.get(this,"finish"))&&e.stop(!0)};return a.finish=a,o||!1===s.queue?this.each(a):this.queue(s.queue,a)},stop:function(t,e,i){var n=function(t){var e=t.stop;delete t.stop,e(i)};return"string"!=typeof t&&(i=e,e=t,t=void 0),e&&!1!==t&&this.queue(t||"fx",[]),this.each(function(){var e=!0,o=null!=t&&t+"queueHooks",s=ut.timers,a=Ut.get(this);if(o)a[o]&&a[o].stop&&n(a[o]);else for(o in a)a[o]&&a[o].stop&&be.test(o)&&n(a[o]);for(o=s.length;o--;)s[o].elem!==this||null!=t&&s[o].queue!==t||(s[o].anim.stop(i),e=!1,s.splice(o,1));!e&&i||ut.dequeue(this,t)})},finish:function(t){return!1!==t&&(t=t||"fx"),this.each(function(){var e,i=Ut.get(this),n=i[t+"queue"],o=i[t+"queueHooks"],s=ut.timers,a=n?n.length:0;for(i.finish=!0,ut.queue(this,t,[]),o&&o.stop&&o.stop.call(this,!0),e=s.length;e--;)s[e].elem===this&&s[e].queue===t&&(s[e].anim.stop(!0),s.splice(e,1));for(e=0;e<a;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete i.finish})}}),ut.each(["toggle","show","hide"],function(t,e){var i=ut.fn[e];ut.fn[e]=function(t,n,o){return null==t||"boolean"==typeof t?i.apply(this,arguments):this.animate($(e,!0),t,n,o)}}),ut.each({slideDown:$("show"),slideUp:$("hide"),slideToggle:$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){ut.fn[t]=function(t,i,n){return this.animate(e,t,i,n)}}),ut.timers=[],ut.fx.tick=function(){var t,e=0,i=ut.timers;for(me=ut.now();e<i.length;e++)(t=i[e])()||i[e]!==t||i.splice(e--,1);i.length||ut.fx.stop(),me=void 0},ut.fx.timer=function(t){ut.timers.push(t),ut.fx.start()},ut.fx.interval=13,ut.fx.start=function(){ue||(ue=!0,O())},ut.fx.stop=function(){ue=null},ut.fx.speeds={slow:600,fast:200,_default:400},ut.fn.delay=function(e,i){return e=ut.fx?ut.fx.speeds[e]||e:e,i=i||"fx",this.queue(i,function(i,n){var o=t.setTimeout(i,e);n.stop=function(){t.clearTimeout(o)}})},function(){var t=it.createElement("input"),e=it.createElement("select"),i=e.appendChild(it.createElement("option"));t.type="checkbox",mt.checkOn=""!==t.value,mt.optSelected=i.selected,t=it.createElement("input"),t.value="t",t.type="radio",mt.radioValue="t"===t.value}();var fe,Ce=ut.expr.attrHandle;ut.fn.extend({attr:function(t,e){return Dt(this,ut.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){ut.removeAttr(this,t)})}}),ut.extend({attr:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?ut.prop(t,e,i):(1===s&&ut.isXMLDoc(t)||(o=ut.attrHooks[e.toLowerCase()]||(ut.expr.match.bool.test(e)?fe:void 0)),void 0!==i?null===i?void ut.removeAttr(t,e):o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:(t.setAttribute(e,i+""),i):o&&"get"in o&&null!==(n=o.get(t,e))?n:(n=ut.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!mt.radioValue&&"radio"===e&&o(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n=0,o=e&&e.match(Et);if(o&&1===t.nodeType)for(;i=o[n++];)t.removeAttribute(i)}}),fe={set:function(t,e,i){return!1===e?ut.removeAttr(t,i):t.setAttribute(i,i),i}},ut.each(ut.expr.match.bool.source.match(/\w+/g),function(t,e){var i=Ce[e]||ut.find.attr;Ce[e]=function(t,e,n){var o,s,a=e.toLowerCase();return n||(s=Ce[a],Ce[a]=o,o=null!=i(t,e,n)?a:null,Ce[a]=s),o}});var ve=/^(?:input|select|textarea|button)$/i,_e=/^(?:a|area)$/i;ut.fn.extend({prop:function(t,e){return Dt(this,ut.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[ut.propFix[t]||t]})}}),ut.extend({prop:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&ut.isXMLDoc(t)||(e=ut.propFix[e]||e,o=ut.propHooks[e]),void 0!==i?o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:t[e]=i:o&&"get"in o&&null!==(n=o.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=ut.find.attr(t,"tabindex");return e?parseInt(e,10):ve.test(t.nodeName)||_e.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),mt.optSelected||(ut.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),ut.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ut.propFix[this.toLowerCase()]=this}),ut.fn.extend({addClass:function(t){var e,i,n,o,s,a,l,r=0;if(ut.isFunction(t))return this.each(function(e){ut(this).addClass(t.call(this,e,K(this)))});if("string"==typeof t&&t)for(e=t.match(Et)||[];i=this[r++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");l=q(n),o!==l&&i.setAttribute("class",l)}return this},removeClass:function(t){var e,i,n,o,s,a,l,r=0;if(ut.isFunction(t))return this.each(function(e){ut(this).removeClass(t.call(this,e,K(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(Et)||[];i=this[r++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");l=q(n),o!==l&&i.setAttribute("class",l)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):ut.isFunction(t)?this.each(function(i){ut(this).toggleClass(t.call(this,i,K(this),e),e)}):this.each(function(){var e,n,o,s;if("string"===i)for(n=0,o=ut(this),s=t.match(Et)||[];e=s[n++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==i||(e=K(this),e&&Ut.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Ut.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+q(K(i))+" ").indexOf(e)>-1)return!0;return!1}});var ye=/\r/g;ut.fn.extend({val:function(t){var e,i,n,o=this[0];{if(arguments.length)return n=ut.isFunction(t),this.each(function(i){var o;1===this.nodeType&&(o=n?t.call(this,i,ut(this).val()):t,null==o?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=ut.map(o,function(t){return null==t?"":t+""})),(e=ut.valHooks[this.type]||ut.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return(e=ut.valHooks[o.type]||ut.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(o,"value"))?i:(i=o.value,"string"==typeof i?i.replace(ye,""):null==i?"":i)}}}),ut.extend({valHooks:{option:{get:function(t){var e=ut.find.attr(t,"value");return null!=e?e:q(ut.text(t))}},select:{get:function(t){var e,i,n,s=t.options,a=t.selectedIndex,l="select-one"===t.type,r=l?null:[],c=l?a+1:s.length;for(n=a<0?c:l?a:0;n<c;n++)if(i=s[n],(i.selected||n===a)&&!i.disabled&&(!i.parentNode.disabled||!o(i.parentNode,"optgroup"))){if(e=ut(i).val(),l)return e;r.push(e)}return r},set:function(t,e){for(var i,n,o=t.options,s=ut.makeArray(e),a=o.length;a--;)n=o[a],(n.selected=ut.inArray(ut.valHooks.option.get(n),s)>-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),ut.each(["radio","checkbox"],function(){ut.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=ut.inArray(ut(t).val(),e)>-1}},mt.checkOn||(ut.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var xe=/^(?:focusinfocus|focusoutblur)$/;ut.extend(ut.event,{trigger:function(e,i,n,o){var s,a,l,r,c,h,d,p=[n||it],m=ht.call(e,"type")?e.type:e,u=ht.call(e,"namespace")?e.namespace.split("."):[];if(a=l=n=n||it,3!==n.nodeType&&8!==n.nodeType&&!xe.test(m+ut.event.triggered)&&(m.indexOf(".")>-1&&(u=m.split("."),m=u.shift(),u.sort()),c=m.indexOf(":")<0&&"on"+m,e=e[ut.expando]?e:new ut.Event(m,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=u.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=null==i?[e]:ut.makeArray(i,[e]),d=ut.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(n,i))){if(!o&&!d.noBubble&&!ut.isWindow(n)){for(r=d.delegateType||m,xe.test(r+m)||(a=a.parentNode);a;a=a.parentNode)p.push(a),l=a;l===(n.ownerDocument||it)&&p.push(l.defaultView||l.parentWindow||t)}for(s=0;(a=p[s++])&&!e.isPropagationStopped();)e.type=s>1?r:d.bindType||m,h=(Ut.get(a,"events")||{})[e.type]&&Ut.get(a,"handle"),h&&h.apply(a,i),(h=c&&a[c])&&h.apply&&Ft(a)&&(e.result=h.apply(a,i),!1===e.result&&e.preventDefault());return e.type=m,o||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),i)||!Ft(n)||c&&ut.isFunction(n[m])&&!ut.isWindow(n)&&(l=n[c],l&&(n[c]=null),ut.event.triggered=m,n[m](),ut.event.triggered=void 0,l&&(n[c]=l)),e.result}},simulate:function(t,e,i){var n=ut.extend(new ut.Event,i,{type:t,isSimulated:!0});ut.event.trigger(n,null,e)}}),ut.fn.extend({trigger:function(t,e){return this.each(function(){ut.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return ut.event.trigger(t,e,i,!0)}}),ut.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){ut.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),ut.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),mt.focusin="onfocusin"in t,mt.focusin||ut.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){ut.event.simulate(e,t.target,ut.event.fix(t))};ut.event.special[e]={setup:function(){var n=this.ownerDocument||this,o=Ut.access(n,e);o||n.addEventListener(t,i,!0),Ut.access(n,e,(o||0)+1)},teardown:function(){var n=this.ownerDocument||this,o=Ut.access(n,e)-1;o?Ut.access(n,e,o):(n.removeEventListener(t,i,!0),Ut.remove(n,e))}}});var we=t.location,Se=ut.now(),Ae=/\?/;ut.parseXML=function(e){var i;if(!e||"string"!=typeof e)return null;try{i=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){i=void 0}return i&&!i.getElementsByTagName("parsererror").length||ut.error("Invalid XML: "+e),i};var ke=/\[\]$/,Te=/\r?\n/g,Ie=/^(?:submit|button|image|reset|file)$/i,Ee=/^(?:input|select|textarea|keygen)/i;ut.param=function(t,e){var i,n=[],o=function(t,e){var i=ut.isFunction(e)?e():e;n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==i?"":i)};if(Array.isArray(t)||t.jquery&&!ut.isPlainObject(t))ut.each(t,function(){o(this.name,this.value)});else for(i in t)Y(i,t[i],e,o);return n.join("&")},ut.fn.extend({serialize:function(){return ut.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ut.prop(this,"elements");return t?ut.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ut(this).is(":disabled")&&Ee.test(this.nodeName)&&!Ie.test(t)&&(this.checked||!Gt.test(t))}).map(function(t,e){var i=ut(this).val();return null==i?null:Array.isArray(i)?ut.map(i,function(t){return{name:e.name,value:t.replace(Te,"\r\n")}}):{name:e.name,value:i.replace(Te,"\r\n")}}).get()}});var Pe=/%20/g,Me=/#.*$/,De=/([?&])_=[^&]*/,Fe=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ue=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ve=/^(?:GET|HEAD)$/,Re=/^\/\//,Be={},Le={},Ne="*/".concat("*"),Oe=it.createElement("a");Oe.href=we.href,ut.extend({active:0,lastModified:{},etag:{},ajaxSettings:{
|
|
|
url:we.href,type:"GET",isLocal:Ue.test(we.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ne,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":JSON.parse,"text xml":ut.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Z(Z(t,ut.ajaxSettings),e):Z(ut.ajaxSettings,t)},ajaxPrefilter:X(Be),ajaxTransport:X(Le),ajax:function(e,i){function n(e,i,n,l){var c,p,m,_,y,x=i;h||(h=!0,r&&t.clearTimeout(r),o=void 0,a=l||"",w.readyState=e>0?4:0,c=e>=200&&e<300||304===e,n&&(_=Q(u,w,n)),_=tt(u,_,w,c),c?(u.ifModified&&(y=w.getResponseHeader("Last-Modified"),y&&(ut.lastModified[s]=y),(y=w.getResponseHeader("etag"))&&(ut.etag[s]=y)),204===e||"HEAD"===u.type?x="nocontent":304===e?x="notmodified":(x=_.state,p=_.data,m=_.error,c=!m)):(m=x,!e&&x||(x="error",e<0&&(e=0))),w.status=e,w.statusText=(i||x)+"",c?f.resolveWith(g,[p,x,w]):f.rejectWith(g,[w,x,m]),w.statusCode(v),v=void 0,d&&b.trigger(c?"ajaxSuccess":"ajaxError",[w,u,c?p:m]),C.fireWith(g,[w,x]),d&&(b.trigger("ajaxComplete",[w,u]),--ut.active||ut.event.trigger("ajaxStop")))}"object"==typeof e&&(i=e,e=void 0),i=i||{};var o,s,a,l,r,c,h,d,p,m,u=ut.ajaxSetup({},i),g=u.context||u,b=u.context&&(g.nodeType||g.jquery)?ut(g):ut.event,f=ut.Deferred(),C=ut.Callbacks("once memory"),v=u.statusCode||{},_={},y={},x="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(h){if(!l)for(l={};e=Fe.exec(a);)l[e[1].toLowerCase()]=e[2];e=l[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return h?a:null},setRequestHeader:function(t,e){return null==h&&(t=y[t.toLowerCase()]=y[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==h&&(u.mimeType=t),this},statusCode:function(t){var e;if(t)if(h)w.always(t[w.status]);else for(e in t)v[e]=[v[e],t[e]];return this},abort:function(t){var e=t||x;return o&&o.abort(e),n(0,e),this}};if(f.promise(w),u.url=((e||u.url||we.href)+"").replace(Re,we.protocol+"//"),u.type=i.method||i.type||u.method||u.type,u.dataTypes=(u.dataType||"*").toLowerCase().match(Et)||[""],null==u.crossDomain){c=it.createElement("a");try{c.href=u.url,c.href=c.href,u.crossDomain=Oe.protocol+"//"+Oe.host!=c.protocol+"//"+c.host}catch(t){u.crossDomain=!0}}if(u.data&&u.processData&&"string"!=typeof u.data&&(u.data=ut.param(u.data,u.traditional)),J(Be,u,i,w),h)return w;d=ut.event&&u.global,d&&0==ut.active++&&ut.event.trigger("ajaxStart"),u.type=u.type.toUpperCase(),u.hasContent=!Ve.test(u.type),s=u.url.replace(Me,""),u.hasContent?u.data&&u.processData&&0===(u.contentType||"").indexOf("application/x-www-form-urlencoded")&&(u.data=u.data.replace(Pe,"+")):(m=u.url.slice(s.length),u.data&&(s+=(Ae.test(s)?"&":"?")+u.data,delete u.data),!1===u.cache&&(s=s.replace(De,"$1"),m=(Ae.test(s)?"&":"?")+"_="+Se+++m),u.url=s+m),u.ifModified&&(ut.lastModified[s]&&w.setRequestHeader("If-Modified-Since",ut.lastModified[s]),ut.etag[s]&&w.setRequestHeader("If-None-Match",ut.etag[s])),(u.data&&u.hasContent&&!1!==u.contentType||i.contentType)&&w.setRequestHeader("Content-Type",u.contentType),w.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+Ne+"; q=0.01":""):u.accepts["*"]);for(p in u.headers)w.setRequestHeader(p,u.headers[p]);if(u.beforeSend&&(!1===u.beforeSend.call(g,w,u)||h))return w.abort();if(x="abort",C.add(u.complete),w.done(u.success),w.fail(u.error),o=J(Le,u,i,w)){if(w.readyState=1,d&&b.trigger("ajaxSend",[w,u]),h)return w;u.async&&u.timeout>0&&(r=t.setTimeout(function(){w.abort("timeout")},u.timeout));try{h=!1,o.send(_,n)}catch(t){if(h)throw t;n(-1,t)}}else n(-1,"No Transport");return w},getJSON:function(t,e,i){return ut.get(t,e,i,"json")},getScript:function(t,e){return ut.get(t,void 0,e,"script")}}),ut.each(["get","post"],function(t,e){ut[e]=function(t,i,n,o){return ut.isFunction(i)&&(o=o||n,n=i,i=void 0),ut.ajax(ut.extend({url:t,type:e,dataType:o,data:i,success:n},ut.isPlainObject(t)&&t))}}),ut._evalUrl=function(t){return ut.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},ut.fn.extend({wrapAll:function(t){var e;return this[0]&&(ut.isFunction(t)&&(t=t.call(this[0])),e=ut(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return ut.isFunction(t)?this.each(function(e){ut(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ut(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=ut.isFunction(t);return this.each(function(i){ut(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){ut(this).replaceWith(this.childNodes)}),this}}),ut.expr.pseudos.hidden=function(t){return!ut.expr.pseudos.visible(t)},ut.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},ut.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var He={0:200,1223:204},$e=ut.ajaxSettings.xhr();mt.cors=!!$e&&"withCredentials"in $e,mt.ajax=$e=!!$e,ut.ajaxTransport(function(e){var i,n;if(mt.cors||$e&&!e.crossDomain)return{send:function(o,s){var a,l=e.xhr();if(l.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)l[a]=e.xhrFields[a];e.mimeType&&l.overrideMimeType&&l.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)l.setRequestHeader(a,o[a]);i=function(t){return function(){i&&(i=n=l.onload=l.onerror=l.onabort=l.onreadystatechange=null,"abort"===t?l.abort():"error"===t?"number"!=typeof l.status?s(0,"error"):s(l.status,l.statusText):s(He[l.status]||l.status,l.statusText,"text"!==(l.responseType||"text")||"string"!=typeof l.responseText?{binary:l.response}:{text:l.responseText},l.getAllResponseHeaders()))}},l.onload=i(),n=l.onerror=i("error"),void 0!==l.onabort?l.onabort=n:l.onreadystatechange=function(){4===l.readyState&&t.setTimeout(function(){i&&n()})},i=i("abort");try{l.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}}),ut.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),ut.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return ut.globalEval(t),t}}}),ut.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ut.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,o){e=ut("<script>").prop({charset:t.scriptCharset,src:t.url}).on("load error",i=function(t){e.remove(),i=null,t&&o("error"===t.type?404:200,t.type)}),it.head.appendChild(e[0])},abort:function(){i&&i()}}}});var ze=[],Ge=/(=)\?(?=&|$)|\?\?/;ut.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=ze.pop()||ut.expando+"_"+Se++;return this[t]=!0,t}}),ut.ajaxPrefilter("json jsonp",function(e,i,n){var o,s,a,l=!1!==e.jsonp&&(Ge.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ge.test(e.data)&&"data");if(l||"jsonp"===e.dataTypes[0])return o=e.jsonpCallback=ut.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,l?e[l]=e[l].replace(Ge,"$1"+o):!1!==e.jsonp&&(e.url+=(Ae.test(e.url)?"&":"?")+e.jsonp+"="+o),e.converters["script json"]=function(){return a||ut.error(o+" was not called"),a[0]},e.dataTypes[0]="json",s=t[o],t[o]=function(){a=arguments},n.always(function(){void 0===s?ut(t).removeProp(o):t[o]=s,e[o]&&(e.jsonpCallback=i.jsonpCallback,ze.push(o)),a&&ut.isFunction(s)&&s(a[0]),a=s=void 0}),"script"}),mt.createHTMLDocument=function(){var t=it.implementation.createHTMLDocument("").body;return t.innerHTML="<form></form><form></form>",2===t.childNodes.length}(),ut.parseHTML=function(t,e,i){if("string"!=typeof t)return[];"boolean"==typeof e&&(i=e,e=!1);var n,o,s;return e||(mt.createHTMLDocument?(e=it.implementation.createHTMLDocument(""),n=e.createElement("base"),n.href=it.location.href,e.head.appendChild(n)):e=it),o=wt.exec(t),s=!i&&[],o?[e.createElement(o[1])]:(o=_([t],e,s),s&&s.length&&ut(s).remove(),ut.merge([],o.childNodes))},ut.fn.load=function(t,e,i){var n,o,s,a=this,l=t.indexOf(" ");return l>-1&&(n=q(t.slice(l)),t=t.slice(0,l)),ut.isFunction(e)?(i=e,e=void 0):e&&"object"==typeof e&&(o="POST"),a.length>0&&ut.ajax({url:t,type:o||"GET",dataType:"html",data:e}).done(function(t){s=arguments,a.html(n?ut("<div>").append(ut.parseHTML(t)).find(n):t)}).always(i&&function(t,e){a.each(function(){i.apply(this,s||[t.responseText,e,t])})}),this},ut.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){ut.fn[e]=function(t){return this.on(e,t)}}),ut.expr.pseudos.animated=function(t){return ut.grep(ut.timers,function(e){return t===e.elem}).length},ut.offset={setOffset:function(t,e,i){var n,o,s,a,l,r,c,h=ut.css(t,"position"),d=ut(t),p={};"static"===h&&(t.style.position="relative"),l=d.offset(),s=ut.css(t,"top"),r=ut.css(t,"left"),c=("absolute"===h||"fixed"===h)&&(s+r).indexOf("auto")>-1,c?(n=d.position(),a=n.top,o=n.left):(a=parseFloat(s)||0,o=parseFloat(r)||0),ut.isFunction(e)&&(e=e.call(t,i,ut.extend({},l))),null!=e.top&&(p.top=e.top-l.top+a),null!=e.left&&(p.left=e.left-l.left+o),"using"in e?e.using.call(t,p):d.css(p)}},ut.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ut.offset.setOffset(this,t,e)});var e,i,n,o,s=this[0];if(s)return s.getClientRects().length?(n=s.getBoundingClientRect(),e=s.ownerDocument,i=e.documentElement,o=e.defaultView,{top:n.top+o.pageYOffset-i.clientTop,left:n.left+o.pageXOffset-i.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var t,e,i=this[0],n={top:0,left:0};return"fixed"===ut.css(i,"position")?e=i.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),o(t[0],"html")||(n=t.offset()),n={top:n.top+ut.css(t[0],"borderTopWidth",!0),left:n.left+ut.css(t[0],"borderLeftWidth",!0)}),{top:e.top-n.top-ut.css(i,"marginTop",!0),left:e.left-n.left-ut.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===ut.css(t,"position");)t=t.offsetParent;return t||Yt})}}),ut.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var i="pageYOffset"===e;ut.fn[t]=function(n){return Dt(this,function(t,n,o){var s;if(ut.isWindow(t)?s=t:9===t.nodeType&&(s=t.defaultView),void 0===o)return s?s[e]:t[n];s?s.scrollTo(i?s.pageXOffset:o,i?o:s.pageYOffset):t[n]=o},t,n,arguments.length)}}),ut.each(["top","left"],function(t,e){ut.cssHooks[e]=F(mt.pixelPosition,function(t,i){if(i)return i=D(t,e),se.test(i)?ut(t).position()[e]+"px":i})}),ut.each({Height:"height",Width:"width"},function(t,e){ut.each({padding:"inner"+t,content:e,"":"outer"+t},function(i,n){ut.fn[n]=function(o,s){var a=arguments.length&&(i||"boolean"!=typeof o),l=i||(!0===o||!0===s?"margin":"border");return Dt(this,function(e,i,o){var s;return ut.isWindow(e)?0===n.indexOf("outer")?e["inner"+t]:e.document.documentElement["client"+t]:9===e.nodeType?(s=e.documentElement,Math.max(e.body["scroll"+t],s["scroll"+t],e.body["offset"+t],s["offset"+t],s["client"+t])):void 0===o?ut.css(e,i,l):ut.style(e,i,o,l)},e,a?o:void 0,a)}})}),ut.fn.extend({bind:function(t,e,i){return this.on(t,null,e,i)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,i,n){return this.on(e,t,i,n)},undelegate:function(t,e,i){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",i)}}),ut.holdReady=function(t){t?ut.readyWait++:ut.ready(!0)},ut.isArray=Array.isArray,ut.parseJSON=JSON.parse,ut.nodeName=o,"function"==typeof define&&define.amd&&define("jquery",[],function(){return ut});var je=t.jQuery,We=t.$;return ut.noConflict=function(e){return t.$===ut&&(t.$=We),e&&t.jQuery===ut&&(t.jQuery=je),ut},e||(t.jQuery=t.$=ut),ut}),function(){var t,e=this,i=e.Backbone,n=[],o=n.slice;t="undefined"!=typeof exports?exports:e.Backbone={},t.VERSION="1.1.0";var s=e._;s||"undefined"==typeof require||(s=require("underscore")),t.$=e.jQuery||e.Zepto||e.ender||e.$,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var a=t.Events={on:function(t,e,i){return r(this,"on",t,[e,i])&&e?(this._events||(this._events={}),(this._events[t]||(this._events[t]=[])).push({callback:e,context:i,ctx:i||this}),this):this},once:function(t,e,i){if(!r(this,"once",t,[e,i])||!e)return this;var n=this,o=s.once(function(){n.off(t,o),e.apply(this,arguments)});return o._callback=e,this.on(t,o,i)},off:function(t,e,i){var n,o,a,l,c,h,d,p;if(!this._events||!r(this,"off",t,[e,i]))return this;if(!t&&!e&&!i)return this._events={},this;for(l=t?[t]:s.keys(this._events),c=0,h=l.length;c<h;c++)if(t=l[c],a=this._events[t]){if(this._events[t]=n=[],e||i)for(d=0,p=a.length;d<p;d++)o=a[d],(e&&e!==o.callback&&e!==o.callback._callback||i&&i!==o.context)&&n.push(o);n.length||delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!r(this,"trigger",t,e))return this;var i=this._events[t],n=this._events.all;return i&&c(i,e),n&&c(n,arguments),this},stopListening:function(t,e,i){var n=this._listeningTo;if(!n)return this;var o=!e&&!i;i||"object"!=typeof e||(i=this),t&&((n={})[t._listenId]=t);for(var a in n)t=n[a],t.off(e,i,this),(o||s.isEmpty(t._events))&&delete this._listeningTo[a];return this}},l=/\s+/,r=function(t,e,i,n){if(!i)return!0;if("object"==typeof i){for(var o in i)t[e].apply(t,[o,i[o]].concat(n));return!1}if(l.test(i)){for(var s=i.split(l),a=0,r=s.length;a<r;a++)t[e].apply(t,[s[a]].concat(n));return!1}return!0},c=function(t,e){var i,n=-1,o=t.length,s=e[0],a=e[1],l=e[2];switch(e.length){case 0:for(;++n<o;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;++n<o;)(i=t[n]).callback.call(i.ctx,s);return;case 2:for(;++n<o;)(i=t[n]).callback.call(i.ctx,s,a);return;case 3:for(;++n<o;)(i=t[n]).callback.call(i.ctx,s,a,l);return;default:for(;++n<o;)(i=t[n]).callback.apply(i.ctx,e)}},h={listenTo:"on",listenToOnce:"once"};s.each(h,function(t,e){a[e]=function(e,i,n){return(this._listeningTo||(this._listeningTo={}))[e._listenId||(e._listenId=s.uniqueId("l"))]=e,n||"object"!=typeof i||(n=this),e[t](i,n,this),this}}),a.bind=a.on,a.unbind=a.off,s.extend(t,a);var d=t.Model=function(t,e){var i=t||{};e||(e={}),this.cid=s.uniqueId("c"),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(i=this.parse(i,e)||{}),i=s.defaults({},i,s.result(this,"defaults")),this.set(i,e),this.changed={},this.initialize.apply(this,arguments)};s.extend(d.prototype,a,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return s.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return s.escape(this.get(t))},has:function(t){return null!=this.get(t)},set:function(t,e,i){var n,o,a,l,r,c,h,d;if(null==t)return this;if("object"==typeof t?(o=t,i=e):(o={})[t]=e,i||(i={}),!this._validate(o,i))return!1;a=i.unset,r=i.silent,l=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=s.clone(this.attributes),this.changed={}),d=this.attributes,h=this._previousAttributes,this.idAttribute in o&&(this.id=o[this.idAttribute]);for(n in o)e=o[n],s.isEqual(d[n],e)||l.push(n),s.isEqual(h[n],e)?delete this.changed[n]:this.changed[n]=e,a?delete d[n]:d[n]=e;if(!r){l.length&&(this._pending=!0);for(var p=0,m=l.length;p<m;p++)this.trigger("change:"+l[p],this,d[l[p]],i)}if(c)return this;if(!r)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,s.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,s.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!s.isEmpty(this.changed):s.has(this.changed,t)},changedAttributes:function(t){if(!t)return!!this.hasChanged()&&s.clone(this.changed);var e,i=!1,n=this._changing?this._previousAttributes:this.attributes;for(var o in t)s.isEqual(n[o],e=t[o])||((i||(i={}))[o]=e);return i},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return s.clone(this._previousAttributes)},fetch:function(t){t=t?s.clone(t):{},void 0===t.parse&&(t.parse=!0);var e=this,i=t.success;return t.success=function(n){if(!e.set(e.parse(n,t),t))return!1;i&&i(e,n,t),e.trigger("sync",e,n,t)},R(this,t),this.sync("read",this,t)},save:function(t,e,i){var n,o,a,l=this.attributes;if(null==t||"object"==typeof t?(n=t,i=e):(n={})[t]=e,i=s.extend({validate:!0},i),n&&!i.wait){if(!this.set(n,i))return!1}else if(!this._validate(n,i))return!1;n&&i.wait&&(this.attributes=s.extend({},l,n)),void 0===i.parse&&(i.parse=!0);var r=this,c=i.success;return i.success=function(t){r.attributes=l;var e=r.parse(t,i);if(i.wait&&(e=s.extend(n||{},e)),s.isObject(e)&&!r.set(e,i))return!1;c&&c(r,t,i),r.trigger("sync",r,t,i)},R(this,i),o=this.isNew()?"create":i.patch?"patch":"update","patch"===o&&(i.attrs=n),a=this.sync(o,this,i),n&&i.wait&&(this.attributes=l),a},destroy:function(t){t=t?s.clone(t):{};var e=this,i=t.success,n=function(){e.trigger("destroy",e,e.collection,t)};if(t.success=function(o){(t.wait||e.isNew())&&n(),i&&i(e,o,t),e.isNew()||e.trigger("sync",e,o,t)},this.isNew())return t.success(),!1;R(this,t);var o=this.sync("delete",this,t);return t.wait||n(),o},url:function(){var t=s.result(this,"urlRoot")||s.result(this.collection,"url")||V();return this.isNew()?t:t+("/"===t.charAt(t.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(t){return this._validate({},s.extend(t||{},{validate:!0}))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=s.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;return!i||(this.trigger("invalid",this,i,s.extend(e,{validationError:i})),!1)}});var p=["keys","values","pairs","invert","pick","omit"];s.each(p,function(t){d.prototype[t]=function(){var e=o.call(arguments);return e.unshift(this.attributes),s[t].apply(s,e)}});var m=t.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,s.extend({silent:!0},e))},u={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};s.extend(m.prototype,a,{model:d,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return t.sync.apply(this,arguments)},add:function(t,e){return this.set(t,s.extend({merge:!1},e,g))},remove:function(t,e){var i=!s.isArray(t);t=i?[t]:s.clone(t),e||(e={});var n,o,a,l;for(n=0,o=t.length;n<o;n++)(l=t[n]=this.get(t[n]))&&(delete this._byId[l.id],delete this._byId[l.cid],a=this.indexOf(l),this.models.splice(a,1),this.length--,e.silent||(e.index=a,l.trigger("remove",l,this,e)),this._removeReference(l));return i?t[0]:t},set:function(t,e){e=s.defaults({},e,u),e.parse&&(t=this.parse(t,e));var i=!s.isArray(t);t=i?t?[t]:[]:s.clone(t);var n,o,a,l,r,c,h,p=e.at,m=this.model,g=this.comparator&&null==p&&!1!==e.sort,b=s.isString(this.comparator)?this.comparator:null,f=[],C=[],v={},_=e.add,y=e.merge,x=e.remove,w=!(g||!_||!x)&&[];for(n=0,o=t.length;n<o;n++){if(r=t[n],a=r instanceof d?l=r:r[m.prototype.idAttribute],c=this.get(a))x&&(v[c.cid]=!0),y&&(r=r===l?l.attributes:r,e.parse&&(r=c.parse(r,e)),c.set(r,e),g&&!h&&c.hasChanged(b)&&(h=!0)),t[n]=c;else if(_){if(!(l=t[n]=this._prepareModel(r,e)))continue;f.push(l),l.on("all",this._onModelEvent,this),this._byId[l.cid]=l,null!=l.id&&(this._byId[l.id]=l)}w&&w.push(c||l)}if(x){for(n=0,o=this.length;n<o;++n)v[(l=this.models[n]).cid]||C.push(l);C.length&&this.remove(C,e)}if(f.length||w&&w.length)if(g&&(h=!0),this.length+=f.length,null!=p)for(n=0,o=f.length;n<o;n++)this.models.splice(p+n,0,f[n]);else{w&&(this.models.length=0);var S=w||f;for(n=0,o=S.length;n<o;n++)this.models.push(S[n])}if(h&&this.sort({silent:!0}),!e.silent){for(n=0,o=f.length;n<o;n++)(l=f[n]).trigger("add",l,this,e);(h||w&&w.length)&&this.trigger("sort",this,e)}return i?t[0]:t},reset:function(t,e){e||(e={});for(var i=0,n=this.models.length;i<n;i++)this._removeReference(this.models[i]);return e.previousModels=this.models,this._reset(),t=this.add(t,s.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),t},push:function(t,e){return this.add(t,s.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t),e},unshift:function(t,e){return this.add(t,s.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t),e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(null!=t)return this._byId[t.id]||this._byId[t.cid]||this._byId[t]},at:function(t){return this.models[t]},where:function(t,e){return s.isEmpty(t)?e?void 0:[]:this[e?"find":"filter"](function(e){for(var i in t)if(t[i]!==e.get(i))return!1;return!0})},findWhere:function(t){return this.where(t,!0)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return t||(t={}),s.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(s.bind(this.comparator,this)),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return s.invoke(this.models,"get",t)},fetch:function(t){t=t?s.clone(t):{},void 0===t.parse&&(t.parse=!0);var e=t.success,i=this;return t.success=function(n){var o=t.reset?"reset":"set";i[o](n,t),e&&e(i,n,t),i.trigger("sync",i,n,t)},R(this,t),this.sync("read",this,t)},create:function(t,e){if(e=e?s.clone(e):{},!(t=this._prepareModel(t,e)))return!1;e.wait||this.add(t,e);var i=this,n=e.success;return e.success=function(t,e,o){o.wait&&i.add(t,o),n&&n(t,e,o)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(t instanceof d)return t.collection||(t.collection=this),t;e=e?s.clone(e):{},e.collection=this;var i=new this.model(t,e);return i.validationError?(this.trigger("invalid",this,i.validationError,e),!1):i},_removeReference:function(t){this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,n){("add"!==t&&"remove"!==t||i===this)&&("destroy"===t&&this.remove(e,n),e&&t==="change:"+e.idAttribute&&(delete this._byId[e.previous(e.idAttribute)],null!=e.id&&(this._byId[e.id]=e)),this.trigger.apply(this,arguments))}});var b=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];s.each(b,function(t){m.prototype[t]=function(){var e=o.call(arguments);return e.unshift(this.models),s[t].apply(s,e)}});var f=["groupBy","countBy","sortBy"];s.each(f,function(t){m.prototype[t]=function(e,i){var n=s.isFunction(e)?e:function(t){return t.get(e)};return s[t](this.models,n,i)}});var C=t.View=function(t){this.cid=s.uniqueId("view"),t||(t={}),s.extend(this,s.pick(t,_)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},v=/^(\S+)\s*(.*)$/,_=["model","collection","el","id","attributes","className","tagName","events"];s.extend(C.prototype,a,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,i){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],!1!==i&&this.delegateEvents(),this},delegateEvents:function(t){if(!t&&!(t=s.result(this,"events")))return this;this.undelegateEvents();for(var e in t){var i=t[e];if(s.isFunction(i)||(i=this[t[e]]),i){var n=e.match(v),o=n[1],a=n[2];i=s.bind(i,this),o+=".delegateEvents"+this.cid,""===a?this.$el.on(o,i):this.$el.on(o,a,i)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(s.result(this,"el"),!1);else{var e=s.extend({},s.result(this,"attributes"));this.id&&(e.id=s.result(this,"id")),this.className&&(e.class=s.result(this,"className"));var i=t.$("<"+s.result(this,"tagName")+">").attr(e);this.setElement(i,!1)}}}),t.sync=function(e,i,n){var o=x[e];s.defaults(n||(n={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var a={type:o,dataType:"json"};if(n.url||(a.url=s.result(i,"url")||V()),null!=n.data||!i||"create"!==e&&"update"!==e&&"patch"!==e||(a.contentType="application/json",a.data=JSON.stringify(n.attrs||i.toJSON(n))),n.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),n.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){a.type="POST",n.emulateJSON&&(a.data._method=o);var l=n.beforeSend;n.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",o),l)return l.apply(this,arguments)}}"GET"===a.type||n.emulateJSON||(a.processData=!1),"PATCH"===a.type&&y&&(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var r=n.xhr=t.ajax(s.extend(a,n));return i.trigger("request",i,r,n),r};var y=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),x={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var w=t.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},S=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,k=/\*\w+/g,T=/[\-{}\[\]+?.,\\\^$|#\s]/g;s.extend(w.prototype,a,{initialize:function(){},route:function(e,i,n){s.isRegExp(e)||(e=this._routeToRegExp(e)),s.isFunction(i)&&(n=i,i=""),n||(n=this[i]);var o=this;return t.history.route(e,function(s){var a=o._extractParameters(e,s);n&&n.apply(o,a),o.trigger.apply(o,["route:"+i].concat(a)),o.trigger("route",i,a),t.history.trigger("route",o,i,a)}),this},navigate:function(e,i){return t.history.navigate(e,i),this},_bindRoutes:function(){if(this.routes){this.routes=s.result(this,"routes");for(var t,e=s.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(T,"\\$&").replace(S,"(?:$1)?").replace(A,function(t,e){return e?t:"([^/]+)"}).replace(k,"(.*?)"),new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return s.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=t.History=function(){this.handlers=[],s.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},E=/^[#\/]|\s+$/g,P=/^\/+|\/+$/g,M=/msie [\w.]+/,D=/\/$/,F=/[?#].*$/;I.started=!1,s.extend(I.prototype,a,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(D,"");t.indexOf(i)||(t=t.slice(i.length))}else t=this.getHash();return t.replace(E,"")},start:function(e){if(I.started)throw new Error("Backbone.history has already been started");I.started=!0,this.options=s.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var i=this.getFragment(),n=document.documentMode,o=M.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(P,"/"),o&&this._wantsHashChange&&(this.iframe=t.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(i)),this._hasPushState?t.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!o?t.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=i;var a=this.location,l=a.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!l)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&l&&a.hash&&(this.fragment=this.getHash().replace(E,""),this.history.replaceState({},document.title,this.root+this.fragment+a.search))}if(!this.options.silent)return this.loadUrl()},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),I.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe))),e===this.fragment)return!1;this.iframe&&this.navigate(e),this.loadUrl()},loadUrl:function(t){return t=this.fragment=this.getFragment(t),s.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0})},navigate:function(t,e){if(!I.started)return!1;e&&!0!==e||(e={trigger:!!e});var i=this.root+(t=this.getFragment(t||""));if(t=t.replace(F,""),this.fragment!==t){if(this.fragment=t,""===t&&"/"!==i&&(i=i.slice(0,-1)),this._hasPushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getFragment(this.getHash(this.iframe))&&(e.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,t,e.replace))}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else t.hash="#"+e}}),t.history=new I;var U=function(t,e){var i,n=this;i=t&&s.has(t,"constructor")?t.constructor:function(){return n.apply(this,arguments)},s.extend(i,n,e);var o=function(){this.constructor=i};return o.prototype=n.prototype,i.prototype=new o,t&&s.extend(i.prototype,t),i.__super__=n.prototype,i};d.extend=m.extend=w.extend=C.extend=I.extend=U;var V=function(){throw new Error('A "url" property or function must be specified')},R=function(t,e){var i=e.error;e.error=function(n){i&&i(t,n,e),t.trigger("error",t,n,e)}}}.call(this),define("backbone",["underscore","jquery"],function(t){return function(){return t.Backbone}}(this)),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");if(function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||e[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}t.fn.emulateTransitionEnd=function(e){var i=!1,n=this;t(this).one("bsTransitionEnd",function(){i=!0});var o=function(){i||t(n).trigger(t.support.transition.end)};return setTimeout(o,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,
|
|
|
delegateType:t.support.transition.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.alert");o||i.data("bs.alert",o=new n(this)),"string"==typeof e&&o[e].call(i)})}var i='[data-dismiss="alert"]',n=function(e){t(e).on("click",i,this.close)};n.VERSION="3.3.7",n.TRANSITION_DURATION=150,n.prototype.close=function(e){function i(){a.detach().trigger("closed.bs.alert").remove()}var o=t(this),s=o.attr("data-target");s||(s=o.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,""));var a=t("#"===s?[]:s);e&&e.preventDefault(),a.length||(a=o.closest(".alert")),a.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(a.removeClass("in"),t.support.transition&&a.hasClass("fade")?a.one("bsTransitionEnd",i).emulateTransitionEnd(n.TRANSITION_DURATION):i())};var o=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=n,t.fn.alert.noConflict=function(){return t.fn.alert=o,this},t(document).on("click.bs.alert.data-api",i,n.prototype.close)}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.button"),s="object"==typeof e&&e;o||n.data("bs.button",o=new i(this,s)),"toggle"==e?o.toggle():e&&o.setState(e)})}var i=function(e,n){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,n),this.isLoading=!1};i.VERSION="3.3.7",i.DEFAULTS={loadingText:"loading..."},i.prototype.setState=function(e){var i="disabled",n=this.$element,o=n.is("input")?"val":"html",s=n.data();e+="Text",null==s.resetText&&n.data("resetText",n[o]()),setTimeout(t.proxy(function(){n[o](null==s[e]?this.options[e]:s[e]),"loadingText"==e?(this.isLoading=!0,n.addClass(i).attr(i,i).prop(i,!0)):this.isLoading&&(this.isLoading=!1,n.removeClass(i).removeAttr(i).prop(i,!1))},this),0)},i.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var n=t.fn.button;t.fn.button=e,t.fn.button.Constructor=i,t.fn.button.noConflict=function(){return t.fn.button=n,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(i){var n=t(i.target).closest(".btn");e.call(n,"toggle"),t(i.target).is('input[type="radio"], input[type="checkbox"]')||(i.preventDefault(),n.is("input,button")?n.trigger("focus"):n.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(e){t(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))})}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.carousel"),s=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e),a="string"==typeof e?e:s.slide;o||n.data("bs.carousel",o=new i(this,s)),"number"==typeof e?o.to(e):a?o[a]():s.interval&&o.pause().cycle()})}var i=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",t.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",t.proxy(this.pause,this)).on("mouseleave.bs.carousel",t.proxy(this.cycle,this))};i.VERSION="3.3.7",i.TRANSITION_DURATION=600,i.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},i.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},i.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},i.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},i.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var n="prev"==t?-1:1,o=(i+n)%this.$items.length;return this.$items.eq(o)},i.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",this.$items.eq(t))},i.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},i.prototype.next=function(){if(!this.sliding)return this.slide("next")},i.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},i.prototype.slide=function(e,n){var o=this.$element.find(".item.active"),s=n||this.getItemForDirection(e,o),a=this.interval,l="next"==e?"left":"right",r=this;if(s.hasClass("active"))return this.sliding=!1;var c=s[0],h=t.Event("slide.bs.carousel",{relatedTarget:c,direction:l});if(this.$element.trigger(h),!h.isDefaultPrevented()){if(this.sliding=!0,a&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var d=t(this.$indicators.children()[this.getItemIndex(s)]);d&&d.addClass("active")}var p=t.Event("slid.bs.carousel",{relatedTarget:c,direction:l});return t.support.transition&&this.$element.hasClass("slide")?(s.addClass(e),s[0].offsetWidth,o.addClass(l),s.addClass(l),o.one("bsTransitionEnd",function(){s.removeClass([e,l].join(" ")).addClass("active"),o.removeClass(["active",l].join(" ")),r.sliding=!1,setTimeout(function(){r.$element.trigger(p)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)):(o.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(p)),a&&this.cycle(),this}};var n=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=i,t.fn.carousel.noConflict=function(){return t.fn.carousel=n,this};var o=function(i){var n,o=t(this),s=t(o.attr("data-target")||(n=o.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var a=t.extend({},s.data(),o.data()),l=o.attr("data-slide-to");l&&(a.interval=!1),e.call(s,a),l&&s.data("bs.carousel").to(l),i.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",o).on("click.bs.carousel.data-api","[data-slide-to]",o),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var i=t(this);e.call(i,i.data())})})}(jQuery),function(t){"use strict";function e(e){var i,n=e.attr("data-target")||(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return t(n)}function i(e){return this.each(function(){var i=t(this),o=i.data("bs.collapse"),s=t.extend({},n.DEFAULTS,i.data(),"object"==typeof e&&e);!o&&s.toggle&&/show|hide/.test(e)&&(s.toggle=!1),o||i.data("bs.collapse",o=new n(this,s)),"string"==typeof e&&o[e]()})}var n=function(e,i){this.$element=t(e),this.options=t.extend({},n.DEFAULTS,i),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};n.VERSION="3.3.7",n.TRANSITION_DURATION=350,n.DEFAULTS={toggle:!0},n.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},n.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,o=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(o&&o.length&&(e=o.data("bs.collapse"))&&e.transitioning)){var s=t.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){o&&o.length&&(i.call(o,"hide"),e||o.data("bs.collapse",null));var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var l=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return l.call(this);var r=t.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",t.proxy(l,this)).emulateTransitionEnd(n.TRANSITION_DURATION)[a](this.$element[0][r])}}}},n.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var i=this.dimension();this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var o=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!t.support.transition)return o.call(this);this.$element[i](0).one("bsTransitionEnd",t.proxy(o,this)).emulateTransitionEnd(n.TRANSITION_DURATION)}}},n.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},n.prototype.getParent=function(){return t(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy(function(i,n){var o=t(n);this.addAriaAndCollapsedClass(e(o),o)},this)).end()},n.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var o=t.fn.collapse;t.fn.collapse=i,t.fn.collapse.Constructor=n,t.fn.collapse.noConflict=function(){return t.fn.collapse=o,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(n){var o=t(this);o.attr("data-target")||n.preventDefault();var s=e(o),a=s.data("bs.collapse"),l=a?"toggle":o.data();i.call(s,l)})}(jQuery),function(t){"use strict";function e(e){var i=e.attr("data-target");i||(i=e.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var n=i&&t(i);return n&&n.length?n:e.parent()}function i(i){i&&3===i.which||(t(o).remove(),t(s).each(function(){var n=t(this),o=e(n),s={relatedTarget:this};o.hasClass("open")&&(i&&"click"==i.type&&/input|textarea/i.test(i.target.tagName)&&t.contains(o[0],i.target)||(o.trigger(i=t.Event("hide.bs.dropdown",s)),i.isDefaultPrevented()||(n.attr("aria-expanded","false"),o.removeClass("open").trigger(t.Event("hidden.bs.dropdown",s)))))}))}function n(e){return this.each(function(){var i=t(this),n=i.data("bs.dropdown");n||i.data("bs.dropdown",n=new a(this)),"string"==typeof e&&n[e].call(i)})}var o=".dropdown-backdrop",s='[data-toggle="dropdown"]',a=function(e){t(e).on("click.bs.dropdown",this.toggle)};a.VERSION="3.3.7",a.prototype.toggle=function(n){var o=t(this);if(!o.is(".disabled, :disabled")){var s=e(o),a=s.hasClass("open");if(i(),!a){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",i);var l={relatedTarget:this};if(s.trigger(n=t.Event("show.bs.dropdown",l)),n.isDefaultPrevented())return;o.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger(t.Event("shown.bs.dropdown",l))}return!1}},a.prototype.keydown=function(i){if(/(38|40|27|32)/.test(i.which)&&!/input|textarea/i.test(i.target.tagName)){var n=t(this);if(i.preventDefault(),i.stopPropagation(),!n.is(".disabled, :disabled")){var o=e(n),a=o.hasClass("open");if(!a&&27!=i.which||a&&27==i.which)return 27==i.which&&o.find(s).trigger("focus"),n.trigger("click");var l=o.find(".dropdown-menu li:not(.disabled):visible a");if(l.length){var r=l.index(i.target);38==i.which&&r>0&&r--,40==i.which&&r<l.length-1&&r++,~r||(r=0),l.eq(r).trigger("focus")}}}};var l=t.fn.dropdown;t.fn.dropdown=n,t.fn.dropdown.Constructor=a,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=l,this},t(document).on("click.bs.dropdown.data-api",i).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",s,a.prototype.toggle).on("keydown.bs.dropdown.data-api",s,a.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",a.prototype.keydown)}(jQuery),function(t){"use strict";function e(e,n){return this.each(function(){var o=t(this),s=o.data("bs.modal"),a=t.extend({},i.DEFAULTS,o.data(),"object"==typeof e&&e);s||o.data("bs.modal",s=new i(this,a)),"string"==typeof e?s[e](n):a.show&&s.show(n)})}var i=function(e,i){this.options=i,this.$body=t(document.body),this.$element=t(e),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};i.VERSION="3.3.7",i.TRANSITION_DURATION=300,i.BACKDROP_TRANSITION_DURATION=150,i.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},i.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},i.prototype.show=function(e){var n=this,o=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(o),this.isShown||o.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){n.$element.one("mouseup.dismiss.bs.modal",function(e){t(e.target).is(n.$element)&&(n.ignoreBackdropClick=!0)})}),this.backdrop(function(){var o=t.support.transition&&n.$element.hasClass("fade");n.$element.parent().length||n.$element.appendTo(n.$body),n.$element.show().scrollTop(0),n.adjustDialog(),o&&n.$element[0].offsetWidth,n.$element.addClass("in"),n.enforceFocus();var s=t.Event("shown.bs.modal",{relatedTarget:e});o?n.$dialog.one("bsTransitionEnd",function(){n.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(i.TRANSITION_DURATION):n.$element.trigger("focus").trigger(s)}))},i.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(i.TRANSITION_DURATION):this.hideModal())},i.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},i.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},i.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},i.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},i.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},i.prototype.backdrop=function(e){var n=this,o=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=t.support.transition&&o;if(this.$backdrop=t(document.createElement("div")).addClass("modal-backdrop "+o).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){if(this.ignoreBackdropClick)return void(this.ignoreBackdropClick=!1);t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;s?this.$backdrop.one("bsTransitionEnd",e).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var a=function(){n.removeBackdrop(),e&&e()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",a).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):a()}else e&&e()},i.prototype.handleUpdate=function(){this.adjustDialog()},i.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},i.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},i.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},i.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",t+this.scrollbarWidth)},i.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},i.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var n=t.fn.modal;t.fn.modal=e,t.fn.modal.Constructor=i,t.fn.modal.noConflict=function(){return t.fn.modal=n,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(i){var n=t(this),o=n.attr("href"),s=t(n.attr("data-target")||o&&o.replace(/.*(?=#[^\s]+$)/,"")),a=s.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(o)&&o},s.data(),n.data());n.is("a")&&i.preventDefault(),s.one("show.bs.modal",function(t){t.isDefaultPrevented()||s.one("hidden.bs.modal",function(){n.is(":visible")&&n.trigger("focus")})}),e.call(s,a,this)})}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.tooltip"),s="object"==typeof e&&e;!o&&/destroy|hide/.test(e)||(o||n.data("bs.tooltip",o=new i(this,s)),"string"==typeof e&&o[e]())})}var i=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};i.VERSION="3.3.7",i.TRANSITION_DURATION=150,i.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},i.prototype.init=function(e,i,n){if(this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),s=o.length;s--;){var a=o[s];if("click"==a)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=a){var l="hover"==a?"mouseenter":"focusin",r="hover"==a?"mouseleave":"focusout";this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},i.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,function(t,n){i[t]!=n&&(e[t]=n)}),e},i.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusin"==e.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState?void(i.hoverState="in"):(clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show())},i.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},i.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusout"==e.type?"focus":"hover"]=!1),!i.isInStateTrue()){if(clearTimeout(i.timeout),i.hoverState="out",!i.options.delay||!i.options.delay.hide)return i.hide();i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)}},i.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var n=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!n)return;var o=this,s=this.tip(),a=this.getUID(this.type);this.setContent(),s.attr("id",a),this.$element.attr("aria-describedby",a),this.options.animation&&s.addClass("fade");var l="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,r=/\s?auto?\s?/i,c=r.test(l);c&&(l=l.replace(r,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(l).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var h=this.getPosition(),d=s[0].offsetWidth,p=s[0].offsetHeight;if(c){var m=l,u=this.getPosition(this.$viewport);l="bottom"==l&&h.bottom+p>u.bottom?"top":"top"==l&&h.top-p<u.top?"bottom":"right"==l&&h.right+d>u.width?"left":"left"==l&&h.left-d<u.left?"right":l,s.removeClass(m).addClass(l)}var g=this.getCalculatedOffset(l,h,d,p);this.applyPlacement(g,l);var b=function(){var t=o.hoverState;o.$element.trigger("shown.bs."+o.type),o.hoverState=null,"out"==t&&o.leave(o)};t.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",b).emulateTransitionEnd(i.TRANSITION_DURATION):b()}},i.prototype.applyPlacement=function(e,i){var n=this.tip(),o=n[0].offsetWidth,s=n[0].offsetHeight,a=parseInt(n.css("margin-top"),10),l=parseInt(n.css("margin-left"),10);isNaN(a)&&(a=0),isNaN(l)&&(l=0),e.top+=a,e.left+=l,t.offset.setOffset(n[0],t.extend({using:function(t){n.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),n.addClass("in");var r=n[0].offsetWidth,c=n[0].offsetHeight;"top"==i&&c!=s&&(e.top=e.top+s-c);var h=this.getViewportAdjustedDelta(i,e,r,c);h.left?e.left+=h.left:e.top+=h.top;var d=/top|bottom/.test(i),p=d?2*h.left-o+r:2*h.top-s+c,m=d?"offsetWidth":"offsetHeight";n.offset(e),this.replaceArrow(p,n[0][m],d)},i.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},i.prototype.hide=function(e){function n(){"in"!=o.hoverState&&s.detach(),o.$element&&o.$element.removeAttr("aria-describedby").trigger("hidden.bs."+o.type),e&&e()}var o=this,s=t(this.$tip),a=t.Event("hide.bs."+this.type);if(this.$element.trigger(a),!a.isDefaultPrevented())return s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",n).emulateTransitionEnd(i.TRANSITION_DURATION):n(),this.hoverState=null,this},i.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},i.prototype.hasContent=function(){return this.getTitle()},i.prototype.getPosition=function(e){e=e||this.$element;var i=e[0],n="BODY"==i.tagName,o=i.getBoundingClientRect();null==o.width&&(o=t.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var s=window.SVGElement&&i instanceof window.SVGElement,a=n?{top:0,left:0}:s?null:e.offset(),l={scroll:n?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},r=n?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},o,l,r,a)},i.prototype.getCalculatedOffset=function(t,e,i,n){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-n,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-n/2,left:e.left-i}:{top:e.top+e.height/2-n/2,left:e.left+e.width}},i.prototype.getViewportAdjustedDelta=function(t,e,i,n){var o={top:0,left:0};if(!this.$viewport)return o;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var l=e.top-s-a.scroll,r=e.top+s-a.scroll+n;l<a.top?o.top=a.top-l:r>a.top+a.height&&(o.top=a.top+a.height-r)}else{var c=e.left-s,h=e.left+s+i;c<a.left?o.left=a.left-c:h>a.right&&(o.left=a.left+a.width-h)}return o},i.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},i.prototype.getUID=function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},i.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(e){var i=this;e&&((i=t(e.currentTarget).data("bs."+this.type))||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i))),e?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)},i.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})};var n=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=i,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=n,this}}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.popover"),s="object"==typeof e&&e;!o&&/destroy|hide/.test(e)||(o||n.data("bs.popover",o=new i(this,s)),"string"==typeof e&&o[e]())})}var i=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");i.VERSION="3.3.7",i.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),i.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),i.prototype.constructor=i,i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof i?"html":"append":"text"](i),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},i.prototype.hasContent=function(){return this.getTitle()||this.getContent()},i.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var n=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=i,t.fn.popover.noConflict=function(){return t.fn.popover=n,this}}(jQuery),function(t){"use strict";function e(i,n){this.$body=t(document.body),this.$scrollElement=t(t(i).is(document.body)?window:i),this.options=t.extend({},e.DEFAULTS,n),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",t.proxy(this.process,this)),this.refresh(),this.process()}function i(i){return this.each(function(){var n=t(this),o=n.data("bs.scrollspy"),s="object"==typeof i&&i;o||n.data("bs.scrollspy",o=new e(this,s)),"string"==typeof i&&o[i]()})}e.VERSION="3.3.7",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e=this,i="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),t.isWindow(this.$scrollElement[0])||(i="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var e=t(this),o=e.data("target")||e.attr("href"),s=/^#./.test(o)&&t(o);return s&&s.length&&s.is(":visible")&&[[s[i]().top+n,o]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){e.offsets.push(this[0]),e.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),n=this.options.offset+i-this.$scrollElement.height(),o=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),e>=n)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<o[0])return this.activeTarget=null,this.clear();for(t=o.length;t--;)a!=s[t]&&e>=o[t]&&(void 0===o[t+1]||e<o[t+1])&&this.activate(s[t])},e.prototype.activate=function(e){this.activeTarget=e,this.clear();var i=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',n=t(i).parents("li").addClass("active");n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate.bs.scrollspy")},e.prototype.clear=function(){t(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var n=t.fn.scrollspy;t.fn.scrollspy=i,t.fn.scrollspy.Constructor=e,t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=n,this},t(window).on("load.bs.scrollspy.data-api",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);i.call(e,e.data())})})}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.tab");o||n.data("bs.tab",o=new i(this)),"string"==typeof e&&o[e]()})}var i=function(e){this.element=t(e)};i.VERSION="3.3.7",i.TRANSITION_DURATION=150,i.prototype.show=function(){
|
|
|
var e=this.element,i=e.closest("ul:not(.dropdown-menu)"),n=e.data("target");if(n||(n=e.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,"")),!e.parent("li").hasClass("active")){var o=i.find(".active:last a"),s=t.Event("hide.bs.tab",{relatedTarget:e[0]}),a=t.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(s),e.trigger(a),!a.isDefaultPrevented()&&!s.isDefaultPrevented()){var l=t(n);this.activate(e.closest("li"),i),this.activate(l,l.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:e[0]}),e.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},i.prototype.activate=function(e,n,o){function s(){a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),e.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),l?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu").length&&e.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),o&&o()}var a=n.find("> .active"),l=o&&t.support.transition&&(a.length&&a.hasClass("fade")||!!n.find("> .fade").length);a.length&&l?a.one("bsTransitionEnd",s).emulateTransitionEnd(i.TRANSITION_DURATION):s(),a.removeClass("in")};var n=t.fn.tab;t.fn.tab=e,t.fn.tab.Constructor=i,t.fn.tab.noConflict=function(){return t.fn.tab=n,this};var o=function(i){i.preventDefault(),e.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',o).on("click.bs.tab.data-api",'[data-toggle="pill"]',o)}(jQuery),function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.affix"),s="object"==typeof e&&e;o||n.data("bs.affix",o=new i(this,s)),"string"==typeof e&&o[e]()})}var i=function(e,n){this.options=t.extend({},i.DEFAULTS,n),this.$target=t(this.options.target).on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.7",i.RESET="affix affix-top affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,n){var o=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return o<i&&"top";if("bottom"==this.affixed)return null!=i?!(o+this.unpin<=s.top)&&"bottom":!(o+a<=t-n)&&"bottom";var l=null==this.affixed,r=l?o:s.top,c=l?a:e;return null!=i&&o<=i?"top":null!=n&&r+c>=t-n&&"bottom"},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),n=this.options.offset,o=n.top,s=n.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof n&&(s=o=n),"function"==typeof o&&(o=n.top(this.$element)),"function"==typeof s&&(s=n.bottom(this.$element));var l=this.getState(a,e,o,s);if(this.affixed!=l){null!=this.unpin&&this.$element.css("top","");var r="affix"+(l?"-"+l:""),c=t.Event(r+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=l,this.unpin="bottom"==l?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(r).trigger(r.replace("affix","affixed")+".bs.affix")}"bottom"==l&&this.$element.offset({top:a-e-s})}};var n=t.fn.affix;t.fn.affix=e,t.fn.affix.Constructor=i,t.fn.affix.noConflict=function(){return t.fn.affix=n,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var i=t(this),n=i.data();n.offset=n.offset||{},null!=n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!=n.offsetTop&&(n.offset.top=n.offsetTop),e.call(i,n)})})}(jQuery),define("bootstrap",["jquery"],function(){}),void 0===Common)var Common={};if(define("notification",["backbone"],function(t){"use strict";var e=function(){};if(_.extend(e.prototype,t.Events),void 0!==Common.NotificationCenter)throw"Native Common.NotificationCenter instance already defined.";e.extend=t.Model.extend,Common.NotificationCenter=new e}),function(){var t=function(t,e){for(var i=t.split("."),n=e||window,o=0,s=i.length;o<s;o++)n=n[i[o]]||{};return n},e=function(t){_.extend(this,t||{}),this.eventbus=new n({application:this}),this.createApplicationNamespace(),this.initialize.apply(this,arguments),!1!==this.autoCreate&&$($.proxy(this.onReady,this))};if(_.extend(e.prototype,{nameSpace:"Application",models:{},collections:{},controllers:{},allocationMap:{model:"Models",collection:"Collections",controller:"Controllers",view:"Views"},createApplicationNamespace:function(){var t=window;this.nameSpace&&void 0===t[this.nameSpace]&&(t[this.nameSpace]={}),t[this.nameSpace]=this,_.each(this.allocationMap,function(t,e){this[t]=this[t]||{}},this)},initialize:function(){},onReady:function(){this.start()},start:function(){this.initializeControllers(this.controllers||{}),this.launchControllers(),this.launch.call(this)},getClasseRefs:function(e,i){var n={},o=this.allocationMap[e],s=this[o];return _.each(i,function(e){n[e]=t(e,e.indexOf(".")>-1?window:s)},this),n},initializeControllers:function(e){this.controllers={},_.each(e,function(e){var i=e.indexOf(".")>-1?window:this[this.allocationMap.controller],n=t(e,i),o=(e.split(".").pop(),new n({id:e,application:this}));o.views=this.getClasseRefs("view",o.views||[]),_.extend(this.models,this.getClasseRefs("model",o.models||[])),_.extend(this.collections,this.getClasseRefs("collection",o.collections||{})),this.buildCollections(),this.controllers[e]=o},this)},launchControllers:function(){_.each(this.controllers,function(t,e){t.onLaunch(this)},this)},launch:function(){},addListeners:function(t,e){this.eventbus.addListeners(t,e)},getController:function(t){return this.controllers[t]},getModel:function(t){this._modelsCache=this._modelsCache||{};var e=this._modelsCache[t],i=this.getModelConstructor(t);return!e&&i&&(e=this.createModel(t),this._modelsCache[t]=e),e||null},getModelConstructor:function(t){return this.models[t]},createModel:function(t,e){var i=this.getModelConstructor(t),n=null;return i&&(n=new i(_.extend(e||{}))),n},getCollection:function(t){this._collectionsCache=this._collectionsCache||{};var e=this._collectionsCache[t],i=this.getCollectionConstructor(t);return!e&&i&&(e=this.createCollection(t),this._collectionsCache[t]=e),e||null},getCollectionConstructor:function(t){return this.collections[t]},createCollection:function(t){var e=this.getCollectionConstructor(t),i=null;return e&&(i=new e),i},buildCollections:function(){_.each(this.collections,function(t,e){this.getCollection(e)},this)}}),void 0!==Backbone.Application)throw"Native Backbone.Application instance already defined.";Backbone.Application=e,Backbone.Application.extend=Backbone.Model.extend;var i=function(t){_.extend(this,t||{}),this.initialize.apply(this,arguments)};if(_.extend(i.prototype,{name:null,views:{},models:{},collections:{},initialize:function(t){},addListeners:function(t){this.getApplication().addListeners(t,this)},onLaunch:function(t){},getApplication:function(){return this.application},getView:function(t){return this._viewsCache[t]},getViewConstructor:function(t){return this.views[t]},createView:function(t,e){var i=this.getViewConstructor(t),n=_.extend(e||{},{alias:t});return this._viewsCache=this._viewsCache||{},this._viewsCache[t]=new i(n),this._viewsCache[t].options=_.extend({},n),this._viewsCache[t]},getModel:function(t){return this.application.getModel(t)},getModelConstructor:function(t){return this.application.getModelConstructor(t)},createModel:function(t,e){return this.application.createModel(t)},getCollection:function(t){return this.application.getCollection(t)},getCollectionConstructor:function(t){return this.application.getCollectionConstructor(t)},createCollection:function(t){return this.application.createCollection(t)},fireEvent:function(t,e,i){this.application.eventbus.fireEvent(t,e,i)},bindViewEvents:function(t,e){this.unbindViewEvents(t),e=_.isFunction(e)?e.call(this):e;for(var i in e){var n=e[i];_.isFunction(n)||(n=this[e[i]]);var o=i.match(/^(\S+)\s*(.*)$/),s=o[1],a=o[2];n=_.bind(n,this),s+=".bindViewEvents"+t.cid,t.$el.on(s,a,n)}return this},unbindViewEvents:function(t){return t.$el.off(".bindViewEvents"+t.cid),this}}),void 0!==Backbone.Controller)throw"Native Backbone.Controller instance already defined.";Backbone.Controller=i,Backbone.Controller.extend=Backbone.Model.extend;var n=function(t){var e=this;_.extend(this,t||{}),_.extend(Backbone.View.prototype,{alias:null,hidden:!1,getAlias:function(){return this.options.alias},fireEvent:function(t,i){this.trigger.apply(this,arguments),e.fireEvent(this.getAlias(),t,i)},hide:function(){this.$el.hide(),this.hidden=!0},show:function(){this.$el.show(),this.hidden=!1}})};if(_.extend(n.prototype,{pool:{},addListeners:function(t,e){this.pool[e.id]=this.pool[e.id]||{};var i=this.pool[e.id];_.isArray(t)?_.each(t,function(t){this.addListeners(t,e)},this):_.isObject(t)&&_.each(t,function(t,e){_.each(t,function(t,n){i[e]=i[e]||{},i[e][n]=i[e][n]||[],i[e][n].push(t)},this)},this)},fireEvent:function(t,e,i){var n=this.getApplication();_.each(this.pool,function(o,s){var a=o[t];if(a){var l=a[e],r=n.getController(s);_.each(l,function(t){t.apply(r,i)})}},this)},getApplication:function(){return this.application}}),void 0!==Backbone.EventBus)throw"Native Backbone.Application instance already defined.";Backbone.EventBus=n}(),define("core",["backbone","notification"],function(){}),void 0===Common)var Common={};if(Common.component=Common.component||{},Common.Analytics=Common.component.Analytics=new function(){var t;return{initialize:function(e,i){if(void 0===e)throw"Analytics: invalid id.";if(void 0===i||"[object String]"!==Object.prototype.toString.apply(i))throw"Analytics: invalid category type.";t=i,$("head").append('<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(["_setAccount", "'+e+'"]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);})();<\/script>')},trackEvent:function(e,i,n){if(void 0!==e&&"[object String]"!==Object.prototype.toString.apply(e))throw"Analytics: invalid action type.";if(void 0!==i&&"[object String]"!==Object.prototype.toString.apply(i))throw"Analytics: invalid label type.";if(void 0!==n&&("[object Number]"!==Object.prototype.toString.apply(n)||!isFinite(n)))throw"Analytics: invalid value type.";if("undefined"!=typeof _gaq){if("undefined"===t)throw"Analytics is not initialized.";_gaq.push(["_trackEvent",t,e,i,n])}}}},define("analytics",["jquery"],function(){}),void 0===Common)var Common={};if(Common.Gateway=new function(){var t=this,e=$(t),i={init:function(t){e.trigger("init",t)},openDocument:function(t){e.trigger("opendocument",t)},showMessage:function(t){e.trigger("showmessage",t)},applyEditRights:function(t){e.trigger("applyeditrights",t)},processSaveResult:function(t){e.trigger("processsaveresult",t)},processRightsChange:function(t){e.trigger("processrightschange",t)},refreshHistory:function(t){e.trigger("refreshhistory",t)},setHistoryData:function(t){e.trigger("sethistorydata",t)},setEmailAddresses:function(t){e.trigger("setemailaddresses",t)},setActionLink:function(t){e.trigger("setactionlink",t.url)},processMailMerge:function(t){e.trigger("processmailmerge",t)},downloadAs:function(t){e.trigger("downloadas",t)},processMouse:function(t){e.trigger("processmouse",t)},internalCommand:function(t){e.trigger("internalcommand",t)},resetFocus:function(t){e.trigger("resetfocus",t)},setUsers:function(t){e.trigger("setusers",t)},showSharingSettings:function(t){e.trigger("showsharingsettings",t)},setSharingSettings:function(t){e.trigger("setsharingsettings",t)},insertImage:function(t){e.trigger("insertimage",t)},setMailMergeRecipients:function(t){e.trigger("setmailmergerecipients",t)}},n=function(t){window.parent&&window.JSON&&(t.frameEditorId=window.frameEditorId,window.parent.postMessage(window.JSON.stringify(t),"*"))},o=function(t){var e=t.data;if("[object String]"===Object.prototype.toString.apply(e)&&window.JSON){var n,o;try{n=window.JSON.parse(e)}catch(t){n=""}n&&(o=i[n.command])&&o.call(this,n.data)}},s=function(t){o(t)};return window.attachEvent?window.attachEvent("onmessage",s):window.addEventListener("message",s,!1),{appReady:function(){n({event:"onAppReady"})},requestEditRights:function(){n({event:"onRequestEditRights"})},requestHistory:function(){n({event:"onRequestHistory"})},requestHistoryData:function(t){n({event:"onRequestHistoryData",data:t})},requestRestore:function(t,e){n({event:"onRequestRestore",data:{version:t,url:e}})},requestEmailAddresses:function(){n({event:"onRequestEmailAddresses"})},requestStartMailMerge:function(){n({event:"onRequestStartMailMerge"})},requestHistoryClose:function(t){n({event:"onRequestHistoryClose"})},reportError:function(t,e){n({event:"onError",data:{errorCode:t,errorDescription:e}})},reportWarning:function(t,e){n({event:"onWarning",data:{warningCode:t,warningDescription:e}})},sendInfo:function(t){n({event:"onInfo",data:t})},setDocumentModified:function(t){n({event:"onDocumentStateChange",data:t})},internalMessage:function(t,e){n({event:"onInternalMessage",data:{type:t,data:e}})},updateVersion:function(){n({event:"onOutdatedVersion"})},downloadAs:function(t){n({event:"onDownloadAs",data:t})},requestSaveAs:function(t,e){n({event:"onRequestSaveAs",data:{url:t,title:e}})},collaborativeChanges:function(){n({event:"onCollaborativeChanges"})},requestRename:function(t){n({event:"onRequestRename",data:t})},metaChange:function(t){n({event:"onMetaChange",data:t})},documentReady:function(){n({event:"onDocumentReady"})},requestClose:function(){n({event:"onRequestClose"})},requestMakeActionLink:function(t){n({event:"onMakeActionLink",data:t})},requestUsers:function(){n({event:"onRequestUsers"})},requestSendNotify:function(t){n({event:"onRequestSendNotify",data:t})},requestInsertImage:function(){n({event:"onRequestInsertImage"})},requestMailMergeRecipients:function(){n({event:"onRequestMailMergeRecipients"})},on:function(i,n){var o=function(e,i){n.call(t,i)};e.on(i,o)}}},define("gateway",["jquery"],function(){}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("../vendor/es6-promise/es6-promise.auto.min.js",e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function i(t){B=t}function n(t){L=t}function o(){return void 0!==R?function(){R(a)}:s()}function s(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<V;t+=2){(0,G[t])(G[t+1]),G[t]=void 0,G[t+1]=void 0}V=0}function l(t,e){var i=this,n=new this.constructor(c);void 0===n[W]&&A(n);var o=i._state;if(o){var s=arguments[o-1];L(function(){return x(o,n,s,i._result)})}else _(i,n,t,e);return n}function r(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var i=new e(c);return b(i,t),i}function c(){}function h(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function p(t,e,i,n){try{t.call(e,i,n)}catch(t){return t}}function m(t,e,i){L(function(t){var n=!1,o=p(i,e,function(i){n||(n=!0,e!==i?b(t,i):C(t,i))},function(e){n||(n=!0,v(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&o&&(n=!0,v(t,o))},t)}function u(t,e){e._state===K?C(t,e._result):e._state===Y?v(t,e._result):_(e,void 0,function(e){return b(t,e)},function(e){return v(t,e)})}function g(t,i,n){i.constructor===t.constructor&&n===l&&i.constructor.resolve===r?u(t,i):void 0===n?C(t,i):e(n)?m(t,i,n):C(t,i)}function b(e,i){if(e===i)v(e,h());else if(t(i)){var n=void 0;try{n=i.then}catch(t){return void v(e,t)}g(e,i,n)}else C(e,i)}function f(t){t._onerror&&t._onerror(t._result),y(t)}function C(t,e){t._state===q&&(t._result=e,t._state=K,0!==t._subscribers.length&&L(y,t))}function v(t,e){t._state===q&&(t._state=Y,t._result=e,L(f,t))}function _(t,e,i,n){var o=t._subscribers,s=o.length;t._onerror=null,o[s]=e,o[s+K]=i,o[s+Y]=n,0===s&&t._state&&L(y,t)}function y(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var n=void 0,o=void 0,s=t._result,a=0;a<e.length;a+=3)n=e[a],o=e[a+i],n?x(i,n,o,s):o(s);t._subscribers.length=0}}function x(t,i,n,o){var s=e(n),a=void 0,l=void 0,r=!0;if(s){try{a=n(o)}catch(t){r=!1,l=t}if(i===a)return void v(i,d())}else a=o;i._state!==q||(s&&r?b(i,a):!1===r?v(i,l):t===K?C(i,a):t===Y&&v(i,a))}function w(t,e){try{e(function(e){b(t,e)},function(e){v(t,e)})}catch(e){v(t,e)}}function S(){return X++}function A(t){t[W]=X++,t._state=void 0,t._result=void 0,t._subscribers=[]}function k(){return new Error("Array Methods must be provided an Array")}function T(t){return new J(this,t).promise}function I(t){var e=this;return new e(U(t)?function(i,n){for(var o=t.length,s=0;s<o;s++)e.resolve(t[s]).then(i,n)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function E(t){var e=this,i=new e(c);return v(i,t),i}function P(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function M(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function D(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var i=null;try{i=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===i&&!e.cast)return}t.Promise=Z}var F=void 0;F=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U=F,V=0,R=void 0,B=void 0,L=function(t,e){G[V]=t,G[V+1]=e,2===(V+=2)&&(B?B(a):j())},N="undefined"!=typeof window?window:void 0,O=N||{},H=O.MutationObserver||O.WebKitMutationObserver,$="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,G=new Array(1e3),j=void 0;j=$?function(){return function(){return process.nextTick(a)}}():H?function(){var t=0,e=new H(a),i=document.createTextNode("");return e.observe(i,{characterData:!0}),function(){i.data=t=++t%2}}():z?function(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}():void 0===N&&"function"==typeof require?function(){try{var t=Function("return this")().require("vertx");return R=t.runOnLoop||t.runOnContext,o()}catch(t){return s()}}():s();var W=Math.random().toString(36).substring(2),q=void 0,K=1,Y=2,X=0,J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(c),this.promise[W]||A(this.promise),U(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&C(this.promise,this._result))):v(this.promise,k())}return t.prototype._enumerate=function(t){for(var e=0;this._state===q&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var i=this._instanceConstructor,n=i.resolve;if(n===r){var o=void 0,s=void 0,a=!1;try{o=t.then}catch(t){a=!0,s=t}if(o===l&&t._state!==q)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(i===Z){var h=new i(c);a?v(h,s):g(h,t,o),this._willSettleAt(h,e)}else this._willSettleAt(new i(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,i){var n=this.promise;n._state===q&&(this._remaining--,t===Y?v(n,i):this._result[e]=i),0===this._remaining&&C(n,this._result)},t.prototype._willSettleAt=function(t,e){var i=this;_(t,void 0,function(t){return i._settledAt(K,e,t)},function(t){return i._settledAt(Y,e,t)})},t}(),Z=function(){function t(e){this[W]=S(),this._result=this._state=void 0,this._subscribers=[],c!==e&&("function"!=typeof e&&P(),this instanceof t?w(this,e):M())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var i=this,n=i.constructor;return e(t)?i.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})}):i.then(t,t)},t}();return Z.prototype.then=l,Z.all=T,Z.race=I,Z.resolve=r,Z.reject=E,Z._setScheduler=i,Z._setAsap=n,Z._asap=L,Z.polyfill=D,Z.Promise=Z,Z.polyfill(),Z}),void 0===Common)var Common={};if(Common.Locale=new function(){"use strict";var l10n=null,loadcallback,apply=!1,_applyLocalization=function(t){try{if(t&&(loadcallback=t),l10n){for(var e in l10n){var i=e.split(".");if(i&&i.length>2){for(var n=window,o=0;o<i.length-1;++o)void 0===n[i[o]]&&(n[i[o]]=new Object),n=n[i[o]];n&&(n[i[i.length-1]]=l10n[e])}}loadcallback&&loadcallback()}else apply=!0}catch(t){}},_get=function(prop,scope){var res="";return l10n&&scope&&scope.name&&(res=l10n[scope.name+"."+prop]),res||(scope?eval(scope.name).prototype[prop]:"")},_getUrlParameterByName=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)"),i=e.exec(location.search);return null==i?"":decodeURIComponent(i[1].replace(/\+/g," "))},_requireLang=function(){var t=(_getUrlParameterByName("lang")||"en").split(/[\-_]/)[0];fetch("locale/"+t+".json").then(function(e){if(!e.ok){if("en"!=t)return fetch("locale/en.json");throw new Error("server error")}return e.json()}).then(function(t){if(t.then)return t.json();throw l10n=t,new Error("loaded")}).then(function(t){l10n=t||{},apply&&_applyLocalization()}).catch(function(t){l10n=l10n||{},apply&&_applyLocalization(),"loaded"==t.message||console.log("fetch error: "+t)})};if(window.fetch)_requireLang();else{var polyfills=["../vendor/fetch/fetch.umd"];window.Promise?require(polyfills,_requireLang):require(["../vendor/es6-promise/es6-promise.auto.min.js"],function(){require(polyfills,_requireLang)})}return{apply:_applyLocalization,get:_get}},define("locale",function(){}),define("text",["module"],function(t){"use strict";var e,i,n,o,s,a=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],l=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,r=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,c="undefined"!=typeof location&&location.href,h=c&&location.protocol&&location.protocol.replace(/\:/,""),d=c&&location.hostname,p=c&&(location.port||void 0),m={},u=t.config&&t.config()||{};return e={version:"2.0.10",strip:function(t){if(t){t=t.replace(l,"");var e=t.match(r);e&&(t=e[1])}else t="";return t},jsEscape:function(t){return t.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:u.createXhr||function(){var t,e,i;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(e=0;e<3;e+=1){i=a[e];try{t=new ActiveXObject(i)}catch(t){}if(t){a=[i];break}}return t},parseName:function(t){var e,i,n,o=!1,s=t.indexOf("."),a=0===t.indexOf("./")||0===t.indexOf("../");return-1!==s&&(!a||s>1)?(e=t.substring(0,s),i=t.substring(s+1,t.length)):e=t,n=i||e,s=n.indexOf("!"),-1!==s&&(o="strip"===n.substring(s+1),n=n.substring(0,s),i?i=n:e=n),{moduleName:e,ext:i,strip:o}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(t,i,n,o){var s,a,l,r=e.xdRegExp.exec(t);return!r||(s=r[2],a=r[3],a=a.split(":"),l=a[1],a=a[0],!(s&&s!==i||a&&a.toLowerCase()!==n.toLowerCase()||(l||a)&&l!==o))},finishLoad:function(t,i,n,o){n=i?e.strip(n):n,u.isBuild&&(m[t]=n),o(n)},load:function(t,i,n,o){if(o.isBuild&&!o.inlineText)return void n();u.isBuild=o.isBuild;var s=e.parseName(t),a=s.moduleName+(s.ext?"."+s.ext:""),l=i.toUrl(a),r=u.useXhr||e.useXhr;if(0===l.indexOf("empty:"))return void n();!c||r(l,h,d,p)?e.get(l,function(i){e.finishLoad(t,s.strip,i,n)},function(t){n.error&&n.error(t)}):i([a],function(t){e.finishLoad(s.moduleName+"."+s.ext,s.strip,t,n)})},write:function(t,i,n,o){if(m.hasOwnProperty(i)){var s=e.jsEscape(m[i]);n.asModule(t+"!"+i,"define(function () { return '"+s+"';});\n")}},writeFile:function(t,i,n,o,s){var a=e.parseName(i),l=a.ext?"."+a.ext:"",r=a.moduleName+l,c=n.toUrl(a.moduleName+l)+".js";e.load(r,n,function(i){var n=function(t){return o(c,t)};n.asModule=function(t,e){return o.asModule(t,c,e)},e.write(t,r,n,s)},s)}},"node"===u.env||!u.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(i=require.nodeRequire("fs"),e.get=function(t,e,n){try{var o=i.readFileSync(t,"utf8");0===o.indexOf("\ufeff")&&(o=o.substring(1)),e(o)}catch(t){n(t)}}):"xhr"===u.env||!u.env&&e.createXhr()?e.get=function(t,i,n,o){var s,a=e.createXhr();if(a.open("GET",t,!0),o)for(s in o)o.hasOwnProperty(s)&&a.setRequestHeader(s.toLowerCase(),o[s]);u.onXhr&&u.onXhr(a,t),a.onreadystatechange=function(e){var o,s;4===a.readyState&&(o=a.status,o>399&&o<600?(s=new Error(t+" HTTP status: "+o),s.xhr=a,n(s)):i(a.responseText),u.onXhrComplete&&u.onXhrComplete(a,t))},a.send(null)}:"rhino"===u.env||!u.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?e.get=function(t,e){var i,n,o=new java.io.File(t),s=java.lang.System.getProperty("line.separator"),a=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o),"utf-8")),l="";try{for(i=new java.lang.StringBuffer,n=a.readLine(),n&&n.length()&&65279===n.charAt(0)&&(n=n.substring(1)),null!==n&&i.append(n);null!==(n=a.readLine());)i.append(s),i.append(n);l=String(i.toString())}finally{a.close()}e(l)}:("xpconnect"===u.env||!u.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(n=Components.classes,o=Components.interfaces,Components.utils.import("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in n,e.get=function(t,e){var i,a,l,r={};s&&(t=t.replace(/\//g,"\\")),l=new FileUtils.File(t);try{i=n["@mozilla.org/network/file-input-stream;1"].createInstance(o.nsIFileInputStream),i.init(l,1,0,!1),a=n["@mozilla.org/intl/converter-input-stream;1"].createInstance(o.nsIConverterInputStream),a.init(i,"utf-8",i.available(),o.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),a.readString(i.available(),r),a.close(),i.close(),e(r.value)}catch(t){throw new Error((l&&l.path||"")+": "+t)}}),e}),define("text!common/main/lib/template/Header.template",[],function(){return'<div id="header-container">\n <div id="header-logo"></div>\n <div id="header-caption"><div><%= headerCaption %></div></div>\n <div id="header-documentcaption"><div><%= documentCaption %></div></div>\n <div id="header-back" style="display: <%= canBack ? \'table-cell\' : \'none\' %>;"><div><%= textBack %></div></div>\n</div>'}),void 0===Common)var Common={};if(define("common/main/lib/component/BaseView",["backbone"],function(t){"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,EQUALITY_FF:61,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,MINUS_FF:173,EQUALITY:187,MINUS:189},BaseView:t.View.extend({isSuspendEvents:!1,initialize:function(t){this.options=this.options?_({}).extend(this.options,t):t},setVisible:function(t){return this[t?"show":"hide"]()},isVisible:function(){return $(this.el).is(":visible")},suspendEvents:function(){this.isSuspendEvents=!0},resumeEvents:function(){this.isSuspendEvents=!1}}),getId:function(t){return _.uniqueId(t||"asc-gen")}})}),void 0===Common)var Common={};if(define("common/main/lib/component/Window",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Window=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=$(".modals-mask");return 0==t.length&&(t=$("<div class='modals-mask'>").appendTo(document.body).hide(),t.attr("counter",0)),t}function e(t){if(!this.isLocked()&&this.isVisible()&&this.initConfig.enableKeyEvents&&!1!==this.pauseKeyEvents)switch(t.keyCode){case Common.UI.Keys.ESC:if($(".asc-loadmask").length<1)return t.preventDefault(),t.stopPropagation(),!1!==this.initConfig.closable&&(this.initConfig.toolcallback?this.initConfig.toolcallback.call(this):"hide"==this.initConfig.toolclose?this.hide():this.close()),!1;break;case Common.UI.Keys.RETURN:if(this.$window.find(".btn.primary").length&&$(".asc-loadmask").length<1&&!1===(this.initConfig.onprimary||this.onPrimary).call(this))return t.preventDefault(),!1}}function i(){if(void 0==window.innerHeight)var t=document.documentElement.offsetWidth,e=document.documentElement.offsetHeight;else t=Common.Utils.innerWidth(),e=Common.Utils.innerHeight();if("auto"==this.initConfig.height){var i=parseInt(this.$window.find(".body").css("height"));this.initConfig.header&&(i+=parseInt(this.$window.find(".header").css("height")))}else i=this.initConfig.height;var n="auto"==this.initConfig.width?parseInt(this.$window.find(".body").css("width")):this.initConfig.width,o=Math.floor((parseInt(e)-parseInt(i))/2),s=Math.floor((parseInt(t)-parseInt(n))/2);this.$window.css("left",s),this.$window.css("top",o)}function n(){if(void 0==window.innerHeight)var t=document.documentElement.offsetWidth,e=document.documentElement.offsetHeight;else t=Common.Utils.innerWidth(),e=Common.Utils.innerHeight();this.getLeft()+this.getWidth()>t&&this.$window.css("left",t-this.getWidth()),this.getTop()+this.getHeight()>e&&this.$window.css("top",e-this.getHeight())}function o(t){return{"-webkit-transition":"0.3s opacity","-moz-transition":"0.3s opacity","-ms-transition":"0.3s opacity","-o-transition":"0.3s opacity",opacity:t}}function s(t){if(!$(t.target).hasClass("close")){Common.UI.Menu.Manager.hideAll();var e=t instanceof jQuery.Event?Common.Utils.zoom():1;if(this.dragging.enabled=!0,this.dragging.initx=t.pageX*e-this.getLeft(),this.dragging.inity=t.pageY*e-this.getTop(),void 0==window.innerHeight)var i=document.documentElement.offsetWidth,n=document.documentElement.offsetHeight;else i=Common.Utils.innerWidth(),n=Common.Utils.innerHeight();this.dragging.maxx=i-this.getWidth(),this.dragging.maxy=n-this.getHeight(),$(document).on("mousemove",this.binding.drag),$(document).on("mouseup",this.binding.dragStop),this.fireEvent("drag",[this,"start"])}}function a(){$(document).off("mousemove",this.binding.drag),$(document).off("mouseup",this.binding.dragStop),this.dragging.enabled=!1,this.fireEvent("drag",[this,"end"])}function l(t){if(this.dragging.enabled){var e=t instanceof jQuery.Event?Common.Utils.zoom():1,i=t.pageX*e-this.dragging.initx,n=t.pageY*e-this.dragging.inity;i<0?i=0:i>this.dragging.maxx&&(i=this.dragging.maxx),n<0?n=0:n>this.dragging.maxy&&(n=this.dragging.maxy),this.$window.css({left:i,top:n})}}function r(t){"mouseup"==t.type&&this.dragging.enabled&&a.call(this)}function c(t){Common.UI.Menu.Manager.hideAll();var e=$(t.target),i=this.getLeft(),n=this.getTop();this.resizing.enabled=!0,this.resizing.initpage_x=t.pageX*Common.Utils.zoom(),this.resizing.initpage_y=t.pageY*Common.Utils.zoom(),this.resizing.initx=this.resizing.initpage_x-i,this.resizing.inity=this.resizing.initpage_y-n,this.resizing.initw=this.getWidth(),this.resizing.inith=this.getHeight(),this.resizing.type=[e.hasClass("left")?-1:e.hasClass("right")?1:0,e.hasClass("top")?-1:e.hasClass("bottom")?1:0]
|
|
|
;var o=void 0==window.innerHeight?document.documentElement.offsetWidth:Common.Utils.innerWidth(),s=void 0==window.innerHeight?document.documentElement.offsetHeight:Common.Utils.innerHeight(),a=this.initConfig.maxwidth?this.initConfig.maxwidth:o,l=this.initConfig.maxheight?this.initConfig.maxheight:s;this.resizing.type[0]>0?(this.resizing.maxx=Math.min(o,i+a),this.resizing.minx=i+this.initConfig.minwidth):this.resizing.type[0]<0&&(this.resizing.maxx=i+this.resizing.initw-this.initConfig.minwidth,this.resizing.minx=Math.max(0,i+this.resizing.initw-a)),this.resizing.type[1]>0?(this.resizing.maxy=Math.min(s,n+l),this.resizing.miny=n+this.initConfig.minheight):this.resizing.type[1]<0&&(this.resizing.maxy=n+this.resizing.inith-this.initConfig.minheight,this.resizing.miny=Math.max(0,n+this.resizing.inith-l)),$(document.body).css("cursor",e.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 h(t){if(this.resizing.enabled){var e=!1,i=t instanceof jQuery.Event?Common.Utils.zoom():1,n=t.pageX*i,o=t.pageY*i;this.resizing.type[0]&&n<this.resizing.maxx&&n>this.resizing.minx&&(this.resizing.type[0]<0&&this.$window.css({left:n-this.resizing.initx}),this.setWidth(this.resizing.initw+(n-this.resizing.initpage_x)*this.resizing.type[0]),e=!0),this.resizing.type[1]&&o<this.resizing.maxy&&o>this.resizing.miny&&(this.resizing.type[1]<0&&this.$window.css({top:o-this.resizing.inity}),this.setHeight(this.resizing.inith+(o-this.resizing.initpage_y)*this.resizing.type[1]),e=!0),e&&this.fireEvent("resizing")}}function d(){$(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 p={closable:!0,header:!0,modal:!0,width:"auto",height:"auto",title:"Title",alias:"Window",cls:"",toolclose:"close",maxwidth:void 0,maxheight:void 0,minwidth:0,minheight:0,enableKeyEvents:!0};return Common.UI.alert=function(t){function e(e){var i=e.getChild(".info-box"),n=e.getChild(".info-box span"),o=e.getChild(".footer"),s=e.getChild(".header"),a=e.getChild(".body"),l=e.getChild(".icon"),r=l.length>0?l.height():0,c=e.getChild(".info-box .dont-show-checkbox");t.dontshow||a.css("padding-bottom","10px"),t.maxwidth&&"auto"==t.width&&n.position().left+n.width()+parseInt(i.css("padding-right"))>t.maxwidth&&(t.width=t.maxwidth),"auto"==t.width?(i.height(Math.max(n.height()+(c.length>0?c.height()+parseInt(c.css("margin-top")):0),r)),a.height(parseInt(i.css("height"))+parseInt(o.css("height"))),e.setSize(n.position().left+n.width()+parseInt(i.css("padding-right")),parseInt(a.css("height"))+parseInt(s.css("height")))):(n.css("white-space","normal"),e.setWidth(t.width),i.height(Math.max(n.height()+(c.length>0?c.height()+parseInt(c.css("margin-top")):0),r)),a.height(parseInt(i.css("height"))+parseInt(o.css("height"))),e.setHeight(parseInt(a.css("height"))+parseInt(s.css("height")))),n.height()<r-10&&n.css({"vertical-align":"baseline","line-height":r+"px"})}function i(e){t.callback&&t.callback.call(l,e.currentTarget.attributes.result.value,!!r&&"checked"==r.getValue()),l.close(!0)}function n(t){return i({currentTarget:l.getChild(".footer .dlg-btn")[0]}),!1}var o=this.Window.prototype,s={ok:o.okButtonText,cancel:o.cancelButtonText,yes:o.yesButtonText,no:o.noButtonText,close:o.closeButtonText};if(t.buttons){if(_.isArray(t.buttons)){void 0==t.primary&&(t.primary="ok");var a={};_.each(t.buttons,function(e){"object"==typeof e?void 0!==e.value&&(a[e.value]={text:e.caption,cls:"custom"+(e.primary||t.primary==e.value?" primary":"")}):(a[e]={text:"custom"==e?t.customButtonText:s[e],cls:t.primary==e?"primary":""},"custom"==e&&(a[e].cls+=" custom"))}),t.buttons=a}}else t.buttons={},t.buttons.ok={text:s.ok,cls:"primary"};t.dontshow=t.dontshow||!1,t.width||(t.width="auto");_.extend(t,{cls:"alert",onprimary:n,tpl:_.template('<div class="info-box"><% if (typeof iconCls !== "undefined") { %><div class="icon img-commonctrl <%= iconCls %>" /><% } %><div class="text" <% if (typeof iconCls == "undefined") { %> style="padding-left:10px;" <% } %>><span><%= msg %></span><% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %></div></div><% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %><% if (_.size(buttons) > 0) { %><div class="footer <% if (dontshow) { %> dontshow <% } %>"><% for(var bt in buttons) { %><button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button><% } %></div><% } %>')(t)});var l=new Common.UI.Window(t),r=null;l.on({"render:after":function(t){t.getChild(".footer .dlg-btn").on("click",i),r=new Common.UI.CheckBox({el:l.$window.find(".dont-show-checkbox"),labelText:l.textDontShow}),e(t)},show:function(t){t.getChild(".footer .dlg-btn").focus()},close:function(){t.callback&&t.callback.call(l,"close")}}),l.show()},Common.UI.error=function(t){t=t||{},!t.title&&(t.title=this.Window.prototype.textError),Common.UI.alert(_.extend(t,{iconCls:"error"}))},Common.UI.confirm=function(t){t=t||{},!t.title&&(t.title=this.Window.prototype.textConfirmation),Common.UI.alert(_.extend(t,{iconCls:"confirm"}))},Common.UI.info=function(t){t=t||{},!t.title&&(t.title=this.Window.prototype.textInformation),Common.UI.alert(_.extend(t,{iconCls:"info"}))},Common.UI.warning=function(t){t=t||{},!t.title&&(t.title=this.Window.prototype.textWarning),Common.UI.alert(_.extend(t,{iconCls:"warn"}))},{$window:void 0,$lastmodal:void 0,dragging:{enabled:!1},resizing:{enabled:!1},initialize:function(t){this.initConfig={},this.binding={},_.extend(this.initConfig,p,t||{}),!this.initConfig.id&&(this.initConfig.id="window-"+this.cid),!this.initConfig.tpl&&(this.initConfig.tpl=""),Common.UI.BaseView.prototype.initialize.call(this,this.initConfig)},render:function(){var t=this.initConfig.renderTo||document.body;if($(t).append(_.template('<div class="asc-window<%= modal?" modal":"" %><%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;"><% if (header==true) { %><div class="header"><% if (closable!==false) %><div class="tool close img-commonctrl"></div><% %><div class="title"><%= title %></div> </div><% } %><div class="body"><%= tpl %></div></div>')(this.initConfig)),this.$window=$("#"+this.initConfig.id),this.binding.keydown=_.bind(e,this),this.initConfig.header){this.binding.drag=_.bind(l,this),this.binding.dragStop=_.bind(a,this),this.binding.dragStart=_.bind(s,this);var i=function(){this.$window.find(".tool.close").hasClass("disabled")||(this.initConfig.toolcallback?this.initConfig.toolcallback.call(this):"hide"==this.initConfig.toolclose?this.hide():this.close())};this.$window.find(".header").on("mousedown",this.binding.dragStart),this.$window.find(".tool.close").on("click",_.bind(i,this)),this.initConfig.modal||Common.Gateway.on("processmouse",_.bind(r,this))}else this.$window.find(".body").css({top:0,"border-radius":"5px"});if("auto"==this.initConfig.height){var n=parseInt(this.$window.find("> .body").css("height"));this.initConfig.header&&(n+=parseInt(this.$window.find("> .header").css("height"))),this.$window.height(n)}else this.$window.css("height",this.initConfig.height);this.initConfig.resizable&&this.setResizable(this.initConfig.resizable);var o=this;return this.binding.winclose=function(t){o.$window&&o.isVisible()&&o.$window==t.$window&&o.close()},Common.NotificationCenter.on("window:close",this.binding.winclose),this.fireEvent("render:after",this),this},show:function(e,s){if(this.initConfig.modal){var a=t();if(!1===this.options.animate||this.options.animate&&!1===this.options.animate.mask)a.attr("counter",parseInt(a.attr("counter"))+1),a.show();else{var l=a.css("opacity");a.css("opacity",0),a.attr("counter",parseInt(a.attr("counter"))+1),a.show(),setTimeout(function(){a.css(o(l))},1)}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}),n.call(this),this.$window.show()):(this.render(),_.isNumber(e)&&_.isNumber(s)?(this.$window.css("left",Math.floor(e)),this.$window.css("top",Math.floor(s))):i.call(this)),$(document).on("keydown."+this.cid,this.binding.keydown);var r=this;setTimeout(function(){r.fireEvent("animate:before",r)},10),!1!==this.options.animate?(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(){r.$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(){r.$window.addClass("notransform"),r.fireEvent("show",r)},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){if($(document).off("keydown."+this.cid),this.initConfig.header&&this.$window.find(".header").off("mousedown",this.binding.dragStart),Common.NotificationCenter.off({"window:close":this.binding.winclose}),this.initConfig.modal){var i=t(),n=!0;if(i.attr("counter",parseInt(i.attr("counter"))-1),this.$lastmodal.length>0&&(this.$lastmodal.removeClass("dethrone"),n=!(this.$lastmodal.hasClass("modal")&&this.$lastmodal.is(":visible"))),n)if(!1!==this.options.animate){var s=i.css("opacity");i.css(o(0)),setTimeout(function(){i.css("opacity",s),parseInt(i.attr("counter"))<1&&(i.hide(),i.attr("counter",0))},300)}else parseInt(i.attr("counter"))<1&&(i.hide(),i.attr("counter",0));Common.NotificationCenter.trigger("modal:close",this)}this.$window.remove(),!0!==e&&this.fireEvent("close",this)},hide:function(){if($(document).off("keydown."+this.cid),this.$window){if(this.initConfig.modal){var e=t(),i=!0;if(e.attr("counter",parseInt(e.attr("counter"))-1),this.$lastmodal.length>0&&(this.$lastmodal.removeClass("dethrone"),i=!(this.$lastmodal.hasClass("modal")&&this.$lastmodal.is(":visible"))),i)if(!1!==this.options.animate){var n=e.css("opacity");e.css(o(0)),setTimeout(function(){e.css("opacity",n),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.initConfig.modal&&this.$window.parent().find(".asc-window.modal:visible").length},getChild:function(t){return t?this.$window.find(t):this.$window},setWidth:function(t){if(t>=0){var e=parseInt(this.$window.css("min-width"));t<e&&(t=e),t-=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width")),this.$window.width(t)}},getWidth:function(){return parseInt(this.$window.css("width"))},setHeight:function(t){if(t>=0){var e=parseInt(this.$window.css("min-height"));t<e&&(t=e),t-=parseInt(this.$window.css("border-bottom-width"))+parseInt(this.$window.css("border-top-width")),this.$window.height(t),this.initConfig.header&&(t-=parseInt(this.$window.find("> .header").css("height"))),this.$window.find("> .body").css("height",t)}},getHeight:function(){return parseInt(this.$window.css("height"))},setSize:function(t,e){this.setWidth(t),this.setHeight(e)},getSize:function(){return[this.getWidth(),this.getHeight()]},setTitle:function(t){this.$window.find("> .header > .title").text(t)},getTitle:function(){return this.$window.find("> .header > .title").text()},getLeft:function(){return parseInt(this.$window.css("left"))},getTop:function(){return parseInt(this.$window.css("top"))},isVisible:function(){return this.$window&&this.$window.is(":visible")},setResizable:function(t,e,i){if(t!==this.resizable){if(t){var n='<div class="resize-border left" style="top:'+(this.initConfig.header?"33":"5")+'px; bottom: 5px; height: auto; border-right-style: solid; cursor: w-resize;"></div><div class="resize-border left bottom" style="border-bottom-left-radius: 5px; cursor: sw-resize;"></div><div class="resize-border bottom" style="left: 4px; right: 4px; width: auto; z-index: 2; border-top-style: solid; cursor: s-resize;"></div><div class="resize-border right bottom" style="border-bottom-right-radius: 5px; cursor: se-resize;"></div><div class="resize-border right" style="top:'+(this.initConfig.header?"33":"5")+'px; bottom: 5px; height: auto; border-left-style: solid; cursor: e-resize;"></div><div class="resize-border left top" style="border-top-left-radius: 5px; cursor: nw-resize;"></div><div class="resize-border top" style="left: 4px; right: 4px; width: auto; z-index: 2; border-bottom-style:'+(this.initConfig.header?"none":"solid")+'; cursor: n-resize;"></div><div class="resize-border right top" style="border-top-right-radius: 5px; cursor: ne-resize;"></div>';this.initConfig.header&&(n+='<div class="resize-border left" style="top: 5px; height: 28px; cursor: w-resize;"></div><div class="resize-border right" style="top: 5px; height: 28px; cursor: e-resize;"></div>'),this.$window.append(_.template(n)),this.binding.resize=_.bind(h,this),this.binding.resizeStop=_.bind(d,this),this.binding.resizeStart=_.bind(c,this),e&&e.length>1&&(this.initConfig.minwidth=e[0]),e&&e.length>1&&(this.initConfig.minheight=e[1]),i&&i.length>1&&(this.initConfig.maxwidth=i[0]),i&&i.length>1&&(this.initConfig.maxheight=i[1]),this.$window.find(".resize-border").on("mousedown",this.binding.resizeStart)}else this.$window.find(".resize-border").remove();this.resizable=t}},suspendKeyEvents:function(){this.pauseKeyEvents=!1},resumeKeyEvents:function(){this.initConfig.enableKeyEvents&&(this.pauseKeyEvents=!0)},onPrimary:function(){},cancelButtonText:"Cancel",okButtonText:"OK",yesButtonText:"Yes",noButtonText:"No",closeButtonText:"Close",textWarning:"Warning",textError:"Error",textConfirmation:"Confirmation",textInformation:"Information",textDontShow:"Don't show this message again"}}(),Common.UI.Window||{}))}),define("common/main/lib/view/RenameDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.RenameDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",filename:""},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textName+"</label>","</div>",'<div id="id-dlg-newname" class="input-row"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputName=new Common.UI.InputField({el:$("#id-dlg-newname"),style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!/[\t*\+:\"<>?|\\\\/]/gim.test(e)||t.txtInvalidName+'*+:"<>?|/'}});var e=this.getChild();e.find(".btn").on("click",_.bind(this.onBtnClick,this)),t.inputNameEl=e.find("input")},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this,e=t.options.filename.lastIndexOf(".");e>0&&(t.options.filename=t.options.filename.substring(0,e)),_.delay(function(){t.inputName.setValue(t.options.filename),t.inputNameEl.focus().select()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputName.checkValidate())return void this.inputNameEl.focus();this.options.handler.call(this,t,this.inputName.getValue())}this.close()},textName:"File name",cancelButtonText:"Cancel",okButtonText:"Ok",txtInvalidName:"The file name cannot contain any of the following characters: "},Common.Views.RenameDialog||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Header",["backbone","text!common/main/lib/template/Header.template","core","common/main/lib/view/RenameDialog"],function(t,e){"use strict";Common.Views.Header=t.View.extend(_.extend(function(){function t(t,e){var i=t.getEditingCount();m&&(i>1||i>0&&p&&!p.isEdit&&!p.isRestrictedEdit?(m.html(v({users:t.chain().filter(function(t){return t.get("online")&&!t.get("view")}).groupBy(function(t){return t.get("idOriginal")}).value(),usertpl:_.template(C),fnEncode:Common.Utils.String.htmlEncode})),m.scroller=new Common.UI.Scroller({el:m.find("ul"),useKeyboard:!0,minScrollbarLength:40,alwaysVisibleY:!0}),m.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})):m.empty()),n(i,t.getEditingOriginalCount())}function i(e){t(e.collection)}function n(t,e){if(g){var i=t>1||t>0&&p&&!p.isEdit&&!p.isRestrictedEdit;i?(g.attr("data-toggle","dropdown").addClass("dropdown-toggle").menu=!0,u.show()):(g.removeAttr("data-toggle").removeClass("dropdown-toggle").menu=!1,u[!f&&p&&!p.isReviewOnly&&p.sharingSettingsUrl&&p.sharingSettingsUrl.length?"show":"hide"]()),g.find(".caption").css({"font-size":i?"12px":"14px","margin-top":i?"0":"-1px"}).html(i?e:"+");var n=g.data("bs.tooltip");n&&(n.options.title=i?n.options.titleExt:n.options.titleNorm,n.setContent())}}function o(){f=!0,u.find("#tlb-change-rights").hide(),g&&!g.menu&&u.hide()}function s(t){if(g.menu){var e=g.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.hide())}else u.removeClass("open"),this.fireEvent("click:users",this)}function a(t){}function l(e){p=e;var i=this;i.btnGoBack.on("click",function(t){Common.NotificationCenter.trigger("goback")}),i.logo&&i.logo.children(0).on("click",function(t){var e=i.branding&&i.branding.logo&&void 0!==i.branding.logo.url?i.branding.logo.url:"https://www.onlyoffice.com/";if(e){var n=window.open(e);n&&n.focus()}}),t(d),u.on("shown.bs.dropdown",function(){m.scroller&&m.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}),u.find(".cousers-menu").on("click",function(t){return!1});var n=d.getEditingCount();g.tooltip({title:n>1||n>0&&!p.isEdit&&!p.isRestrictedEdit?i.tipViewUsers:i.tipAccessRights,titleNorm:i.tipAccessRights,titleExt:i.tipViewUsers,placement:"bottom",html:!0}),g.on("click",s.bind(i));var o=u.find("#tlb-change-rights");o.on("click",function(t){u.removeClass("open"),i.fireEvent("click:users",i)}),o[!e.isOffline&&!e.isReviewOnly&&e.sharingSettingsUrl&&e.sharingSettingsUrl.length?"show":"hide"](),u[n>1||n>0&&!p.isEdit&&!p.isRestrictedEdit||!e.isOffline&&!e.isReviewOnly&&e.sharingSettingsUrl&&e.sharingSettingsUrl.length?"show":"hide"](),b&&(b.attr("data-width",i.textSaveExpander),p.canUseHistory||b.addClass("locked")),i.btnPrint&&(i.btnPrint.updateHint(i.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),i.btnPrint.on("click",function(t){i.fireEvent("print",i)})),i.btnSave&&(i.btnSave.updateHint(i.tipSave+Common.Utils.String.platformKey("Ctrl+S")),i.btnSave.on("click",function(t){i.fireEvent("save",i)})),i.btnUndo&&(i.btnUndo.updateHint(i.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),i.btnUndo.on("click",function(t){i.fireEvent("undo",i)})),i.btnRedo&&(i.btnRedo.updateHint(i.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),i.btnRedo.on("click",function(t){i.fireEvent("redo",i)})),e.isEdit||(i.btnDownload&&(i.btnDownload.updateHint(i.tipDownload),i.btnDownload.on("click",function(t){i.fireEvent("downloadas",["original"])})),i.btnEdit&&(i.btnEdit.updateHint(i.tipGoEdit),i.btnEdit.on("click",function(t){i.fireEvent("go:editor",i)}))),i.btnOptions&&i.btnOptions.updateHint(i.tipViewSettings)}function r(t){var e=this;t.canUndock&&(e.btnUndock=new Common.UI.Button({cls:"btn-header no-caret",iconCls:"svgicon svg-btn-undock",hint:e.tipUndock,split:!0}),e.btnUndock.on("click",function(t){Common.NotificationCenter.trigger("action:undocking","undock")}),e.btnUndock.render($("#toolbar .box-tabs #slot-btn-undock")))}function c(t){var e=this,i=e.labelDocName.val();t.keyCode==Common.UI.Keys.RETURN?(i=i.trim(),_.isEmpty(i)||e.documentCaption===i||(/[\t*\+:\"<>?|\\\\/]/gim.test(i)?_.defer(function(){Common.UI.error({msg:(new Common.Views.RenameDialog).txtInvalidName+'*+:"<>?|/',callback:function(){_.delay(function(){e.labelDocName.focus()},50)}}),e.labelDocName.blur()}):(Common.Gateway.requestRename(i),Common.NotificationCenter.trigger("edit:complete",e)))):t.keyCode==Common.UI.Keys.ESC?(e.labelDocName.val(e.documentCaption),Common.NotificationCenter.trigger("edit:complete",this)):e.labelDocName.attr("size",i.length>10?i.length:10)}function h(t){var e=this;e.btnUndock&&("undocked"==t.status?e.btnUndock.hide():e.btnUndock.show())}var d,p,m,u,g,b,f=!1,C='<li id="<%= user.get("iid") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>"><div class="user-name"><div class="color" style="background-color: <%= user.get("color") %>;"></div><label><%= fnEncode(user.get("username")) %></label><% if (len>1) { %><label style="margin-left:3px;">(<%=len%>)</label><% } %></div></li>',v=_.template("<ul><% for (originalId in users) { %><%= usertpl({user: users[originalId][0], fnEncode: fnEncode, len: users[originalId].length}) %><% } %></ul>");return{options:{branding:{},documentCaption:"",canBack:!1},el:"#header",template:_.template(e),events:{},initialize:function(e){var n=this;this.options=this.options?_.extend(this.options,e):e,this.documentCaption=this.options.documentCaption,this.branding=this.options.customization,this.isModified=!1,n.btnGoBack=new Common.UI.Button({id:"btn-goback",cls:"btn-header",iconCls:"svgicon svg-btn-goback",split:!0}),d=this.options.storeUsers,d.bind({add:i,change:i,reset:t}),n.btnOptions=new Common.UI.Button({cls:"btn-header no-caret",iconCls:"svgicon svg-btn-options",menu:!0}),n.mnuZoom={options:{value:100}},Common.NotificationCenter.on({"app:ready":function(t){Common.Utils.asyncCall(l,n,t)},"app:face":function(t){Common.Utils.asyncCall(a,n,t)},"app:config":function(t){Common.Utils.asyncCall(r,n,t)},"undock:status":h.bind(this)}),Common.NotificationCenter.on("collaboration:sharingdeny",o)},render:function(t,e){return $(t).html(this.getPanel(e)),this},getPanel:function(t,e){function i(t,e,i){return new Common.UI.Button({cls:"btn-header",iconCls:"svgicon "+t,disabled:!0===i}).render(e)}var n=this;if(!("left"!=t||e&&e.isDesktopApp))return o=$('<section class="logo"><div id="header-logo"><i /></div></section>'),this.logo=o.find("#header-logo"),this.branding&&this.branding.logo&&this.branding.logo.image&&this.logo&&(this.logo.html('<img src="'+this.branding.logo.image+'" style="max-width:100px; max-height:20px; margin: 0;"/>'),this.logo.css({"background-image":"none",width:"auto"}),(this.branding.logo.url||void 0===this.branding.logo.url)&&this.logo.addClass("link")),o;if("right"==t){var o=$(_.template('<section><section id="box-doc-name"><input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;"></section><a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a><div class="hedset"><div class="btn-slot" id="slot-hbtn-edit"></div><div class="btn-slot" id="slot-hbtn-print"></div><div class="btn-slot" id="slot-hbtn-download"></div></div><div class="hedset"><section id="tlb-box-users" class="box-cousers dropdown""><div class="btn-users"><svg class="icon"><use xlink:href="#svg-btn-users"></use></svg><label class="caption">+</label></div><div class="cousers-menu dropdown-menu"><label id="tlb-users-menu-descr"><%= tipUsers %></label><div class="cousers-list"></div><label id="tlb-change-rights" class="link"><%= txtAccessRights %></label></div></section></div><div class="hedset"><div class="btn-slot" id="slot-btn-undock"></div><div class="btn-slot" id="slot-btn-back"></div><div class="btn-slot" id="slot-btn-options"></div></div></section>')({tipUsers:this.labelCoUsersDescr,txtAccessRights:this.txtAccessRights,textSaveEnd:this.textSaveEnd}));return n.labelDocName||(n.labelDocName=o.find("#rib-doc-name"),n.labelDocName.text=function(t){this.val(t).attr("size",t.length)},n.documentCaption&&n.labelDocName.text(n.documentCaption)),_.isUndefined(this.options.canRename)||this.setCanRename(this.options.canRename),o.find("#rib-save-status").hide(),!0===this.options.canBack?n.btnGoBack.render(o.find("#slot-btn-back")):o.find("#slot-btn-back").hide(),e.isEdit||(!e.canDownload&&!e.canDownloadOrigin||e.isOffline||(this.btnDownload=i("svg-btn-download",o.find("#slot-hbtn-download"))),e.canPrint&&(this.btnPrint=i("svg-btn-print",o.find("#slot-hbtn-print"))),e.canEdit&&e.canRequestEditRights&&(this.btnEdit=i("svg-btn-edit",o.find("#slot-hbtn-edit")))),n.btnOptions.render(o.find("#slot-btn-options")),m=o.find(".cousers-list"),u=o.find(".box-cousers"),g=o.find(".btn-users"),u.hide(),o}if("title"==t){var o=$(_.template('<section id="box-document-title"><div class="extra"></div><div class="hedset"><div class="btn-slot" id="slot-btn-dt-save"></div><div class="btn-slot" id="slot-btn-dt-print"></div><div class="btn-slot" id="slot-btn-dt-undo"></div><div class="btn-slot" id="slot-btn-dt-redo"></div></div><div class="lr-separator"></div><input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;"><label id="title-user-name" style="pointer-events: none;"></label></section>')());if(!!n.labelDocName&&n.labelDocName.hide().off(),n.labelDocName=o.find("> #title-doc-name"),n.labelDocName.text=function(t){this.val(t)},n.labelDocName.text(n.documentCaption),n.labelUserName=$("> #title-user-name",o),n.setUserName(n.options.userName),e.canPrint&&e.isEdit&&(n.btnPrint=i("svg-btn-print",$("#slot-btn-dt-print",o),!0)),n.btnSave=i("svg-btn-save",$("#slot-btn-dt-save",o),!0),n.btnUndo=i("svg-btn-undo",$("#slot-btn-dt-undo",o),!0),n.btnRedo=i("svg-btn-redo",$("#slot-btn-dt-redo",o),!0),n.btnSave.$icon.is("svg")){n.btnSave.$icon.addClass("icon-save");var s=function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","use");return i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),i.setAttribute("id",e),$(i)};s("#svg-btn-save-coauth","coauth").appendTo(n.btnSave.$icon),s("#svg-btn-save-sync","sync").appendTo(n.btnSave.$icon)}return o}},setVisible:function(t){},setBranding:function(t){var e;this.branding=t,t&&t.logo&&t.logo.image&&(e=$("#header-logo"))&&(e.html('<img src="'+t.logo.image+'" style="max-width:100px; max-height:20px; margin: 0;"/>'),e.css({"background-image":"none",width:"auto"}),(t.logo.url||void 0===t.logo.url)&&e.addClass("link"))},setDocumentCaption:function(t){return!t&&(t=""),this.documentCaption=t,this.isModified&&(t+="*"),this.labelDocName&&(this.labelDocName.text(t),this.setCanRename(!0)),t},getDocumentCaption:function(){return this.documentCaption},setDocumentChanged:function(t){this.isModified=t;var e=this.documentCaption;t&&(e+="*"),this.labelDocName.text(e)},setCanBack:function(t,e){return this.options.canBack=t,this.btnGoBack[t?"show":"hide"](),t&&this.btnGoBack.updateHint(e&&"string"==typeof e?e:this.textBack),this},getCanBack:function(){return this.options.canBack},setCanRename:function(t){t=!1;var e=this;if(e.options.canRename=t,e.labelDocName){var i=e.labelDocName;if(t)i.removeAttr("disabled").tooltip({title:e.txtRename,placement:"cursor"}),i.on({keydown:c.bind(this),blur:function(t){}});else{i.off(),i.attr("disabled",!0);var n=i.data("bs.tooltip");n&&(n.options.title="",n.setContent())}i.attr("data-can-copy",t)}},setSaveStatus:function(t){if(b){b.is(":hidden")&&b.show();var e;switch(t){case"begin":e=this.textSaveBegin;break;case"changed":e=this.textSaveChanged;break;default:e=this.textSaveEnd}b.text(e)}},setUserName:function(t){return this.labelUserName?t?this.labelUserName.text(t).show():this.labelUserName.hide():this.options.userName=t,this},getButton:function(t){if("save"==t)return this.btnSave},lockHeaderBtns:function(t,e){var i=this;if("users"==t)e?g.addClass("disabled").attr("disabled","disabled"):g.removeClass("disabled").attr("disabled","");else{var n=function(t){t&&(e?(t.keepState={disabled:t.isDisabled()},t.setDisabled(!0)):(t.setDisabled(t.keepState&&t.keepState.disabled||e),delete t.keepState))};switch(t){case"undo":n(i.btnUndo);break;case"redo":n(i.btnRedo);break;case"opts":n(i.btnOptions)}}},fakeMenuItem:function(){return{conf:{checked:!1},setChecked:function(t){this.conf.checked=t},isChecked:function(){return this.conf.checked}}},textBack:"Go to Documents",txtRename:"Rename",textSaveBegin:"Saving...",textSaveEnd:"All changes saved",textSaveChanged:"Modified",textSaveExpander:"All changes saved",txtAccessRights:"Change access rights",tipAccessRights:"Manage document access rights",labelCoUsersDescr:"Document is currently being edited by several users.",tipViewUsers:"View users and manage document access rights",tipDownload:"Download file",tipPrint:"Print file",tipGoEdit:"Edit current file",tipSave:"Save",tipUndo:"Undo",tipRedo:"Redo",tipUndock:"Undock",textCompactView:"Hide Toolbar",textHideStatusBar:"Hide Status Bar",textHideLines:"Hide Rulers",textZoom:"Zoom",textAdvSettings:"Advanced Settings",tipViewSettings:"View Settings"}}(),Common.Views.Header||{}))}),define("text!spreadsheeteditor/main/app/template/Viewport.template",[],function(){return'<div class="layout-region">\n <div id="viewport-vbox-layout" class="layout-ct vbox">\n <section class="layout-ct">\n <div id="file-menu-panel" class="toolbar-fullview-panel" style="display:none;"></div>\n </section>\n <section id="app-title" class="layout-item"></section>\n <div id="toolbar" class="layout-item"></div>\n <div class="layout-item">\n <div id="viewport-hbox-layout" class="layout-ct hbox">\n <div id="left-menu" class="layout-item" style="width: 40px;"></div>\n <div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>\n <div class="layout-item">\n <div class="layout-ct vbox">\n <div id="cell-editing-box" class="layout-item" style="height:18px;"></div>\n <div id="editor_sdk" class="layout-item" style="min-height: 100px;"></div>\n </div>\n </div>\n <div id="right-menu" class="layout-item"></div>\n </div>\n </div>\n <div id="statusbar" class="layout-item"></div>\n </div>\n</div>\n'}),void 0===Common)var Common={};if(define("common/main/lib/component/Layout",["backbone"],function(){"use strict";var t=function(t){this.box=null,this.panels=[],this.splitters=[],_.extend(this,t||{})},e=function(){return{width:null,height:null,resize:!1,stretch:!1,rely:!1}};_.extend(t.prototype,Backbone.Events,{initialize:function(t){this.$parent=this.box.parent(),this.resize={eventMove:_.bind(this.resizeMove,this),eventStop:_.bind(this.resizeStop,this)};this.freeze=t.freeze,this.changeLayout(t.items)},doLayout:function(){},changeLayout:function(t){var i,n,o=!1;this.splitters&&this.splitters.forEach(function(t){t.resizer&&t.resizer.el.remove()},this),this.splitters=[],this.panels=[],t.forEach(function(t){t.el instanceof HTMLElement&&(t.el=$(t.el)),i=_.extend(new e,t),i.stretch&&(o=!0,i.rely=!1,i.resize=!1),this.panels.push(i),i.resize&&(n={isresizer:!0,minpos:i.resize.min||0,maxpos:i.resize.max||0,fmin:i.resize.fmin,fmax:i.resize.fmax,behaviour:i.behaviour,index:this.splitters.length,offset:i.resize.offset||0},
|
|
|
o?(i.resize.el=n.el=i.el.before('<div class="layout-resizer before"></div>').prev(),this.panels.splice(this.panels.length-1,0,n)):(i.resize.el=n.el=i.el.after('<div class="layout-resizer after"></div>').next(),this.panels.push(n)),this.splitters.push({resizer:n}),i.resize.hidden&&n.el.hide(),Common.Gateway.on("processmouse",this.resize.eventStop))},this),this.freezePanels(this.freeze)},getElementHeight:function(t){return parseInt(t.css("height"))},getElementWidth:function(t){return parseInt(t.css("width"))},getItem:function(t){for(var e in this.panels){var i=this.panels[e];if(i.alias==t)return i}},onSelectStart:function(t){return t.preventDefault&&t.preventDefault(),!1},addHandler:function(t,e,i){t.addEventListener?t.addEventListener(e,i):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i},removeHandler:function(t,e,i){t.removeEventListener?t.removeEventListener(e,i):t.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null},clearSelection:function(){if(window.getSelection){var t=window.getSelection();t.empty?t.empty():t.removeAllRanges&&t.removeAllRanges()}else document.selection&&document.selection.empty()},resizeStart:function(t){if(!this.freeze){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 e=t.data.panel;this.resize.type=t.data.type,this.resize.$el=e.el,this.resize.min=e.minpos,this.resize.fmin=e.fmin,this.resize.fmax=e.fmax,this.resize.behaviour=e.behaviour,this.resize.$el.addClass("move"),"vertical"==t.data.type?(this.resize.height=parseInt(this.resize.$el.css("height")),this.resize.max=(e.maxpos>0?e.maxpos:this.resize.$el.parent().height()+e.maxpos)-this.resize.height,this.resize.inity=t.pageY*Common.Utils.zoom()-parseInt(t.currentTarget.style.top)):"horizontal"==t.data.type&&(this.resize.width=parseInt(this.resize.$el.css("width")),this.resize.max=(e.maxpos>0?e.maxpos:this.resize.$el.parent().height()+e.maxpos)-this.resize.width,this.resize.initx=t.pageX*Common.Utils.zoom()-parseInt(t.currentTarget.style.left)),Common.NotificationCenter.trigger("layout:resizestart")}},resizeMove:function(t){var e=t instanceof jQuery.Event?Common.Utils.zoom():1;if("vertical"==this.resize.type)var i="top",n=t.pageY*e-this.resize.inity;else"horizontal"==this.resize.type&&(i="left",n=t.pageX*e-this.resize.initx);this.resize.fmin&&this.resize.fmax?n<this.resize.fmin()||n>this.resize.fmax()||(this.resize.$el[0].style[i]=n+"px"):n<this.resize.min||n>this.resize.max||(this.resize.$el[0].style[i]=n+"px")},resizeStop:function(t){if(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}),this.resize.$el){var e=t instanceof jQuery.Event?Common.Utils.zoom():1;if(t instanceof jQuery.Event||void 0!==t.pageY&&void 0!==t.pageX||(t.pageY=t.y,t.pageX=t.x),"vertical"==this.resize.type)var i="height",n=t.pageY*e-this.resize.inity;else"horizontal"==this.resize.type&&(i="width",n=t.pageX*e-this.resize.initx);this.resize.fmin&&this.resize.fmax?(n<this.resize.fmin()&&(n=this.resize.fmin()),n>this.resize.fmax()&&(n=this.resize.fmax())):(n<this.resize.min&&(n=this.resize.min),n>this.resize.max&&(n=this.resize.max));var o=null,s=null,a=0;this.resize.$el.hasClass("after")?(o=this.resize.$el.prev(),s=this.resize.$el.next(),a=parseInt(o.css(i))):(o=this.resize.$el.next(),s=this.resize.$el.next(),a=parseInt(o.css(i)),n=o.parent()[i]()-(n+this.resize[i])),"vertical"==this.resize.type&&(n-=o.position().top),"horizontal"==this.resize.type&&(n-=o.position().left),o.css(i,n+"px"),this.resize.behaviour&&s.css(i,parseInt(s.css(i))-(n-a)),this.resize.$el.removeClass("move"),delete this.resize.$el,this.resize.value!=n&&(this.doLayout(),this.trigger("layout:resizedrag",this)),Common.NotificationCenter.trigger("layout:resizestop")}},freezePanels:function(t){this.panels.forEach(function(e){!e.stretch&&e.resize&&$(e.resize.el).css("cursor",t?"default":"")}),this.freeze=t},setResizeValue:function(t,e){if(t>=this.splitters.length)return this.doLayout(),!1;var i=null,n=null,o=0,s=this.splitters[t].resizer,a="height";return e<s.fmin()&&(e=s.fmin()),e>s.fmax()&&(e=s.fmax()),s.el.hasClass("after")?(i=s.el.prev(),n=s.el.next(),o=parseInt(i.css(a))):(i=s.el.next(),e=i.parent()[a]()-(e+s[a]),n=s.el.next(),o=parseInt(i.css(a))),e-=i.position().top,i.css(a,e+"px"),s.behaviour&&n.css(a,parseInt(n.css(a))-(e-o)),s.value!=e&&this.doLayout(),Math.abs(o-e)>.99}}),!Common.UI&&(Common.UI={}),Common.UI.VBoxLayout=function(e){t.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.VBoxLayout.prototype=_.extend(new t,{initialize:function(e){t.prototype.initialize.call(this,e)},doLayout:function(){var t,e,i=0;this.panels.forEach(function(n){n.stretch?t=n:(e=n.el.is(":visible"),e&&(i+=!0!==n.rely?n.height:this.getElementHeight(n.el)),n.resize&&!1!==n.resize.autohide&&n.resize.el&&(e?(n.resize.el.show(),t&&(i+=n.resize.height)):(n.resize.el.hide(),t&&(i-=n.resize.height))))},this),t&&(t.height=this.$parent.height()-i),i=0,this.panels.forEach(function(t){t.el.is(":visible")&&(e={top:i},!0!==t.rely&&(e.height=t.height),t.el.css(e),i+=e.height||this.getElementHeight(t.el))},this)},changeLayout:function(e){t.prototype.changeLayout.call(this,e),this.panels.forEach(function(t){!t.stretch&&!t.height&&(t.height=this.getElementHeight(t.el)),t.isresizer&&t.el.on("mousedown",{type:"vertical",panel:t},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)}}),Common.UI.HBoxLayout=function(e){t.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.HBoxLayout.prototype=_.extend(new t,{initialize:function(e){t.prototype.initialize.call(this,e)},doLayout:function(t){var e,i,n=0;this.panels.forEach(function(t){t.stretch?e=t:(i=t.el.is(":visible"),i&&(t.isresizer?n+=t.offset:n+=!0!==t.rely?t.width:this.getElementWidth(t.el)),t.resize&&!1!==t.resize.autohide&&t.resize.el&&(i?(t.resize.el.show(),e&&(n-=t.resize.width)):(t.resize.el.hide(),e&&(n-=t.resize.width))))},this),e&&(e.width=this.$parent.width()-n),n=0,this.panels.forEach(function(t){t.el.is(":visible")&&(i={left:n-(t.isresizer?t.width:0)},!0!==t.rely&&(i.width=t.width),t.el.css(i),t.isresizer?n+=t.offset:n+=this.getElementWidth(t.el))},this)},changeLayout:function(e){t.prototype.changeLayout.call(this,e),this.panels.forEach(function(t){!t.stretch&&!t.width&&(t.width=this.getElementWidth(t.el)),t.isresizer&&t.el.on("mousedown",{type:"horizontal",panel:t},_.bind(this.resizeStart,this))},this),this.doLayout.call(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(t,e,i,n){"use strict";SSE.Views.Viewport=n.View.extend({el:"#viewport",template:i.template(t),events:{},initialize:function(){},render:function(){var t=e(this.el);t.html(this.template({})),Common.Utils.isSafari?(e("body").addClass("safari"),e("body").mousewheel(function(t){t.preventDefault(),t.stopPropagation()})):Common.Utils.isChrome&&e("body").addClass("chrome");var i=e("#viewport-vbox-layout",t),n=i.find(" > .layout-item");return this.vlayout=new Common.UI.VBoxLayout({box:i,items:[{el:i.find("> .layout-item#app-title").hide(),alias:"title",height:Common.Utils.InternalSettings.get("document-title-height")},{el:n[1],alias:"toolbar",height:Common.localStorage.getBool("sse-compact-toolbar")?Common.Utils.InternalSettings.get("toolbar-height-compact"):Common.Utils.InternalSettings.get("toolbar-height-normal")},{el:n[2],stretch:!0},{el:n[3],height:25}]}),i=e("#viewport-hbox-layout",t),n=i.find(" > .layout-item"),this.hlayout=new Common.UI.HBoxLayout({box:i,items:[{el:n[0],rely:!0,resize:{hidden:!0,autohide:!1,min:300,max:600,offset:4}},{el:n[1],stretch:!0},{el:e(n[2]).hide(),rely:!0}]}),i=i.find(".layout-ct.vbox"),n=i.find(" > .layout-item"),this.celayout=new Common.UI.VBoxLayout({box:i,items:[{el:n[0],rely:!0,resize:{min:19,max:-100}},{el:n[1],stretch:!0}]}),this},applyEditorMode:function(){var t=this,e=SSE.getController("RightMenu").getView("RightMenu");t._rightMenu=e.render(this.mode)},setMode:function(t,e){t.isDisconnected?(i.isUndefined(this.mode)&&(this.mode={}),this.mode.canCoAuthoring=!1):(this.mode=t,this.vlayout&&t.isDesktopApp&&!t.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(t){"use strict";SSE.Controllers.Viewport=Backbone.Controller.extend(_.assign({models:[],collections:[],views:["Viewport","Common.Views.Header"],initialize:function(){var t=this;this.addListeners({FileMenu:{"menu:hide":t.onFileMenu.bind(t,"hide"),"menu:show":t.onFileMenu.bind(t,"show")},Statusbar:{"sheet:changed":t.onApiSheetChanged.bind(t)},Toolbar:{"render:before":function(e){var i=SSE.getController("Main").appOptions;e.setExtra("right",t.header.getPanel("right",i)),(!i.isEdit||i.customization&&i.customization.compactHeader)&&e.setExtra("left",t.header.getPanel("left",i)),!t.appConfig||!t.appConfig.isEdit||i.customization&&i.customization.compactHeader||!e.btnCollabChanges||(e.btnCollabChanges=t.header.btnSave)},"view:compact":function(e,i){t.header.mnuitemCompactToolbar.setChecked(i,!0),t.viewport.vlayout.getItem("toolbar").height=i?Common.Utils.InternalSettings.get("toolbar-height-compact"):Common.Utils.InternalSettings.get("toolbar-height-normal")},"undo:disabled":function(e){t.header.btnUndo&&(t.header.btnUndo.keepState?t.header.btnUndo.keepState.disabled=e:t.header.btnUndo.setDisabled(e))},"redo:disabled":function(e){t.header.btnRedo&&(t.header.btnRedo.keepState?t.header.btnRedo.keepState.disabled=e:t.header.btnRedo.setDisabled(e))},"print:disabled":function(e){t.header.btnPrint&&t.header.btnPrint.setDisabled(e)},"save:disabled":function(e){t.header.btnSave&&t.header.btnSave.setDisabled(e)}}}),Common.NotificationCenter.on("app:face",this.onAppShowed.bind(this)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("cells:range",this.onCellsRange.bind(this))},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onZoomChanged",this.onApiZoomChange.bind(this)),this.api.asc_registerCallback("asc_onSheetsChanged",this.onApiSheetChanged.bind(this)),this.api.asc_registerCallback("asc_onUpdateSheetViewSettings",this.onApiSheetChanged.bind(this)),this.api.asc_registerCallback("asc_onEditCell",this.onApiEditCell.bind(this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",this.onApiCoAuthoringDisconnect.bind(this)),Common.NotificationCenter.on("api:disconnect",this.onApiCoAuthoringDisconnect.bind(this))},onAppShowed:function(t){var e=this;e.appConfig=t;var i=Common.Utils.InternalSettings,n=$(".toolbar-fullview-panel");if(n.css("top",i.get("toolbar-height-tabs")),e.viewport.$el.attr("applang",e.appConfig.lang.split(/[\-_]/)[0]),!t.isEdit||!Common.localStorage.itemExists("sse-compact-toolbar")&&t.customization&&t.customization.compactToolbar?e.viewport.vlayout.getItem("toolbar").height=i.get("toolbar-height-compact"):(t.isEditDiagram||t.isEditMailMerge)&&(e.viewport.vlayout.getItem("toolbar").height=41),t.isEdit&&!t.isEditDiagram&&!t.isEditMailMerge&&(!t.customization||!t.customization.compactHeader)){var o=e.viewport.vlayout.getItem("title").el;o.html(e.header.getPanel("title",t)).show(),o.find(".extra").html(e.header.getPanel("left",t));var s=e.viewport.vlayout.getItem("toolbar");s.el.addClass("top-title"),s.height-=i.get("toolbar-height-tabs")-i.get("toolbar-height-tabs-top-title");var a=i.get("toolbar-height-tabs-top-title");i.set("toolbar-height-tabs",a),i.set("toolbar-height-compact",a),i.set("toolbar-height-normal",a+i.get("toolbar-height-controls")),n.css("top",a+i.get("document-title-height"))}t.customization&&(t.customization.toolbarNoTabs&&e.viewport.vlayout.getItem("toolbar").el.addClass("style-off-tabs"),t.customization.toolbarHideFileName&&e.viewport.vlayout.getItem("toolbar").el.addClass("style-skip-docname"))},onAppReady:function(t){var e=this;if(e.header.btnOptions){var i=!t.isEdit;!t.isEdit||t.isEditDiagram||t.isEditMailMerge||(Common.localStorage.itemExists("sse-compact-toolbar")?i=Common.localStorage.getBool("sse-compact-toolbar"):t.customization&&t.customization.compactToolbar&&(i=!0)),e.header.mnuitemCompactToolbar=new Common.UI.MenuItem({caption:e.header.textCompactView,checked:i,checkable:!0,value:"toolbar"}),t.isEdit||t.isEditDiagram||t.isEditMailMerge||(e.header.mnuitemCompactToolbar.hide(),Common.NotificationCenter.on("tab:visible",_.bind(function(t,i){"plugins"==t&&i&&e.header.mnuitemCompactToolbar.show()},this)));var n=new Common.UI.MenuItem({caption:e.textHideFBar,checked:Common.localStorage.getBool("sse-hidden-formula"),checkable:!0,value:"formula"});e.header.mnuitemHideHeadings=new Common.UI.MenuItem({caption:e.textHideHeadings,checkable:!0,checked:e.header.mnuitemHideHeadings.isChecked(),value:"headings"}),e.header.mnuitemHideGridlines=new Common.UI.MenuItem({caption:e.textHideGridlines,checkable:!0,checked:e.header.mnuitemHideGridlines.isChecked(),value:"gridlines"}),e.header.mnuitemFreezePanes=new Common.UI.MenuItem({caption:e.textFreezePanes,checkable:!0,checked:e.header.mnuitemFreezePanes.isChecked(),value:"freezepanes"}),e.header.mnuZoom=new Common.UI.MenuItem({template:_.template(['<div id="hdr-menu-zoom" class="menu-zoom" style="height: 25px;" ',"<% if(!_.isUndefined(options.stopPropagation)) { %>",'data-stopPropagation="true"',"<% } %>",">",'<label class="title">'+e.header.textZoom+"</label>",'<button id="hdr-menu-zoom-in" type="button" style="float:right; margin: 2px 5px 0 0;" class="btn small btn-toolbar"><i class="icon btn-zoomin"> </i></button>','<label class="zoom"><%= options.value %>%</label>','<button id="hdr-menu-zoom-out" type="button" style="float:right; margin-top: 2px;" class="btn small btn-toolbar"><i class="icon btn-zoomout"> </i></button>',"</div>"].join("")),stopPropagation:!0,value:e.header.mnuZoom.options.value});var o=new Common.UI.MenuItem({caption:e.header.textAdvSettings,value:"advanced"});if(e.header.btnOptions.setMenu(new Common.UI.Menu({cls:"pull-right",style:"min-width: 180px;",items:[e.header.mnuitemCompactToolbar,n,{caption:"--"},e.header.mnuitemHideHeadings,e.header.mnuitemHideGridlines,{caption:"--"},e.header.mnuitemFreezePanes,{caption:"--"},e.header.mnuZoom,{caption:"--"},o]})),!t.isEdit){var s=e.header.btnOptions.menu;e.header.mnuitemHideHeadings.hide(),e.header.mnuitemHideGridlines.hide(),e.header.mnuitemFreezePanes.hide(),s.items[5].hide(),s.items[7].hide(),t.canViewComments}var a=function(t){if("up"==t){var i=Math.floor(10*this.api.asc_getZoom())/10;i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i)}else i=Math.ceil(10*this.api.asc_getZoom())/10,(i-=.1)<.5||this.api.asc_setZoom(i);Common.NotificationCenter.trigger("edit:complete",e.header)};new Common.UI.Button({el:$("#hdr-menu-zoom-out",e.header.mnuZoom.$el),cls:"btn-toolbar"}).on("click",a.bind(e,"down")),new Common.UI.Button({el:$("#hdr-menu-zoom-in",e.header.mnuZoom.$el),cls:"btn-toolbar"}).on("click",a.bind(e,"up")),e.header.btnOptions.menu.on("item:click",e.onOptionsItemClick.bind(this))}},onLaunch:function(){this.viewport=this.createView("Viewport").render(),this.header=this.createView("Common.Views.Header",{headerCaption:"Spreadsheet Editor",storeUsers:SSE.getCollection("Common.Collections.Users")}),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 t=$("#left-menu");this.viewport.hlayout.on("layout:resizedrag",function(){this.api.asc_Resize(),Common.localStorage.setItem("sse-mainmenu-width",t.width())},this),this.boxSdk=$("#editor_sdk"),this.boxFormula=$("#cell-editing-box"),this.boxSdk.css("border-left","none"),this.boxFormula.css("border-left","none"),this.header.mnuitemHideHeadings=this.header.fakeMenuItem(),this.header.mnuitemHideGridlines=this.header.fakeMenuItem(),this.header.mnuitemFreezePanes=this.header.fakeMenuItem()},onLayoutChanged:function(t){switch(t){default:this.viewport.vlayout.doLayout(),this.viewport.celayout.doLayout();case"rightmenu":this.viewport.hlayout.doLayout();break;case"leftmenu":var e=this.viewport.hlayout.items[0];e.resize.el&&(e.el.width()>40?(this.boxSdk.css("border-left",""),this.boxFormula.css("border-left",""),e.resize.el.show()):(e.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","hidden"==arguments[1]?"none":""),this.viewport.celayout.doLayout()}this.api.asc_Resize()},onWindowResize:function(t){this.onLayoutChanged("window"),Common.NotificationCenter.trigger("window:resize")},onFileMenu:function(t){var e=this,i="show"==t;e.header.lockHeaderBtns("undo",i),e.header.lockHeaderBtns("redo",i),e.header.lockHeaderBtns("opts",i),e.header.lockHeaderBtns("users",i)},onApiZoomChange:function(t,e){switch(e){case 1:case 2:case 0:default:this.header.mnuZoom.options.value=Math.floor(100*(t+.005)),$(".menu-zoom .zoom",this.header.mnuZoom.$el).html(Math.floor(100*(t+.005))+"%")}},onApiSheetChanged:function(){var t=this,e=t.viewport.mode;if(e&&!e.isEditDiagram&&!e.isEditMailMerge){var i=t.api.asc_getSheetViewSettings();t.header.mnuitemHideHeadings.setChecked(!i.asc_getShowRowColHeaders()),t.header.mnuitemHideGridlines.setChecked(!i.asc_getShowGridLines()),t.header.mnuitemFreezePanes.setChecked(i.asc_getIsFreezePane())}},onApiEditCell:function(t){t==Asc.c_oAscCellEditorState.editStart?this.header.lockHeaderBtns("opts",!0):t==Asc.c_oAscCellEditorState.editEnd&&this.header.lockHeaderBtns("opts",!1)},onCellsRange:function(t){this.onApiEditCell(t!=Asc.c_oAscSelectionDialogType.None?Asc.c_oAscCellEditorState.editStart:Asc.c_oAscCellEditorState.editEnd)},onOptionsItemClick:function(t,e,i){var n=this;switch(e.value){case"toolbar":n.header.fireEvent("toolbar:setcompact",[t,e.isChecked()]);break;case"formula":n.header.fireEvent("formulabar:hide",[e.isChecked()]);break;case"headings":n.api.asc_setDisplayHeadings(!e.isChecked());break;case"gridlines":n.api.asc_setDisplayGridlines(!e.isChecked());break;case"freezepanes":n.api.asc_freezePane();break;case"advanced":n.header.fireEvent("file:settings",n.header)}},onApiCoAuthoringDisconnect:function(t){this.header&&(this.header.btnDownload&&!t&&this.header.btnDownload.hide(),this.header.btnPrint&&!t&&this.header.btnPrint.hide(),this.header.btnEdit&&this.header.btnEdit.hide())},textHideFBar:"Hide Formula Bar",textHideHeadings:"Hide Headings",textHideGridlines:"Hide Gridlines",textFreezePanes:"Freeze Panes"},SSE.Controllers.Viewport))}),void 0===Common)var Common={};if(void 0===Common.Utils&&(Common.Utils={}),Common.Utils=_.extend(new function(){var t=navigator.userAgent.toLowerCase(),e=function(e){return e.test(t)},i="CSS1Compat"==document.compatMode,n=function(e,i){var n;return e&&(n=i.exec(t))?parseFloat(n[1]):0},o=document.documentMode,s=(e(/edge/),e(/opera/)),a=s&&e(/version\/10\.5/),l=!s&&(e(/msie/)||e(/trident/)||e(/edge/)),r=l&&(e(/msie 7/)&&8!=o&&9!=o&&10!=o||7==o),c=l&&(e(/msie 8/)&&7!=o&&9!=o&&10!=o||8==o),h=l&&(e(/msie 9/)&&7!=o&&8!=o&&10!=o||9==o),d=l&&(e(/msie 10/)&&7!=o&&8!=o&&9!=o||10==o),p=l&&(e(/trident\/7\.0/)&&7!=o&&8!=o&&9!=o&&10!=o||11==o),m=l&&e(/msie 6/),u=!l&&e(/\bchrome\b/),g=!l&&e(/webkit/),b=!l&&!u&&e(/safari/),f=b&&e(/applewebkit\/4/),C=b&&e(/version\/3/),v=b&&e(/version\/4/),_=b&&e(/version\/5\.0/),y=b&&e(/version\/5/),x=!g&&!l&&e(/gecko/),w=x&&e(/rv:1\.9/),S=x&&e(/rv:2\.0/),A=x&&e(/rv:5\./),k=x&&e(/rv:10\./),T=w&&e(/rv:1\.9\.0/),I=w&&e(/rv:1\.9\.1/),E=w&&e(/rv:1\.9\.2/),P=e(/windows|win32/),M=e(/macintosh|mac os x/),D=e(/linux/),F=n(!0,/\bchrome\/(\d+\.\d+)/),U=n(!0,/\bfirefox\/(\d+\.\d+)/),V=n(l,/msie (\d+\.\d+)/),R=n(s,/version\/(\d+\.\d+)/),B=n(b,/version\/(\d+\.\d+)/),L=n(g,/webkit\/(\d+\.\d+)/),N=/^https/i.test(window.location.protocol),O=/^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,H=/^(((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,z=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,G=/^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,j=/(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/gi,W=/(mailto:|\s[@]|\s[+])?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/gi,q=/(((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,})?)*)*\/?/gi,K=/((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/gi,Y={Paragraph:0,Table:1,Header:2,TextArt:3,Shape:4,Image:5,Slide:6,Chart:7,MailMerge:8,Signature:9,Pivot:10,Cell:11},X={DRM:0,CSV:1,TXT:2,Paste:3,Columns:4},J=/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),Z=this,Q=function(){if(Z.zoom=1,u&&!s&&!J&&document&&document.firstElementChild&&document.body)if(window.devicePixelRatio>.1){if(window.devicePixelRatio<1.99){var t=1;Z.zoom=window.devicePixelRatio/t}else{var t=2;Z.zoom=window.devicePixelRatio/t}document.firstElementChild.style.zoom=1/Z.zoom}else document.firstElementChild.style.zoom="normal";Z.innerWidth=window.innerWidth*Z.zoom,Z.innerHeight=window.innerHeight*Z.zoom};return Z.zoom=1,Z.innerWidth=window.innerWidth,Z.innerHeight=window.innerHeight,Q(),$(window).on("resize",Q),{userAgent:t,isStrict:i,isIEQuirks:l&&!i&&(m||r||c||h),isOpera:s,isOpera10_5:a,isWebKit:g,isChrome:u,isSafari:b,isSafari3:C,isSafari4:v,isSafari5:y,isSafari5_0:_,isSafari2:f,isIE:l,isIE6:m,isIE7:r,isIE7m:m||r,isIE7p:l&&!m,isIE8:c,isIE8m:m||r||c,isIE8p:l&&!(m||r),isIE9:h,isIE9m:m||r||c||h,isIE9p:l&&!(m||r||c),isIE10:d,isIE10m:m||r||c||h||d,isIE10p:l&&!(m||r||c||h),isIE11:p,isIE11m:m||r||c||h||d||p,isIE11p:l&&!(m||r||c||h||d),isGecko:x,isGecko3:w,isGecko4:S,isGecko5:A,isGecko10:k,isFF3_0:T,isFF3_5:I,isFF3_6:E,isFF4:4<=U&&U<5,isFF5:5<=U&&U<6,isFF10:10<=U&&U<11,isLinux:D,isWindows:P,isMac:M,chromeVersion:F,firefoxVersion:U,ieVersion:V,operaVersion:R,safariVersion:B,webKitVersion:L,isSecure:N,emailRe:O,ipRe:H,hostnameRe:z,localRe:G,emailStrongRe:j,emailAddStrongRe:W,ipStrongRe:q,hostnameStrongRe:K,documentSettingsType:Y,importTextType:X,zoom:function(){return Z.zoom},innerWidth:function(){return Z.innerWidth},innerHeight:function(){return Z.innerHeight}}},Common.Utils||{}),Common.Utils.ThemeColor=new function(){return{ThemeValues:[6,15,7,16,0,1,2,3,4,5],setColors:function(t,e){var i,n,o;if(e&&e.length>0){var s=[];for(i=0;i<e.length;i++)o=this.getHexColor(e[i].get_r(),e[i].get_g(),e[i].get_b()),s.push(o);this.standartcolors=s}var a=[];for(i=0;i<6;i++)for(n=0;n<10;n++){var l=i+6*n;o={color:this.getHexColor(t[l].get_r(),t[l].get_g(),t[l].get_b()),effectId:l,effectValue:this.ThemeValues[n]},a.push(o)}this.effectcolors=a},getEffectColors:function(){return this.effectcolors},getStandartColors:function(){return this.standartcolors},getHexColor:function(t,e,i){return t=t.toString(16),e=e.toString(16),i=i.toString(16),1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),t+e+i},getRgbColor:function(t){var e="object"==typeof t?t.color:t;e=e.replace(/#/,""),3==e.length&&(e=e.replace(/(.)/g,"$1$1")),e=parseInt(e,16);var i=new Asc.asc_CColor;return i.put_type("object"==typeof t&&void 0!==t.effectId?Asc.c_oAscColor.COLOR_TYPE_SCHEME:Asc.c_oAscColor.COLOR_TYPE_SRGB),i.put_r(e>>16),i.put_g((65280&e)>>8),i.put_b(255&e),i.put_a(255),void 0!==t.effectId&&i.put_value(t.effectId),i},colorValue2EffectId:function(t){if("object"==typeof t&&void 0!==t.effectValue&&this.effectcolors)for(var e=0;e<this.effectcolors.length;e++)if(this.effectcolors[e].effectValue===t.effectValue&&t.color.toUpperCase()===this.effectcolors[e].color.toUpperCase()){t.effectId=this.effectcolors[e].effectId;break}return t}}},Common.Utils.Metric=_.extend(new function(){var t=this;return t.c_MetricUnits={cm:0,pt:1,inch:2},t.currentMetric=t.c_MetricUnits.pt,t.metricName=["Cm","Pt","Inch"],t.defaultMetric=t.c_MetricUnits.cm,{c_MetricUnits:t.c_MetricUnits,txtCm:"cm",txtPt:"pt",txtInch:'"',setCurrentMetric:function(e){t.currentMetric=e},getCurrentMetric:function(){return t.currentMetric},getCurrentMetricName:function(){return this["txt"+t.metricName[t.currentMetric]]},getMetricName:function(e){return this["txt"+t.metricName[void 0!==e?e:0]]},setDefaultMetric:function(e){t.defaultMetric=e},getDefaultMetric:function(){return t.defaultMetric},fnRecalcToMM:function(e){if(null!==e&&void 0!==e)switch(t.currentMetric){case t.c_MetricUnits.cm:return 10*e;case t.c_MetricUnits.pt:return 25.4*e/72;case t.c_MetricUnits.inch:return 25.4*e}return e},fnRecalcFromMM:function(e){switch(t.currentMetric){case t.c_MetricUnits.cm:return parseFloat((e/10).toFixed(4));case t.c_MetricUnits.pt:return parseFloat((72*e/25.4).toFixed(3));case t.c_MetricUnits.inch:return parseFloat((e/25.4).toFixed(3))}return e}}},Common.Utils.Metric||{}),Common.Utils.RGBColor=function(t){var e,i,n;"#"==t.charAt(0)&&(t=t.substr(1,6)),t=t.replace(/ /g,""),t=t.toLowerCase();for(var o=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^hsb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(t){var e={},i=Math.round(t[1]),n=Math.round(255*t[2]/100),o=Math.round(255*t[3]/100);if(0==n)e.r=e.g=e.b=o;else{var s=o,a=(255-n)*o/255,l=i%60*(s-a)/60;360==i&&(i=0),i<60?(e.r=s,e.b=a,e.g=a+l):i<120?(e.g=s,e.b=a,e.r=s-l):i<180?(e.g=s,e.r=a,e.b=a+l):i<240?(e.b=s,e.r=a,e.g=s-l):i<300?(e.b=s,e.g=a,e.r=a+l):i<360?(e.r=s,e.g=a,e.b=s-l):(e.r=0,e.g=0,e.b=0)}return[Math.round(e.r),Math.round(e.g),Math.round(e.b)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],s=0;s<o.length;s++){var a=o[s].re,l=o[s].process,r=a.exec(t);if(r){var c=l(r);e=c[0],i=c[1],n=c[2]}}return e=e<0||isNaN(e)?0:e>255?255:e,i=i<0||isNaN(i)?0:i>255?255:i,n=n<0||isNaN(n)?0:n>255?255:n,{r:e,g:i,b:n,isEqual:function(t){return e==t.r&&i==t.g&&n==t.b},toRGB:function(){return"rgb("+e+", "+i+", "+n+")"},toRGBA:function(t){return void 0===t&&(t=1),"rgba("+e+", "+i+", "+n+", "+t+")"},toHex:function(){var t=e.toString(16),o=i.toString(16),s=n.toString(16);return 1==t.length&&(t="0"+t),1==o.length&&(o="0"+o),1==s.length&&(s="0"+s),"#"+t+o+s},toHSB:function(){var t={h:0,s:0,b:0},o=Math.min(e,i,n),s=Math.max(e,i,n),a=s-o;return t.b=s,t.s=0!=s?255*a/s:0,0!=t.s?t.h=e==s?0+(i-n)/a:i==s?2+(n-e)/a:4+(e-i)/a:t.h=0,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t.h=parseInt(t.h),t.s=parseInt(t.s),t.b=parseInt(t.b),t}}},Common.Utils.String=new function(){return{format:function(t){var e=_.toArray(arguments).slice(1);return e.length&&"object"==typeof e[0]&&(e=e[0]),t.replace(/\{(\d+)\}/g,function(t,i){return e[i]})},htmlEncode:function(t){return _.escape(t)},htmlDecode:function(t){return _.unescape(t)},ellipsis:function(t,e,i){if(t&&t.length>e){if(i){var n=t.substr(0,e-2),o=Math.max(n.lastIndexOf(" "),n.lastIndexOf("."),n.lastIndexOf("!"),n.lastIndexOf("?"));if(-1!==o&&o>=e-15)return n.substr(0,o)+"..."}return t.substr(0,e-3)+"..."}return t},platformKey:function(t,e,i){return _.isEmpty(e)&&(e=" ({0})"),Common.Utils.isMac?(_.isFunction(i)&&(t=i.call(this,t)),Common.Utils.String.format(e,t.replace(/\+(?=\S)/g,"").replace(/Ctrl|ctrl/g,"⌘").replace(/Alt|alt/g,"⌥").replace(/Shift|shift/g,"⇧"))):Common.Utils.String.format(e,t)}}},Common.Utils.isBrowserSupported=function(){return!(0!=Common.Utils.ieVersion&&Common.Utils.ieVersion<10||0!=Common.Utils.safariVersion&&Common.Utils.safariVersion<5||0!=Common.Utils.firefoxVersion&&Common.Utils.firefoxVersion<4||0!=Common.Utils.chromeVersion&&Common.Utils.chromeVersion<7||0!=Common.Utils.operaVersion&&Common.Utils.operaVersion<10.5)},Common.Utils.showBrowserRestriction=function(){if(!(document.getElementsByClassName&&document.getElementsByClassName("app-error-panel").length>0)){var t=window.DE?"Document":window.SSE?"Spreadsheet":window.PE?"Presentation":"that",e=document.createElement("div");e.innerHTML='<div class="app-error-panel"><div class="message-block"><div class="message-inner"><div class="title">Your browser is not supported.</div><div class="text">Sorry, '+t+' Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div></div></div><div class="message-auxiliary"></div></div>',document.body.appendChild(e),$("#loading-mask").hide().remove(),$("#viewport").hide().remove()}},Common.Utils.applyCustomization=function(t,e){for(var i in t){var n;if(e[i]&&(n=$(e[i]),n.length)){var o=t[i];!1===o||!1===o.visible?n.hide():(o.text&&n.text(o.text),!1===o.visible&&n.hide())}}},Common.Utils.applyCustomizationPlugins=function(plugins){if(plugins&&!(plugins.length<1)){var _createXMLHTTPObject=function(){var t;if("undefined"!=typeof XMLHttpRequest)t=new XMLHttpRequest;else try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t},_getPluginCode=function(url){if(!url)return"";try{var xhrObj=_createXMLHTTPObject();xhrObj&&url&&(xhrObj.open("GET",url,!1),xhrObj.send(""),200==xhrObj.status&&eval(xhrObj.responseText))}catch(t){}return null};plugins.forEach(function(t){t&&_getPluginCode(t)})}},Common.Utils.fillUserInfo=function(t,e,i){var n=t||{};return!n.id&&(n.id="uid-"+Date.now()),n.fullname=_.isEmpty(n.name)?i:n.name,n},Common.Utils.createXhr=function(){var t;if("undefined"!=typeof XMLHttpRequest)t=new XMLHttpRequest;else try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t},Common.Utils.getConfigJson=function(t){if(t)try{var e=Common.Utils.createXhr();if(e)return e.open("GET",t,!1),e.send(""),JSON.parse(e.responseText)}catch(t){}return null},Common.Utils.loadConfig=function(t,e){"use strict";fetch(t).then(function(t){return t.ok?t.json():"error"}).then(function(t){e(t)})},Common.Utils.asyncCall=function(t,e,i){new Promise(function(t,e){t()}).then(function(){t.call(e,i)})},String.prototype.strongMatch=function(t){if(t&&t instanceof RegExp){var e=this.toString().match(t);return!!(e&&e.length>0&&e[0].length==this.length)}
|
|
|
return!1},Common.Utils.InternalSettings=new function(){var t={};return{get:function(e){return t[e]},set:function(e,i){t[e]=i}}},Common.Utils.lockControls=function(t,e,i,n){function o(t,i){if(t&&_.contains(t.options.lock,i)){var n=t.keepState.indexOf(i);e?n<0&&t.keepState.push(i):n<0||t.keepState.splice(n,1)}}!i&&(i={});var s=i.array||n;i.merge&&(s=_.union(n,s)),_.each(s,function(e){e&&_.isFunction(e.setDisabled)&&(!e.keepState&&(e.keepState=[]),i.clear&&i.clear.length>0&&e.keepState.length>0&&(e.keepState=_.difference(e.keepState,i.clear)),_.isArray(t)?_.each(t,function(t){o(e,t)}):o(e,t),e.keepState.length>0?!e.isDisabled()&&e.setDisabled(!0):e.isDisabled()&&e.setDisabled(!1))})},Common.Utils.injectButtons=function(t,e,i,n,o,s,a,l){var r=createButtonSet();return r.setDisabled(!0),e=e||"id-toolbar-"+i,t.each(function(c,h){var d="btn-toolbar";/x-huge/.test(h.className)&&(d+=" x-huge icon-top");var p=new Common.UI.Button({id:e+c,cls:d,iconCls:i,caption:n,split:s||!1,menu:a||!1,enableToggle:l||!1,lock:o,disabled:!0}).render(t.eq(c));r.add(p)}),r},Common.Utils.injectComponent=function(t,e){e&&t.length&&(e.rendered?t.append(e.$el):e.render(t))},Common.Utils.InternalSettings.set("toolbar-height-tabs",32),Common.Utils.InternalSettings.set("toolbar-height-tabs-top-title",28),Common.Utils.InternalSettings.set("toolbar-height-controls",67),Common.Utils.InternalSettings.set("document-title-height",28),Common.Utils.InternalSettings.set("toolbar-height-compact",Common.Utils.InternalSettings.get("toolbar-height-tabs")),Common.Utils.InternalSettings.set("toolbar-height-normal",Common.Utils.InternalSettings.get("toolbar-height-tabs")+Common.Utils.InternalSettings.get("toolbar-height-controls")),define("common/main/lib/util/utils",function(){}),function(t){function e(t,e){for(var i=t.length;i--;)if(t[i]===e)return i;return-1}function i(t,e){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function n(t){for(x in A)A[x]=t[M[x]]}function o(t){var i,o,s,a,r,c;if(i=t.keyCode,-1==e(P,i)&&P.push(i),93!=i&&224!=i||(i=91),i in A){A[i]=!0;for(s in T)T[s]==i&&(l[s]=!0)}else if(n(t),l.filter.call(this,t)&&i in S)for(c=m(),a=0;a<S[i].length;a++)if(o=S[i][a],o.scope==c||"all"==o.scope){r=o.mods.length>0;for(s in A)(!A[s]&&e(o.mods,+s)>-1||A[s]&&-1==e(o.mods,+s))&&(r=!1);(0!=o.mods.length||A[16]||A[18]||A[17]||A[91])&&!r||(!0===w||o.locked||!1===o.method(t,o))&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function s(t){var i,n=t.keyCode,o=e(P,n);if(o>=0&&P.splice(o,1),93!=n&&224!=n||(n=91),n in A){A[n]=!1;for(i in T)T[i]==n&&(l[i]=!1)}}function a(){for(x in A)A[x]=!1;for(x in T)l[x]=!1}function l(t,e,i){var n,o;n=g(t),void 0===i&&(i=e,e="all");for(var s=0;s<n.length;s++)o=[],t=n[s].split("+"),t.length>1&&(o=b(t),t=[t[t.length-1]]),t=t[0],t=E(t),t in S||(S[t]=[]),S[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:o})}function r(t,e){var n,o,s,a,l,r=[];for(n=g(t),a=0;a<n.length;a++){if(o=n[a].split("+"),o.length>1&&(r=b(o),t=o[o.length-1]),t=E(t),void 0===e&&(e=m()),!S[t])return;for(s in S[t])l=S[t][s],l.scope===e&&i(l.mods,r)&&(S[t][s]={})}}function c(t){return"string"==typeof t&&(t=E(t)),-1!=e(P,t)}function h(){return P.slice(0)}function d(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function p(t){k=t||"all"}function m(){return k||"all"}function u(t){var e,i,n;for(e in S)for(i=S[e],n=0;n<i.length;)i[n].scope===t?i.splice(n,1):n++}function g(t){var e;return t=t.replace(/\s/g,""),e=t.split(","),""==e[e.length-1]&&(e[e.length-2]+=","),e}function b(t){for(var e=t.slice(0,t.length-1),i=0;i<e.length;i++)e[i]=T[e[i]];return e}function f(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&t.attachEvent("on"+e,function(){i(window.event)})}function C(){var e=t.key;return t.key=D,e}function v(t,e,n,o){for(var s,a,l,r=[],c=g(t),h=c.length;h--;)if(s=c[h].split("+"),s.length>1&&(r=b(s),t=s[s.length-1]),t=E(t),void 0===e&&(e=m()),S[t])for(a in S[t])l=S[t][a],l.scope===e&&i(l.mods,r)&&(S[t][a][n]=o)}function _(t,e){t?v(t,e,"locked",!0):w=!0}function y(t,e){t?v(t,e,"locked",!1):w=!1}var x,w,S={},A={16:!1,18:!1,17:!1,91:!1},k="all",T={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},I={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},E=function(t){return I[t]||t.toUpperCase().charCodeAt(0)},P=[];for(x=1;x<20;x++)I["f"+x]=111+x;var M={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(x in T)l[x]=!1;f(document,"keydown",function(t){o(t)}),f(document,"keyup",s),f(window,"focus",a);var D=t.key;t.key=l,t.key.setScope=p,t.key.getScope=m,t.key.deleteScope=u,t.key.filter=d,t.key.isPressed=c,t.key.getPressedKeyCodes=h,t.key.noConflict=C,t.key.unbind=r,t.key.suspend=_,t.key.resume=y,"undefined"!=typeof module&&(module.exports=key)}(this),define("keymaster",function(){}),void 0===Common)var Common={};if(Common.util=Common.util||{},define("common/main/lib/util/Shortcuts",["backbone","keymaster"],function(t){"use strict";var e=function(t){return this.cid=_.uniqueId("shortcuts"),this.initialize.apply(this,arguments),this};_.extend(e.prototype,t.Events,{initialize:function(){window.key.filter=function(t){return!0},Common.NotificationCenter.on({"modal:show":function(t){window.key.suspend()},"modal:close":function(t){window.key.resume()},"modal:hide":function(t){window.key.resume()}})},delegateShortcuts:function(t){if(t&&t.shortcuts){this.removeShortcuts(t);var e,i,n,o,s,a,l=[];for(s in t.shortcuts){if(e=t.shortcuts[s],_.isFunction(e))n=e;else if(!(n=t[e]))throw new Error("Method "+e+" does not exist");i=s.match(/^(\S+)\s*(.*)$/),a=i[1],o=i[2].length?i[2]:"all",n=_.bind(n,this),l.push(window.key(a,o,n))}}},removeShortcuts:function(t){if(t&&t.shortcuts){var e,i,n,o;for(n in t.shortcuts)e=n.match(/^(\S+)\s*(.*)$/),o=e[1],i=e[2].length?e[2]:"all",window.key.unbind(o,i)}},suspendEvents:function(t,e){window.key.suspend(t,e)},resumeEvents:function(t,e){window.key.resume(t,e)}}),e.extend=t.View.extend,Common.util.Shortcuts=new e}),void 0===Common)var Common={};if(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(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box">','<p class="message">'+this.textMsg+"</p>",'<div class="hotkeys">',"<div>",'<p class="hotkey">'+Common.Utils.String.platformKey("Ctrl+C","{0}")+"</p>",'<p class="message">'+this.textToCopy+"</p>","</div>","<div>",'<p class="hotkey">'+Common.Utils.String.platformKey("Ctrl+X","{0}")+"</p>",'<p class="message">'+this.textToCut+"</p>","</div>","<div>",'<p class="hotkey">'+Common.Utils.String.platformKey("Ctrl+V","{0}")+"</p>",'<p class="message">'+this.textToPaste+"</p>","</div>","</div>",'<div id="copy-warning-checkbox" style="margin-top: 20px; text-align: left;"></div>',"</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary">'+this.okButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),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 t=this.getChild(".box"),e=this.getChild(".footer"),i=this.getChild(".header"),n=this.getChild(".body");n.height(parseInt(t.height())+parseInt(e.css("height"))),this.setHeight(parseInt(n.css("height"))+parseInt(i.css("height")))},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,"checked"==this.chDontShow.getValue()),this.close()},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&(this.options.handler&&this.options.handler.call(this,"checked"==this.chDontShow.getValue()),this.close())},getSettings:function(){return"checked"==this.chDontShow.getValue()},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.<br><br>.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||{}))}),define("common/main/lib/view/OpenDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.OpenDialog=Common.UI.Window.extend(_.extend({applyFunction:void 0,initialize:function(t){var e,i,n=this,o={};t.preview?(e=414,i=277):(e=t.type!==Common.Utils.importTextType.DRM?340:t.warning?370:262,i=t.type==Common.Utils.importTextType.CSV||t.type==Common.Utils.importTextType.Paste||t.type==Common.Utils.importTextType.Columns?190:t.warning?187:147),_.extend(o,{closable:!1,preview:t.preview,warning:t.warning,codepages:t.codepages,width:e,height:i,header:!0,cls:"open-dlg",contentTemplate:"",toolcallback:_.bind(n.onToolClose,n),closeFile:!1},t),this.template=t.template||['<div class="box" style="height:'+(o.height-85)+'px;">','<div class="content-panel" >',"<% if (type == Common.Utils.importTextType.DRM) { %>","<% if (warning) { %>","<div>",'<div class="icon img-commonctrl warn"/>','<div style="padding-left: 50px;"><div style="font-size: 12px;">'+n.txtProtected+"</div>",'<label class="header" style="margin-top: 15px;">'+n.txtPassword+"</label>",'<div id="id-password-txt" style="width: 240px;"></div></div>',"</div>","<% } else { %>","<div>",'<label class="header">'+n.txtPassword+"</label>",'<div id="id-password-txt"></div>',"</div>","<% } %>","<% } else { %>","<% if (codepages && codepages.length>0) { %>",'<div style="<% if (!!preview && (type == Common.Utils.importTextType.CSV || type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns)) { %>width: 230px;margin-right: 10px;display: inline-block;<% } else { %>width: 100%;<% } %>margin-bottom:15px;">','<label class="header">'+n.txtEncoding+"</label>","<div>",'<div id="id-codepages-combo" class="input-group-nr" style="width: 100%; display: inline-block; vertical-align: middle;"></div>',"</div>","</div>","<% } %>","<% if (type == Common.Utils.importTextType.CSV || type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns) { %>",'<div style="display: inline-block; margin-bottom:15px;">','<label class="header">'+n.txtDelimiter+"</label>","<div>",'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 100px;display: inline-block; vertical-align: middle;"></div>','<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>',"</div>","</div>","<% } %>","<% if (!!preview) { %>",'<div style="">','<label class="header">'+n.txtPreview+"</label>",'<div style="position: relative;">','<div style="width: 100%;">','<div id="id-preview">',"<div>",'<div style="position: absolute; top: 0;"><div id="id-preview-data"></div></div>',"</div>","</div>","</div>","</div>","</div>","<% } %>","<% } %>","</div>","</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok">'+n.okButtonText+"</button>","<% if (closeFile) { %>",'<button class="btn normal dlg-btn" result="cancel" style="margin-left:10px;">'+n.closeButtonText+"</button>","<% } %>","<% if (closable) { %>",'<button class="btn normal dlg-btn" result="cancel" style="margin-left:10px;">'+n.cancelButtonText+"</button>","<% } %>","</div>"].join(""),this.handler=o.handler,this.type=o.type,this.preview=o.preview,this.previewData=o.previewData,this.warning=o.warning||!1,this.closable=o.closable,this.codepages=o.codepages,this.settings=o.settings,this.api=o.api,this.validatePwd=o.validatePwd||!1,o.tpl=_.template(this.template)(o),Common.UI.Window.prototype.initialize.call(this,o)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.closable||this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.previewPanel=this.$window.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=this.$window.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.type==Common.Utils.importTextType.DRM?(this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"text",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}}),this.$window.find("input").on("input",function(){""!==$(this).val()?"password"!==$(this).attr("type")&&$(this).attr("type","password"):$(this).attr("type","text")})):(this.initCodePages(),this.preview&&(this.previewData?this.previewCallback(this.previewData):this.updatePreview())),this.onPrimary=function(){return t._handleInput("ok"),!1}}},show:function(){if(Common.UI.Window.prototype.show.apply(this,arguments),this.type==Common.Utils.importTextType.DRM){var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus(),t.validatePwd&&t.inputPwd.checkValidate()},500)}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onToolClose:function(){this._handleInput("cancel")},_handleInput:function(t){if(this.handler)if(this.type==Common.Utils.importTextType.DRM)this.handler.call(this,t,this.inputPwd.getValue());else{var e=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,i=this.cmbDelimiter?this.cmbDelimiter.getValue():null,n=-1==i?this.inputDelimiter.getValue():null;-1==i&&(i=null),this.handler.call(this,t,e,i,n)}this.close()},initCodePages:function(){var t,e,i,n=[],o=[],s=0,a=0;if(this.codepages){for(n=[],t=0;t<this.codepages.length;++t)i=this.codepages[t],e=[],e[0]=i.asc_getCodePage(),e[1]=i.asc_getCodePageName(),e[2]=i.asc_getLcid(),n.push(e);a=50}if(s=n.length){for(t=0;t<s;++t)o.push({value:n[t][0],displayValue:Common.Utils.String.htmlEncode(n[t][1]),lcid:n[t][2]||""});var l=_.template(["<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">','<div style="display: inline-block;"><%= item.displayValue %></div>','<label style="text-align: right;width:'+a+'px;"><%= item.lcid %></label>',"</a></li>","<% }); %>"].join(""));this.cmbEncoding=new Common.UI.ComboBox({el:$("#id-codepages-combo",this.$window),style:"width: 100%;",menuStyle:"min-width: 100%; max-height: 200px;",cls:"input-group-nr",menuCls:"scrollable-menu",data:o,editable:!1,disabled:!0,itemsTemplate:l}),this.cmbEncoding.setDisabled(!1),this.cmbEncoding.setValue(this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():n[0][0]),this.preview&&this.cmbEncoding.on("selected",_.bind(this.onCmbEncodingSelect,this));var r=this.cmbEncoding.cmpEl.find("ul"),c=r.find("li:nth(0) a"),h=r.width()-parseInt(c.css("padding-left"))-parseInt(c.css("padding-right"))-50;r.find("li div").width(h)}this.type!=Common.Utils.importTextType.CSV&&this.type!=Common.Utils.importTextType.Paste&&this.type!=Common.Utils.importTextType.Columns||(this.cmbDelimiter=new Common.UI.ComboBox({el:$("#id-delimiters-combo",this.$window),style:"width: 100px;",menuStyle:"min-width: 100px;",cls:"input-group-nr",data:[{value:4,displayValue:this.txtComma},{value:2,displayValue:this.txtSemicolon},{value:3,displayValue:this.txtColon},{value:1,displayValue:this.txtTab},{value:5,displayValue:this.txtSpace},{value:-1,displayValue:this.txtOther}],editable:!1}),this.cmbDelimiter.setValue(this.settings&&this.settings.asc_getDelimiter()?this.settings.asc_getDelimiter():4),this.cmbDelimiter.on("selected",_.bind(this.onCmbDelimiterSelect,this)),this.inputDelimiter=new Common.UI.InputField({el:$("#id-delimiter-other"),style:"width: 30px;",maxLength:1,validateOnChange:!0,validateOnBlur:!1,value:this.settings&&this.settings.asc_getDelimiterChar()?this.settings.asc_getDelimiterChar():""}),this.inputDelimiter.setVisible(!1),this.preview&&this.inputDelimiter.on("changing",_.bind(this.updatePreview,this)))},updatePreview:function(){var t=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,e=this.cmbDelimiter?this.cmbDelimiter.getValue():null,i=-1==e?this.inputDelimiter.getValue():null;switch(-1==e&&(e=null),this.type){case Common.Utils.importTextType.CSV:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t,e,i),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.TXT:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.Paste:case Common.Utils.importTextType.Columns:this.api.asc_TextImport(new Asc.asc_CTextOptions(t,e,i),_.bind(this.previewCallback,this),this.type==Common.Utils.importTextType.Paste)}},previewCallback:function(t){t&&t.length&&(this.data=t,this.previewInner.height(17*t.length),this.scrollerY||(this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:20,alwaysVisibleY:!0,alwaysVisibleX:!0,onChange:_.bind(function(){if(this.scrollerY){var t=this.scrollerY.getScrollTop(),e=Math.floor(t/17+.5),i=e+Math.min(6,this.data.length);i>this.data.length&&(i=this.data.length,e=this.data.length-6,t=17*e),this.previewParent.height(108),this.previewParent.css({top:t}),this.previewDataBlock(this.data.slice(e,i))}},this)})),this.scrollerY.update(),this.scrollerY.scrollTop(0))},previewDataBlock:function(t){if(_.isUndefined(this.scrollerX)||(this.scrollerX.destroy(),delete this.scrollerX),this.type==Common.Utils.importTextType.CSV||this.type==Common.Utils.importTextType.Paste||this.type==Common.Utils.importTextType.Columns){for(var e=0,i=0;i<t.length;i++)t[i].length>e&&(e=t[i].length);for(var n="<table>",i=0;i<t.length;i++){n+='<tr style="vertical-align: top;">';for(var o=0;o<t[i].length;o++)n+="<td>"+Common.Utils.String.htmlEncode(t[i][o])+"</td>";for(o=t[i].length;o<e;o++)n+="<td></td>";n+="</tr>"}n+="</table>"}else{for(var n="<table>",i=0;i<t.length;i++)n+='<tr style="vertical-align: top;"><td>'+Common.Utils.String.htmlEncode(t[i])+"</td></tr>";n+="</table>"}this.previewPanel.html(n),this.scrollerX=new Common.UI.Scroller({el:this.previewPanel,suppressScrollY:!0,alwaysVisibleX:!0,minScrollbarLength:20})},onCmbDelimiterSelect:function(t,e){this.inputDelimiter.setVisible(-1==e.value),-1==e.value&&this.inputDelimiter.cmpEl.find("input").focus(),this.preview&&this.updatePreview()},onCmbEncodingSelect:function(t,e){this.updatePreview()},okButtonText:"OK",cancelButtonText:"Cancel",txtDelimiter:"Delimiter",txtEncoding:"Encoding ",txtSpace:"Space",txtTab:"Tab",txtTitle:"Choose %1 options",txtPassword:"Password",txtTitleProtected:"Protected File",txtOther:"Other",txtIncorrectPwd:"Password is incorrect.",closeButtonText:"Close File",txtPreview:"Preview",txtComma:"Comma",txtColon:"Colon",txtSemicolon:"Semicolon",txtProtected:"Once you enter the password and open the file, the current password to the file will be reset."},Common.Views.OpenDialog||{}))}),$(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api","[data-toggle=dropdown], [role=menu]",onDropDownKeyDown),"ontouchstart"in document.documentElement&&$(document).on("click.bs.dropdown.data-api","[data-toggle=dropdown]",toggle),function(){function t(t){1!=t.which&&void 0!=t.which||clearMenus(/form-control/.test(t.target.className))}var e,i=$._data($(document).get(0),"events");i&&i.click&&i.click.every(function(t,i,n){return/click/.test(t.type)&&!t.selector&&/bs\..+\.dropdown/.test(t.namespace)&&(e=t.handler),!e}),e&&$(document).off("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",t)}(),define("common/main/lib/extend/Bootstrap",function(){}),void 0===Common)var Common={};if(define("common/main/lib/component/ToggleManager",["common/main/lib/component/BaseView"],function(){"use strict";function t(t,i){var n,o,s;if(i)for(n=e[t.toggleGroup],o=0,s=n.length;o<s;o++)n[o]!==t&&(n[o].isActive?n[o].isActive()&&n[o].toggle(!1):n[o].toggle(!1))}var e={};Common.UI.ToggleManager={register:function(i){if(i.toggleGroup){var n=e[i.toggleGroup];n||(n=e[i.toggleGroup]=[]),n.push(i),i.on("toggle",t)}},unregister:function(i){if(i.toggleGroup){var n=e[i.toggleGroup];n&&(_.without(n,i),i.off("toggle",t))}},getToggled:function(t){var i,n=e[t],o=0;if(n)for(i=n.length;o<i;o++)if(!0===n[o].pressed||!0===n[o].checked)return n[o];return null}}}),void 0===Common)var Common={};if(define("common/main/lib/component/MenuItem",["common/main/lib/component/BaseView","common/main/lib/component/ToggleManager"],function(){"use strict";Common.UI.MenuItem=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,checkable:!1,checked:!1,allowDepress:!1,disabled:!1,value:null,toggleGroup:null,iconCls:"",menu:null,canFocused:!0},tagName:"li",template:_.template(['<a id="<%= id %>" style="<%= style %>" <% if(options.canFocused) { %> tabindex="-1" type="menuitem" <% }; if(!_.isUndefined(options.stopPropagation)) { %> data-stopPropagation="true" <% }; %> >',"<% if (!_.isEmpty(iconCls)) { %>",'<span class="menu-item-icon <%= iconCls %>"></span>',"<% } %>","<%= caption %>","</a>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);this.id=e.options.id||Common.UI.getId(),this.cls=e.options.cls,this.style=e.options.style,this.caption=e.options.caption,this.menu=e.options.menu||null,this.checkable=e.options.checkable,this.checked=e.options.checked,e.allowDepress=e.options.allowDepress,this.disabled=e.options.disabled,this.value=e.options.value,this.toggleGroup=e.options.toggleGroup,this.template=e.options.template||this.template,this.iconCls=e.options.iconCls,this.hint=e.options.hint,this.rendered=!1,null===this.menu||this.menu instanceof Common.UI.Menu||(this.menu=new Common.UI.Menu(_.extend({},e.options.menu))),e.options.el&&this.render()},render:function(){var t=this,e=$(this.el);if(t.trigger("render:before",t),"--"===t.caption)e.addClass("divider");else if(!this.rendered){e.off("click"),Common.UI.ToggleManager.unregister(t),$(this.el).html(this.template({id:t.id,caption:t.caption,iconCls:t.iconCls,style:t.style,options:t.options})),t.menu&&(e.addClass("dropdown-submenu"),t.menu.render($(this.el)),e.mouseenter(_.bind(t.menu.alignPosition,t.menu)),e.focusout(_.bind(t.onBlurItem,t)),e.hover(_.bind(t.onHoverItem,t),_.bind(t.onUnHoverItem,t)));var i=e.children(":first");this.checkable&&i&&(i.toggleClass("checkable",this.checkable),i.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||i.css("background-image","none")),t.options.hint&&(e.attr("data-toggle","tooltip"),e.tooltip({title:t.options.hint,placement:t.options.hintAnchor||function(t,e){var i=this.getPosition(),n=t.offsetWidth,o=t.offsetHeight,s=Common.Utils.innerWidth(),a=Common.Utils.innerHeight(),l=i.top,r=i.left+i.width+2;l+o>a&&(l=a-o-2),r+n>s&&(r=i.left-n-2),$(t).offset({top:l,left:r}).addClass("in")}})),this.disabled&&$(this.el).toggleClass("disabled",this.disabled),e.on("click",_.bind(this.onItemClick,this)),e.on("mousedown",_.bind(this.onItemMouseDown,this)),Common.UI.ToggleManager.register(t)}return t.cmpEl=$(this.el),t.rendered=!0,t.trigger("render:after",t),this},setCaption:function(t,e){this.caption=t,this.rendered&&(this.cmpEl.find("a").contents().last()[0].textContent=e?t:Common.Utils.String.htmlEncode(t))},setChecked:function(t,e){this.toggle(t,e)},isChecked:function(){return this.checked},setDisabled:function(t){this.disabled=!!t,this.rendered&&this.cmpEl.toggleClass("disabled",this.disabled)},isDisabled:function(){return this.disabled},toggle:function(t,e){var i=void 0===t?!this.checked:!!t;if(this.checkable){if(this.checked=i,this.rendered){var n=this.cmpEl.children(":first");n&&(n.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||n.css("background-image","none"))}e||this.trigger("toggle",this,i)}},onItemMouseDown:function(t){if(1!=t.which)return t.preventDefault(),t.stopPropagation(),!1;t.stopPropagation()},onItemClick:function(t){return(1==t.which||void 0===t.which&&!this.menu)&&(this.disabled||!this.allowDepress&&this.checked&&this.toggleGroup||this.menu||this.setChecked(!this.checked),this.menu?t.target.id!=this.id&&void(this.menu.isOver||this.cmpEl.removeClass("over")):!this.disabled&&void this.trigger("click",this,t))},onHoverItem:function(t){this._doHover(t)},onUnHoverItem:function(t){this._doUnHover(t)},onBlurItem:function(t){this._doUnHover(t)},_doHover:function(t){var e=this;e.menu&&!e.disabled&&(clearTimeout(e.hideMenuTimer),e.cmpEl.trigger("show.bs.dropdown"),e.expandMenuTimer=_.delay(function(){e.cmpEl.addClass("over"),e.cmpEl.trigger("shown.bs.dropdown")},200))},_doUnHover:function(t){var e=this;if(e.cmpEl.hasClass("dropdown-submenu")&&e.cmpEl.hasClass("over")&&(t&&t.relatedTarget&&e.cmpEl.find(t.relatedTarget).length>0||e.cmpEl.hasClass("focused-submenu")))return void e.cmpEl.removeClass("focused-submenu");if(e.menu&&!e.disabled&&(clearTimeout(e.expandMenuTimer),e.hideMenuTimer=_.delay(function(){e.menu.isOver||e.cmpEl.removeClass("over")},200),t&&"focusout"!==t.type)){var i=e.cmpEl.children(":focus");i.length>0&&(i.blur(),e.cmpEl.closest("ul").focus())}}}),Common.UI.MenuItemSeparator=function(t){return t=t||{},t.caption="--",new Common.UI.MenuItem(t)}}),function(t){"function"==typeof define&&define.amd?define("jmousewheel",["jquery"],t):"object"==typeof exports?module.exports=t:t(jQuery)}(function(t){function e(e){var a=e||window.event,l=r.call(arguments,1),c=0,h=0,d=0,p=0;if(e=t.event.fix(a),e.type="mousewheel","detail"in a&&(d=-1*a.detail),"wheelDelta"in a&&(d=a.wheelDelta),"wheelDeltaY"in a&&(d=a.wheelDeltaY),"wheelDeltaX"in a&&(h=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(h=-1*d,d=0),c=0===d?h:d,"deltaY"in a&&(d=-1*a.deltaY,c=d),"deltaX"in a&&(h=a.deltaX,0===d&&(c=-1*h)),0!==d||0!==h){if(1===a.deltaMode){var m=t.data(this,"mousewheel-line-height");c*=m,d*=m,h*=m}else if(2===a.deltaMode){var u=t.data(this,"mousewheel-page-height");c*=u,d*=u,h*=u}return p=Math.max(Math.abs(d),Math.abs(h)),(!s||p<s)&&(s=p,n(a,p)&&(s/=40)),n(a,p)&&(c/=40,h/=40,d/=40),c=Math[c>=1?"floor":"ceil"](c/s),h=Math[h>=1?"floor":"ceil"](h/s),d=Math[d>=1?"floor":"ceil"](d/s),e.deltaX=h,e.deltaY=d,e.deltaFactor=s,e.deltaMode=0,l.unshift(e,c,h,d),o&&clearTimeout(o),o=setTimeout(i,200),(t.event.dispatch||t.event.handle).apply(this,l)}}function i(){s=null}function n(t,e){return h.settings.adjustOldDeltas&&"mousewheel"===t.type&&e%120==0}var o,s,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],l="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r=Array.prototype.slice;if(t.event.fixHooks)for(var c=a.length;c;)t.event.fixHooks[a[--c]]=t.event.mouseHooks;var h=t.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=l.length;i;)this.addEventListener(l[--i],e,!1);else this.onmousewheel=e;t.data(this,"mousewheel-line-height",h.getLineHeight(this)),t.data(this,"mousewheel-page-height",h.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=l.length;t;)this.removeEventListener(l[--t],e,!1);else this.onmousewheel=null},getLineHeight:function(e){return parseInt(t(e)["offsetParent"in t.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(e){return t(e).height()},settings:{adjustOldDeltas:!0}};t.fn.extend({mousewheel:function(t){return t?this.bind("mousewheel",t):this.trigger("mousewheel")},unmousewheel:function(t){return this.unbind("mousewheel",t)}})}),function(t){"use strict";"function"==typeof define&&define.amd?define("perfectscrollbar",["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){"use strict";var e={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1,includeMargin:!0},i=function(){var t=0;return function(){var e=t;return t+=1,".perfect-scrollbar-"+e}}();t.fn.perfectScrollbar=function(n,o){return this.each(function(){var s=t.extend(!0,{},e),a=t(this);if("object"==typeof n?t.extend(!0,s,n):o=n,"update"===o)return a.data("perfect-scrollbar-update")&&a.data("perfect-scrollbar-update")(),a;if("destroy"===o)return a.data("perfect-scrollbar-destroy")&&a.data("perfect-scrollbar-destroy")(),a;if(a.data("perfect-scrollbar"))return a.data("perfect-scrollbar");a.addClass("ps-container oo");var l,r,c,h,d,p,m,u,g,b,f,C,v=t("<div class='ps-scrollbar-x-rail'></div>").appendTo(a),_=t("<div class='ps-scrollbar-y-rail'></div>").appendTo(a),y=t("<div class='ps-scrollbar-x'></div>").appendTo(v),x=t("<div class='ps-scrollbar-y'></div>").appendTo(_),w=parseInt(v.css("bottom"),10),S=parseInt(_.css("right"),10),A=i(),k=function(t,e){var i=t+e,n=C-b;f=i<0?0:i>n?n:i;var o=parseInt(f*(p-h)/(C-b),10);a.scrollTop(o),v.css({bottom:w-o})},T=function(t,e){var i=t+e,n=g-m;u=i<0?0:i>n?n:i;var o=parseInt(u*(d-c)/(g-m),10);a.scrollLeft(o),_.css({right:S-o})},I=function(t){return s.minScrollbarLength&&(t=Math.max(t,s.minScrollbarLength)),t},E=function(){v.css({left:a.scrollLeft(),bottom:w-a.scrollTop(),width:g,display:l?"inherit":"none"}),_.hasClass("in-scrolling")?_.css({right:S-a.scrollLeft(),height:C,display:r?"inherit":"none"}):_.css({top:a.scrollTop(),right:S-a.scrollLeft(),height:C,display:r?"inherit":"none"}),y.css({left:u,width:m}),x.css({top:f,height:b})},P=function(){c=s.includePadding?a.innerWidth():a.width(),h=s.includePadding?a.innerHeight():a.height(),C=h-(s.includeMargin?parseInt(_.css("margin-top"))+parseInt(_.css("margin-bottom")):0),g=c-(s.includeMargin?parseInt(v.css("margin-left"))+parseInt(v.css("margin-right")):0),d=a.prop("scrollWidth"),p=a.prop("scrollHeight"),!s.suppressScrollX&&c+s.scrollXMarginOffset<d?(l=!0,m=I(parseInt(g*c/d,10)),u=parseInt(a.scrollLeft()*(g-m)/(d-c),10)):(l=!1,m=0,u=0,a.scrollLeft(0)),!s.suppressScrollY&&h+s.scrollYMarginOffset<p?(r=!0,b=I(parseInt(C*h/p,10)),f=parseInt(a.scrollTop()*(C-b)/(p-h),10)):(r=!1,b=0,f=0,a.scrollTop(0)),f>=C-b&&(f=C-b),u>=g-m&&(u=g-m),E(),s.onChange&&s.onChange(this)},M=function(){var e,i;y.bind("mousedown"+A,function(t){i=t.pageX,e=y.position().left,v.addClass("in-scrolling"),t.stopPropagation(),t.preventDefault()}),t(document).bind("mousemove"+A,function(t){v.hasClass("in-scrolling")&&(T(e,t.pageX-i),t.stopPropagation(),t.preventDefault())}),t(document).bind("mouseup"+A,function(t){v.hasClass("in-scrolling")&&v.removeClass("in-scrolling")}),e=i=null},D=function(){var e,i;x.bind("mousedown"+A,function(t){i=t.pageY,e=x.position().top,_.addClass("in-scrolling");var n=parseInt(_.css("margin-top")),o=_[0].getBoundingClientRect();_.css({position:"fixed",left:o.left,top:o.top-n}),t.stopPropagation(),t.preventDefault()}),t(document).bind("mousemove"+A,function(t){_.hasClass("in-scrolling")&&(k(e,t.pageY-i),t.stopPropagation(),t.preventDefault())}),t(document).bind("mouseup"+A,function(t){_.hasClass("in-scrolling")&&(_.removeClass("in-scrolling"),_.css({position:"",left:"",top:""}),E())}),e=i=null},F=function(t,e){var i=a.scrollTop();if(0===t){if(!r)return!1;if(0===i&&e>0||i>=p-h&&e<0)return!s.wheelPropagation}var n=a.scrollLeft();if(0===e){if(!l)return!1;if(0===n&&t<0||n>=d-c&&t>0)return!s.wheelPropagation}return!0},U=function(){s.wheelSpeed/=10;var e=!1;a.bind("mousewheel"+A,function(i,n,o,c){
|
|
|
var h=i.deltaX*i.deltaFactor||o,d=i.deltaY*i.deltaFactor||c;if(i&&i.target&&("textarea"===i.target.type||"input"===i.target.type)){i.stopImmediatePropagation(),i.preventDefault();var p=t(i.target).scrollTop(),m=0;return i.originalEvent?i.originalEvent.wheelDelta?m=i.originalEvent.wheelDelta:i.originalEvent.deltaY?m=40*-i.originalEvent.deltaY:i.originalEvent.detail&&(m=i.originalEvent.detail):m=void 0!==i.wheelDelta?i.wheelDelta:i.deltaY,void t(i.target).scrollTop(p-m)}e=!1,s.useBothWheelAxes?r&&!l?(d?a.scrollTop(a.scrollTop()-d*s.wheelSpeed):a.scrollTop(a.scrollTop()+h*s.wheelSpeed),e=!0):l&&!r&&(h?a.scrollLeft(a.scrollLeft()+h*s.wheelSpeed):a.scrollLeft(a.scrollLeft()-d*s.wheelSpeed),e=!0):(a.scrollTop(a.scrollTop()-d*s.wheelSpeed),a.scrollLeft(a.scrollLeft()+h*s.wheelSpeed)),P(),(e=e||F(h,d))&&(i.stopPropagation(),i.preventDefault())}),a.bind("MozMousePixelScroll"+A,function(t){e&&t.preventDefault()})},V=function(){var e=!1;a.bind("mouseenter"+A,function(t){e=!0}),a.bind("mouseleave"+A,function(t){e=!1});var i=!1;t(document).bind("keydown"+A,function(n){if(e&&!t(document.activeElement).is(":input,[contenteditable]")){var o=0,s=0;switch(n.which){case 37:o=-30;break;case 38:s=30;break;case 39:o=30;break;case 40:s=-30;break;case 33:s=90;break;case 32:case 34:s=-90;break;case 35:s=-h;break;case 36:s=h;break;default:return}a.scrollTop(a.scrollTop()-s),a.scrollLeft(a.scrollLeft()+o),i=F(o,s),i&&n.preventDefault()}})},R=function(){var t=function(t){t.stopPropagation()};x.bind("click"+A,t),_.bind("click"+A,function(t){var e=parseInt(b/2,10),i=t.pageY-_.offset().top-e,n=C-b,o=i/n;o<0?o=0:o>1&&(o=1),a.scrollTop((p-h)*o)}),y.bind("click"+A,t),v.bind("click"+A,function(t){var e=parseInt(m/2,10),i=t.pageX-v.offset().left-e,n=g-m,o=i/n;o<0?o=0:o>1&&(o=1),a.scrollLeft((d-c)*o)})},B=function(){var e=function(t,e){a.scrollTop(a.scrollTop()-e),a.scrollLeft(a.scrollLeft()-t),P()},i={},n=0,o={},s=null,l=!1;t(window).bind("touchstart"+A,function(t){l=!0}),t(window).bind("touchend"+A,function(t){l=!1}),a.bind("touchstart"+A,function(t){var e=t.originalEvent.targetTouches[0];i.pageX=e.pageX,i.pageY=e.pageY,n=(new Date).getTime(),null!==s&&clearInterval(s),t.stopPropagation()}),a.bind("touchmove"+A,function(t){if(!l&&1===t.originalEvent.targetTouches.length){var s=t.originalEvent.targetTouches[0],a={};a.pageX=s.pageX,a.pageY=s.pageY;var r=a.pageX-i.pageX,c=a.pageY-i.pageY;e(r,c),i=a;var h=(new Date).getTime(),d=h-n;d>0&&(o.x=r/d,o.y=c/d,n=h),t.preventDefault()}}),a.bind("touchend"+A,function(t){clearInterval(s),s=setInterval(function(){if(Math.abs(o.x)<.01&&Math.abs(o.y)<.01)return void clearInterval(s);e(30*o.x,30*o.y),o.x*=.8,o.y*=.8},10)})},L=function(){a.bind("scroll"+A,function(t){P()})},N=function(){a.unbind(A),t(window).unbind(A),t(document).unbind(A),a.data("perfect-scrollbar",null),a.data("perfect-scrollbar-update",null),a.data("perfect-scrollbar-destroy",null),y.remove(),x.remove(),v.remove(),_.remove(),y=x=c=h=d=p=m=u=w=b=f=S=null},O=function(e){a.addClass("ie").addClass("ie"+e);6===e&&(function(){var e=function(){t(this).addClass("hover")},i=function(){t(this).removeClass("hover")};a.bind("mouseenter"+A,e).bind("mouseleave"+A,i),v.bind("mouseenter"+A,e).bind("mouseleave"+A,i),_.bind("mouseenter"+A,e).bind("mouseleave"+A,i),y.bind("mouseenter"+A,e).bind("mouseleave"+A,i),x.bind("mouseenter"+A,e).bind("mouseleave"+A,i)}(),function(){E=function(){y.css({left:u+a.scrollLeft(),bottom:w,width:m}),x.css({top:f+a.scrollTop(),right:S,height:b}),y.hide().show(),x.hide().show()}}())},H="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;return function(){var t=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);t&&"msie"===t[1]&&O(parseInt(t[2],10)),P(),L(),M(),D(),R(),H&&B(),a.mousewheel&&U(),s.useKeyboard&&V(),a.data("perfect-scrollbar",a),a.data("perfect-scrollbar-update",P),a.data("perfect-scrollbar-destroy",N)}(),a})}}),void 0===Common)var Common={};if(define("common/main/lib/component/Scroller",["jmousewheel","perfectscrollbar","common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Scroller=function(){var t;return _.extend(Common.UI.BaseView.extend({options:{wheelSpeed:20,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:5,scrollYMarginOffset:5,includePadding:!0,includeMargin:!0,alwaysVisibleX:!1,alwaysVisibleY:!1},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.options.el&&this.render()},render:function(){var t=this;return t.cmpEl=$(this.el),t.rendered||(t.cmpEl.perfectScrollbar(_.extend({},t.options)),t.rendered=!0,this.setAlwaysVisibleX(t.options.alwaysVisibleX),this.setAlwaysVisibleY(t.options.alwaysVisibleY)),this},remove:function(){this.destroy(),Backbone.View.prototype.remove.call(this)},update:function(e){var i=this.options;e?(this.destroy(),i=_.extend(this.options,e),this.cmpEl.perfectScrollbar(i)):this.cmpEl.perfectScrollbar("update"),this.setAlwaysVisibleX(i.alwaysVisibleX),this.setAlwaysVisibleY(i.alwaysVisibleY);var n=function(e){t=!0;var i=function(e){$(document).unbind("mouseup",i),_.delay(function(){t=!1},10)};$(document).mouseup(i)};$(".ps-scrollbar-x-rail, .ps-scrollbar-y-rail, .ps-scrollbar-x, .ps-scrollbar-y",this.cmpEl).off("mousedown",n).on("mousedown",n)},destroy:function(){this.cmpEl.perfectScrollbar("destroy")},scrollLeft:function(t){this.cmpEl.scrollLeft(t),this.update()},scrollTop:function(t){this.cmpEl.scrollTop(t),this.update()},getScrollTop:function(){return this.cmpEl.scrollTop()},getScrollLeft:function(){return this.cmpEl.scrollLeft()},setAlwaysVisibleX:function(t){t?($(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(t){t?($(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"))},isVisible:function(){return $(this.el).find(".ps-scrollbar-y-rail").is(":visible")}}),{isMouseCapture:function(){return t}})}()}),void 0===Common)var Common={};if(define("common/main/lib/component/Menu",["common/main/lib/extend/Bootstrap","common/main/lib/component/BaseView","common/main/lib/component/MenuItem","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.Menu=function(){var t=function(){var t=[],e={};return{register:function(i){e[i.id]=i,i.on("show:after",function(e){t.push(e)}).on("hide:after",function(e){var i=t.indexOf(e);i>-1&&t.splice(i,1)})},unregister:function(i){var n=t.indexOf(i);delete e[i.id],n>-1&&t.splice(n,1),i.off("show:after").off("hide:after")},hideAll:function(){return Common.NotificationCenter.trigger("menumanager:hideall"),!!(t&&t.length>0)&&(_.each(t,function(t){t&&t.hide()}),!0)}}}();return _.extend(Common.UI.BaseView.extend({options:{cls:"",style:"",itemTemplate:null,items:[],menuAlign:"tl-bl",menuAlignEl:null,offset:[0,0],cyclic:!0,search:!1,scrollAlwaysVisible:!0},template:_.template(['<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var i=this;this.id=this.options.id||Common.UI.getId(),this.itemTemplate=this.options.itemTemplate||Common.UI.MenuItem.prototype.template,this.rendered=!1,this.items=[],this.offset=[0,0],this.menuAlign=this.options.menuAlign,this.menuAlignEl=this.options.menuAlignEl,this.scrollAlwaysVisible=this.options.scrollAlwaysVisible,this.search=this.options.search,this.options.restoreHeight&&(this.options.restoreHeight="number"==typeof this.options.restoreHeight?this.options.restoreHeight:this.options.maxHeight?this.options.maxHeight:1e5,!this.options.maxHeight&&(this.options.maxHeight=this.options.restoreHeight)),this.options.cyclic||(this.options.cls+=" no-cyclic"),_.each(this.options.items,function(t){t instanceof Common.UI.MenuItem?i.items.push(t):i.items.push(new Common.UI.MenuItem(_.extend({tagName:"li",template:i.itemTemplate},t)))}),this.options.el&&this.render(),t.register(this)},remove:function(){t.unregister(this),Common.UI.BaseView.prototype.remove.call(this)},render:function(t){var e=this;this.trigger("render:before",this),this.cmpEl=$(this.el),t?(this.setElement(t,!1),e.rendered||(this.cmpEl=$(this.template({options:e.options})),t.append(this.cmpEl))):e.rendered||(this.cmpEl=this.template({options:e.options}),$(this.el).append(this.cmpEl));var i=this.cmpEl.parent(),n="menu"===i.attr("role")?i:i.find("[role=menu]");return this.menuRoot=n,n&&(e.rendered||_.each(e.items||[],function(t){n.append(t.render().el),t.on("click",_.bind(e.onItemClick,e)),t.on("toggle",_.bind(e.onItemToggle,e))}),this.options.maxHeight&&(n.css({"max-height":e.options.maxHeight}),this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),minScrollbarLength:30,suppressScrollX:!0,alwaysVisibleY:this.scrollAlwaysVisible})),n.css({position:"fixed",right:"auto",left:-1e3,top:-1e3}),this.parentEl=n.parent(),this.parentEl.on("show.bs.dropdown",_.bind(e.onBeforeShowMenu,e)),this.parentEl.on("shown.bs.dropdown",_.bind(e.onAfterShowMenu,e)),this.parentEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),this.parentEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e)),this.parentEl.on("keydown.after.bs.dropdown",_.bind(e.onAfterKeydownMenu,e)),n.hover(function(t){e.isOver=!0},function(t){e.isOver=!1})),this.rendered=!0,this.trigger("render:after",this),this},isVisible:function(){return this.rendered&&this.cmpEl.is(":visible")},show:function(){this.rendered&&this.parentEl&&!this.parentEl.hasClass("open")&&this.cmpEl.dropdown("toggle")},hide:function(){this.rendered&&this.parentEl&&(this.parentEl.hasClass("open")?this.cmpEl.dropdown("toggle"):this.parentEl.hasClass("over")&&this.parentEl.removeClass("over"))},insertItem:function(t,e){var i=this;this.cmpEl;if(e instanceof Common.UI.MenuItem||(e=new Common.UI.MenuItem(_.extend({tagName:"li",template:i.itemTemplate},e))),t<0||t>=i.items.length?i.items.push(e):i.items.splice(t,0,e),this.rendered){var n=this.menuRoot;n&&(t<0?n.append(e.render().el):0===t?n.prepend(e.render().el):n.children("li:nth-child("+(t+1)+")").before(e.render().el),e.on("click",_.bind(i.onItemClick,i)),e.on("toggle",_.bind(i.onItemToggle,i)))}},addItem:function(t){this.insertItem(-1,t)},removeItem:function(t){var e=this,i=e.items.indexOf(t);i>-1&&(e.items.splice(i,1),t.off("click").off("toggle"),t.remove())},removeItems:function(t,e){if(!(t>this.items.length-1)){t+e>this.items.length&&(e=this.items.length-t);for(var i=t;i<t+e;i++)this.items[i].off("click").off("toggle"),this.items[i].remove();this.items.splice(t,e)}},removeAll:function(){var t=this;_.each(t.items,function(t){t.off("click").off("toggle"),t.remove()}),t.items=[]},onBeforeShowMenu:function(t){Common.NotificationCenter.trigger("menu:show"),this.trigger("show:before",this,t),this.alignPosition()},onAfterShowMenu:function(t){if(this.trigger("show:after",this,t),this.scroller){this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible});var e=this.menuRoot,i=e.find("> li .checked");if(i.length){var n=i.position().top,o=i.height(),s=e.height();(n<0||n+o>s)&&e.scrollTop(e.scrollTop()+n+o-s/2),setTimeout(function(){i.focus()},1)}}this._search={}},onBeforeHideMenu:function(t){this.trigger("hide:before",this,t),Common.UI.Scroller.isMouseCapture()&&t.preventDefault()},onAfterHideMenu:function(t,e){this.trigger("hide:after",this,t,e),Common.NotificationCenter.trigger("menu:hide",this,e)},onAfterKeydownMenu:function(t){if(this.trigger("keydown:before",this,t),!t.isDefaultPrevented())if(t.keyCode==Common.UI.Keys.RETURN){var e=$(t.target).closest("li");if(e.length<=0&&(e=$(t.target).parent().find("li .dataview")),e.length>0&&e.click(),e.hasClass("dropdown-submenu")||Common.UI.Menu.Manager.hideAll(),$(t.currentTarget).closest("li").hasClass("dropdown-submenu"))return t.stopPropagation(),!1}else if(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN)this.fromKeyDown=!0;else if(t.keyCode==Common.UI.Keys.ESC);else if(this.search&&t.keyCode>64&&t.keyCode<91&&t.key){var i=this;if(clearTimeout(this._search.timer),this._search.timer=setTimeout(function(){i._search={}},1e3),!this._search.text&&(this._search.text=""),!this._search.char&&(this._search.char=t.key),this._search.char!==t.key&&(this._search.full=!0),this._search.text+=t.key,void 0===this._search.index){var n=this.menuRoot.find("> li").find("> a");this._search.index=n.index(n.filter(":focus"))}this.selectCandidate()}},selectCandidate:function(){for(var t,e,i=this._search.index||0,n=new RegExp("^"+(this._search.full?this._search.text:this._search.char),"i"),o=0;o<this.items.length;o++){var s=this.items[o];if(n.test(s.caption)&&(t||(t=s,e=o),this._search.full&&o==i||o>i)){t=s,e=o;break}}if(t){this._search.index=e;var s=t.cmpEl.find("a");if(this.scroller){this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible});var a=s.position().top,l=s.height(),r=this.menuRoot.height();(a<0||a+l>r)&&this.menuRoot.scrollTop(this.menuRoot.scrollTop()+a+l-r/2)}s.focus()}},onItemClick:function(t,e){if(t.menu||(this.isOver=!1),t.options.stopPropagation){e.stopPropagation();var i=this;return void _.delay(function(){i.$el.parent().parent().find("[data-toggle=dropdown]").focus()},10)}this.trigger("item:click",this,t,e)},onItemToggle:function(t,e,i){this.trigger("item:toggle",this,t,e,i)},setOffset:function(t,e){this.offset[0]=_.isUndefined(t)?this.offset[0]:t,this.offset[1]=_.isUndefined(e)?this.offset[1]:e,this.alignPosition()},getOffset:function(){return this.offset},alignPosition:function(t,e){var i=this.menuRoot,n=this.menuAlignEl||i.parent(),o=this.menuAlign.match(/^([a-z]+)-([a-z]+)/),s=n.offset(),a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight()-10,r=i.outerWidth(),c=i.outerHeight(),h=n.outerWidth(),d=n.outerHeight(),p={tl:[0,0],bl:[0,c],tr:[r,0],br:[r,c]},m={tl:[0,0],tr:[h,0],bl:[0,d],br:[h,d]},u=s.left-p[o[1]][0]+m[o[2]][0]+this.offset[0],g=s.top-p[o[1]][1]+m[o[2]][1]+this.offset[1];u+r>a&&(u=n.is("li.dropdown-submenu")?s.left-r+2:a-r),this.options.restoreHeight?"number"==typeof this.options.restoreHeight&&(g+c>l?(i.css("max-height",l-g+"px"),!this.scroller&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),minScrollbarLength:30,suppressScrollX:!0,alwaysVisibleY:this.scrollAlwaysVisible}))):g+c<l&&i.height()<this.options.restoreHeight&&i.css("max-height",Math.min(l-g,this.options.restoreHeight)+"px")):(g+c>l&&(t&&"string"==typeof t?(o=t.match(/^([a-z]+)-([a-z]+)/),g=s.top-p[o[1]][1]+m[o[2]][1]+this.offset[1]+(e||0)):g=l-c),g<0&&(g=0)),this.options.additionalAlign?this.options.additionalAlign.call(this,i,u,g):i.css({left:Math.ceil(u),top:Math.ceil(g)})},clearAll:function(){_.each(this.items,function(t){t.setChecked&&t.setChecked(!1,!0)})}}),{Manager:function(){return t}()})}()}),define("spreadsheeteditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/component/Menu"],function(t,e,i,n){"use strict";SSE.Views.DocumentHolder=i.View.extend(e.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var t=this;this.setApi=function(e){return t.api=e,t}},render:function(){return this.fireEvent("render:before",this),this.cmpEl=t(this.el),this.fireEvent("render:after",this),this},focus:function(){var t=this;e.defer(function(){t.cmpEl.focus()},50)},createDelayedElementsViewer:function(){var t=this;t.menuViewCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.menuViewUndo=new Common.UI.MenuItem({caption:t.textUndo}),t.menuViewCopySeparator=new Common.UI.MenuItem({caption:"--"}),t.menuViewAddComment=new Common.UI.MenuItem({id:"id-context-menu-item-view-add-comment",caption:t.txtAddComment}),t.menuSignatureViewSign=new Common.UI.MenuItem({caption:this.strSign,value:0}),t.menuSignatureDetails=new Common.UI.MenuItem({caption:this.strDetails,value:1}),t.menuSignatureViewSetup=new Common.UI.MenuItem({caption:this.strSetup,value:2}),t.menuSignatureRemove=new Common.UI.MenuItem({caption:this.strDelete,value:3}),t.menuViewSignSeparator=new Common.UI.MenuItem({caption:"--"}),this.viewModeMenu=new Common.UI.Menu({items:[t.menuViewCopy,t.menuViewUndo,t.menuViewCopySeparator,t.menuSignatureViewSign,t.menuSignatureDetails,t.menuSignatureViewSetup,t.menuSignatureRemove,t.menuViewSignSeparator,t.menuViewAddComment]}),t.fireEvent("createdelayedelements",[t])},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}]})});var i=e.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div style="position: relative;"><div style="position: absolute; left: 0; width: 100px;"><%= caption %></div><label style="width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;cursor: pointer;"><%= options.exampleval ? options.exampleval : "" %></label></div></a>');t.pmiNumFormat=new Common.UI.MenuItem({caption:t.txtNumFormat,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.txtGeneral,template:i,checkable:!0,format:"General",exampleval:"100",value:Asc.c_oAscNumFormatType.General},{caption:this.txtNumber,template:i,checkable:!0,format:"0.00",exampleval:"100,00",value:Asc.c_oAscNumFormatType.Number},{caption:this.txtScientific,template:i,checkable:!0,format:"0.00E+00",exampleval:"1,00E+02",value:Asc.c_oAscNumFormatType.Scientific},{caption:this.txtAccounting,template:i,checkable:!0,format:'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',exampleval:"100,00 $",value:Asc.c_oAscNumFormatType.Accounting},{caption:this.txtCurrency,template:i,checkable:!0,format:"$#,##0.00",exampleval:"100,00 $",value:Asc.c_oAscNumFormatType.Currency},{caption:this.txtDate,template:i,checkable:!0,format:"MM-dd-yyyy",exampleval:"04-09-1900",value:Asc.c_oAscNumFormatType.Date},{caption:this.txtTime,template:i,checkable:!0,format:"HH:MM:ss",exampleval:"00:00:00",value:Asc.c_oAscNumFormatType.Time},{caption:this.txtPercentage,template:i,checkable:!0,format:"0.00%",exampleval:"100,00%",value:Asc.c_oAscNumFormatType.Percent},{caption:this.txtFraction,template:i,checkable:!0,format:"# ?/?",exampleval:"100",value:Asc.c_oAscNumFormatType.Fraction},{caption:this.txtText,template:i,checkable:!0,format:"@",exampleval:"100",value:Asc.c_oAscNumFormatType.Text},{caption:"--"},t.pmiAdvancedNumFormat=new Common.UI.MenuItem({caption:t.textMoreFormats,value:"advanced"})]})}),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.pmiNumFormat,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"}),t.menuSignatureEditSign=new Common.UI.MenuItem({caption:this.strSign,value:0}),t.menuSignatureEditSetup=new Common.UI.MenuItem({caption:this.strSetup,value:2}),t.menuEditSignSeparator=new Common.UI.MenuItem({caption:"--"}),t.menuImgOriginalSize=new Common.UI.MenuItem({caption:t.originalSizeText}),t.menuImgReplace=new Common.UI.MenuItem({caption:t.textReplace,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textFromFile,value:"file"}),new Common.UI.MenuItem({caption:this.textFromUrl,value:"url"})]})}),t.menuImgCrop=new Common.UI.MenuItem({caption:t.textCrop,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:t.textCrop,checkable:!0,allowDepress:!0,value:0}),new Common.UI.MenuItem({caption:t.textCropFill,value:1}),new Common.UI.MenuItem({caption:t.textCropFit,value:2})]})}),t.mnuBringToFront=new Common.UI.MenuItem({caption:this.textArrangeFront,iconCls:"mnu-arrange-front",type:"arrange",value:Asc.c_oAscDrawingLayerType.BringToFront}),t.mnuSendToBack=new Common.UI.MenuItem({caption:this.textArrangeBack,iconCls:"mnu-arrange-back",type:"arrange",value:Asc.c_oAscDrawingLayerType.SendToBack}),t.mnuBringForward=new Common.UI.MenuItem({caption:this.textArrangeForward,iconCls:"mnu-arrange-forward",type:"arrange",value:Asc.c_oAscDrawingLayerType.BringForward}),t.mnuSendBackward=new Common.UI.MenuItem({caption:this.textArrangeBackward,iconCls:"mnu-arrange-backward",type:"arrange",value:Asc.c_oAscDrawingLayerType.SendBackward}),t.menuImageArrange=new Common.UI.MenuItem({caption:t.textArrange,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.mnuBringToFront,t.mnuSendToBack,t.mnuBringForward,t.mnuSendBackward,{caption:"--"},t.mnuGroupImg,t.mnuUnGroupImg]})}),t.menuImageAlign=new Common.UI.MenuItem({caption:t.textAlign,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.textShapeAlignLeft,iconCls:"mnu-img-align-left",value:0},{caption:t.textShapeAlignCenter,iconCls:"mnu-img-align-center",value:4},{caption:t.textShapeAlignRight,iconCls:"mnu-img-align-right",value:1},{caption:t.textShapeAlignTop,iconCls:"mnu-img-align-top",value:3},{caption:t.textShapeAlignMiddle,iconCls:"mnu-img-align-middle",value:5},{caption:t.textShapeAlignBottom,iconCls:"mnu-img-align-bottom",value:2},{caption:"--"},{caption:t.txtDistribHor,iconCls:"mnu-distrib-hor",value:6},{caption:t.txtDistribVert,iconCls:"mnu-distrib-vert",value:7}]})}),t.menuImgRotate=new Common.UI.MenuItem({caption:t.textRotate,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:t.textRotate90,type:"rotate",value:1}),new Common.UI.MenuItem({caption:t.textRotate270,type:"rotate",value:0}),{caption:"--"},new Common.UI.MenuItem({caption:t.textFlipH,type:"flip",value:1}),new Common.UI.MenuItem({caption:t.textFlipV,type:"flip",value:0})]})}),this.imgMenu=new Common.UI.Menu({items:[t.pmiImgCut,t.pmiImgCopy,t.pmiImgPaste,{caption:"--"},t.menuSignatureEditSign,t.menuSignatureEditSetup,t.menuEditSignSeparator,t.menuImageArrange,t.menuImageAlign,t.menuImgRotate,t.mnuShapeSeparator,t.menuImgCrop,t.mnuChartEdit,t.mnuShapeAdvanced,t.menuImgOriginalSize,t.menuImgReplace,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.menuParagraphBullets=new Common.UI.MenuItem({caption:t.bulletsText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:e.template('<div id="id-docholder-menu-bullets" class="menu-layouts" style="width: 184px; margin: 0 4px;"></div>')},{caption:"--"},t.menuParagraphBulletNone=new Common.UI.MenuItem({caption:t.textNone,checkable:!0,checked:!1,value:-1})]})}),t.paraBulletsPicker={conf:{rec:null},store:new Common.UI.DataViewStore([{offsety:38,type:0,subtype:1},{offsety:76,type:0,subtype:2},{offsety:114,type:0,subtype:3},{offsety:152,type:0,subtype:4},{offsety:190,type:0,subtype:5},{offsety:228,type:0,subtype:6},{offsety:266,type:0,subtype:7},{offsety:684,type:0,subtype:8},{offsety:570,type:1,subtype:4},{offsety:532,type:1,subtype:5},{offsety:608,type:1,subtype:6},{offsety:418,type:1,subtype:1},{offsety:456,type:1,subtype:2},{offsety:494,type:1,subtype:3},{offsety:646,type:1,subtype:7}]),selectRecord:function(t){this.conf.rec=t}},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.menuParagraphBullets,t.menuAddHyperlinkShape,t.menuHyperlinkShape,{caption:"--"},t.pmiTextAdvanced]}),t.pmiCommonCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiCommonCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiCommonPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),this.copyPasteMenu=new Common.UI.Menu({items:[t.pmiCommonCut,t.pmiCommonCopy,t.pmiCommonPaste]}),this.entriesMenu=new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]}).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)}),t.fireEvent("createdelayedelements",[t])},setMenuItemCommentCaptionMode:function(t,e,i){t.setCaption(e?this.txtAddComment:i?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 Middle",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 Text Down",direct270Text:"Rotate Text Up",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",textNone:"None",bulletsText:"Bullets and Numbering",textUndo:"Undo",strSign:"Sign",strDetails:"Signature Details",strSetup:"Signature Setup",strDelete:"Remove Signature",originalSizeText:"Default Size",textReplace:"Replace image",textFromUrl:"From URL",textFromFile:"From File",txtNumFormat:"Number Format",txtGeneral:"General",txtNumber:"Number",txtScientific:"Scientific",txtAccounting:"Accounting",txtCurrency:"Currency",txtDate:"Date",txtTime:"Time",txtPercentage:"Percentage",txtFraction:"Fraction",txtText:"Text",textMoreFormats:"More formats",textShapeAlignLeft:"Align Left",textShapeAlignRight:"Align Right",textShapeAlignCenter:"Align Center",textShapeAlignTop:"Align Top",textShapeAlignBottom:"Align Bottom",textShapeAlignMiddle:"Align Middle",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",textRotate270:"Rotate 90° Counterclockwise",textRotate90:"Rotate 90° Clockwise",textFlipV:"Flip Vertically",textFlipH:"Flip Horizontally",textRotate:"Rotate",textArrange:"Arrange",textAlign:"Align",textCrop:"Crop",textCropFill:"Fill",textCropFit:"Fit"},SSE.Views.DocumentHolder||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboBox",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.ComboBoxModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),value:null,displayValue:null}}}),Common.UI.ComboBoxStore=Backbone.Collection.extend({model:Common.UI.ComboBoxModel}),Common.UI.ComboBox=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",hint:!1,editable:!0,disabled:!1,menuCls:"",menuStyle:"",displayField:"displayValue",valueField:"value",search:!1,scrollAlwaysVisible:!1},template:_.template(['<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control" spellcheck="false">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',"<% }); %>","</ul>","</span>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);this.id=e.options.id||Common.UI.getId(),this.cls=e.options.cls,this.style=e.options.style,this.menuCls=e.options.menuCls,this.menuStyle=e.options.menuStyle,this.template=e.options.template||e.template,this.itemsTemplate=e.options.itemsTemplate,this.hint=e.options.hint,this.editable=e.options.editable,this.disabled=e.options.disabled,this.store=e.options.store||new Common.UI.ComboBoxStore,this.displayField=e.options.displayField,this.valueField=e.options.valueField,this.search=e.options.search,this.scrollAlwaysVisible=e.options.scrollAlwaysVisible,e.rendered=e.options.rendered||!1,this.lastValue=null,e.store.add(e.options.data),e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered)this.cmpEl=$(this.el);else{var i=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:i,scope:e})),this.itemsTemplate&&this.cmpEl.find("ul").html($(this.itemsTemplate({items:i,scope:e}))),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)}if(!e.rendered){var n=this.cmpEl;if(this._input=n.find("input"),this._button=n.find(".btn"),n.on("click","a",_.bind(this.itemClicked,this)),n.on("mousedown","a",_.bind(this.itemMouseDown,this)),this.editable?(n.on("change","input",_.bind(this.onInputChanged,this)),n.on("keydown","input",_.bind(this.onInputKeyDown,this)),n.on("focusin","input",_.bind(this.onInputFocusIn,this)),n.on("click",".form-control",_.bind(this.onEditableInputClick,this))):(n.on("click",".form-control",_.bind(this.onInputClick,this)),this._input.attr("readonly","readonly"),this._input.attr("data-can-copy",!1)),e.options.hint){n.attr("data-toggle","tooltip"),n.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"});var o=n.closest(".asc-window");o.length>0&&n.data("bs.tooltip").tip().css("z-index",parseInt(o.css("z-index"))+10),n.find(".dropdown-menu").on("mouseenter",function(){var t=n.data("bs.tooltip");t&&(void 0===t.dontShow&&(t.dontShow=!0),t.hide())})}n.on("show.bs.dropdown",_.bind(e.onBeforeShowMenu,e)),n.on("shown.bs.dropdown",_.bind(e.onAfterShowMenu,e)),n.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),n.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e)),n.on("keydown.after.bs.dropdown",_.bind(e.onAfterKeydownMenu,e)),Common.NotificationCenter.on("menumanager:hideall",_.bind(e.closeMenu,e)),this.setDefaultSelection(),this.listenTo(this.store,"reset",this.onResetItems)}return e.rendered=!0,e.disabled&&e.setDisabled(e.disabled),this},setData:function(t){this.store.reset([]),this.store.add(t),this.setRawValue(""),this.onResetItems()},openMenu:function(t){var e=this;this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),_.delay(function(){e.cmpEl.addClass("open")},t||0)},closeMenu:function(){this.cmpEl.removeClass("open")},isMenuOpen:function(){return this.cmpEl.hasClass("open")},onBeforeShowMenu:function(t){if(this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),Common.NotificationCenter.trigger("menu:show"),this.trigger("show:before",this,t),this.options.hint){var e=this.cmpEl.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.hide())}},onAfterShowMenu:function(t){var e=$(this.el).find("ul"),i=e.find("> li.selected");if(i.length){var n=i.position().top,o=i.height(),s=e.height();(n<0||n+o>s)&&e.scrollTop(e.scrollTop()+n+o-s/2),setTimeout(function(){i.find("a").focus()},1)}this.scroller&&this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible}),this.trigger("show:after",this,t),this._search={}},onBeforeHideMenu:function(t){this.trigger("hide:before",this,t),Common.UI.Scroller.isMouseCapture()&&t.preventDefault()},onAfterHideMenu:function(t,e){this.cmpEl.find(".dropdown-toggle").blur(),this.trigger("hide:after",this,t,e),Common.NotificationCenter.trigger("menu:hide",this,e)},onAfterKeydownMenu:function(t){if(t.keyCode==Common.UI.Keys.RETURN){$(t.target).click();var e=this;return this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur()),!1}if(t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this.closeMenu(),this.onAfterHideMenu(t),!1;if(this.search&&t.keyCode>64&&t.keyCode<91&&t.key){var e=this;if(clearTimeout(this._search.timer),this._search.timer=setTimeout(function(){e._search={}},1e3),!this._search.text&&(this._search.text=""),!this._search.char&&(this._search.char=t.key),this._search.char!==t.key&&(this._search.full=!0),this._search.text+=t.key,void 0===this._search.index){var i=this.cmpEl.find("ul > li").find("> a");this._search.index=i.index(i.filter(":focus"))}this.selectCandidate()}},selectCandidate:function(){for(var t,e,i=this._search.index||0,n=new RegExp("^"+(this._search.full?this._search.text:this._search.char),"i"),o=0;o<this.store.length;o++){var s=this.store.at(o);if(n.test(s.get(this.displayField))&&(t||(t=s,e=o),this._search.full&&o==i||o>i)){t=s,e=o;break}}if(t){this._search.index=e;var s=$("#"+t.get("id")+" a",$(this.el));if(this.scroller){this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible});var a=$(this.el).find("ul"),l=s.position().top,r=s.height(),c=a.height();(l<0||l+r>c)&&a.scrollTop(a.scrollTop()+l+r-c/2)}s.focus()}},onInputKeyDown:function(t){var e=this;t.keyCode==Common.UI.Keys.ESC?(this.closeMenu(),this.onAfterHideMenu(t)):t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?(this.isMenuOpen()||this.openMenu(),_.delay(function(){e._skipInputChange=!0,e.cmpEl.find("ul li:first a").focus()},10)):t.keyCode==Common.UI.Keys.RETURN&&$(t.target).val()===e.lastValue?this._input.trigger("change",{reapply:!0}):e._skipInputChange=!1},onInputFocusIn:function(t){this.trigger("combo:focusin",this,t)},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));if(n[this.valueField]=i,this.trigger("changed:before",this,n,t),!t.isDefaultPrevented()){var o;this._selectedItem=this.store.findWhere((o={},o[this.displayField]=i,o)),this._selectedItem&&(n=this._selectedItem.toJSON(),$(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")),this.trigger("changed:after",this,n,t)}}},onInputClick:function(t){this._button&&this._button.dropdown("toggle"),t.preventDefault(),t.stopPropagation()},onEditableInputClick:function(t){if(this.options.hint){var e=this.cmpEl.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.hide())}this.isMenuOpen()&&1==t.which&&t.stopPropagation()},setDefaultSelection:function(){if(this.rendered){var t,e=this._input.val();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(t){this.disabled=t,this.rendered&&(t?this._input.attr("disabled",!0):this._input.removeAttr("disabled"),this.cmpEl.toggleClass("disabled",t),this._button.toggleClass("disabled",t))},isDisabled:function(){return this.disabled},setRawValue:function(t){this.rendered&&(this._input.val(t).trigger("change",{synthetic:!0}),this.lastValue=null!==t&&void 0!==t?t.toString():t)},getRawValue:function(){return this.rendered?this._input.val():null},setValue:function(t,e){if(this.rendered){var i;this._selectedItem=this.store.findWhere((i={},i[this.valueField]=t,i)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem?(this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")):this.setRawValue(void 0!==e?e:t)}},getValue:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?this._selectedItem.get(this.valueField):this._input.val():null},getDisplayValue:function(t){return Common.Utils.String.htmlEncode(t[this.displayField])},getSelectedRecord:function(){return this.rendered&&this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?_.extend({},this._selectedItem.toJSON()):null},selectRecord:function(t){this.rendered&&t&&(this._selectedItem=t,$(".selected",$(this.el)).removeClass("selected"),this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected"))},itemClicked:function(t){var e=$(t.target).closest("li");this._selectedItem=this.store.findWhere({id:e.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"),e.addClass("selected"),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault()),this._isMouseDownMenu=!1},itemMouseDown:function(t){if(1!=t.which)return t.preventDefault(),t.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) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',"<% }); %>"].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,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))}}}())}),function(t){var e=t.fn.tooltip;e.prototype=t.fn.tooltip.Constructor.prototype,t.extend(t.fn.tooltip.Constructor.DEFAULTS,{container:"body",delay:{show:500},arrow:!1});var i=function(t,e){this.init("tooltip",t,e)};i.prototype=t.extend({},t.fn.tooltip.Constructor.prototype,{constructor:i,init:function(){e.prototype.init.apply(this,arguments),"cursor"==this.options.placement&&/hover/.exec(this.options.trigger)&&this.$element.on("mousemove.tooltip",this.options.selector,t.proxy(this.mousemove,this)),this.options.zIndex&&this.tip().css("z-index",this.options.zIndex);var i=this;Common.NotificationCenter.on({"layout:changed":function(t){!i.options.hideonclick&&i.tip().is(":visible")&&i.hide()}})},mousemove:function(t){this.targetXY=[t.clientX*Common.Utils.zoom(),t.clientY*Common.Utils.zoom()]},leave:function(t){e.prototype.leave.apply(this,arguments),this.dontShow=void 0},show:function(i){if(this.hasContent()&&this.enabled&&!this.dontShow){if(!this.$element.is(":visible")&&this.$element.closest("[role=menu]").length>0)return;var n=this.tip();!1===this.options.arrow&&n.addClass("arrow-free"),this.options.cls&&n.addClass(this.options.cls);var o="function"!=typeof this.options.placement?/^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(this.options.placement):null;if(i||!o||o[2].length){var s=t.Event("show.bs.tooltip");if(this.$element.trigger(s),s.isDefaultPrevented())return;if(this.setContent(),this.options.animation&&n.addClass("fade"),n.detach().css({top:0,left:0,display:"block"}),this.options.container?n.appendTo(this.options.container):n.insertAfter(this.$element),"function"==typeof this.options.placement)this.options.placement.call(this,n[0],this.$element[0]);else if("object"==typeof i){var a={top:i[1]+15,left:i[0]+18},l=Common.Utils.innerWidth(),r=Common.Utils.innerHeight();a.left+n.width()>l&&(a.left=l-n.width()-30),a.top+n.height()>r&&(a.top=r-n.height()-30),n.offset(a).addClass("in")}else{var c=this.getPosition(),h=n[0].offsetWidth,d=n[0].offsetHeight;switch(o[1]){case"bottom":a={top:c.top+c.height+10};break;case"top":a={top:c.top-d-10}}switch(o[2]){case"left":a.left=c.left,this.$element.outerWidth()<=18&&(a.left-=4);break;case"right":a.left=c.left+c.width-h,this.$element.outerWidth()<=18&&(a.left+=4)}this.applyPlacement(a,o[1]),this.moveArrow(),n.addClass(o[1]).addClass(o[0])}this.$element.trigger("shown.bs.tooltip")}else e.prototype.show.apply(this,arguments);var p=this;clearTimeout(p.timeout),p.timeout=setTimeout(function(){"in"==p.hoverState&&p.hide(),p.dontShow=!1},5e3)}},moveArrow:function(){var t=this.tip().find(".tooltip-arrow, .arrow");switch(this.options.placement){case"top-left":case"bottom-left":t.css("left",10);break;case"top-right":case"bottom-right":t.css("right",10)}},enter:function(e){if("mouseenter"===e.type){var i=t(e.target);if(!(i.is("[role=menu]")||i.parentsUntil(e.currentTarget,"[role=menu]").length&&e.target!==e.currentTarget||this.tip().is(":visible"))){var n=e instanceof this.constructor?e:t(e.currentTarget)[this.type](this.getDelegateOptions()).data("bs.tooltip");clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show("cursor"==n.options.placement?n.targetXY:void 0)},n.options.delay.show):n.show()}}},replaceArrow:function(t,i,n){!1===this.options.arrow?this.arrow().hide():e.prototype.replaceArrow.apply(this,arguments)},getCalculatedOffset:function(t,i,n,o){var s=e.prototype.getCalculatedOffset.apply(this,arguments);if(this.options.offset>0||this.options.offset<0)switch(/(bottom|top)/.exec(t)[1]){case"bottom":s.top+=this.options.offset;break;case"top":s.top-=this.options.offset}return s}});var n=t.fn.tooltip;t.fn.tooltip=function(e){return this.each(function(){var n=t(this),o=n.data("bs.tooltip"),s="object"==typeof e&&e;o||n.data("bs.tooltip",o=new i(this,s)),"string"==typeof e&&o[e]()})},t.fn.tooltip.Constructor=i,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=n,this}}(window.jQuery),define("tip",function(){}),define("common/main/lib/component/Tooltip",["tip","backbone"],function(){"use strict";var t=function(t){this.$element=this.placement=void 0,this.init.call(this,t)};_.extend(t.prototype,Backbone.Events,{init:function(t){if(this.$element=t.owner instanceof Backbone.View?t.owner.$el:$(t.owner),this.placement=t.placement,this.$element.data("bs.tooltip")&&this.$element.removeData("bs.tooltip"),this.$element.tooltip({title:t.title,trigger:"manual",placement:t.placement,offset:t.offset,cls:t.cls,html:t.html,hideonclick:t.hideonclick}),t.hideonclick){var e=this.$element.data("bs.tooltip");e&&e.tip().on("click",function(){e.hide()})}this.$element.on("shown.bs.tooltip",_.bind(this.onTipShown,this)),this.$element.on("hidden.bs.tooltip",_.bind(this.onTipHidden,this))},show:function(t){this.getBSTip().show(t)},hide:function(t){this.getBSTip().hide(t)},setTitle:function(t){var e=this.getBSTip();e&&(e.options.title=t)},updateTitle:function(){var t=this.getBSTip();t.$tip.find(".tooltip-inner")[t.options.html?"html":"text"](t.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=t}),void 0===Common)var Common={};if(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,editable:!0},template:_.template(['<div class="input-field" style="<%= style %>">',"<input ",'type="<%= type %>" ','name="<%= name %>" ','spellcheck="<%= spellcheck %>" ','class="form-control <%= cls %>" ','placeholder="<%= placeHolder %>" ','value="<%= value %>"',">",'<span class="input-error"/>',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);this.id=e.options.id||Common.UI.getId(),this.cls=e.options.cls,this.style=e.options.style,this.value=e.options.value,this.type=e.options.type,this.name=e.options.name,this.validation=e.options.validation,this.allowBlank=e.options.allowBlank,this.placeHolder=e.options.placeHolder,this.template=e.options.template||e.template,this.editable=e.options.editable,this.disabled=e.options.disabled,this.spellcheck=e.options.spellcheck,this.blankError=e.options.blankError||"This field is required",this.validateOnChange=e.options.validateOnChange,this.validateOnBlur=e.options.validateOnBlur,this.maxLength=e.options.maxLength,e.rendered=e.options.rendered||!1,e.options.el&&e.render()},render:function(t){var e=this;if(e.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:e})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),!e.rendered){var i=this.cmpEl;if(this._input=this.cmpEl.find("input").addBack().filter("input"),this.editable&&(this._input.on("blur",_.bind(this.onInputChanged,this)),this._input.on("keypress",_.bind(this.onKeyPress,this)),this._input.on("keydown",_.bind(this.onKeyDown,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),this._input.closest(".asc-window").length>0)var n=function(){var t=i.find(".input-error").data("bs.tooltip");t&&t.tip().remove(),Common.NotificationCenter.off({"modal:close":n})};Common.NotificationCenter.on({"modal:close":n})}return e.rendered=!0,this},_doChange:function(t,e){if(!e||!e.synthetic){var i=$(t.target).val(),n=this.value;this.trigger("changed:before",this,i,n,t),t.isDefaultPrevented()||(this.value=i,this.validateOnBlur&&this.checkValidate(),this.trigger("changed:after",this,i,n,t))}},onInputChanged:function(t,e){this._doChange(t,e)},onInputChanging:function(t,e){var i=$(t.target).val(),n=this.value;t.isDefaultPrevented()||(this.value=i,this.validateOnBlur&&this.checkValidate(),this.trigger("changing",this,i,n,t))},onKeyPress:function(t){if(this.trigger("keypress:before",this,t),!t.isDefaultPrevented()){if(this.options.maskExp&&!_.isEmpty(this.options.maskExp.source)){var e=String.fromCharCode(t.which);this.options.maskExp.test(e)||t.ctrlKey||t.keyCode===Common.UI.Keys.RETURN||(t.preventDefault(),t.stopPropagation())}this.trigger("keypress:after",this,t)}},onKeyDown:function(t){this.trigger("keydown:before",this,t),t.isDefaultPrevented()||t.keyCode===Common.UI.Keys.RETURN&&this._doChange(t)},onKeyUp:function(t){this.trigger("keyup:before",this,t),t.isDefaultPrevented()||this.trigger("keyup:after",this,t)},setEditable:function(t){var e=this._input;this.editable=t,t&&e?(e.removeAttr("readonly"),e.removeAttr("data-can-copy")):(e.attr("readonly","readonly"),e.attr("data-can-copy",!1))},isEditable:function(){return this.editable},setDisabled:function(t){this.disabled=t,$(this.el).toggleClass("disabled",t),t?this._input.attr("disabled",!0):this._input.removeAttr("disabled")},isDisabled:function(){return this.disabled},setValue:function(t){this.value=t,this.rendered&&this._input.val(t)},getValue:function(){return this.value},focus:function(){this._input.focus()},checkValidate:function(){var t=this,e=[];if(!t.allowBlank&&_.isEmpty(t.value)&&e.push(t.blankError),_.isFunction(t.validation)){var i=t.validation.call(t,t.value);!0!==i&&(e=_.flatten(e.concat(i)))}if(!_.isEmpty(e)){if(t.cmpEl.hasClass("error")){var n=t.cmpEl.find(".input-error").data("bs.tooltip");return n&&(n.options.title=e.join("\n"),n.setContent()),e}t.cmpEl.addClass("error");var o=t.cmpEl.find(".input-error"),s=o.closest(".asc-window"),n=o.data("bs.tooltip");return n&&n.tip().remove(),o.attr("data-toggle","tooltip"),o.removeData("bs.tooltip"),o.tooltip({title:e.join("\n"),placement:"cursor"}),s.length>0&&o.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),e}return t.cmpEl.removeClass("error"),!0},showError:function(t){var e=this;if(_.isEmpty(t))e.cmpEl.removeClass("error");else{e.cmpEl.addClass("error");var i=e.cmpEl.find(".input-error"),n=i.closest(".asc-window"),o=i.data("bs.tooltip");o&&o.tip().remove(),i.attr("data-toggle","tooltip"),i.removeData("bs.tooltip"),i.tooltip({title:t.join("\n"),placement:"cursor"}),n.length>0&&i.data("bs.tooltip").tip().css("z-index",parseInt(n.css("z-index"))+10)}}}}())}),void 0===Common)var Common={};if(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(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box">','<div class="input-row" style="margin-bottom: 10px;">','<button type="button" class="btn btn-text-default auto" id="id-dlg-hyperlink-external" style="border-top-right-radius: 0;border-bottom-right-radius: 0;">',this.textExternalLink,"</button>",'<button type="button" class="btn btn-text-default auto" id="id-dlg-hyperlink-internal" style="border-top-left-radius: 0;border-bottom-left-radius: 0;">',this.textInternalLink,"</button>","</div>",'<div id="id-external-link">','<div class="input-row">',"<label>"+this.strLinkTo+" *</label>","</div>",'<div id="id-dlg-hyperlink-url" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div id="id-internal-link" class="hidden">','<div class="input-row">','<label style="width: 50%;">'+this.strSheet+"</label>",'<label style="width: 50%;">'+this.strRange+" *</label>","</div>",'<div class="input-row" style="margin-bottom: 5px;">','<div id="id-dlg-hyperlink-sheet" style="display: inline-block; width: 50%; padding-right: 10px; float: left;"></div>','<div id="id-dlg-hyperlink-range" style="display: inline-block; width: 50%;"></div>',"</div>","</div>",'<div class="input-row">',"<label>"+this.strDisplay+"</label>","</div>",'<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+this.textTipText+"</label>","</div>",'<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),this.api=this.options.api,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild(),e=this;e.btnExternal=new Common.UI.Button({el:$("#id-dlg-hyperlink-external"),enableToggle:!0,toggleGroup:"hyperlink-type",allowDepress:!1,pressed:!0}),e.btnExternal.on("click",_.bind(e.onLinkTypeClick,e,Asc.c_oAscHyperlinkType.WebLink)),e.btnInternal=new Common.UI.Button({el:$("#id-dlg-hyperlink-internal"),enableToggle:!0,toggleGroup:"hyperlink-type",allowDepress:!1}),e.btnInternal.on("click",_.bind(e.onLinkTypeClick,e,Asc.c_oAscHyperlinkType.RangeLink)),e.cmbSheets=new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-sheet"),cls:"input-group-nr",editable:!1,menuStyle:"min-width: 100%;max-height: 150px;"}),e.inputUrl=new Common.UI.InputField({el:$("#id-dlg-hyperlink-url"),allowBlank:!1,blankError:e.txtEmpty,validateOnBlur:!1,style:"width: 100%;",validation:function(t){var i=e.api.asc_getUrlType($.trim(t));return e.isEmail=2==i,i>0||e.txtNotUrl}}),e.inputRange=new Common.UI.InputField({el:$("#id-dlg-hyperlink-range"),allowBlank:!1,blankError:e.txtEmpty,style:"width: 100%;",validateOnChange:!0,validateOnBlur:!1,validation:function(t){return e.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.FormatTable,t,!1)==Asc.c_oAscError.ID.No||e.textInvalidRange}}),e.inputDisplay=new Common.UI.InputField({el:$("#id-dlg-hyperlink-display"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}),e.inputTip=new Common.UI.InputField({el:$("#id-dlg-hyperlink-tip"),style:"width: 100%;",maxLength:Asc.c_oAscMaxTooltipLength}),t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.externalPanel=t.find("#id-external-link"),e.internalPanel=t.find("#id-internal-link")},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.focusedInput&&t.focusedInput.focus()},50)},setSettings:function(t){if(t){var e=this;this.cmbSheets.setData(t.sheets);var i=t.props?t.props.asc_getType():Asc.c_oAscHyperlinkType.WebLink;i==Asc.c_oAscHyperlinkType.WebLink?e.btnExternal.toggle(!0):e.btnInternal.toggle(!0),e.ShowHideElem(i),e.btnInternal.setDisabled(!t.allowInternal&&i==Asc.c_oAscHyperlinkType.WebLink),e.btnExternal.setDisabled(!t.allowInternal&&i==Asc.c_oAscHyperlinkType.RangeLink),t.props?(i==Asc.c_oAscHyperlinkType.RangeLink?(this.cmbSheets.setValue(t.props.asc_getSheet()),this.inputRange.setValue(t.props.asc_getRange()),this.focusedInput=this.inputRange.cmpEl.find("input")):(this.inputUrl.setValue(t.props.asc_getHyperlinkUrl().replace(new RegExp(" ","g"),"%20")),this.focusedInput=this.inputUrl.cmpEl.find("input"),this.cmbSheets.setValue(t.currentSheet)),this.inputDisplay.setValue(t.isLock?this.textDefault:t.props.asc_getText()),this.inputTip.setValue(t.props.asc_getTooltip())):(this.inputDisplay.setValue(t.isLock?this.textDefault:t.text),this.focusedInput=this.inputUrl.cmpEl.find("input"),this.cmbSheets.setValue(t.currentSheet)),this.inputDisplay.setDisabled(t.isLock)}},getSettings:function(){var t=new Asc.asc_CHyperlink,e="";if(t.asc_setType(this.btnInternal.isActive()?Asc.c_oAscHyperlinkType.RangeLink:Asc.c_oAscHyperlinkType.WebLink),this.btnInternal.isActive())t.asc_setSheet(this.cmbSheets.getValue()),t.asc_setRange(this.inputRange.getValue()),e=this.cmbSheets.getValue()+"!"+this.inputRange.getValue();else{var i=this.inputUrl.getValue().replace(/^\s+|\s+$/g,"");/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(i)||(i=(this.isEmail?"mailto:":"http://")+i),i=i.replace(new RegExp("%20","g")," "),t.asc_setHyperlinkUrl(i),e=i}return this.inputDisplay.isDisabled()?t.asc_setText(null):(_.isEmpty(this.inputDisplay.getValue())&&this.inputDisplay.setValue(e),t.asc_setText(this.inputDisplay.getValue())),
|
|
|
t.asc_setTooltip(this.inputTip.getValue()),t},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){var e=!this.btnExternal.isActive()||this.inputUrl.checkValidate(),i=!this.btnInternal.isActive()||this.inputRange.checkValidate(),n=this.inputDisplay.checkValidate();if(!0!==e)return void this.inputUrl.cmpEl.find("input").focus();if(!0!==i)return void this.inputRange.cmpEl.find("input").focus();if(!0!==n)return void this.inputDisplay.cmpEl.find("input").focus()}this.options.handler.call(this,this,t)}this.close()},ShowHideElem:function(t){this.externalPanel.toggleClass("hidden",t!==Asc.c_oAscHyperlinkType.WebLink),this.internalPanel.toggleClass("hidden",t!==Asc.c_oAscHyperlinkType.RangeLink)},onLinkTypeClick:function(t,e,i){this.ShowHideElem(t)},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",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'<div id="id-adv-paragraph-indents" class="settings-panel active">\r\n <div class="inner-content">\r\n <div>\r\n <div class="padding-large" style="display: inline-block;">\r\n <label class="input-label"><%= scope.textAlign %></label>\r\n <div id="paragraphadv-spin-text-alignment"></div>\r\n </div>\r\n </div>\r\n <div style="padding-bottom: 4px;"><label class="header"><%= scope.strIndent %></label></div>\r\n <div>\r\n <div class="padding-large" style="display: inline-block;">\r\n <label class="input-label"><%= scope.strIndentsLeftText %></label>\r\n <div id="paragraphadv-spin-indent-left"></div>\r\n </div>\r\n <div class="padding-large" style="display: inline-block;">\r\n <label class="input-label"><%= scope.strIndentsRightText %></label>\r\n <div id="paragraphadv-spin-indent-right"></div>\r\n </div>\r\n <div class="padding-large" style="display: inline-block;">\r\n <div>\r\n <label class="input-label"><%= scope.strIndentsSpecial %></label>\r\n </div>\r\n <div>\r\n <div id="paragraphadv-spin-special" style="display: inline-block;"></div>\r\n <div id="paragraphadv-spin-special-by" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n </div>\r\n <div style="padding-bottom: 4px;"><label class="header"><%= scope.strSpacing %></label></div>\r\n <div>\r\n <div style="display: inline-block;">\r\n <label class="input-label"><%= scope.strIndentsSpacingBefore %></label>\r\n <div id="paragraphadv-spin-spacing-before"></div>\r\n </div>\r\n <div style="display: inline-block;">\r\n <label class="input-label"><%= scope.strIndentsSpacingAfter %></label>\r\n <div id="paragraphadv-spin-spacing-after"></div>\r\n </div>\r\n <div style="display: inline-block;">\r\n <div>\r\n <label class="input-label"><%= scope.strIndentsLineSpacing %></label>\r\n </div>\r\n <div>\r\n <div id="paragraphadv-spin-line-rule" style="display: inline-block;"></div>\r\n <div id="paragraphadv-spin-line-height" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="padding-large" style="padding-top: 16px; display: none;">\r\n <div style="border: 1px solid #cbcbcb; width: 350px;">\r\n <div id="paragraphadv-indent-preview" style="height: 80px; position: relative;"></div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-font" class="settings-panel">\r\n <div class="inner-content" style="width: 100%;">\r\n <div class="padding-small">\r\n <label class="header"><%= scope.textEffects %></label>\r\n </div>\r\n <div>\r\n <div class="padding-large" style="display: inline-block;">\r\n <div class="padding-small" id="paragraphadv-checkbox-strike"></div>\r\n <div class="padding-small" id="paragraphadv-checkbox-double-strike"></div>\r\n <div id="paragraphadv-checkbox-superscript"></div>\r\n </div>\r\n <div class="padding-large" style="display: inline-block; padding-left: 40px;">\r\n <div class="padding-small" id="paragraphadv-checkbox-subscript"></div>\r\n <div class="padding-small" id="paragraphadv-checkbox-small-caps"></div>\r\n <div id="paragraphadv-checkbox-all-caps"></div>\r\n </div>\r\n </div>\r\n <div class="padding-small">\r\n <label class="header"><%= scope.textCharacterSpacing %></label>\r\n </div>\r\n <div class="padding-large">\r\n <div style="display: inline-block;">\r\n <div id="paragraphadv-spin-spacing"></div>\r\n </div>\r\n </div>\r\n <div style="border: 1px solid #cbcbcb;">\r\n <div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative; margin: 0 auto;"></div>\r\n </div>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-tabs" class="settings-panel">\r\n <div class="inner-content">\r\n <div class="padding-large">\r\n <label class="input-label"><%= scope.textDefault %></label>\r\n <div id="paraadv-spin-default-tab"></div>\r\n\r\n </div>\r\n <div>\r\n <div class="padding-large" style="display: inline-block; margin-right: 9px;">\r\n <label class="input-label"><%= scope.textTabPosition %></label>\r\n <div id="paraadv-spin-tab"></div>\r\n </div>\r\n <div class="padding-large" style=" display: inline-block; margin-right: 9px;">\r\n <label class="input-label"><%= scope.textAlign %></label>\r\n <div id="paraadv-cmb-align"></div>\r\n </div>\r\n </div>\r\n <div>\r\n <div colspan=3 class="padding-large">\r\n <div id="paraadv-list-tabs" style="width:348px; height: 110px;"></div>\r\n </div>\r\n </div>\r\n <div>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textSet %></button>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textRemove %></button>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:108px;display: inline-block;"><%= scope.textRemoveAll %></button>\r\n </div>\r\n </div>\r\n</div>'}),define("common/main/lib/view/AdvancedSettingsWindow",["common/main/lib/component/Window"],function(){"use strict";Common.Views.AdvancedSettingsWindow=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{height:200,header:!0,cls:"advanced-settings-dlg",toggleGroup:"advanced-settings-group",contentTemplate:"",items:[]},t),this.template=t.template||['<div class="box" style="height:'+(e.height-85)+'px;">','<div class="menu-panel">',"<% _.each(items, function(item) { %>",'<button class="btn btn-category" content-target="<%= item.panelId %>"><span class=""><%= item.panelCaption %></span></button>',"<% }); %>","</div>",'<div class="separator"/>','<div class="content-panel" >'+e.contentTemplate+"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),e.tpl=_.template(this.template)(e),this.handler=e.handler,this.toggleGroup=e.toggleGroup,this.contentWidth=e.contentWidth,this.storageName=e.storageName,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this)),this.btnsCategory=[],_.each(e.find(".btn-category"),function(e,i){var n=$(e),o=new Common.UI.Button({el:n,enableToggle:!0,toggleGroup:t.toggleGroup,allowDepress:!1,contentTarget:n.attr("content-target")});o.on("click",_.bind(t.onCategoryClick,t)),t.btnsCategory.push(o)});var i=e.find(".content-panel"),n=e.find(".menu-panel");i.width(this.contentWidth),e.width((n.length>0?n.width():0)+i.outerWidth()+2),this.content_panels=e.find(".settings-panel"),this.btnsCategory.length>0&&this.btnsCategory[0].toggle(!0,!0),t.menuAddAlign=function(t,i,n){var o=this;e.hasClass("notransform")?(t.css({left:i,top:n}),o.options.additionalAlign=null):(e.addClass("notransform"),t.addClass("hidden"),setTimeout(function(){t.removeClass("hidden"),t.css({left:i,top:n}),o.options.additionalAlign=null},300))}},setHeight:function(t){Common.UI.Window.prototype.setHeight.call(this,t),this.getChild().find(".body > .box").css("height",t-85)},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0)||this.close()},onCategoryClick:function(t,e){this.content_panels.filter(".active").removeClass("active"),$("#"+t.options.contentTarget).addClass("active")},getSettings:function(){},onPrimary:function(){if(!this.handler||!this.handler.call(this,"ok",this.getSettings()))return this.close(),!1},setActiveCategory:function(t){if(!(this.btnsCategory.length<1)){var e=this.btnsCategory[t>=0&&t<this.btnsCategory.length?t:0];if(!e.isVisible()||e.isDisabled())for(var i=0;i<this.btnsCategory.length;i++){var n=this.btnsCategory[i];if(n.isVisible()&&!n.isDisabled()){e=n;break}}e.toggle(!0),this.onCategoryClick(e)}},getActiveCategory:function(){var t=-1;return this.btnsCategory.forEach(function(e,i){e.pressed&&(t=i)}),t},close:function(t){this.storageName&&Common.localStorage.setItem(this.storageName,this.getActiveCategory()),Common.UI.Window.prototype.close.call(this,t)},cancelButtonText:"Cancel",okButtonText:"Ok"},Common.Views.AdvancedSettingsWindow||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/MetricSpinner",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MetricSpinner=Common.UI.BaseView.extend({options:{minValue:0,maxValue:100,step:1,defaultUnit:"px",allowAuto:!1,autoText:"Auto",hold:!0,speed:"medium",width:90,allowDecimal:!0},disabled:!1,value:"0 px",rendered:!1,template:'<input type="text" class="form-control" spellcheck="false"><div class="spinner-buttons"><button type="button" class="spinner-up"><i class="img-commonctrl"></i></button><button type="button" class="spinner-down"><i class="img-commonctrl"></i></button></div>',initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=$(this.el);e.addClass("spinner"),e.on("mousedown",".spinner-up",_.bind(this.onMouseDown,this,!0)),e.on("mousedown",".spinner-down",_.bind(this.onMouseDown,this,!1)),e.on("mouseup",".spinner-up",_.bind(this.onMouseUp,this,!0)),e.on("mouseup",".spinner-down",_.bind(this.onMouseUp,this,!1)),e.on("mouseover",".spinner-up, .spinner-down",_.bind(this.onMouseOver,this)),e.on("mouseout",".spinner-up, .spinner-down",_.bind(this.onMouseOut,this)),e.on("keydown",".form-control",_.bind(this.onKeyDown,this)),e.on("keyup",".form-control",_.bind(this.onKeyUp,this)),e.on("blur",".form-control",_.bind(this.onBlur,this)),e.on("input",".form-control",_.bind(this.onInput,this)),this.options.allowDecimal||e.on("keypress",".form-control",_.bind(this.onKeyPress,this)),this.switches={count:1,enabled:!0,fromKeyDown:!1},"medium"===this.options.speed?this.switches.speed=300:"fast"===this.options.speed?this.switches.speed=100:this.switches.speed=500,this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),void 0!==this.options.value&&(this.value=this.options.value),this.setRawValue(this.value),this.options.width&&$(this.el).width(this.options.width),void 0===this.options.defaultValue&&(this.options.defaultValue=this.options.minValue),this.oldValue=this.options.minValue,this.lastValue=null},render:function(){var t=$(this.el);return t.html(this.template),this.$input=t.find(".form-control"),this.rendered=!0,void 0!=this.options.tabindex&&this.$input.attr("tabindex",this.options.tabindex),this},setDisabled:function(t){var e=$(this.el);t!==this.disabled&&(e.find("button").toggleClass("disabled",t),e.toggleClass("disabled",t),t?this.$input.attr({disabled:t}):this.$input.removeAttr("disabled")),this.disabled=t},isDisabled:function(){return this.disabled},setDefaultUnit:function(t){if(this.options.defaultUnit!=t){var e=this.options.defaultUnit;this.options.defaultUnit=t,this.setMinValue(this._recalcUnits(this.options.minValue,e)),this.setMaxValue(this._recalcUnits(this.options.maxValue,e)),this.setValue(this._recalcUnits(this.getNumberValue(),e),!0)}},setMinValue:function(t){this.options.minValue=t},setMaxValue:function(t){this.options.maxValue=t},setStep:function(t){this.options.step=t},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(t){this.$input&&this.$input.val(t)},getRawValue:function(){return this.$input.val()},setValue:function(t,e){var i=!1;if(this._fromKeyDown=!1,this.lastValue=this.value,void 0===t||""===t)this.value="";else if(this.options.allowAuto&&(Math.abs(parseFloat(t)+1)<1e-4||t==this.options.autoText))this.value=this.options.autoText;else{var n=this._add(parseFloat(t),0,this.options.allowDecimal?3:0);(void 0===t||isNaN(n))&&(n=this.oldValue,i=!0);var o=this.options.defaultUnit;if(void 0!==t.match){var s=t.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i);null!==s&&"undefined"!==s[0]&&(o=s[0].toLowerCase())}this.options.defaultUnit===o||i||(n=this._recalcUnits(n,o)),n>this.options.maxValue&&(n=this.options.maxValue,i=!0),n<this.options.minValue&&(n=this.options.minValue,i=!0),this.value=(n+" "+this.options.defaultUnit).trim(),this.oldValue=n}!0!==e&&this.lastValue!==this.value&&this.trigger("change",this,this.value,this.lastValue),!0!==e&&i&&this.trigger("inputerror",this,this.value),this.rendered?this.setRawValue(this.value):this.options.value=this.value},setMask:function(t){this.options.maskExp=t},onMouseDown:function(t,e){this.disabled||(e&&$(e.currentTarget).addClass("active"),this.options.hold&&(this.switches.fromKeyDown=!1,this._startSpin(t,e)))},onMouseUp:function(t,e){this.disabled||($(e.currentTarget).removeClass("active"),this.options.hold?this._stopSpin():this._step(t))},onMouseOver:function(t){this.disabled||$(t.currentTarget).addClass("over")},onMouseOut:function(t){this.disabled||($(t.currentTarget).removeClass("active over"),this.options.hold&&this._stopSpin())},onKeyDown:function(t){if(!this.disabled)if(!this.options.hold||t.keyCode!=Common.UI.Keys.UP&&t.keyCode!=Common.UI.Keys.DOWN)if(t.keyCode==Common.UI.Keys.RETURN)if(this.options.defaultUnit&&this.options.defaultUnit.length){var e=this.getRawValue();if(this.value!=e)return this.onEnterValue(),this.value==e}else this.onEnterValue();else this._fromKeyDown=!0;else t.preventDefault(),t.stopPropagation(),void 0===this.switches.timeout&&(this.switches.fromKeyDown=!0,this._startSpin(t.keyCode==Common.UI.Keys.UP,t))},onKeyUp:function(t){this.disabled||t.keyCode!=Common.UI.Keys.UP&&t.keyCode!=Common.UI.Keys.DOWN||(t.stopPropagation(),t.preventDefault(),this.options.hold?this._stopSpin():this._step(t.keyCode==Common.UI.Keys.UP))},onKeyPress:function(t){if(!this.disabled){var e=String.fromCharCode(t.charCode);"."==e||","==e?(t.preventDefault(),t.stopPropagation()):!this.options.maskExp||this.options.maskExp.test(e)||t.ctrlKey||t.keyCode===Common.UI.Keys.RETURN||(t.preventDefault(),t.stopPropagation())}},onInput:function(t,e){this.disabled||t.isDefaultPrevented()||this.trigger("changing",this,$(t.target).val(),t)},onEnterValue:function(){if(this.$input){var t=this.getRawValue();this.setValue(""===t?this.value:t),this.trigger("entervalue",this)}},onBlur:function(t){if(this.$input){var e=this.getRawValue();this.setValue(""===e?this.value:e),this.options.hold&&this.switches.fromKeyDown&&this._stopSpin()}},_startSpin:function(t,e){if(!this.disabled){var i=this.switches.count;1===i?(this._step(t,!0),i=1):i=i<3?1.5:i<8?2.5:6,this.switches.timeout=setTimeout($.proxy(function(){this._step(t,!0),this._startSpin(t)},this),this.switches.speed/i),this.switches.count++}},_stopSpin:function(t){void 0!==this.switches.timeout&&(clearTimeout(this.switches.timeout),this.switches.timeout=void 0,this.switches.count=1,this.trigger("change",this,this.value,this.lastValue))},_increase:function(t){var e=this;if(!e.readOnly){var i=e.options.step;e._fromKeyDown?(i=this.getRawValue(),i=_.isEmpty(i)?e.oldValue:parseFloat(i)):""!==e.getValue()?(i=e.options.allowAuto&&e.getValue()==e.options.autoText?e.options.minValue-e.options.step:parseFloat(e.getValue()),isNaN(i)&&(i=this.oldValue)):i=e.options.defaultValue-e.options.step,e.setValue((this._add(i,e.options.step,e.options.allowDecimal?3:0)+" "+this.options.defaultUnit).trim(),t)}},_decrease:function(t){var e=this;if(!e.readOnly){var i=e.options.step;if(e._fromKeyDown)i=this.getRawValue(),i=_.isEmpty(i)?e.oldValue:parseFloat(i);else if(""!==e.getValue()){if(i=e.options.allowAuto&&e.getValue()==e.options.autoText?e.options.minValue:parseFloat(e.getValue()),isNaN(i)&&(i=this.oldValue),e.options.allowAuto&&this._add(i,-e.options.step,e.options.allowDecimal?3:0)<e.options.minValue)return void e.setValue(e.options.autoText,!0)}else i=e.options.defaultValue;e.setValue((this._add(i,-e.options.step,e.options.allowDecimal?3:0)+" "+this.options.defaultUnit).trim(),t)}},_step:function(t,e){t?this._increase(e):this._decrease(e)},_add:function(t,e,i){var n=Math.pow(10,i||this.options.allowDecimal?2:0);return(Math.round(t*n)+Math.round(e*n))/n},_recalcUnits:function(t,e){if(e.match(/(s|ms|сек|мс)$/i)&&this.options.defaultUnit.match(/(s|ms|сек|мс)$/i)){var i=t;return"ms"!=e&&"мс"!=e||(i=parseFloat((i/1e3).toFixed(6))),"ms"!=this.options.defaultUnit&&"мс"!=this.options.defaultUnit||(i=parseFloat((1e3*i).toFixed(6))),i}if(null===e.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)||null===this.options.defaultUnit.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i))return t;var i=t;return"cm"==e||"см"==e?i*=10:"pt"==e||"пт"==e?i=25.4*i/72:'"'==e?i*=25.4:"pc"==e&&(i=25.4*i/6),"cm"==this.options.defaultUnit||"см"==this.options.defaultUnit?i=parseFloat((i/10).toFixed(6)):"pt"==this.options.defaultUnit||"пт"==this.options.defaultUnit?i=parseFloat((72*i/25.4).toFixed(3)):'"'==this.options.defaultUnit?i=parseFloat((i/25.4).toFixed(3)):"pc"==this.options.defaultUnit&&(i=parseFloat((6*i/25.4).toFixed(6))),i}}),Common.UI.CustomSpinner=Common.UI.MetricSpinner.extend(_.extend({initialize:function(t){this.options.toCustomFormat=t.toCustomFormat?t.toCustomFormat:function(t){return t},this.options.fromCustomFormat=t.fromCustomFormat?t.fromCustomFormat:function(t){return t},Common.UI.MetricSpinner.prototype.initialize.call(this,t)},setRawValue:function(t){this.$input&&this.$input.val(this.options.toCustomFormat(t))},getRawValue:function(){return this.options.fromCustomFormat(this.$input.val())}},Common.UI.CustomSpinner||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/CheckBox",["common/main/lib/component/BaseView","underscore"],function(t,e){"use strict";Common.UI.CheckBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,indeterminate:!1,checked:!1,value:"unchecked",template:e.template('<label class="checkbox-indeterminate"><input type="button" class="img-commonctrl"><span><%= labelText %></span></label>'),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.options.el&&this.render()},render:function(t){var i=this,n=$(this.el);return i.rendered||(t?(this.setElement(t,!1),t.html(this.template({labelText:this.options.labelText})),n=$(this.el)):n.html(this.template({labelText:this.options.labelText})),this.$chk=n.find("input[type=button]"),this.$label=n.find("label"),this.$chk.on("click",e.bind(this.onItemCheck,this))),this.rendered=!0,this.options.disabled&&this.setDisabled(this.options.disabled),void 0!==this.options.value&&this.setValue(this.options.value,!0),this},setDisabled:function(t){this.rendered&&(t=!0===t,t!==this.disabled&&(this.$label.toggleClass("disabled",t),t?this.$chk.attr({disabled:t}):this.$chk.removeAttr("disabled")),this.disabled=t)},isDisabled:function(){return this.disabled},onItemCheck:function(t){this.disabled||(this.indeterminate?(this.indeterminate=!1,this.setValue(!1)):this.setValue(!this.checked))},setRawValue:function(t){this.checked=!0===t||"true"===t||"1"===t||1===t||"checked"===t,this.indeterminate="indeterminate"===t,this.$chk.toggleClass("checked",this.checked),this.$chk.toggleClass("indeterminate",this.indeterminate),this.value=this.indeterminate?"indeterminate":this.checked?"checked":"unchecked"},setValue:function(t,e){this.rendered?(this.lastValue=this.value,this.setRawValue(t),!0!==e&&this.lastValue!==t&&this.trigger("change",this,this.value,this.lastValue)):this.options.value=t},getValue:function(){return this.value},isChecked:function(){return this.checked},setCaption:function(t){this.$label.find("span").text(t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/RadioBox",["common/main/lib/component/BaseView","underscore"],function(t,e){"use strict";Common.UI.RadioBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,template:e.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><%= labelText %></label>'),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);$(this.el);this.name=this.options.name||Common.UI.getId(),this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),void 0!==this.options.checked&&this.setValue(this.options.checked,!0),this.$radio.on("click",e.bind(this.onItemCheck,this))},render:function(){var t=$(this.el);return t.html(this.template({labelText:this.options.labelText,name:this.name})),this.$radio=t.find("input[type=button]"),this.rendered=!0,this},setDisabled:function(t){this.rendered&&(t!==this.disabled&&(this.$radio.toggleClass("disabled",t),t?this.$radio.attr({disabled:t}):this.$radio.removeAttr("disabled")),this.disabled=t)},isDisabled:function(){return this.disabled},onItemCheck:function(t){this.disabled||this.setValue(!0)},setRawValue:function(t){var t=!0===t||"true"===t||"1"===t||1===t;$("input[type=button][name="+this.name+"]").removeClass("checked"),this.$radio.toggleClass("checked",t)},setValue:function(t,e){if(this.rendered){var i=this.$radio.hasClass("checked");this.setRawValue(t),!0!==e&&i!==t&&this.trigger("change",this,this.$radio.hasClass("checked"))}else this.options.checked=t},getValue:function(){return this.$radio.hasClass("checked")}})}),void 0===Common)var Common={};if(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:void 0}}}),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(['<div id="<%= id %>"><%= value %></div>'].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.template=e.options.template||e.template,e.listenTo(e.model,"change",e.render),e.listenTo(e.model,"change:selected",e.onSelectChange),e.listenTo(e.model,"remove",e.remove)},render:function(){if(_.isUndefined(this.model.id))return this;var t=$(this.el);t.html(this.template(this.model.toJSON())),t.addClass("item"),t.toggleClass("selected",this.model.get("selected")&&this.model.get("allowSelected")),t.off("click dblclick contextmenu"),t.on({click:_.bind(this.onClick,this),dblclick:_.bind(this.onDblClick,this),contextmenu:_.bind(this.onContextMenu,this)}),t.toggleClass("disabled",!!this.model.get("disabled")),_.isUndefined(this.model.get("cls"))||t.addClass(this.model.get("cls"));var e=t.data("bs.tooltip");return e&&void 0===e.dontShow&&t.is(":hover")&&(e.dontShow=!0),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(t){if(this.model.get("disabled"))return!1;this.trigger("click",this,this.model,t)},onDblClick:function(t){if(this.model.get("disabled"))return!1;this.trigger("dblclick",this,this.model,t)},onContextMenu:function(t){this.trigger("contextmenu",this,this.model,t)},onSelectChange:function(t,e){this.trigger("select",this,t,e)}}),Common.UI.DataView=Common.UI.BaseView.extend({options:{multiSelect:!1,handleSelect:!0,enableKeyEvents:!0,keyMoveDirection:"both",restoreHeight:0,emptyText:"",listenStoreEvents:!0,allowScrollbar:!0,scrollAlwaysVisible:!1,showLast:!0,useBSKeydown:!1},template:_.template(['<div class="dataview inner" style="<%= style %>">',"<% _.each(groups, function(group) { %>","<% if (group.headername !== undefined) { %>",'<div class="header-name"><%= group.headername %></div>',"<% } %>",'<div class="grouped-data <% if (group.inline) { %> inline <% } %> <% if (!_.isEmpty(group.caption)) { %> margin <% } %>" id="<%= group.id %>">',"<% if (!_.isEmpty(group.caption)) { %>",'<div class="group-description">',"<span><%= group.caption %></span>","</div>","<% } %>",'<div class="group-items-container">',"</div>","</div>","<% }); %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.template=e.options.template||e.template,e.store=e.options.store||new Common.UI.DataViewStore,e.groups=e.options.groups||null,e.itemTemplate=e.options.itemTemplate||null,e.multiSelect=e.options.multiSelect,e.handleSelect=e.options.handleSelect,e.parentMenu=e.options.parentMenu,e.enableKeyEvents=e.options.enableKeyEvents,e.useBSKeydown=e.options.useBSKeydown,e.showLast=e.options.showLast,e.style=e.options.style||"",e.emptyText=e.options.emptyText||"",e.listenStoreEvents=void 0===e.options.listenStoreEvents||e.options.listenStoreEvents,e.allowScrollbar=void 0===e.options.allowScrollbar||e.options.allowScrollbar,e.scrollAlwaysVisible=e.options.scrollAlwaysVisible||!1,e.parentMenu&&(e.parentMenu.options.restoreHeight=e.options.restoreHeight>0),e.rendered=!1,e.dataViewItems=[],"vertical"==e.options.keyMoveDirection?e.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN]:"horizontal"==e.options.keyMoveDirection?e.moveKeys=[Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT]:e.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN,Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT],e.options.el&&e.render()},render:function(t){var e=this;this.trigger("render:before",this),this.cmpEl=$(this.el),t?(this.setElement(t,!1),this.cmpEl=$(this.template({groups:e.groups?e.groups.toJSON():null,style:e.style})),t.html(this.cmpEl)):this.cmpEl.html(this.template({groups:e.groups?e.groups.toJSON():null,style:e.style}));var i=this.cmpEl.closest(".asc-window");return i.length<1&&(i=this.cmpEl.closest('[id^="menu-container-"]')),i.length>0&&(this.tipZIndex=parseInt(i.css("z-index"))+10),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&&(e.showLast||this.parentMenu.on("show:before",function(t){e.deselectAll()}),this.parentMenu.on("show:after",function(t){e.showLast&&e.showLastSelected(),Common.NotificationCenter.trigger("dataview:focus"),_.delay(function(){t.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").addBack().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible})),this.rendered=!0,this.cmpEl.on("click",function(t){if(/dataview/.test(t.target.className))return!1}),this.trigger("render:after",this),this},setStore:function(t){t&&(this.stopListening(this.store),this.store=t,this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)))},selectRecord:function(t,e){if(this.handleSelect)return e&&this.suspendEvents(),this.multiSelect?t&&t.set({selected:!t.get("selected")}):(_.each(this.store.where({selected:!0}),function(t){t.set({selected:!1})}),t&&t.set({selected:!0})),e&&this.resumeEvents(),t},selectByIndex:function(t,e){if(this.store.length>0&&t>-1&&t<this.store.length)return this.selectRecord(this.store.at(t),e)},deselectAll:function(t){t&&this.suspendEvents(),_.each(this.store.where({selected:!0}),function(t){t.set({selected:!1})}),t&&this.resumeEvents()},getSelectedRec:function(){return this.multiSelect?this.store.where({selected:!0}):this.store.findWhere({selected:!0})},onAddItem:function(t,e,i){var n=new Common.UI.DataViewItem({template:this.itemTemplate,model:t});if(n){var o=$(this.el).find(".inner").addBack().filter(".inner");if(this.groups&&this.groups.length>0){var s=this.groups.findWhere({id:t.get("group")});s&&(o=o.find("#"+s.id+" .group-items-container"))}if(o){i&&0==i.at?o.prepend(n.render().el):o.append(n.render().el),this.dataViewItems.length<1&&o.find(".empty-text").remove();var a=_.indexOf(this.store.models,t);if(this.dataViewItems=this.dataViewItems.slice(0,a).concat(n).concat(this.dataViewItems.slice(a)),t.get("tip")){var l=$(n.el);l.attr("data-toggle","tooltip"),l.tooltip({title:t.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}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.listenTo(n,"contextmenu",this.onContextMenuItem),this.isSuspendEvents||this.trigger("item:add",this,n,t)}}},onResetItems:function(){_.each(this.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.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").addBack().filter(".inner").append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>"),_.each(this.dataViewItems,function(t){this.stopListening(t),t.stopListening(t.model)},this),this.dataViewItems=[],this.store.each(this.onAddItem,this),this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").addBack().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible})),this.disabled&&this.setDisabled(this.disabled),this.attachKeyEvents(),this.lastSelectedRec=null,this._layoutParams=void 0},onChangeItem:function(t,e){this.isSuspendEvents||this.trigger("item:change",this,t,e)},onRemoveItem:function(t,e){var i=t.$el.data("bs.tooltip");if(i&&(void 0===i.dontShow&&(i.dontShow=!0),i.tip().remove()),this.stopListening(t),t.stopListening(),this.store.length<1&&this.emptyText.length>0){var n=$(this.el).find(".inner").addBack().filter(".inner");n.find(".empty-text").length<=0&&n.append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>")}for(var o=0;o<this.dataViewItems.length;o++)if(_.isEqual(t,this.dataViewItems[o])){this.dataViewItems.splice(o,1);break}this.isSuspendEvents||this.trigger("item:remove",this,t,e)},onClickItem:function(t,e,i){if(!this.disabled){window._event=i,this.showLast&&this.selectRecord(e),this.lastSelectedRec=null;var n=t.$el.data("bs.tooltip");n&&n.tip().remove(),this.isSuspendEvents||this.trigger("item:click",this,t,e,i)}},onDblClickItem:function(t,e,i){this.disabled||(window._event=i,this.showLast&&this.selectRecord(e),this.lastSelectedRec=null,this.isSuspendEvents||this.trigger("item:dblclick",this,t,e,i))},onSelectItem:function(t,e,i){this.isSuspendEvents||this.trigger(i?"item:select":"item:deselect",this,t,e,this._fromKeyDown)},onContextMenuItem:function(t,e,i){this.isSuspendEvents||this.trigger("item:contextmenu",this,t,e,i)},scrollToRecord:function(t){if(t){var e=$(this.el).find(".inner"),i=e.offset().top,n=_.indexOf(this.store.models,t),o=n>=0&&this.dataViewItems.length>n?$(this.dataViewItems[n].el):e.find("#"+t.get("id"));if(!(o.length<=0)){var s=o.offset().top,a=$(this.dataViewItems[0].el),l=a.length>0?a[0].offsetTop:0;(s<i+l||s+o.outerHeight()>i+e.height())&&(this.scroller&&this.allowScrollbar?this.scroller.scrollTop(e.scrollTop()+s-i-l,0):e.scrollTop(e.scrollTop()+s-i-l))}}},onKeyDown:function(t,e){if(!this.disabled)if(void 0===e&&(e=t),_.indexOf(this.moveKeys,e.keyCode)>-1||e.keyCode==Common.UI.Keys.RETURN){e.preventDefault(),e.stopPropagation();var i=this.getSelectedRec();if(null===this.lastSelectedRec&&(this.lastSelectedRec=i),e.keyCode==Common.UI.Keys.RETURN)this.lastSelectedRec=null,this.selectedBeforeHideRec&&(i=this.selectedBeforeHideRec),this.trigger("item:click",this,this,i,t),this.trigger("item:select",this,this,i,t),this.trigger("entervalue",this,i,t),this.parentMenu&&this.parentMenu.hide();else{var n=_.indexOf(this.store.models,i);if(n<0)if(e.keyCode==Common.UI.Keys.LEFT){var o=$(t.target).closest(".dropdown-submenu.over");o.length>0?(o.removeClass("over"),o.find("> a").focus()):n=0}else n=0;else if("both"==this.options.keyMoveDirection){void 0===this._layoutParams&&this.fillIndexesArray();var s=this.dataViewItems[n].topIdx,a=this.dataViewItems[n].leftIdx;if(n=void 0,e.keyCode==Common.UI.Keys.LEFT)for(;void 0===n;){if(--a<0){var o=$(t.target).closest(".dropdown-submenu.over");if(o.length>0){o.removeClass("over"),o.find("> a").focus();break}a=this._layoutParams.columns-1}n=this._layoutParams.itemsIndexes[s][a]}else if(e.keyCode==Common.UI.Keys.RIGHT)for(;void 0===n;)a++,a>this._layoutParams.columns-1&&(a=0),n=this._layoutParams.itemsIndexes[s][a];else if(e.keyCode==Common.UI.Keys.UP)for(;void 0===n;)s--,s<0&&(s=this._layoutParams.rows-1),n=this._layoutParams.itemsIndexes[s][a];else for(;void 0===n;)s++,s>this._layoutParams.rows-1&&(s=0),n=this._layoutParams.itemsIndexes[s][a]}else n=e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.LEFT?Math.max(0,n-1):Math.min(this.store.length-1,n+1);void 0!==n&&n>=0&&(i=this.store.at(n)),i&&(this._fromKeyDown=!0,this.selectRecord(i),this._fromKeyDown=!1,this.scrollToRecord(i))}}else this.trigger("item:keydown",this,i,t)},attachKeyEvents:function(){if(this.enableKeyEvents&&this.handleSelect){var t=$(this.el).find(".inner").addBack().filter(".inner");t.addClass("canfocused"),t.attr("tabindex","0"),t.on(this.parentMenu&&this.useBSKeydown?"dataview:keydown":"keydown",_.bind(this.onKeyDown,this))}},showLastSelected:function(){this.lastSelectedRec?(this.selectRecord(this.lastSelectedRec,!0),this.scrollToRecord(this.lastSelectedRec),this.lastSelectedRec=null):this.scrollToRecord(this.getSelectedRec())},setDisabled:function(t){this.disabled=t,$(this.el).find(".inner").addBack().filter(".inner").toggleClass("disabled",t)},isDisabled:function(){return this.disabled},setEmptyText:function(t){this.emptyText=t},alignPosition:function(){var t="menu"===this.parentMenu.cmpEl.attr("role")?this.parentMenu.cmpEl:this.parentMenu.cmpEl.find("[role=menu]"),e=Common.Utils.innerHeight()-10,i=$(this.el).find(".inner").addBack().filter(".inner"),n=i.parent(),o=parseInt(n.css("margin-top"))+parseInt(n.css("margin-bottom"))+parseInt(t.css("margin-top")),s=parseInt(t.css("padding-top"))+parseInt(t.css("padding-bottom")),a=t.outerHeight(),l=parseInt(t.css("top")),r={minScrollbarLength:40};this.scrollAlwaysVisible&&(r.alwaysVisibleY=this.scrollAlwaysVisible),l+a>e?(i.css("max-height",e-l-s-o+"px"),this.allowScrollbar&&this.scroller.update(r)):l+a<e&&i.height()<this.options.restoreHeight&&(i.css("max-height",Math.min(e-l-s-o,this.options.restoreHeight)+"px"),this.allowScrollbar&&this.scroller.update(r))},fillIndexesArray:function(){if(!(this.dataViewItems.length<=0)){this._layoutParams={itemsIndexes:[],columns:0,rows:0};for(var t=$(this.dataViewItems[0].el),e=t.outerWidth()+parseInt(t.css("margin-left"))+parseInt(t.css("margin-right")),i=this.$el.offset().left,n=t.offset().top,o=-1,s=0,a=0,l=0;l<this.dataViewItems.length;l++){var r=$(this.dataViewItems[l].el).offset().top-n;a=Math.floor(($(this.dataViewItems[l].el).offset().left-i)/e),r>o&&(o=r,this._layoutParams.itemsIndexes.push([]),s=this._layoutParams.itemsIndexes.length-1),this._layoutParams.itemsIndexes[s][a]=l,this.dataViewItems[l].topIdx=s,this.dataViewItems[l].leftIdx=a,this._layoutParams.columns<a&&(this._layoutParams.columns=a)}this._layoutParams.rows=this._layoutParams.itemsIndexes.length,this._layoutParams.columns++}},onResize:function(){this._layoutParams=void 0}}),$(document).on("keydown.dataview","[data-toggle=dropdown], [role=menu]",function(t){t.keyCode!==Common.UI.Keys.UP&&t.keyCode!==Common.UI.Keys.DOWN&&t.keyCode!==Common.UI.Keys.LEFT&&t.keyCode!==Common.UI.Keys.RIGHT&&t.keyCode!==Common.UI.Keys.RETURN||_.defer(function(){var e=$(t.target).closest(".dropdown-toggle");e.length?e.parent().find(".inner.canfocused").trigger("dataview:keydown",t):$(t.target).closest(".dropdown-submenu").find(".inner.canfocused").trigger("dataview:keydown",t)},100)})}),void 0===Common)var Common={};if(define("common/main/lib/component/ListView",["common/main/lib/component/DataView"],function(){"use strict";Common.UI.ListView=Common.UI.DataView.extend(function(){return{options:{handleSelect:!0,enableKeyEvents:!0,showLast:!0,simpleAddMode:!1,keyMoveDirection:"vertical",itemTemplate:_.template('<div id="<%= id %>" class="list-item" style=""><%= value %></div>')},template:_.template(['<div class="listview inner"></div>'].join("")),onResetItems:function(){this.innerEl=null,Common.UI.DataView.prototype.onResetItems.call(this),this.trigger("items:reset",this)},onAddItem:function(t,e,i){var n=new Common.UI.DataViewItem({template:this.itemTemplate,model:t});if(this.innerEl||(this.innerEl=$(this.el).find(".inner")),n&&this.innerEl){if(this.dataViewItems.length<1&&this.innerEl.find(".empty-text").remove(),this.options.simpleAddMode)this.innerEl.append(n.render().el),this.dataViewItems.push(n);else{var o=_.indexOf(this.store.models,t),s=this.innerEl.find("> div");o>0?$(s.get(o-1)).after(n.render().el):s.length>0?$(s[o]).before(n.render().el):this.innerEl.append(n.render().el),this.dataViewItems=this.dataViewItems.slice(0,o).concat(n).concat(this.dataViewItems.slice(o))}if(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),t.get("tip")){var a=$(n.el);a.attr("data-toggle","tooltip"),a.tooltip({title:t.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}this.isSuspendEvents||this.trigger("item:add",this,n,t)}}}}())}),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(t){"use strict";SSE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:370,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"sse-para-settings-adv-category"},initialize:function(e){var i=this;_.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(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.spinners=[],this.FirstLine=void 0,this.Spacing=null,this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps),this._arrLineRule=[{displayValue:this.textAuto,defaultValue:1,value:c_paragraphLinerule.LINERULE_AUTO,minValue:.5,step:.01,defaultUnit:""},{displayValue:this.textExact,defaultValue:5,value:c_paragraphLinerule.LINERULE_EXACT,minValue:.03,step:.01,defaultUnit:"cm"}];var n=this._originalProps.asc_getSpacing().asc_getLineRule(),o=_.findWhere(this._arrLineRule,{value:n});this.CurLineRuleIdx=this._arrLineRule.indexOf(o),this._arrTextAlignment=[{displayValue:this.textTabLeft,value:c_paragraphTextAlignment.LEFT},{displayValue:this.textTabCenter,value:c_paragraphTextAlignment.CENTERED},{displayValue:this.textTabRight,value:c_paragraphTextAlignment.RIGHT},{displayValue:this.textJustified,value:c_paragraphTextAlignment.JUSTIFIED}],this._arrSpecial=[{displayValue:this.textNoneSpecial,value:c_paragraphSpecial.NONE_SPECIAL,defaultValue:0},{displayValue:this.textFirstLine,value:c_paragraphSpecial.FIRST_LINE,defaultValue:12.7},{displayValue:this.textHanging,value:c_paragraphSpecial.HANGING,defaultValue:12.7}],this._arrTabAlign=[{value:1,displayValue:this.textTabLeft},{value:3,displayValue:this.textTabCenter},{value:2,displayValue:this.textTabRight}],this._arrKeyTabAlign=[],this._arrTabAlign.forEach(function(t){i._arrKeyTabAlign[t.value]=t.displayValue})},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbTextAlignment=new Common.UI.ComboBox({el:$("#paragraphadv-spin-text-alignment"),cls:"input-group-nr",editable:!1,data:this._arrTextAlignment,style:"width: 173px;",menuStyle:"min-width: 173px;"}),this.cmbTextAlignment.setValue(""),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:0}),this.numIndentsLeft.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue();this._changedProps&&(null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().put_Left(Common.Utils.Metric.fnRecalcToMM(o)))},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:0}),this.numIndentsRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.cmbSpecial=new Common.UI.ComboBox({el:$("#paragraphadv-spin-special"),cls:"input-group-nr",editable:!1,data:this._arrSpecial,style:"width: 85px;",menuStyle:"min-width: 85px;"}),this.cmbSpecial.setValue(""),this.cmbSpecial.on("selected",_.bind(this.onSpecialSelect,this)),this.numSpecialBy=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-special-by"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numSpecialBy),this.numSpecialBy.on("change",_.bind(this.onFirstLineChange,this)),this.numSpacingBefore=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing-before"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.numSpacingBefore.on("change",_.bind(function(t,e,i,n){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.asc_getSpacing()}this.Spacing.Before=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())},this)),this.spinners.push(this.numSpacingBefore),this.numSpacingAfter=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing-after"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.numSpacingAfter.on("change",_.bind(function(t,e,i,n){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.asc_getSpacing()}this.Spacing.After=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())},this)),this.spinners.push(this.numSpacingAfter),this.cmbLineRule=new Common.UI.ComboBox({el:$("#paragraphadv-spin-line-rule"),cls:"input-group-nr",editable:!1,data:this._arrLineRule,style:"width: 85px;",menuStyle:"min-width: 85px;"}),this.cmbLineRule.setValue(this.CurLineRuleIdx),this.cmbLineRule.on("selected",_.bind(this.onLineRuleSelect,this)),this.numLineHeight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-line-height"),step:.01,width:85,value:"",defaultUnit:"",maxValue:132,minValue:.5}),this.spinners.push(this.numLineHeight),this.numLineHeight.on("change",_.bind(this.onNumLineHeightChange,this)),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(t,e,i,n){if(this._changedProps&&this._changedProps.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},this)),this.spinners.push(this.numSpacing),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:108,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:108,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_putDefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(t.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,template:_.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:_.template(['<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;">','<div style="width: 117px;display: inline-block;"><%= value %></div>','<div style="display: inline-block;"><%= displayTabAlign %></div>',"</div>"].join(""))}),this.tabList.store.comparator=function(t){return t.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var e=function(){t._noApply||(t._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",e),this.listenTo(this.tabList.store,"remove",e),this.listenTo(this.tabList.store,"reset",e),this.cmbAlign=new Common.UI.ComboBox({el:$("#paraadv-cmb-align"),style:"width: 108px;",menuStyle:"min-width: 108px;",editable:!1,cls:"input-group-nr",data:this._arrTabAlign}),this.cmbAlign.setValue(1),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(t){t.getChild(".footer .primary").focus()}),this.afterRender()},getSettings:function(){this._tabListChanged&&(null!==this._changedProps.asc_getTabs()&&void 0!==this._changedProps.asc_getTabs()||this._changedProps.asc_putTabs(new Asc.asc_CParagraphTabs),this.tabList.store.each(function(t,e){var i=new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(t.get("tabPos")),t.get("tabAlign"));this._changedProps.asc_getTabs().add_Tab(i)},this));var t=this.cmbTextAlignment.getValue();return this._changedProps.asc_putJc(void 0!==t&&null!==t?t:c_paragraphTextAlignment.LEFT),null!==this.Spacing&&this._changedProps.asc_putSpacing(this.Spacing),{paragraphProps:this._changedProps}},_setDefaults:function(t){if(t){this._originalProps=new Asc.asc_CParagraphProperty(t),this.FirstLine=null!==t.asc_getInd()?t.asc_getInd().asc_getFirstLine():null,this.numIndentsLeft.setValue(null!==t.asc_getInd()&&null!==t.asc_getInd().asc_getLeft()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getInd().asc_getLeft()):"",!0),this.numIndentsRight.setValue(null!==t.asc_getInd()&&null!==t.asc_getInd().asc_getRight()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getInd().asc_getRight()):"",!0),this.cmbTextAlignment.setValue(void 0!==t.asc_getJc()&&null!==t.asc_getJc()?t.asc_getJc():c_paragraphTextAlignment.CENTERED,!0),void 0===this.CurSpecial&&(this.CurSpecial=0===t.asc_getInd().asc_getFirstLine()?c_paragraphSpecial.NONE_SPECIAL:t.asc_getInd().asc_getFirstLine()>0?c_paragraphSpecial.FIRST_LINE:c_paragraphSpecial.HANGING),this.cmbSpecial.setValue(this.CurSpecial),this.numSpecialBy.setValue(null!==this.FirstLine?Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)):"",!0),this.numSpacingBefore.setValue(null!==t.asc_getSpacing()&&null!==t.asc_getSpacing().asc_getBefore()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getSpacing().asc_getBefore()):"",!0),this.numSpacingAfter.setValue(null!==t.asc_getSpacing()&&null!==t.asc_getSpacing().asc_getAfter()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getSpacing().asc_getAfter()):"",!0);var e=t.asc_getSpacing().asc_getLineRule();this.cmbLineRule.setValue(null!==e?e:"",!0),null!==t.asc_getSpacing()&&null!==t.asc_getSpacing().asc_getLine()?this.numLineHeight.setValue(e==c_paragraphLinerule.LINERULE_AUTO?t.asc_getSpacing().asc_getLine():Common.Utils.Metric.fnRecalcFromMM(t.asc_getSpacing().asc_getLine()),!0):this.numLineHeight.setValue("",!0),this._noApply=!0,this.chStrike.setValue(null!==t.asc_getStrikeout()&&void 0!==t.asc_getStrikeout()?t.asc_getStrikeout():"indeterminate",!0),this.chDoubleStrike.setValue(null!==t.asc_getDStrikeout()&&void 0!==t.asc_getDStrikeout()?t.asc_getDStrikeout():"indeterminate",!0),this.chSubscript.setValue(null!==t.asc_getSubscript()&&void 0!==t.asc_getSubscript()?t.asc_getSubscript():"indeterminate",!0),this.chSuperscript.setValue(null!==t.asc_getSuperscript()&&void 0!==t.asc_getSuperscript()?t.asc_getSuperscript():"indeterminate",!0),this.chSmallCaps.setValue(null!==t.asc_getSmallCaps()&&void 0!==t.asc_getSmallCaps()?t.asc_getSmallCaps():"indeterminate",!0),this.chAllCaps.setValue(null!==t.asc_getAllCaps()&&void 0!==t.asc_getAllCaps()?t.asc_getAllCaps():"indeterminate",!0),this.numSpacing.setValue(null!==t.asc_getTextSpacing()&&void 0!==t.asc_getTextSpacing()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getTextSpacing()):"",!0),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(null!==t.asc_getDefaultTab()&&void 0!==t.asc_getDefaultTab()?Common.Utils.Metric.fnRecalcFromMM(parseFloat(t.asc_getDefaultTab().toFixed(1))):"",!0);var i=this.tabList.store,n=t.asc_getTabs();if(n){for(var o=[],s=n.asc_getCount(),a=0;a<s;a++){var l=n.asc_getTab(a),r=Common.Utils.Metric.fnRecalcFromMM(parseFloat(l.asc_getPos().toFixed(1))),c=new Common.UI.DataViewModel;c.set({tabPos:r,value:parseFloat(r.toFixed(3))+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:l.asc_getValue(),displayTabAlign:this._arrKeyTabAlign[l.asc_getValue()]}),o.push(c)}i.reset(o,{silent:!1}),this.tabList.selectByIndex(0)}this._noApply=!1,this._changedProps=new Asc.asc_CParagraphProperty}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),"paragraphadv-spin-spacing"==e.el.id||"paragraphadv-spin-position"==e.el.id||"paragraphadv-spin-spacing-before"==e.el.id||"paragraphadv-spin-spacing-after"==e.el.id?e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01):e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}this._arrLineRule[1].defaultUnit=Common.Utils.Metric.getCurrentMetricName(),this._arrLineRule[1].minValue=parseFloat(Common.Utils.Metric.fnRecalcFromMM(.3).toFixed(2)),this._arrLineRule[1].step=Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01,null!==this.CurLineRuleIdx&&(this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit),this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step))},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},onStrikeChange:function(t,e,i,n){if(this._changedProps&&1!=this.checkGroup&&this._changedProps.asc_putStrikeout("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=1,this.chDoubleStrike.setValue(0),this._changedProps&&this._changedProps.asc_putDStrikeout(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putStrikeout("checked"==t.getValue()),o.asc_putDStrikeout("checked"==this.chDoubleStrike.getValue()),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onDoubleStrikeChange:function(t,e,i,n){if(this._changedProps&&1!=this.checkGroup&&this._changedProps.asc_putDStrikeout("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=1,this.chStrike.setValue(0),this._changedProps&&this._changedProps.asc_putStrikeout(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putDStrikeout("checked"==t.getValue()),o.asc_putStrikeout("checked"==this.chStrike.getValue()),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onSuperscriptChange:function(t,e,i,n){if(this._changedProps&&2!=this.checkGroup&&this._changedProps.asc_putSuperscript("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=2,this.chSubscript.setValue(0),this._changedProps&&this._changedProps.asc_putSubscript(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putSuperscript("checked"==t.getValue()),o.asc_putSubscript("checked"==this.chSubscript.getValue()),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onSubscriptChange:function(t,e,i,n){if(this._changedProps&&2!=this.checkGroup&&this._changedProps.asc_putSubscript("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=2,this.chSuperscript.setValue(0),this._changedProps&&this._changedProps.asc_putSuperscript(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putSubscript("checked"==t.getValue()),o.asc_putSuperscript("checked"==this.chSuperscript.getValue()),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onSmallCapsChange:function(t,e,i,n){if(this._changedProps&&3!=this.checkGroup&&this._changedProps.asc_putSmallCaps("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=3,this.chAllCaps.setValue(0),this._changedProps&&this._changedProps.asc_putAllCaps(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putSmallCaps("checked"==t.getValue()),o.asc_putAllCaps("checked"==this.chAllCaps.getValue()),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onAllCapsChange:function(t,e,i,n){if(this._changedProps&&3!=this.checkGroup&&this._changedProps.asc_putAllCaps("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=3,this.chSmallCaps.setValue(0),this._changedProps&&this._changedProps.asc_putSmallCaps(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putAllCaps("checked"==t.getValue()),o.asc_putSmallCaps("checked"==this.chSmallCaps.getValue()),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},addTab:function(t,e){var i=this.numTab.getNumberValue(),n=this.cmbAlign.getValue(),o=this._arrKeyTabAlign[n],s=this.tabList.store,a=s.find(function(t){return Math.abs(t.get("tabPos")-i)<.001});a?(a.set("tabAlign",n),a.set("displayTabAlign",o),this._tabListChanged=!0):(a=new Common.UI.DataViewModel,a.set({tabPos:i,value:i+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:n,displayTabAlign:o}),s.add(a)),this.tabList.selectRecord(a),this.tabList.scrollToRecord(a)},removeTab:function(t,e){var i=this.tabList.getSelectedRec();if(i){var n=this.tabList.store,o=_.indexOf(n.models,i);n.remove(i),o>n.length-1&&(o=n.length-1),n.length>0&&(this.tabList.selectByIndex(o),this.tabList.scrollToRecord(n.at(o)))}},removeAllTabs:function(t,e){this.tabList.store.reset()},onSelectTab:function(t,e,i){var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON()}else n=i;this.numTab.setValue(n.tabPos),this.cmbAlign.setValue(n.tabAlign)},onSpecialSelect:function(t,e){if(this.CurSpecial=e.value,this.CurSpecial===c_paragraphSpecial.NONE_SPECIAL&&this.numSpecialBy.setValue(0,!0),this._changedProps){null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd);var i=Common.Utils.Metric.fnRecalcToMM(this.numSpecialBy.getNumberValue());0===i&&(this.numSpecialBy.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrSpecial[e.value].defaultValue),!0),i=this._arrSpecial[e.value].defaultValue),this.CurSpecial===c_paragraphSpecial.HANGING&&(i=-i),this._changedProps.asc_getInd().put_FirstLine(i)}},onFirstLineChange:function(t,e,i,n){if(this._changedProps){null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd);var o=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue());this.CurSpecial===c_paragraphSpecial.HANGING?o=-o:this.CurSpecial===c_paragraphSpecial.NONE_SPECIAL&&o>0?(this.CurSpecial=c_paragraphSpecial.FIRST_LINE,this.cmbSpecial.setValue(c_paragraphSpecial.FIRST_LINE)):0===o&&(this.CurSpecial=c_paragraphSpecial.NONE_SPECIAL,this.cmbSpecial.setValue(c_paragraphSpecial.NONE_SPECIAL)),this._changedProps.asc_getInd().put_FirstLine(o)}},onLineRuleSelect:function(t,e){if(null===this.Spacing){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=i.asc_getSpacing()}this.Spacing.LineRule=e.value;var n=_.findWhere(this._arrLineRule,{value:e.value}),o=this._arrLineRule.indexOf(n);this.CurLineRuleIdx!==o&&(this.numLineHeight.setDefaultUnit(this._arrLineRule[o].defaultUnit),this.numLineHeight.setMinValue(this._arrLineRule[o].minValue),this.numLineHeight.setStep(this._arrLineRule[o].step),this.Spacing.LineRule===c_paragraphLinerule.LINERULE_AUTO?this.numLineHeight.setValue(this._arrLineRule[o].defaultValue):this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[o].defaultValue)),this.CurLineRuleIdx=o)},onNumLineHeightChange:function(t,e,i,n){if(""!==this.cmbLineRule.getRawValue()){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.asc_getSpacing()}this.Spacing.Line=this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())}},textTitle:"Paragraph - Advanced Settings",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Spacing",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",textJustified:"Justified",strIndentsSpecial:"Special",textNoneSpecial:"(none)",textFirstLine:"First line",textHanging:"Hanging",strIndentsSpacingBefore:"Before",strIndentsSpacingAfter:"After",strIndentsLineSpacing:"Line Spacing",txtAutoText:"Auto",textAuto:"Multiple",textExact:"Exactly",strIndent:"Indents",strSpacing:"Spacing"},SSE.Views.ParagraphSettingsAdvanced||{}))}),define("text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template",[],function(){
|
|
|
return'<div id="id-adv-image-rotate" class="settings-panel active">\n <div class="inner-content padding-large">\n <div style="width: 100%;">\n <label class="input-label"><%= scope.textAngle %></label>\n <div id="image-advanced-spin-angle" style="display: inline-block; margin-left: 5px;"></div>\n </div>\n </div>\n <div class="separator horizontal padding-large"></div>\n <div class="inner-content padding-large">\n <table cols="2">\n <tr>\n <td rowspan="2" class="padding-small" style="vertical-align: top;">\n <label class="input-label" style="margin-right: 15px;vertical-align: top;"><%= scope.textFlipped %></label>\n </td>\n <td class="padding-small">\n <div id="image-advanced-checkbox-hor"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="image-advanced-checkbox-vert"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>\n<div id="id-adv-image-alttext" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" width="100%">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.textAltTitle %></label>\n <div id="image-advanced-alt-title"></div>\n </td>\n </tr>\n <tr>\n <td>\n <label class="header"><%= scope.textAltDescription %></label>\n <textarea id="image-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\n </td>\n </tr>\n <tr>\n <td>\n <label><%= scope.textAltTip %></label>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),define("spreadsheeteditor/main/app/view/ImageSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t){"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(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-rotate",panelCaption:this.textRotation},{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),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 t=this;this.spnAngle=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-angle"),step:1,width:80,defaultUnit:"°",value:"0 °",maxValue:3600,minValue:-3600}),this.chFlipHor=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-hor"),labelText:this.textHorizontally}),this.chFlipVert=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-vert"),labelText:this.textVertically}),this.inputAltTitle=new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){var e=t.asc_getTitle();this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),e=t.asc_getRot(),this.spnAngle.setValue(void 0==e||null===e?"":Math.floor(180*e/3.14159265358979+.5),!0),this.chFlipHor.setValue(t.asc_getFlipH()),this.chFlipVert.setValue(t.asc_getFlipV());var i=t.asc_getPluginGuid();this.btnsCategory[0].setVisible(null===i||void 0===i),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()),this._changedProps.asc_putRot(3.14159265358979*this.spnAngle.getNumberValue()/180),this._changedProps.asc_putFlipH("checked"==this.chFlipHor.getValue()),this._changedProps.asc_putFlipV("checked"==this.chFlipVert.getValue()),{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.",textRotation:"Rotation",textAngle:"Angle",textFlipped:"Flipped",textHorizontally:"Horizontally",textVertically:"Vertically"},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(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box">','<div class="input-row">','<div id="id-spin-set-value"></div>',"</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),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(){if(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:null!==this.startvalue?this.startvalue+" "+this.defaultUnit:""}),null!==this.startvalue){var t=this;setTimeout(function(){var e=t.spnSize.$input[0];document.selection?t.spnSize.$input.select():(e.selectionStart=0,e.selectionEnd=t.startvalue.toString().length)},10)}this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.spnSize.on("entervalue",_.bind(this.onPrimary,this)),this.options.rounding&&this.spnSize.on("change",_.bind(this.onChange,this)),this.spnSize.$el.find("input").focus()},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onChange:function(){var t=this.spnSize.getNumberValue();t/=this.step,t=(t|t)*this.step,this.spnSize.setValue(t,!0)},getSettings:function(){return this.spnSize.getNumberValue()},onPrimary:function(){return this._handleInput("ok"),!1},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||{}))}),void 0===Common)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(['<div class="palette-color-ext">',"<% var me = this; %>","<% $(colors).each(function(num, item) { %>","<% if (me.isColor(item)) { %>",'<div class="palette-color-item palette-color color-<%=item%>" style="background:#<%=item%>" hidefocus="on">','<em><span style="background:#<%=item%>;" unselectable="on"> </span></em>',"</div>","<% } else if (me.isTransparent(item)) { %>",'<div class="palette-color-item color-<%=item%>" hidefocus="on">','<em><span unselectable="on"> </span></em>',"</div>","<% } else if (me.isEffect(item)) { %>",'<div effectid="<%=item.effectId%>" effectvalue="<%=item.effectValue%>" class="palette-color-item palette-color-effect color-<%=item.color%>" style="background:#<%=item.color%>" hidefocus="on">','<em><span style="background:#<%=item.color%>;" unselectable="on"> </span></em>',"</div>","<% } %>","<% }); %>","</div>"].join("")),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),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(t){var e=this;return e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl),this.cmpEl.on("click",_.bind(this.handleClick,this))),e.rendered=!0,this},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},handleClick:function(t){var e,i=this,n=$(t.target).closest("div.palette-color-item");if(0!=n.length)if(n.hasClass("color-transparent"))$(i.el).find("div."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),i.value="transparent",i.trigger("select",i,"transparent");else if((!/^[a-fA-F0-9]{6}$/.test(i.value)||_.indexOf(i.colors,i.value)<0)&&(i.value=!1),$(i.el).find("div."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),e=n[0].className.match(i.colorRe)[1],n.hasClass("palette-color-effect")){var o=parseInt(n.attr("effectid"));e&&(i.value=e.toUpperCase(),i.trigger("select",i,{color:e,effectId:o}))}else/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),i.value=e,i.trigger("select",i,e))},select:function(t,e){var i=$(this.el);if(i.find("div."+this.selectedCls).removeClass(this.selectedCls),t)if("object"==typeof t){var n;void 0!==t.effectId?(n=i.find('div[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('div[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("div.color-transparent").addClass(this.selectedCls):i.find("div.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('div[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},updateColors:function(t){void 0!==t&&(this.colors=t,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(t){$(this.el).find("div."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0}})}),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(t){var e=this,i={};_.extend(i,{width:501,height:230,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[]},t),this.template=t.template||['<div class="box" style="height:'+(i.height-85)+'px;">','<div class="content-panel" >','<label class="header">',e.textShowRows,"</label>",'<div style="margin-top:15px;">','<div id="id-search-begin-digital-combo" class="input-group-nr" style="vertical-align:top;width:225px;display:inline-block;"></div>','<div id="id-sd-cell-search-begin" class="" style="width:225px;display:inline-block;margin-left:18px;"></div>',"</div>","<div>",'<div id="id-and-radio" class="padding-small" style="display: inline-block; margin-top:10px;"></div>','<div id="id-or-radio" class="padding-small" style="display: inline-block; margin-left:25px;"></div>',"</div>",'<div style="margin-top:10px;">','<div id="id-search-end-digital-combo" class="input-group-nr" style="vertical-align:top;width:225px;display:inline-block;"></div>','<div id="id-sd-cell-search-end" class="" style="width:225px;display:inline-block;margin-left:18px;"></div>',"</div>","</div>","</div>",'<div class="separator horizontal" style="width:100%"></div>','<div class="footer right" style="margin-left:-15px;">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">',e.okButtonText,"</button>",'<button class="btn normal dlg-btn" result="cancel">',e.cancelButtonText,"</button>","</div>"].join(""),this.api=t.api,this.handler=t.handler,this.type=t.type||"number",i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.conditions=[{value:Asc.c_oAscCustomAutoFilter.equals,displayValue:this.capCondition1},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,displayValue:this.capCondition2},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,displayValue:this.capCondition3},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,displayValue:this.capCondition4},{value:Asc.c_oAscCustomAutoFilter.isLessThan,displayValue:this.capCondition5},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,displayValue:this.capCondition6}],"text"==this.type&&(this.conditions=this.conditions.concat([{value:Asc.c_oAscCustomAutoFilter.beginsWith,displayValue:this.capCondition7},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,displayValue:this.capCondition8},{value:Asc.c_oAscCustomAutoFilter.endsWith,displayValue:this.capCondition9},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,displayValue:this.capCondition10},{value:Asc.c_oAscCustomAutoFilter.contains,displayValue:this.capCondition11},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,displayValue:this.capCondition12}])),this.cmbCondition1=new Common.UI.ComboBox({el:$("#id-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 t=function(t,e){var i=t.get("intval"),n=e.get("intval"),o=void 0!==i;return o!==(void 0!==n)?o?-1:1:(!o&&(i=t.get("value").toLowerCase())&&(n=e.get("value").toLowerCase()),i==n?0:""==n||""!==i&&i<n?-1:1)};this.cmbValue1.store.comparator=this.cmbValue2.store.comparator=t,this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this);var t=this;_.defer(function(){t.cmbValue1&&t.cmbValue1._input.focus()},500)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties&&this.rbOr&&this.rbAnd&&this.cmbCondition1&&this.cmbCondition2&&this.cmbValue1&&this.cmbValue2){var t=[];this.properties.asc_getValues().forEach(function(e){var i=e.asc_getText();_.isEmpty(i)||t.push({value:i,displayValue:i,intval:!isNaN(parseFloat(i))&&isFinite(i)?parseFloat(i):void 0})}),this.cmbValue1.setData(t),this.cmbValue2.setData(t);var e=this.properties.asc_getFilterObj();if(e.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var i=e.asc_getFilter(),n=i.asc_getCustomFilters();i.asc_getAnd()?this.rbAnd.setValue(!0):this.rbOr.setValue(!0),this.cmbCondition1.setValue(n[0].asc_getOperator()||Asc.c_oAscCustomAutoFilter.equals),this.cmbCondition2.setValue(n.length>1?n[1].asc_getOperator()||0:0),this.cmbValue1.setValue(null===n[0].asc_getVal()?"":n[0].asc_getVal()),this.cmbValue2.setValue(n.length>1?null===n[1].asc_getVal()?"":n[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.rbOr&&this.rbAnd&&this.cmbCondition1&&this.cmbCondition2&&this.cmbValue1&&this.cmbValue2){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.CustomFilters),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var e=t.asc_getFilter();e.asc_setCustomFilters(0==this.cmbCondition2.getValue()?[new Asc.CustomFilter]:[new Asc.CustomFilter,new Asc.CustomFilter]);var i=e.asc_getCustomFilters();e.asc_setAnd(this.rbAnd.getValue()),i[0].asc_setOperator(this.cmbCondition1.getValue()),i[0].asc_setVal(this.cmbValue1.getValue()),0!==this.cmbCondition2.getValue()&&(i[1].asc_setOperator(this.cmbCondition2.getValue()||void 0),i[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(t){var e=this,i={};_.extend(i,{width:318,height:160,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[]},t),this.template=t.template||['<div class="box" style="height:'+(i.height-85)+'px;">','<div class="content-panel" >','<div style="margin-right:15px; display: inline-block; vertical-align: middle;">','<label class="input-label">',e.textType,"</label>",'<div id="id-top10-type-combo" style=""></div>',"</div>",'<div style="margin-right:15px; display: inline-block; vertical-align: middle;">','<label class="input-label"></label>','<div id="id-top10-count-spin" class="input-group-nr" style=""></div>',"</div>",'<div style="display: inline-block; vertical-align: middle;">','<label class="input-label"></label>','<div id="id-top10-item-combo" class="input-group-nr" style=""></div>',"</div>","</div>","</div>",'<div class="separator horizontal" style="width:100%"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">',e.okButtonText,"</button>",'<button class="btn normal dlg-btn" result="cancel">',e.cancelButtonText,"</button>","</div>"].join(""),this.api=t.api,this.handler=t.handler,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.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(t,e){this.spnCount.setDefaultUnit(e.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 t=this;_.defer(function(){t.spnCount&&t.spnCount.$input.focus()},500)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties){var t=this.properties.asc_getFilterObj();if(t.asc_getType()==Asc.c_oAscAutoFilterTypes.Top10){var e=t.asc_getFilter(),i=e.asc_getTop(),n=e.asc_getPercent();this.cmbType.setValue(i||null===i),this.cmbItem.setValue(n||null===n),this.spnCount.setDefaultUnit(n||null===n?"%":""),this.spnCount.setValue(e.asc_getVal())}}},save:function(){if(this.api&&this.properties){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.Top10),t.asc_setType(Asc.c_oAscAutoFilterTypes.Top10);var e=t.asc_getFilter();e.asc_setTop(this.cmbType.getValue()),e.asc_setPercent(this.cmbItem.getValue()),e.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(t){var e=this,i={},n=void 0,o=void 0;Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(n=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0],o=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[1]),_.extend(i,{width:n||450,height:o||265,contentWidth:n-50||400,header:!1,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,modal:!1,animate:!1,items:[],resizable:!0,minwidth:450,minheight:265},t),this.template=t.template||['<div class="box" style="height: 100%; display: flex; justify-content: space-between;">','<div class="content-panel" style="width: 100%; border-right: 1px solid #cbcbcb; display: flex; flex-direction: column; justify-content: space-between;">','<div class="" style="display: flex; flex-direction: column; justify-content: flex-start; height: calc(100% - 40px);">','<div id="id-sd-cell-search" style="height:22px; margin-bottom:10px;"></div>','<div class="border-values" style="overflow: hidden; flex-grow: 1;">','<div id="id-dlg-filter-values" class="combo-values" style=""/>',"</div>","</div>",'<div class="footer center">','<div id="id-apply-filter" style="display: inline-block;"></div>','<button class="btn normal dlg-btn" result="cancel">',e.cancelButtonText,"</button>","</div>","</div>",'<div class="menu-panel" style="width: 195px; float: right;">','<div id="menu-container-filters" style=""><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',"</div>","</div>"].join(""),this.api=t.api,this.handler=t.handler,this.throughIndexes=[],this.filteredIndexes=[],this.curSize=null,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this))},render:function(){var t=this;Common.UI.Window.prototype.render.call(this);var e=this.$window.find(".resize-border");this.$window.find(".resize-border.left, .resize-border.top").css({cursor:"default"}),e.css({background:"none",border:"none"}),e.removeClass("left"),e.removeClass("top"),this.$window.find(".btn").on("click",_.bind(this.onBtnClick,this)),this.btnOk=new Common.UI.Button({cls:"btn normal dlg-btn primary",caption:this.okButtonText,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('<div id="filter-dlg-sort-cells-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),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('<div id="filter-dlg-sort-font-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),this.miNumFilter=new Common.UI.MenuItem({caption:this.txtNumFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10},{value:Asc.c_oAscDynamicAutoFilter.aboveAverage,caption:this.txtAboveAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:Asc.c_oAscDynamicAutoFilter.belowAverage,caption:this.txtBelowAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})});for(var i=this.miNumFilter.menu.items,n=0;n<i.length;n++)i[n].on("click",_.bind(i[n].options.type==Asc.c_oAscAutoFilterTypes.CustomFilters?this.onNumCustomFilterItemClick:i[n].options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter?this.onNumDynamicFilterItemClick:this.onTop10FilterItemClick,this));this.miTextFilter=new Common.UI.MenuItem({caption:this.txtTextFilter,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.beginsWith,caption:this.txtBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,caption:this.txtNotBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.endsWith,caption:this.txtEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,caption:this.txtNotEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.contains,caption:this.txtContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,caption:this.txtNotContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})}),this.miTextFilter.menu.on("item:click",_.bind(this.onTextFilterMenuClick,this)),this.miFilterCellColor=new Common.UI.MenuItem({caption:this.txtFilterCellColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('<div id="filter-dlg-filter-cells-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),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('<div id="filter-dlg-filter-font-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),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 o=this.$window.find("#menu-container-filters");this.filtersMenu.render(o),this.filtersMenu.cmpEl.attr({tabindex:"-1"}),this.mnuSortColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-cells-color"),colors:[]}),this.mnuSortColorCellsPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFill)),this.mnuSortColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-font-color"),colors:[]}),this.mnuSortColorFontPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFont)),
|
|
|
this.mnuFilterColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-cells-color"),colors:[]}),this.mnuFilterColorCellsPicker.on("select",_.bind(this.onFilterColorSelect,this,!0)),this.mnuFilterColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-font-color"),colors:[]}),this.mnuFilterColorFontPicker.on("select",_.bind(this.onFilterColorSelect,this,!1)),this.input=new Common.UI.InputField({el:$("#id-sd-cell-search",this.$window),allowBlank:!0,placeHolder:this.txtEmpty,validateOnChange:!0,validation:function(){return!0}}).on("changing",function(e,i){i.length?(i=i.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),t.filter=new RegExp(i,"ig")):t.filter=void 0,t.setupDataCells()}),this.cells=new Common.UI.DataViewStore,this.filterExcludeCells=new Common.UI.DataViewStore,this.cells&&(this.cellsList=new Common.UI.ListView({el:$("#id-dlg-filter-values",this.$window),store:this.cells,simpleAddMode:!0,template:_.template(['<div class="listview inner" style="border:none;"></div>'].join("")),itemTemplate:_.template(["<div>",'<label class="checkbox-indeterminate" style="position:absolute;">','<% if (check=="indeterminate") { %>','<input type="button" class="indeterminate img-commonctrl"/>',"<% } else if (check) { %>",'<input type="button" class="checked img-commonctrl"/>',"<% } else { %>",'<input type="button" class="img-commonctrl"/>',"<% } %>","</label>",'<div id="<%= id %>" class="list-item" style="pointer-events:none; margin-left: 20px;display: flex;">','<div style="flex-grow: 1;"><%= Common.Utils.String.htmlEncode(value) %></div>','<% if (typeof count !=="undefined" && count) { %>','<div style="word-break: normal; margin-left: 10px; color: #afafaf;"><%= count%></div>',"<% } %>","</div>","</div>"].join(""))}),this.cellsList.store.comparator=function(t,e){if("0"==t.get("groupid"))return-1;if("0"==e.get("groupid"))return 1;if("2"==t.get("groupid"))return-1;if("2"==e.get("groupid"))return 1;var i=t.get("intval"),n=e.get("intval"),o=void 0!==i;return o!==(void 0!==n)?o?-1:1:(!o&&(i=t.get("cellvalue").toLowerCase())&&(n=e.get("cellvalue").toLowerCase()),i==n?0:""==n||""!==i&&i<n?-1:1)},this.cellsList.on("item:select",_.bind(this.onCellCheck,this)),this.cellsList.onKeyDown=_.bind(this.onListKeyDown,this)),this.setupDataCells(),this._setDefaults();var s=function(e){t._skipCheckDocumentClick||$(e.target).closest(".filter-dlg").length<=0&&t.close()};this.on("close",function(){$(document.body).off("mousedown",s)}),_.delay(function(){$(document.body).on("mousedown",s)},100,this),Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(this.$window.find(".combo-values").css({height:Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[1]-103+"px"}),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}))},show:function(t,e){Common.UI.Window.prototype.show.call(this,t,e);var i=this;this.input&&_.delay(function(){i.input.$el.find("input").focus()},500,this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&"cancel"===t.currentTarget.attributes.result.value&&this.close()},onApplyFilter:function(){this.testFilter()&&(this.save(),this.close())},onSortType:function(t){this.api&&this.configTo&&this.api.asc_sortColFilter(t,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName()),this.close()},onNumCustomFilterItemClick:function(t){var e=this.configTo.asc_getFilterObj(),i="",n="",o=Asc.c_oAscCustomAutoFilter.equals,s=0,a=!0;if(e.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var l=e.asc_getFilter(),r=l.asc_getCustomFilters();a=l.asc_getAnd(),o=r[0].asc_getOperator(),s=r.length>1?r[1].asc_getOperator()||0:0,i=null===r[0].asc_getVal()?"":r[0].asc_getVal(),n=r.length>1?null===r[1].asc_getVal()?"":r[1].asc_getVal():""}if(-1!==t.value){var c=new Asc.CustomFilters;c.asc_setCustomFilters(-2==t.value?[new Asc.CustomFilter,new Asc.CustomFilter]:[new Asc.CustomFilter]);var h=c.asc_getCustomFilters();if(h[0].asc_setOperator(-2==t.value?Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:t.value),-2==t.value){var d=o==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&s==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo;c.asc_setAnd(!d||a),h[0].asc_setVal(d?i:""),h[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),h[1].asc_setVal(d?n:"")}else c.asc_setAnd(!0),h[0].asc_setVal(t.value==o?i:"");e.asc_setFilter(c),e.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var p=this,m=new SSE.Views.DigitalFilterDialog({api:this.api,type:"number"}).on({close:function(){p.close()}});this.close(),m.setSettings(this.configTo),m.show()},onTextFilterMenuClick:function(t,e){var i=this.configTo.asc_getFilterObj(),n="",o=Asc.c_oAscCustomAutoFilter.equals;if(i.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var s=i.asc_getFilter(),a=s.asc_getCustomFilters();s.asc_getAnd(),o=a[0].asc_getOperator(),a.length>1?a[1].asc_getOperator()||0:0,n=null===a[0].asc_getVal()?"":a[0].asc_getVal(),a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():""}if(-1!==e.value){var l=new Asc.CustomFilters;l.asc_setCustomFilters([new Asc.CustomFilter]);var r=l.asc_getCustomFilters();l.asc_setAnd(!0),r[0].asc_setOperator(e.value),r[0].asc_setVal(e.value==o?n:""),i.asc_setFilter(l),i.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var c=this,h=new SSE.Views.DigitalFilterDialog({api:this.api,type:"text"}).on({close:function(){c.close()}});this.close(),h.setSettings(this.configTo),h.show()},onNumDynamicFilterItemClick:function(t){var e=this.configTo.asc_getFilterObj();e.asc_getType()!==Asc.c_oAscAutoFilterTypes.DynamicFilter&&(e.asc_setFilter(new Asc.DynamicFilter),e.asc_setType(Asc.c_oAscAutoFilterTypes.DynamicFilter)),e.asc_getFilter().asc_setType(t.value),this.api.asc_applyAutoFilter(this.configTo),this.close()},onTop10FilterItemClick:function(t,e){var i=this,n=new SSE.Views.Top10FilterDialog({api:this.api}).on({close:function(){i.close()}});this.close(),n.setSettings(this.configTo),n.show()},onFilterColorSelect:function(t,e,i){var n=this.configTo.asc_getFilterObj();n.asc_getType()!==Asc.c_oAscAutoFilterTypes.ColorFilter&&(n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter));var o=n.asc_getFilter();o.asc_setCellColor(!!t&&null),o.asc_setCColor(t&&"transparent"==i||!t&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i)),this.api.asc_applyAutoFilter(this.configTo),this.close()},onSortColorSelect:function(t,e,i){if(this.api&&this.configTo){var n=t==Asc.c_oAscSortOptions.ByColorFill;this.api.asc_sortColFilter(t,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName(),n&&"transparent"==i||!n&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i))}this.close()},onCellCheck:function(t,e,i){if(!this.checkCellTrigerBlock){var n="",o="",s=!1,a=null,l=window.event?window.event:window._event;if(l){if(o=l.target.type,n=$(l.currentTarget).find(".list-item"),n.length){a=n.get(0).getBoundingClientRect();var r=l.clientX*Common.Utils.zoom(),c=l.clientY*Common.Utils.zoom();a.left<r&&r<a.right&&a.top<c&&c<a.bottom&&(s=!0)}("button"===o||s)&&(this.updateCellCheck(t,i),_.delay(function(){t.$el.find(".listview").focus()},100,this))}}},onListKeyDown:function(t,e){var i=this.cellsList;i.disabled||(_.isUndefined(void 0)&&(e=t),e.keyCode==Common.UI.Keys.SPACE?(e.preventDefault(),e.stopPropagation(),this.updateCellCheck(i,i.getSelectedRec())):Common.UI.DataView.prototype.onKeyDown.call(this.cellsList,t,e))},updateCellCheck:function(t,e){if(e&&t){t.isSuspendEvents=!0;var i=!e.get("check"),n=this,o=n.filter?n.filteredIndexes:n.throughIndexes;if("0"==e.get("groupid"))this.cells.each(function(t){"2"!==t.get("groupid")&&(t.set("check",i),t.get("throughIndex")>1&&(o[parseInt(t.get("throughIndex"))]=i))});else{e.set("check",i),o[parseInt(e.get("throughIndex"))]=i;for(var s=i,a=0;a<this.cells.length;a++){var l=this.cells.at(a);if("1"==l.get("groupid")&&l.get("check")!==i){s="indeterminate";break}}this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",s),this.checkCellTrigerBlock=void 0}this.btnOk.setDisabled(!1),this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),t.isSuspendEvents=!1,t.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onClear:function(){this.api&&this.configTo&&this.api.asc_clearFilterColumn(this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName()),this.close()},onReapply:function(){this.api&&this.configTo&&this.api.asc_reapplyAutoFilter(this.config.asc_getDisplayName()),this.close()},setSettings:function(t){this.config=t,this.configTo=t},_setDefaults:function(){this.initialFilterType=this.configTo.asc_getFilterObj().asc_getType();var t=this.configTo.asc_getFilterObj(),e=this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters,i=this.initialFilterType===Asc.c_oAscAutoFilterTypes.DynamicFilter,n=this.initialFilterType===Asc.c_oAscAutoFilterTypes.Top10,o=this.configTo.asc_getIsTextFilter(),s=this.configTo.asc_getColorsFill(),a=this.configTo.asc_getColorsFont(),l=this.configTo.asc_getSortState(),r=this.configTo.asc_getSortColor();r&&(r=Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()).toLocaleUpperCase()),this.miTextFilter.setVisible(o),this.miNumFilter.setVisible(!o),this.miTextFilter.setChecked(e&&o,!0),this.miNumFilter.setChecked((e||i||n)&&!o,!0),this.miSortLow2High.setChecked(l==Asc.c_oAscSortOptions.Ascending,!0),this.miSortHigh2Low.setChecked(l==Asc.c_oAscSortOptions.Descending,!0);var c=a&&a.length>0;if(this.miSortFontColor.setVisible(c),this.miFilterFontColor.setVisible(c),c){var h=[];a.forEach(function(t,e){t?h.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):h.push("000000")}),this.mnuSortColorFontPicker.updateColors(h),this.mnuFilterColorFontPicker.updateColors(h),this.miFilterFontColor.setChecked(!1,!0),this.miSortFontColor.setChecked(l==Asc.c_oAscSortOptions.ByColorFont,!0),l==Asc.c_oAscSortOptions.ByColorFont&&this.mnuSortColorFontPicker.select(r||"000000",!0)}if(c=s&&s.length>0,this.miSortCellColor.setVisible(c),this.miFilterCellColor.setVisible(c),c){var h=[];s.forEach(function(t,e){t?h.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):h.push("transparent")}),this.mnuSortColorCellsPicker.updateColors(h),this.mnuFilterColorCellsPicker.updateColors(h),this.miFilterCellColor.setChecked(!1,!0),this.miSortCellColor.setChecked(l==Asc.c_oAscSortOptions.ByColorFill,!0),l==Asc.c_oAscSortOptions.ByColorFill&&this.mnuSortColorCellsPicker.select(r||"transparent",!0)}if(e){var d=t.asc_getFilter(),p=d.asc_getCustomFilters(),m=(d.asc_getAnd(),p[0].asc_getOperator()),u=p.length>1?p[1].asc_getOperator()||0:0,g=o?this.miTextFilter.menu.items:this.miNumFilter.menu.items,b=!0;1==p.length?g.forEach(function(t){var e=t.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters&&t.value==m;t.setChecked(e,!0),e&&(b=!1)}):!o&&(m==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&u==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo||m==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo&&u==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo)&&(g[6].setChecked(!0,!0),b=!1),b&&g[g.length-1].setChecked(!0,!0)}else if(this.initialFilterType===Asc.c_oAscAutoFilterTypes.ColorFilter){var f=t.asc_getFilter(),C=f.asc_getCColor();C&&(C=Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()).toLocaleUpperCase()),null===f.asc_getCellColor()?(this.miFilterCellColor.setChecked(!0,!0),this.mnuFilterColorCellsPicker.select(C||"transparent",!0)):!1===f.asc_getCellColor()&&(this.miFilterFontColor.setChecked(!0,!0),this.mnuFilterColorFontPicker.select(C||"000000",!0))}else if(i||n){var v=i?t.asc_getFilter().asc_getType():null,g=this.miNumFilter.menu.items;g.forEach(function(t){t.setChecked(i&&t.options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter&&t.value==v||n&&t.options.type==Asc.c_oAscAutoFilterTypes.Top10,!0)})}this.miClear.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.miReapply.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.btnOk.setDisabled(this.initialFilterType!==Asc.c_oAscAutoFilterTypes.Filters&&this.initialFilterType!==Asc.c_oAscAutoFilterTypes.None)},setupDataCells:function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}var e,i,n,o=this,s=0,a=2,l=!0,r=!1,c=0,h=[],d=[],p=o.filter?o.filteredIndexes:o.throughIndexes;this.configTo.asc_getValues().forEach(function(r){i=r.asc_getText(),e=t(i),l=!0,n=r.asc_getRepeats?r.asc_getRepeats():void 0,o.filter?(null===i.match(o.filter)&&(l=!1),p[a]=l):void 0==p[a]&&(p[a]=r.asc_getVisible()),l?(h.push(new Common.UI.DataViewModel({id:++s,selected:!1,allowSelected:!0,cellvalue:i,value:e?i:i.length>0?i:o.textEmptyItem,intval:e?parseFloat(i):void 0,strval:e?"":i,groupid:"1",check:p[a],throughIndex:a,count:n?n.toString():""})),p[a]&&c++):d.push(new Common.UI.DataViewModel({cellvalue:i})),++a}),c==h.length?r=!0:c>0&&(r="indeterminate"),(o.filter||void 0==p[0])&&(p[0]=!0),(!o.filter||h.length>0)&&h.unshift(new Common.UI.DataViewModel({id:++s,selected:!1,allowSelected:!0,value:o.filter?this.textSelectAllResults:this.textSelectAll,groupid:"0",check:p[0],throughIndex:0})),o.filter&&h.length>1&&(void 0==p[1]&&(p[1]=!1),h.splice(1,0,new Common.UI.DataViewModel({id:++s,selected:!1,allowSelected:!0,value:this.textAddSelection,groupid:"2",check:p[1],throughIndex:1}))),this.cells.reset(h),this.filterExcludeCells.reset(d),this.cells.length&&(this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",r),this.checkCellTrigerBlock=void 0),this.btnOk.setDisabled(this.cells.length<1),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),this.cellsList.cmpEl.toggleClass("scroll-padding",this.cellsList.scroller.isVisible())},testFilter:function(){var t=this,e=!1;return this.cells&&(this.filter&&this.filteredIndexes[1]?e=!0:this.cells.forEach(function(t){if("1"==t.get("groupid")&&t.get("check"))return e=!0,!0})),e||(t._skipCheckDocumentClick=!0,Common.UI.warning({title:this.textWarning,msg:this.warnNoSelected,callback:function(){t._skipCheckDocumentClick=!1,_.delay(function(){t.input.$el.find("input").focus()},100,this)}})),e},save:function(){if(this.api&&this.configTo&&this.cells&&this.filterExcludeCells){var t=this.configTo.asc_getValues(),e=!1;if(this.filter&&this.filteredIndexes[1])this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters&&t.forEach(function(t,e){t.asc_setVisible(!0)}),this.cells.each(function(e){"1"==e.get("groupid")&&t[parseInt(e.get("throughIndex"))-2].asc_setVisible(e.get("check"))}),t.forEach(function(t,i){if(t.asc_getVisible())return e=!0,!0});else{var i=this.filter?this.filteredIndexes:this.throughIndexes;t.forEach(function(t,e){t.asc_setVisible(i[e+2])}),e=!0}e&&(this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),this.api.asc_applyAutoFilter(this.configTo))}},onPrimary:function(){return this.save(),this.close(),!1},onWindowResize:function(t){if(t&&"start"==t[1])this.curSize={resize:!1,height:this.getSize()[1]};else if(this.curSize.resize){var e=this.getSize();this.$window.find(".combo-values").css({height:e[1]-100+"px"}),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();t[1]!==this.curSize.height&&(this.curSize.resize||(this.curSize.resize=!0,this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!1,suppressScrollX:!0})),this.$window.find(".combo-values").css({height:t[1]-100+"px"}),this.curSize.height=t[1]),Common.Utils.InternalSettings.set("sse-settings-size-filter-window",t)}},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||{}))});var c_paragraphLinerule={LINERULE_AUTO:1,LINERULE_EXACT:2},c_paragraphTextAlignment={RIGHT:0,LEFT:1,CENTERED:2,JUSTIFIED:3},c_paragraphSpecial={NONE_SPECIAL:0,FIRST_LINE:1,HANGING:2};if(define("spreadsheeteditor/main/app/controller/DocumentHolder",["core","common/main/lib/util/utils","common/main/lib/util/Shortcuts","common/main/lib/view/CopyWarningDialog","common/main/lib/view/OpenDialog","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 t=this;t.tooltips={hyperlink:{},comment:{},coauth:{ttHeight:20},row_column:{ttHeight:20},filter:{ttHeight:40},func_arg:{},input_msg:{}},t.mouse={},t.popupmenu=!1,t.rangeSelectionMode=!1,t.namedrange_locked=!1,t._currentMathObj=void 0,t._currentParaObjDisabled=!1,t._isDisabled=!1,t._state={},this.wrapEvents={apiHideComment:_.bind(this.onApiHideComment,this)},this.addListeners({DocumentHolder:{createdelayedelements:this.onCreateDelayedElements}});var e={};this.hkComments="alt+h",e[this.hkComments]=function(){return t.onAddComment(),!1},Common.util.Shortcuts.delegateShortcuts({shortcuts:e})},onLaunch:function(){var t=this;t.documentHolder=this.createView("DocumentHolder"),t.documentHolder.render(),t.documentHolder.el.tabIndex=-1,$(document).on("mousewheel",_.bind(t.onDocumentWheel,t)),$(document).on("mousedown",_.bind(t.onDocumentRightDown,t)),$(document).on("mouseup",_.bind(t.onDocumentRightUp,t)),$(document).on("keydown",_.bind(t.onDocumentKeyDown,t)),$(document).on("mousemove",_.bind(t.onDocumentMouseMove,t)),$(window).on("resize",_.bind(t.onDocumentResize,t)),SSE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",_.bind(t.onDocumentResize,t)),Common.NotificationCenter.on({"window:show":function(e){t.hideHyperlinkTip()},"modal:show":function(e){t.hideCoAuthTips()},"layout:changed":function(e){t.hideHyperlinkTip(),t.hideCoAuthTips(),t.onDocumentResize()},"cells:range":function(e){t.onCellsRange(e)}}),Common.Gateway.on("processmouse",_.bind(t.onProcessMouse,t))},onCreateDelayedElements:function(t){var e=this;e.permissions.isEdit?(t.pmiCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiImgCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiImgCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiImgPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiTextCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiTextCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiTextPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiCommonCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiCommonCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiCommonPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiInsertEntire.on("click",_.bind(e.onInsertEntire,e)),t.pmiDeleteEntire.on("click",_.bind(e.onDeleteEntire,e)),t.pmiInsertCells.menu.on("item:click",_.bind(e.onInsertCells,e)),t.pmiDeleteCells.menu.on("item:click",_.bind(e.onDeleteCells,e)),t.pmiSparklines.menu.on("item:click",_.bind(e.onClear,e)),t.pmiSortCells.menu.on("item:click",_.bind(e.onSortCells,e)),t.pmiFilterCells.menu.on("item:click",_.bind(e.onFilterCells,e)),t.pmiReapply.on("click",_.bind(e.onReapply,e)),t.pmiClear.menu.on("item:click",_.bind(e.onClear,e)),t.pmiSelectTable.menu.on("item:click",_.bind(e.onSelectTable,e)),t.pmiInsertTable.menu.on("item:click",_.bind(e.onInsertTable,e)),t.pmiDeleteTable.menu.on("item:click",_.bind(e.onDeleteTable,e)),t.pmiInsFunction.on("click",_.bind(e.onInsFunction,e)),t.menuAddHyperlink.on("click",_.bind(e.onInsHyperlink,e)),t.menuEditHyperlink.on("click",_.bind(e.onInsHyperlink,e)),t.menuRemoveHyperlink.on("click",_.bind(e.onDelHyperlink,e)),t.pmiRowHeight.menu.on("item:click",_.bind(e.onSetSize,e)),t.pmiColumnWidth.menu.on("item:click",_.bind(e.onSetSize,e)),t.pmiEntireHide.on("click",_.bind(e.onEntireHide,e)),t.pmiEntireShow.on("click",_.bind(e.onEntireShow,e)),t.pmiFreezePanes.on("click",_.bind(e.onFreezePanes,e)),t.pmiEntriesList.on("click",_.bind(e.onEntriesList,e)),t.pmiAddComment.on("click",_.bind(e.onAddComment,e)),t.pmiAddNamedRange.on("click",_.bind(e.onAddNamedRange,e)),t.menuImageArrange.menu.on("item:click",_.bind(e.onImgMenu,e)),t.menuImgRotate.menu.on("item:click",_.bind(e.onImgMenu,e)),t.menuImgCrop.menu.on("item:click",_.bind(e.onImgCrop,e)),t.menuImageAlign.menu.on("item:click",_.bind(e.onImgMenuAlign,e)),t.menuParagraphVAlign.menu.on("item:click",_.bind(e.onParagraphVAlign,e)),t.menuParagraphDirection.menu.on("item:click",_.bind(e.onParagraphDirection,e)),t.menuParagraphBullets.menu.on("item:click",_.bind(e.onSelectNoneBullet,e)),t.menuAddHyperlinkShape.on("click",_.bind(e.onInsHyperlink,e)),t.menuEditHyperlinkShape.on("click",_.bind(e.onInsHyperlink,e)),t.menuRemoveHyperlinkShape.on("click",_.bind(e.onRemoveHyperlinkShape,e)),t.pmiTextAdvanced.on("click",_.bind(e.onTextAdvanced,e)),t.mnuShapeAdvanced.on("click",_.bind(e.onShapeAdvanced,e)),t.mnuChartEdit.on("click",_.bind(e.onChartEdit,e)),t.mnuImgAdvanced.on("click",_.bind(e.onImgAdvanced,e)),t.textInShapeMenu.on("render:after",_.bind(e.onTextInShapeAfterRender,e)),t.menuSignatureEditSign.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureEditSetup.on("click",_.bind(e.onSignatureClick,e)),t.menuImgOriginalSize.on("click",_.bind(e.onOriginalSizeClick,e)),t.menuImgReplace.menu.on("item:click",_.bind(e.onImgReplace,e)),t.pmiNumFormat.menu.on("item:click",_.bind(e.onNumberFormatSelect,e)),t.pmiNumFormat.menu.on("show:after",_.bind(e.onNumberFormatOpenAfter,e)),t.pmiAdvancedNumFormat.on("click",_.bind(e.onCustomNumberFormat,e))):(t.menuViewCopy.on("click",_.bind(e.onCopyPaste,e)),t.menuViewUndo.on("click",_.bind(e.onUndo,e)),t.menuViewAddComment.on("click",_.bind(e.onAddComment,e)),t.menuSignatureViewSign.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureDetails.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureViewSetup.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureRemove.on("click",_.bind(e.onSignatureClick,e)));var i=t.cmpEl;if(i){i.on({mousedown:function(t){"canvas"==t.target.localName&&2!=t.button&&Common.UI.Menu.Manager.hideAll()},click:function(t){e.api&&(e.api.isTextAreaBlur=!1,"canvas"!=t.target.localName||e.isEditFormula||i.focus())}});var n=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(t.el,n,_.bind(this.onDocumentWheel,this)),e.cellEditor=$("#ce-cell-content")}},loadConfig:function(t){this.editorConfig=t.config},setMode:function(t){this.permissions=t,this.permissions.canCoAuthoring&&this.permissions.canComments?Common.util.Shortcuts.resumeEvents(this.hkComments):Common.util.Shortcuts.suspendEvents(this.hkComments)},setApi:function(t){return this.api=t,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_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),!0===this.permissions.isEdit&&(this.api.asc_registerCallback("asc_onSetAFDialog",_.bind(this.onApiAutofilter,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_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.api.asc_registerCallback("asc_onToggleAutoCorrectOptions",_.bind(this.onToggleAutoCorrectOptions,this)),this.api.asc_registerCallback("asc_onFormulaInfo",_.bind(this.onFormulaInfo,this)),this.api.asc_registerCallback("asc_ChangeCropState",_.bind(this.onChangeCropState,this)),this.api.asc_registerCallback("asc_onInputMessage",_.bind(this.onInputMessage,this))),this},resetApi:function(t){this.api.asc_unregisterCallback("asc_onHideComment",this.wrapEvents.apiHideComment),this.api.asc_registerCallback("asc_onHideComment",this.wrapEvents.apiHideComment)},onCopyPaste:function(t){var e=this;if(e.api){if("cut"==t.value?e.api.asc_Cut():"copy"==t.value?e.api.asc_Copy():e.api.asc_Paste())Common.component.Analytics.trackEvent("ToolBar","Copy Warning");else{var i=Common.localStorage.getItem("sse-hide-copywarning");i&&1==parseInt(i)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)}}).show()}}Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},onInsertEntire:function(t){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(t,e){this.api&&(this.api.asc_insertCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert Cells"))},onDeleteEntire:function(t){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(t,e){this.api&&(this.api.asc_deleteCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete Cells"))},onSortCells:function(t,e){if(this.api){var i=this.api.asc_sortCellsRangeExpand();if(i){var n={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(t){"expand"!=t&&"sort"!=t||this.api.asc_sortColFilter(e.value,"",void 0,e.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,"expand"==t),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")},this)};Common.UI.alert(n)}else this.api.asc_sortColFilter(e.value,"",void 0,e.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,null!==i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")}},onFilterCells:function(t,e){if(this.api){var i=new Asc.AutoFiltersOptions,n=new Asc.AutoFilterObj;if(e.value>0){n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var o=n.asc_getFilter();o.asc_setCellColor(1==e.value&&null),o.asc_setCColor(1==e.value?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{n.asc_setFilter(new Asc.CustomFilters),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var s=n.asc_getFilter();s.asc_setCustomFilters([new Asc.CustomFilter]),s.asc_setAnd(!0);s.asc_getCustomFilters()[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}i.asc_setFilterObj(n),this.api.asc_applyAutoFilterByType(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(t,e){this.api&&(this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(t){var e=this.getApplication().getController("FormulaDialog");e&&this.api&&e.showDialog()},onInsHyperlink:function(t){var e,i,n=this;if(n.api){for(var o=n.api.asc_getWorksheetsCount(),s=-1,a=[];++s<o;)this.api.asc_isWorksheetHidden(s)||a.push({displayValue:n.api.asc_getWorksheetName(s),value:n.api.asc_getWorksheetName(s)});var l=function(t,e){"ok"==e&&(i=t.getSettings(),n.api.asc_insertHyperlink(i)),Common.NotificationCenter.trigger("edit:complete",n.documentHolder)},r=n.api.asc_getCellInfo();i=r.asc_getHyperlink(),e=new SSE.Views.HyperlinkSettingsDialog({api:n.api,handler:l}),e.show(),e.setSettings({sheets:a,currentSheet:n.api.asc_getWorksheetName(n.api.asc_getActiveWorksheetIndex()),props:i,text:r.asc_getText(),isLock:r.asc_getFlags().asc_getLockText(),allowInternal:t.options.inCell})}Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")},onDelHyperlink:function(t){this.api&&(this.api.asc_removeHyperlink(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink"))},onSetSize:function(t,e){
|
|
|
if("row-height"==e.value||"column-width"==e.value){var i=this;new SSE.Views.SetValueDialog({title:e.caption,startvalue:"row-height"==e.value?i.api.asc_getRowHeight():i.api.asc_getColumnWidth(),maxvalue:"row-height"==e.value?Asc.c_oAscMaxRowHeight:Asc.c_oAscMaxColumnWidth,step:"row-height"==e.value?.75:1,rounding:"row-height"==e.value,defaultUnit:"row-height"==e.value?Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt):i.textSym,handler:function(t,n){if("ok"==n){var o=t.getSettings();isNaN(o)||("row-height"==e.value?i.api.asc_setRowHeight(o):i.api.asc_setColumnWidth(o))}Common.NotificationCenter.trigger("edit:complete",i.documentHolder)}}).show()}else"auto-row-height"==e.value?this.api.asc_autoFitRowHeight():this.api.asc_autoFitColumnWidth(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onEntireHide:function(t){this.api&&this.api[t.isrowmenu?"asc_hideRows":"asc_hideColumns"]()},onEntireShow:function(t){this.api&&this.api[t.isrowmenu?"asc_showRows":"asc_showColumns"]()},onFreezePanes:function(t){this.api&&this.api.asc_freezePane()},onEntriesList:function(t){if(this.api){var e=this;setTimeout(function(){e.api.asc_showAutoComplete()},10)}},onAddComment:function(t){if(this.api&&this.permissions.canCoAuthoring&&this.permissions.canComments){var e=SSE.getController("Common.Controllers.Comments"),i=this.api.asc_getCellInfo();if(e){var n=i.asc_getComments();n.length?e.onEditComments(n):(this.permissions.canCoAuthoring||this.commentsCollection.getCommentsReplysCount()<3)&&e.addDummyComment()}}},onAddNamedRange:function(t){if(this.namedrange_locked)return void Common.NotificationCenter.trigger("namedrange:locked");for(var e=this,i=e.api.asc_getWorksheetsCount(),n=-1,o=[];++n<i;)this.api.asc_isWorksheetHidden(n)||o.push({displayValue:e.api.asc_getWorksheetName(n),value:n});var s=function(t,i){"ok"==t&&i&&(e.api.asc_setDefinedNames(i),Common.component.Analytics.trackEvent("DocumentHolder","New Named Range")),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)};new SSE.Views.NamedRangeEditDlg({api:e.api,handler:s,sheets:o,currentSheet:e.api.asc_getActiveWorksheetIndex(),props:e.api.asc_getDefaultDefinedName(),isEdit:!1}).show()},onImgMenu:function(t,e){if(this.api)if("arrange"==e.options.type)this.api.asc_setSelectedDrawingObjectLayer(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Arrange");else if("group"==e.options.type)this.api["grouping"==e.value?"asc_groupGraphicsObjects":"asc_unGroupGraphicsObjects"](),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","grouping"==e.value?"Grouping":"Ungrouping");else if("rotate"==e.options.type){var i=new Asc.asc_CImgProperty;i.asc_putRotAdd(3.14159265358979*(1==e.value?90:270)/180),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Rotate")}else if("flip"==e.options.type){var i=new Asc.asc_CImgProperty;1==e.value?i.asc_putFlipHInvert(!0):i.asc_putFlipVInvert(!0),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Flip")}},onImgCrop:function(t,e){this.api&&(1==e.value?this.api.asc_cropFill():2==e.value?this.api.asc_cropFit():e.checked?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onImgMenuAlign:function(t,e){this.api&&(e.value>-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")))},onParagraphVAlign:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVerticalTextAlign(e.value),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVert(e.options.direction),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")}},onSelectNoneBullet:function(t,e){this.api&&-1==e.options.value&&(this.api.asc_setListType(e.options.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type"))},onSelectBullets:function(t,e,i,n){var o={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;o=i.toJSON()}else o=i;this.api&&this.api.asc_setListType(o.type,o.subtype),"click"!==n.type&&this.documentHolder.textInShapeMenu.hide(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type")},onRemoveHyperlinkShape:function(t){this.api&&(this.api.asc_removeHyperlink(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink"))},onTextAdvanced:function(t){var e=this;new SSE.Views.ParagraphSettingsAdvanced({paragraphProps:t.textInfo,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.api.asc_setGraphicObjectProps(i.paragraphProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced paragraph settings")),Common.NotificationCenter.trigger("edit:complete",e)}}).show()},onShapeAdvanced:function(t){var e=this;new SSE.Views.ShapeSettingsAdvanced({shapeProps:t.shapeInfo,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.api.asc_setGraphicObjectProps(i.shapeProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced shape settings")),Common.NotificationCenter.trigger("edit:complete",e)}}).show()},onImgAdvanced:function(t){var e=this;new SSE.Views.ImageSettingsAdvanced({imageProps:t.imageInfo,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.api.asc_setGraphicObjectProps(i.imageProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced image settings")),Common.NotificationCenter.trigger("edit:complete",e)}}).show()},onChartEdit:function(t){var e,i=this;i.api&&(e=i.api.asc_getChartObject())&&new SSE.Views.ChartSettingsDlg({chartSettings:e,imageSettings:t.chartInfo,isChart:!0,api:i.api,handler:function(t,e){"ok"==t&&i.api&&(i.api.asc_editChartDrawingObject(e.chartSettings),e.imageSettings&&i.api.asc_setGraphicObjectProps(e.imageSettings)),Common.NotificationCenter.trigger("edit:complete",i)}}).show()},onApiCoAuthoringDisconnect:function(){this.permissions.isEdit=!1},hideCoAuthTips:function(){this.tooltips.coauth.ref&&($(this.tooltips.coauth.ref).remove(),this.tooltips.coauth.ref=void 0,this.tooltips.coauth.x_point=void 0,this.tooltips.coauth.y_point=void 0)},hideHyperlinkTip:function(){!this.tooltips.hyperlink.isHidden&&this.tooltips.hyperlink.ref&&(this.tooltips.hyperlink.ref.hide(),this.tooltips.hyperlink.ref=void 0,this.tooltips.hyperlink.text="",this.tooltips.hyperlink.isHidden=!0)},onApiMouseMove:function(t){if(!this._isFullscreenMenu&&t.length){for(var e,i,n,o,s,a,l=t.length;l>0;l--)switch(t[l-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:e=l;break;case Asc.c_oAscMouseMoveType.Comment:i=l;break;case Asc.c_oAscMouseMoveType.LockedObject:n=l;break;case Asc.c_oAscMouseMoveType.ResizeColumn:o=l;break;case Asc.c_oAscMouseMoveType.ResizeRow:s=l;break;case Asc.c_oAscMouseMoveType.Filter:a=l}var r=this,c=[0,0],h=r.tooltips.coauth,d=r.tooltips.comment,p=r.tooltips.hyperlink,m=r.tooltips.row_column,u=r.tooltips.filter,g=[r.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),r.documentHolder.cmpEl.offset().top-$(window).scrollTop()];if(e||r.hideHyperlinkTip(),void 0===o&&void 0===s&&!m.isHidden&&m.ref&&(m.ref.hide(),m.ref=void 0,m.text="",m.isHidden=!0),(r.permissions.isEdit||r.permissions.canViewComments)&&(!i||this.popupmenu)&&(d.moveCommentId=void 0,void 0!=d.viewCommentId)){d={};var b=this.getApplication().getController("Common.Controllers.Comments");b&&(this.permissions.canCoAuthoring&&this.permissions.canViewComments?setTimeout(function(){b.onApiHideComment(!0)},200):b.onApiHideComment(!0))}r.permissions.isEdit&&(n||r.hideCoAuthTips()),(void 0===a||r.dlgFilter&&r.dlgFilter.isVisible()||r.currentMenu&&r.currentMenu.isVisible())&&!u.isHidden&&u.ref&&(u.ref.hide(),u.ref=void 0,u.text="",u.isHidden=!0);if(e){p.parentEl||(p.parentEl=$('<div id="tip-container-hyperlinktip" style="position: absolute; z-index: 10000;"></div>'),r.documentHolder.cmpEl.append(p.parentEl));var f=t[e-1],C=f.asc_getHyperlink();if(C.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var v=C.asc_getTooltip();v=v?Common.Utils.String.htmlEncode(v)+"<br><b>"+r.textCtrlClick+"</b>":C.asc_getHyperlinkUrl()+"<br><b>"+r.textCtrlClick+"</b>"}else v=C.asc_getTooltip()||C.asc_getLocation(),v+="<br><b>"+r.textCtrlClick+"</b>";if(p.ref&&p.ref.isVisible()&&p.text!=v&&(p.ref.hide(),p.ref=void 0,p.text="",p.isHidden=!0),!p.ref||!p.ref.isVisible()){p.text=v,p.ref=new Common.UI.Tooltip({owner:p.parentEl,html:!0,title:v}),p.ref.show([-1e4,-1e4]),p.isHidden=!1,c=[f.asc_getX(),f.asc_getY()],c[0]+=g[0]+6,c[1]+=g[1]-20,c[1]-=p.ref.getBSTip().$tip.height();var _=p.ref.getBSTip().$tip.width();c[0]+_>r.tooltips.coauth.bodyWidth&&(c[0]=r.tooltips.coauth.bodyWidth-_),p.ref.getBSTip().$tip.css({top:c[1]+"px",left:c[0]+"px"})}}if(void 0!==o||void 0!==s){m.parentEl||(m.parentEl=$('<div id="tip-container-rowcolumntip" style="position: absolute; z-index: 10000;"></div>'),r.documentHolder.cmpEl.append(m.parentEl));var f=t[void 0!==o?o-1:s-1],y=Common.Utils.String.format(void 0!==o?this.textChangeColumnWidth:this.textChangeRowHeight,f.asc_getSizeCCOrPt().toFixed(2),f.asc_getSizePx().toFixed());if(m.ref&&m.ref.isVisible()&&m.text!=y&&(m.text=y,m.ref.setTitle(y),m.ref.updateTitle()),!m.ref||!m.ref.isVisible()){m.text=y,m.ref=new Common.UI.Tooltip({owner:m.parentEl,html:!0,title:y}),m.ref.show([-1e4,-1e4]),m.isHidden=!1,c=[f.asc_getX(),f.asc_getY()],c[0]+=g[0]+6,c[1]+=g[1]-20-m.ttHeight;var _=m.ref.getBSTip().$tip.width();c[0]+_>r.tooltips.coauth.bodyWidth&&(c[0]=r.tooltips.coauth.bodyWidth-_-20),m.ref.getBSTip().$tip.css({top:c[1]+"px",left:c[0]+"px"})}}if((r.permissions.isEdit||r.permissions.canViewComments)&&i&&!this.popupmenu&&(f=t[i-1],!d.editCommentId&&d.moveCommentId!=f.asc_getCommentIndexes()[0])){d.moveCommentId=f.asc_getCommentIndexes()[0],d.moveCommentTimer&&clearTimeout(d.moveCommentTimer);var x=f.asc_getCommentIndexes(),w=f.asc_getX(),S=f.asc_getY(),A=f.asc_getReverseX();d.moveCommentTimer=setTimeout(function(){if(d.moveCommentId&&!d.editCommentId){d.viewCommentId=d.moveCommentId;var t=r.getApplication().getController("Common.Controllers.Comments");t&&(t.isSelectedComment||t.onApiShowComment(x,w,S,A,!1,!0))}},400)}if(r.permissions.isEdit&&n&&(f=t[n-1],h.XY||r.onDocumentResize(),h.x_point!=f.asc_getX()||h.y_point!=f.asc_getY())){r.hideCoAuthTips(),h.x_point=f.asc_getX(),h.y_point=f.asc_getY();var k=$(document.createElement("div")),T=f.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||f.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;h.ref=k,k.addClass("username-tip"),k.css({height:h.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(k),c=[T?h.x_point+h.rightMenuWidth:h.bodyWidth-(h.x_point+h.XY[0]),h.y_point+h.XY[1]],c[1]>=h.XY[1]&&c[1]+h.ttHeight<h.XY[1]+h.apiHeight&&(k.text(function(t){var e=SSE.getCollection("Common.Collections.Users");if(e){var i=e.findUser(t);if(i)return i.get("username")}return r.guestText}(f.asc_getUserId())),h.bodyWidth-c[0]<h.ref.width()?k.css({visibility:"visible",left:"0px",top:c[1]-h.ttHeight+"px"}):k.css({visibility:"visible",right:c[0]+"px",top:c[1]+"px"}))}if(!(void 0===a||r.dlgFilter&&r.dlgFilter.isVisible()||r.currentMenu&&r.currentMenu.isVisible())){u.parentEl||(u.parentEl=$('<div id="tip-container-filtertip" style="position: absolute; z-index: 10000;"></div>'),r.documentHolder.cmpEl.append(u.parentEl));var f=t[a-1],y=r.makeFilterTip(f.asc_getFilter());if(u.ref&&u.ref.isVisible()&&u.text!=y&&(u.text=y,u.ref.setTitle(y),u.ref.updateTitle()),!u.ref||!u.ref.isVisible()){u.text=y,u.ref=new Common.UI.Tooltip({owner:u.parentEl,html:!0,title:y,cls:"auto-tooltip"}),u.ref.show([-1e4,-1e4]),u.isHidden=!1,c=[f.asc_getX()+g[0]-10,f.asc_getY()+g[1]+20];u.ref.getBSTip().$tip.width();c[1]+u.ttHeight>r.tooltips.coauth.bodyHeight&&(c[1]=r.tooltips.coauth.bodyHeight-u.ttHeight-5,c[0]+=20);var _=u.ref.getBSTip().$tip.width();c[0]+_>r.tooltips.coauth.bodyWidth&&(c[0]=r.tooltips.coauth.bodyWidth-_-20),u.ref.getBSTip().$tip.css({top:c[1]+"px",left:c[0]+"px"})}}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=void 0},onApiHyperlinkClick:function(t){if(!t)return void Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});if(this.api.asc_getUrlType(t)>0){var e=window.open(t,"_blank");e&&e.focus()}},onApiAutofilter:function(t){var e=this;if(!e.tooltips.filter.isHidden&&e.tooltips.filter.ref&&(e.tooltips.filter.ref.hide(),e.tooltips.filter.ref=void 0,e.tooltips.filter.text="",e.tooltips.filter.isHidden=!0),e.permissions.isEdit&&!e.dlgFilter){e.dlgFilter=new SSE.Views.AutoFilterDialog({api:this.api}).on({close:function(){e.api&&e.api.asc_enableKeyEvents(!0),e.dlgFilter=void 0}}),e.api&&e.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),e.dlgFilter.setSettings(t);var i=e.documentHolder.cmpEl.offset(),n=t.asc_getCellCoord(),o=n.asc_getX()+n.asc_getWidth()+i.left,s=n.asc_getY()+n.asc_getHeight()+i.top,a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight();o+e.dlgFilter.options.width>a&&(o=a-e.dlgFilter.options.width-5),s+e.dlgFilter.options.height>l&&(s=l-e.dlgFilter.options.height-5),e.dlgFilter.show(o,s)}},makeFilterTip:function(t){var e=t.asc_getFilterObj(),i=e.asc_getType(),n=(t.asc_getIsTextFilter(),t.asc_getColorsFill(),t.asc_getColorsFont(),"");if(i===Asc.c_oAscAutoFilterTypes.CustomFilters){var o=e.asc_getFilter(),s=o.asc_getCustomFilters();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,s[0].asc_getOperator())+' "'+s[0].asc_getVal()+'"',s.length>1&&(n=n+" "+(o.asc_getAnd()?this.txtAnd:this.txtOr),n=n+" "+this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,s[1].asc_getOperator())+' "'+s[1].asc_getVal()+'"')}else if(i===Asc.c_oAscAutoFilterTypes.ColorFilter){var a=e.asc_getFilter();null===a.asc_getCellColor()?n=this.txtEqualsToCellColor:!1===a.asc_getCellColor()&&(n=this.txtEqualsToFontColor)}else if(i===Asc.c_oAscAutoFilterTypes.DynamicFilter)n=this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter,e.asc_getFilter().asc_getType());else if(i===Asc.c_oAscAutoFilterTypes.Top10){var l=e.asc_getFilter(),r=l.asc_getPercent();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10,l.asc_getTop()),n+=" "+l.asc_getVal()+" "+(r||null===r?this.txtPercent:this.txtItems)}else if(i===Asc.c_oAscAutoFilterTypes.Filters){var c=0,h=0,d=void 0,p=t.asc_getValues();p.forEach(function(t){t.asc_getVisible()&&(h++,c<100&&t.asc_getText()&&(n+=t.asc_getText()+"; ",c=n.length)),t.asc_getText()||(d=t.asc_getVisible())}),h==p.length?n=this.txtAll:1==h&&d?n=this.txtEquals+' "'+this.txtBlanks+'"':h==p.length-1&&0==d?n=this.txtNotEquals+' "'+this.txtBlanks+'"':(d&&(n+=this.txtBlanks+"; "),n=this.txtEquals+' "'+n.substring(0,n.length-2)+'"')}else i===Asc.c_oAscAutoFilterTypes.None&&(n=this.txtAll);return n.length>100&&(n=n.substring(0,100)+"..."),n="<b>"+(t.asc_getColumnName()||"("+this.txtColumn+" "+t.asc_getSheetColumnName()+")")+":</b><br>"+n},getFilterName:function(t,e){var i="";if(t==Asc.c_oAscAutoFilterTypes.CustomFilters)switch(e){case Asc.c_oAscCustomAutoFilter.equals:i=this.txtEquals;break;case Asc.c_oAscCustomAutoFilter.isGreaterThan:i=this.txtGreater;break;case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:i=this.txtGreaterEquals;break;case Asc.c_oAscCustomAutoFilter.isLessThan:i=this.txtLess;break;case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo:i=this.txtLessEquals;break;case Asc.c_oAscCustomAutoFilter.doesNotEqual:i=this.txtNotEquals;break;case Asc.c_oAscCustomAutoFilter.beginsWith:i=this.txtBegins;break;case Asc.c_oAscCustomAutoFilter.doesNotBeginWith:i=this.txtNotBegins;break;case Asc.c_oAscCustomAutoFilter.endsWith:i=this.txtEnds;break;case Asc.c_oAscCustomAutoFilter.doesNotEndWith:i=this.txtNotEnds;break;case Asc.c_oAscCustomAutoFilter.contains:i=this.txtContains;break;case Asc.c_oAscCustomAutoFilter.doesNotContain:i=this.txtNotContains}else if(t==Asc.c_oAscAutoFilterTypes.DynamicFilter)switch(e){case Asc.c_oAscDynamicAutoFilter.aboveAverage:i=this.txtAboveAve;break;case Asc.c_oAscDynamicAutoFilter.belowAverage:i=this.txtBelowAve}else t==Asc.c_oAscAutoFilterTypes.Top10&&(i=e||null===e?this.txtFilterTop:this.txtFilterBottom);return i},onUndo:function(){this.api&&(this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder))},onApiContextMenu:function(t){var e=this;_.delay(function(){e.showObjectMenu.call(e,t)},10)},onAfterRender:function(t){},onDocumentResize:function(t){var e=this;e.documentHolder&&(e.tooltips.coauth.XY=[e.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),e.documentHolder.cmpEl.offset().top-$(window).scrollTop()],e.tooltips.coauth.apiHeight=e.documentHolder.cmpEl.height(),e.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),e.tooltips.coauth.bodyWidth=$(window).width(),e.tooltips.coauth.bodyHeight=$(window).height())},onDocumentWheel:function(t){if(this.api&&!this.isEditCell){var e=_.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;if(_.isUndefined(e)&&(e=t.deltaY),(t.ctrlKey||t.metaKey)&&!t.altKey){var i=this.api.asc_getZoom();e<0?(i=Math.ceil(10*i)/10,(i-=.1)<.5||this.api.asc_setZoom(i)):e>0&&(i=Math.floor(10*i)/10,(i+=.1)>0&&!(i>2)&&this.api.asc_setZoom(i)),t.preventDefault(),t.stopPropagation()}}},onDocumentKeyDown:function(t){if(this.api){var e=t.keyCode;if(!t.ctrlKey&&!t.metaKey||t.shiftKey||t.altKey){if(e==Common.UI.Keys.F10&&t.shiftKey)return this.showObjectMenu(t),t.preventDefault(),t.stopPropagation(),!1}else if(e===Common.UI.Keys.NUM_PLUS||e===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&e===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==e){if(!this.api.isCellEdited){var i=Math.floor(10*this.api.asc_getZoom())/10;return i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}}else if((e===Common.UI.Keys.NUM_MINUS||e===Common.UI.Keys.MINUS||Common.Utils.isGecko&&e===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==e)&&!this.api.isCellEdited)return i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,i<.5||this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}},onDocumentRightDown:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!1)},onProcessMouse:function(t){"mouseup"==t.type&&(this.mouse.isLeftButtonDown=!1)},onDocumentMouseMove:function(t){"canvas"!==t.target.localName&&this.hideHyperlinkTip()},showObjectMenu:function(t){!this.api||this.mouse.isLeftButtonDown||this.rangeSelectionMode||(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(this.api.asc_getCellInfo(),!0,t):this.fillViewMenuProps(this.api.asc_getCellInfo(),!0,t))},onSelectionChanged:function(t){!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(t,!0):this.fillViewMenuProps(t,!0))},fillMenuProps:function(t,e,i){var n,o,s,a,l,r,c,h,d,p,m=this.documentHolder,u=t.asc_getFlags().asc_getSelectionType(),g=t.asc_getLocked(),b=!0===t.asc_getLockedTable(),f=!1,C=this.getApplication().getController("Common.Controllers.Comments"),v=this.permissions.isEditMailMerge||this.permissions.isEditDiagram;switch(u){case Asc.c_oAscSelectionType.RangeCells:n=!0;break;case Asc.c_oAscSelectionType.RangeRow:o=!0;break;case Asc.c_oAscSelectionType.RangeCol:s=!0;break;case Asc.c_oAscSelectionType.RangeMax:a=!0;break;case Asc.c_oAscSelectionType.RangeImage:r=!v;break;case Asc.c_oAscSelectionType.RangeShape:h=!v;break;case Asc.c_oAscSelectionType.RangeChart:l=!v;break;case Asc.c_oAscSelectionType.RangeChartText:d=!v;break;case Asc.c_oAscSelectionType.RangeShapeText:c=!v}if(this.api.asc_getHeaderFooterMode()){if(!m.copyPasteMenu||!e&&!m.copyPasteMenu.isVisible())return;e&&this.showPopupMenu(m.copyPasteMenu,{},i)}else if(r||h||l){if(!m.imgMenu||!e&&!m.imgMenu.isVisible())return;r=h=l=!1,m.mnuImgAdvanced.imageInfo=void 0;for(var y,x=!1,w=this.api.asc_getGraphicObjectProps(),S=0;S<w.length;S++)if(w[S].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image){var A=w[S].asc_getObjectValue();f=f||A.asc_getLocked();var k=A.asc_getShapeProperties();k?k.asc_getFromChart()?l=!0:k.asc_getFromImage()?p=!0:(m.mnuShapeAdvanced.shapeInfo=A,h=!0):A.asc_getChartProperties()?(m.mnuChartEdit.chartInfo=A,l=!0,x=!0):(m.mnuImgAdvanced.imageInfo=A,r=!0),this.permissions.isSignatureSupport&&(y=A.asc_getSignatureId())}var T=this.api.asc_canGroupGraphicsObjects();m.mnuUnGroupImg.setDisabled(f||!this.api.asc_canUnGroupGraphicsObjects()),m.mnuGroupImg.setDisabled(f||!T),m.menuImageAlign.setDisabled(f||!T);var I=this.api.asc_getSelectedDrawingObjectsCount();m.menuImageAlign.menu.items[7].setDisabled(I<3),m.menuImageAlign.menu.items[8].setDisabled(I<3),m.mnuShapeAdvanced.setVisible(h&&!r&&!l),m.mnuShapeAdvanced.setDisabled(f),m.mnuChartEdit.setVisible(l&&!r&&!h&&x),m.mnuChartEdit.setDisabled(f),m.pmiImgCut.setDisabled(f),m.pmiImgPaste.setDisabled(f),m.mnuImgAdvanced.setVisible(r&&(!h||p)&&!l),m.mnuImgAdvanced.setDisabled(f),m.menuImgOriginalSize.setVisible(r&&(!h||p)&&!l),m.mnuImgAdvanced.imageInfo&&m.menuImgOriginalSize.setDisabled(f||null===m.mnuImgAdvanced.imageInfo.get_ImageUrl()||void 0===m.mnuImgAdvanced.imageInfo.get_ImageUrl());var E=m.mnuImgAdvanced.imageInfo?m.mnuImgAdvanced.imageInfo.asc_getPluginGuid():null;m.menuImgReplace.setVisible(p&&(null===E||void 0===E)),m.menuImgReplace.setDisabled(f||null===E),m.menuImageArrange.setDisabled(f),m.menuImgRotate.setVisible(!l&&(null===E||void 0===E)),m.menuImgRotate.setDisabled(f),m.menuImgCrop.setVisible(this.api.asc_canEditCrop()),m.menuImgCrop.isVisible()&&m.menuImgCrop.setDisabled(f);var P=!!y;m.menuSignatureEditSign.setVisible(P),m.menuSignatureEditSetup.setVisible(P),m.menuEditSignSeparator.setVisible(P),P&&(m.menuSignatureEditSign.cmpEl.attr("data-value",y),m.menuSignatureEditSetup.cmpEl.attr("data-value",y)),e&&this.showPopupMenu(m.imgMenu,{},i),m.mnuShapeSeparator.setVisible(m.mnuShapeAdvanced.isVisible()||m.mnuChartEdit.isVisible()||m.mnuImgAdvanced.isVisible())}else if(c||d){if(!m.textInShapeMenu||!e&&!m.textInShapeMenu.isVisible())return;m.pmiTextAdvanced.textInfo=void 0;for(var w=this.api.asc_getGraphicObjectProps(),M=!1,S=0;S<w.length;S++){var D=w[S].asc_getObjectType();if(D==Asc.c_oAscTypeSelectElement.Image){var F=w[S].asc_getObjectValue(),U=F.asc_getVerticalTextAlign(),V=F.asc_getVert(),R=this.api.asc_getCurrentListType();f=f||F.asc_getLocked(),m.menuParagraphTop.setChecked(U==Asc.c_oAscVAlign.Top),m.menuParagraphCenter.setChecked(U==Asc.c_oAscVAlign.Center),m.menuParagraphBottom.setChecked(U==Asc.c_oAscVAlign.Bottom),m.menuParagraphDirectH.setChecked(V==Asc.c_oAscVertDrawingText.normal),m.menuParagraphDirect90.setChecked(V==Asc.c_oAscVertDrawingText.vert),m.menuParagraphDirect270.setChecked(V==Asc.c_oAscVertDrawingText.vert270),m.menuParagraphBulletNone.setChecked(-1==R.get_ListType());var B=m.paraBulletsPicker.store.findWhere({type:R.get_ListType(),subtype:R.get_ListSubType()});m.paraBulletsPicker.selectRecord(B,!0)}else D==Asc.c_oAscTypeSelectElement.Paragraph?(m.pmiTextAdvanced.textInfo=w[S].asc_getObjectValue(),f=f||m.pmiTextAdvanced.textInfo.asc_getLocked()):D==Asc.c_oAscTypeSelectElement.Math&&(this._currentMathObj=w[S].asc_getObjectValue(),M=!0)}var L=t.asc_getHyperlink(),N=this.api.asc_canAddShapeHyperlink();m.menuHyperlinkShape.setVisible(c&&!1!==N&&L),m.menuAddHyperlinkShape.setVisible(c&&!1!==N&&!L),m.menuParagraphVAlign.setVisible(!0!==d&&!M),m.menuParagraphDirection.setVisible(!0!==d&&!M),m.pmiTextAdvanced.setVisible(void 0!==m.pmiTextAdvanced.textInfo),_.each(m.textInShapeMenu.items,function(t){t.setDisabled(f)}),m.pmiTextCopy.setDisabled(!1);this._currentParaObjDisabled=f,M?this.addEquationMenu(4):this.clearEquationMenu(4),e&&this.showPopupMenu(m.textInShapeMenu,{},i)}else if(!this.permissions.isEditMailMerge&&!this.permissions.isEditDiagram||u!==Asc.c_oAscSelectionType.RangeImage&&u!==Asc.c_oAscSelectionType.RangeShape&&u!==Asc.c_oAscSelectionType.RangeChart&&u!==Asc.c_oAscSelectionType.RangeChartText&&u!==Asc.c_oAscSelectionType.RangeShapeText){if(!m.ssMenu||!e&&!m.ssMenu.isVisible())return;var O=this.api.isCellEdited,H=t.asc_getFormatTableInfo(),$=null!==t.asc_getSparklineInfo(),z=null!==H,G=t.asc_getFlags().asc_getMultiselect();m.ssMenu.formatTableName=z?H.asc_getTableName():null,m.ssMenu.cellColor=t.asc_getFill().asc_getColor(),m.ssMenu.fontColor=t.asc_getFont().asc_getColor(),m.pmiInsertEntire.setVisible(o||s),m.pmiInsertEntire.setCaption(o?this.textInsertTop:this.textInsertLeft),m.pmiDeleteEntire.setVisible(o||s),m.pmiInsertCells.setVisible(n&&!O&&!z),m.pmiDeleteCells.setVisible(n&&!O&&!z),m.pmiSelectTable.setVisible(n&&!O&&z),m.pmiInsertTable.setVisible(n&&!O&&z),m.pmiDeleteTable.setVisible(n&&!O&&z),m.pmiSparklines.setVisible($),m.pmiSortCells.setVisible((n||a)&&!O),m.pmiSortCells.menu.items[2].setVisible(!v),m.pmiSortCells.menu.items[3].setVisible(!v),m.pmiFilterCells.setVisible(n&&!O&&!v),m.pmiReapply.setVisible((n||a)&&!O&&!v),m.ssMenu.items[12].setVisible((n||a||$)&&!O),m.pmiInsFunction.setVisible(n&&!O),m.pmiAddNamedRange.setVisible(n&&!O&&!v),z&&(m.pmiInsertTable.menu.items[0].setDisabled(!H.asc_getIsInsertRowAbove()),m.pmiInsertTable.menu.items[1].setDisabled(!H.asc_getIsInsertRowBelow()),m.pmiInsertTable.menu.items[2].setDisabled(!H.asc_getIsInsertColumnLeft()),m.pmiInsertTable.menu.items[3].setDisabled(!H.asc_getIsInsertColumnRight()),m.pmiDeleteTable.menu.items[0].setDisabled(!H.asc_getIsDeleteRow()),m.pmiDeleteTable.menu.items[1].setDisabled(!H.asc_getIsDeleteColumn()),m.pmiDeleteTable.menu.items[2].setDisabled(!H.asc_getIsDeleteTable()));var L=t.asc_getHyperlink();m.menuHyperlink.setVisible(n&&L&&!O&&!G&&!v),m.menuAddHyperlink.setVisible(n&&!L&&!O&&!G&&!v),m.pmiRowHeight.setVisible(o||a),m.pmiColumnWidth.setVisible(s||a),m.pmiEntireHide.setVisible(s||o),m.pmiEntireShow.setVisible(s||o),m.pmiFreezePanes.setVisible(!O),m.pmiFreezePanes.setCaption(this.api.asc_getSheetViewSettings().asc_getIsFreezePane()?m.textUnFreezePanes:m.textFreezePanes);var j=t.asc_getComments().length;m.ssMenu.items[17].setVisible(n&&!O&&this.permissions.canCoAuthoring&&this.permissions.canComments&&j<1),m.pmiAddComment.setVisible(n&&!O&&this.permissions.canCoAuthoring&&this.permissions.canComments&&j<1),m.pmiCellMenuSeparator.setVisible(n&&!O||o||s||a),m.pmiEntireHide.isrowmenu=o,m.pmiEntireShow.isrowmenu=o,C&&C.blockPopover(!0),m.pmiClear.menu.items[0].setDisabled(!this.permissions.canModifyFilter),m.pmiClear.menu.items[1].setDisabled(O),m.pmiClear.menu.items[2].setDisabled(O||!this.permissions.canModifyFilter),m.pmiClear.menu.items[3].setDisabled(O),m.pmiClear.menu.items[4].setDisabled(O),m.pmiClear.menu.items[3].setVisible(!this.permissions.isEditDiagram),m.pmiClear.menu.items[4].setVisible(!this.permissions.isEditDiagram);var W=t.asc_getAutoFilterInfo(),q=!!W&&W.asc_getIsApplyAutoFilter();W=W?W.asc_getIsAutoFilter():null,m.pmiInsertCells.menu.items[0].setDisabled(q),m.pmiDeleteCells.menu.items[0].setDisabled(q),m.pmiInsertCells.menu.items[1].setDisabled(q),m.pmiDeleteCells.menu.items[1].setDisabled(q);var K=!!t.asc_getPivotTableInfo();m.pmiEntriesList.setVisible(!O&&!K),m.pmiNumFormat.setVisible(!O),m.pmiAdvancedNumFormat.options.numformatinfo=m.pmiNumFormat.menu.options.numformatinfo=t.asc_getNumFormatInfo(),m.pmiAdvancedNumFormat.options.numformat=t.asc_getNumFormat(),_.each(m.ssMenu.items,function(t){t.setDisabled(g)}),m.pmiCopy.setDisabled(!1),m.pmiCut.setDisabled(g||K),m.pmiPaste.setDisabled(g||K),m.pmiInsertEntire.setDisabled(g||b),m.pmiInsertCells.setDisabled(g||b||K),m.pmiInsertTable.setDisabled(g||b),m.pmiDeleteEntire.setDisabled(g||b),m.pmiDeleteCells.setDisabled(g||b||K),m.pmiDeleteTable.setDisabled(g||b),m.pmiClear.setDisabled(g||K),m.pmiFilterCells.setDisabled(g||b||null==W||K||!W&&!this.permissions.canModifyFilter),m.pmiSortCells.setDisabled(g||b||null==W||K||!this.permissions.canModifyFilter),m.pmiReapply.setDisabled(g||b||!0!==q),m.menuHyperlink.setDisabled(g||K),m.menuAddHyperlink.setDisabled(g||K),m.pmiInsFunction.setDisabled(g||K),e&&this.showPopupMenu(m.ssMenu,{},i)}else if(this.permissions.isEditDiagram&&u==Asc.c_oAscSelectionType.RangeChartText){if(!e&&!m.textInShapeMenu.isVisible())return;m.pmiTextAdvanced.textInfo=void 0,m.menuHyperlinkShape.setVisible(!1),m.menuAddHyperlinkShape.setVisible(!1),m.menuParagraphVAlign.setVisible(!1),m.menuParagraphDirection.setVisible(!1),m.pmiTextAdvanced.setVisible(!1),m.textInShapeMenu.items[9].setVisible(!1),m.pmiTextCopy.setDisabled(!1),e&&this.showPopupMenu(m.textInShapeMenu,{},i)}},fillViewMenuProps:function(t,e,i){var n,o=this.documentHolder,s=t.asc_getFlags().asc_getSelectionType(),a=t.asc_getLocked(),l=!0===t.asc_getLockedTable(),r=this.getApplication().getController("Common.Controllers.Comments"),c=s==Asc.c_oAscSelectionType.RangeCells&&!this.permissions.isEditMailMerge&&!this.permissions.isEditDiagram,h=this.api.isCellEdited,d=s==Asc.c_oAscSelectionType.RangeImage&&!this.permissions.isEditMailMerge&&!this.permissions.isEditDiagram;if(o.viewModeMenu||o.createDelayedElementsViewer(),o.viewModeMenu||o.createDelayedElementsViewer(),e||o.viewModeMenu.isVisible()){if(d&&this.permissions.isSignatureSupport)for(var p=this.api.asc_getGraphicObjectProps(),m=0;m<p.length;m++)p[m].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&(n=p[m].asc_getObjectValue().asc_getSignatureId());var u=n?this.api.asc_getSignatureSetup(n):null,g=!!u&&this._canProtect,b=c&&!h&&this.permissions.canCoAuthoring&&this.permissions.canComments&&!this._isDisabled&&t.asc_getComments().length<1;o.menuViewUndo.setVisible(this.permissions.canCoAuthoring&&this.permissions.canComments&&!this._isDisabled),o.menuViewUndo.setDisabled(!this.api.asc_getCanUndo()&&!this._isDisabled),o.menuViewCopySeparator.setVisible(g);var f=!!u&&u.asc_getRequested();o.menuSignatureViewSign.setVisible(g&&f),o.menuSignatureDetails.setVisible(g&&!f),o.menuSignatureViewSetup.setVisible(g),o.menuSignatureRemove.setVisible(g&&!f),o.menuViewSignSeparator.setVisible(b),g&&(o.menuSignatureViewSign.cmpEl.attr("data-value",n),o.menuSignatureDetails.cmpEl.attr("data-value",u.asc_getId()),o.menuSignatureViewSetup.cmpEl.attr("data-value",n),o.menuSignatureRemove.cmpEl.attr("data-value",n)),o.menuViewAddComment.setVisible(b),r&&r.blockPopover(!0),o.menuViewAddComment.setDisabled(a||l),e&&this.showPopupMenu(o.viewModeMenu,{},i)}},showPopupMenu:function(t,e,i){if(!_.isUndefined(t)&&null!==t&&i){Common.UI.Menu.Manager.hideAll()
|
|
|
;var n=this,o=n.documentHolder,s=[i.pageX*Common.Utils.zoom()-o.cmpEl.offset().left,i.pageY*Common.Utils.zoom()-o.cmpEl.offset().top],a=o.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",t.id));if(t.rendered||(a.length<1&&(a=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',t.id)),o.cmpEl.append(a)),t.render(a),t.cmpEl.attr({tabindex:"-1"})),2!==i.button){var l=n.api.asc_getActiveCellCoord(),r={left:0,top:0};s[0]=l.asc_getX()+l.asc_getWidth()+r.left,s[1]=(l.asc_getY()<0?0:l.asc_getY())+l.asc_getHeight()+r.top}a.css({left:s[0],top:s[1]}),_.isFunction(t.options.initMenu)&&(t.options.initMenu(e),t.alignPosition()),_.delay(function(){t.cmpEl.focus()},10),t.show(),n.currentMenu=t}},onEntriesListMenu:function(t){if(t&&t.length>0){for(var e=this,i=e.documentHolder,n=i.entriesMenu,o=i.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",n.id)),s=0;s<n.items.length;s++)n.removeItem(n.items[s]),s--;_.each(t,function(t,i){var o=new Common.UI.MenuItem({caption:t}).on("click",function(t,i){e.api.asc_insertFormula(t.caption,Asc.c_oAscPopUpSelectorType.None,!1)});n.addItem(o)}),Common.UI.Menu.Manager.hideAll(),n.rendered||(o.length<1&&(o=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',n.id)),i.cmpEl.append(o)),n.render(o),n.cmpEl.attr({tabindex:"-1"}));var a=e.api.asc_getActiveCellCoord(),l={left:0,top:0},r=[a.asc_getX()+l.left,(a.asc_getY()<0?0:a.asc_getY())+a.asc_getHeight()+l.top];o.css({left:r[0],top:r[1]}),n.show(),n.alignPosition(),_.delay(function(){n.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onFormulaCompleteMenu:function(t){if(this.documentHolder.funcMenu)if(t){for(var e=this,i=e.documentHolder,n=i.funcMenu,o=i.cmpEl.find("#menu-formula-selection"),s=e.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),a=0;a<n.items.length;a++){var l=n.items[a].cmpEl.data("bs.tooltip");l&&l.hide(),n.removeItem(n.items[a]),a--}t.sort(function(t,e){var i=t.asc_getName(!0).toLocaleUpperCase(),n=e.asc_getName(!0).toLocaleUpperCase();return i<n?-1:i>n?1:0}),_.each(t,function(t,i){var o=t.asc_getType(),a=t.asc_getName(!0),l=e.api.asc_getFormulaNameByLocale(a),r=new Common.UI.MenuItem({iconCls:o==Asc.c_oAscPopUpSelectorType.Func?"mnu-popup-func":o==Asc.c_oAscPopUpSelectorType.Table?"mnu-popup-table":"mnu-popup-range",caption:a,hint:s&&s[l]?s[l].d:""}).on("click",function(t,i){setTimeout(function(){e.api.asc_insertFormula(t.caption,o,!1)},10)});n.addItem(r)}),n.rendered||(o.length<1&&(o=$(Common.Utils.String.format('<div id="menu-formula-selection" style="position: absolute; z-index: 10000;" class="no-stop-propagate"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>')),i.cmpEl.append(o)),n.onAfterKeydownMenu=function(t){if(t.keyCode!=Common.UI.Keys.RETURN||!t.ctrlKey&&!t.altKey){var e;if(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),o.hasClass("open"))if(t.keyCode==Common.UI.Keys.TAB||t.keyCode==Common.UI.Keys.RETURN&&!t.ctrlKey&&!t.altKey)e=o.find("a.focus").closest("li");else if(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN){var i=n.cmpEl,s=i.offset().top,a=o.find("a.focus").closest("li"),l=a.offset().top;(l<s||l+a.outerHeight()>s+i.height())&&(n.scroller?n.scroller.scrollTop(i.scrollTop()+l-s,0):i.scrollTop(i.scrollTop()+l-s))}e&&(e.length>0&&e.click(),Common.UI.Menu.Manager.hideAll())}},n.on("hide:after",function(){for(var t=0;t<n.items.length;t++){var e=n.items[t].cmpEl.data("bs.tooltip");e&&e.hide()}}),n.render(o),n.cmpEl.attr({tabindex:"-1"}));var r=e.api.asc_getActiveCellCoord(),c={left:0,top:0},h=[r.asc_getX()+c.left,(r.asc_getY()<0?0:r.asc_getY())+r.asc_getHeight()+c.top];o.css({left:h[0],top:h[1]}),n.alignPosition();var d=e.cellEditor.is(":focus");n.isVisible()||Common.UI.Menu.Manager.hideAll(),_.delay(function(){n.isVisible()||n.show(),n.scroller&&(n.scroller.update({alwaysVisibleY:!0}),n.scroller.scrollTop(0)),d&&e.cellEditor.focus(),n.cmpEl.toggleClass("from-cell-edit",d),_.delay(function(){var t=n.cmpEl.find("li:first a");t.addClass("focus");var e=t.parent().data("bs.tooltip");e&&e.show()},10),d||_.delay(function(){n.cmpEl.focus()},10)},1)}else this.documentHolder.funcMenu.hide()},onFormulaInfo:function(t){var e=this.tooltips.func_arg;if(t){e.parentEl||(e.parentEl=$('<div id="tip-container-functip" style="position: absolute; z-index: 10000;"></div>'),this.documentHolder.cmpEl.append(e.parentEl));var i=this.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),n=(i&&i[t]?this.api.asc_getFormulaLocaleName(t)+i[t].a:"").replace(/[,;]/g,this.api.asc_getFunctionArgumentSeparator());if(e.ref&&e.ref.isVisible()&&e.text!=n&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0),!n)return;e.ref&&e.ref.isVisible()||(e.text=n,e.ref=new Common.UI.Tooltip({owner:e.parentEl,html:!0,title:n,cls:"auto-tooltip"}),e.ref.show([-1e4,-1e4]),e.isHidden=!1);var o=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],s=this.api.asc_getActiveCellCoord(),a=[s.asc_getX()+o[0]-3,s.asc_getY()+o[1]-e.ref.getBSTip().$tip.height()-5],l=e.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),e.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!e.isHidden&&e.ref&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0)},onInputMessage:function(t,e){var i=this.tooltips.input_msg;if(e){i.parentEl||(i.parentEl=$('<div id="tip-container-inputtip" style="position: absolute; z-index: 10000;"></div>'),this.documentHolder.cmpEl.append(i.parentEl));var n=t?"<b>"+(t||"")+"</b><br>":"";n+=e||"",i.ref&&i.ref.isVisible()&&i.text!=n&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0),i.ref&&i.ref.isVisible()||(i.text=n,i.ref=new Common.UI.Tooltip({owner:i.parentEl,html:!0,title:n}),i.ref.show([-1e4,-1e4]),i.isHidden=!1);var o=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],s=this.api.asc_getActiveCellCoord(),a=[s.asc_getX()+o[0]-3,s.asc_getY()+o[1]-i.ref.getBSTip().$tip.height()-5],l=i.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),i.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!i.isHidden&&i.ref&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0)},onShowSpecialPasteOptions:function(t){var e=this,i=e.documentHolder,n=t.asc_getCellCoord(),o=i.cmpEl.find("#special-paste-container"),s=t.asc_getOptions();if(s){if(o.length<1&&(e._arrSpecialPaste=[],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=[e.txtPaste,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=[e.txtPasteFormulas,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=[e.txtPasteFormulaNumFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=[e.txtPasteKeepSourceFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=[e.txtPasteBorders,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=[e.txtPasteColWidths,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=[e.txtPasteMerge,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=[e.txtPasteTranspose,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=[e.txtPasteValues,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=[e.txtPasteValNumFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=[e.txtPasteValFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=[e.txtPasteFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=[e.txtPasteLink,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=[e.txtPastePicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=[e.txtPasteLinkPicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=[e.txtPasteSourceFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=[e.txtPasteDestFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=[e.txtKeepTextOnly,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport]=[e.txtUseTextImport,3],o=$('<div id="special-paste-container" style="position: absolute;"><div id="id-document-holder-btn-special-paste"></div></div>'),i.cmpEl.append(o),e.btnSpecialPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),e.btnSpecialPaste.render($("#id-document-holder-btn-special-paste"))),s.length>0){for(var a=e.btnSpecialPaste.menu,l=0;l<a.items.length;l++)a.removeItem(a.items[l]),l--;for(var r=[],l=0;l<3;l++)r[l]=[];var c;_.each(s,function(t,i){if(t==Asc.c_oSpecialPasteProps.useTextImport)c=new Common.UI.MenuItem({caption:e._arrSpecialPaste[t][0],value:t,checkable:!0,toggleGroup:"specialPasteGroup"}).on("click",function(t,i){new Common.Views.OpenDialog({title:e.txtImportWizard,closable:!0,type:Common.Utils.importTextType.Paste,preview:!0,api:e.api,handler:function(i,n,o,s){if("ok"==i){if(e&&e.api){var a=new Asc.SpecialPasteProps;a.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport),a.asc_setAdvancedOptions(new Asc.asc_CTextOptions(n,o,s)),e.api.asc_SpecialPaste(a)}e._state.lastSpecPasteChecked=t}else t.setChecked(!1,!0),e._state.lastSpecPasteChecked&&e._state.lastSpecPasteChecked.setChecked(!0,!0)}}).show(),setTimeout(function(){a.hide()},100)});else{var n=new Common.UI.MenuItem({caption:e._arrSpecialPaste[t][0],value:t,checkable:!0,toggleGroup:"specialPasteGroup"}).on("click",function(t,i){e._state.lastSpecPasteChecked=t;var n=new Asc.SpecialPasteProps;n.asc_setProps(t.value),e.api.asc_SpecialPaste(n),setTimeout(function(){a.hide()},100)});r[e._arrSpecialPaste[t][1]].push(n)}});for(var h=!1,l=0;l<3;l++)h&&r[l].length>0&&(a.addItem(new Common.UI.MenuItem({caption:"--"})),h=!1),_.each(r[l],function(t,e){a.addItem(t),h=!0});a.items.length>0&&a.items[0].setChecked(!0,!0),e._state.lastSpecPasteChecked=a.items.length>0?a.items[0]:null,c&&(a.addItem(new Common.UI.MenuItem({caption:"--"})),a.addItem(c))}if(n[0].asc_getX()<0||n[0].asc_getY()<0)return void(o.is(":visible")&&o.hide());var d=n[0],p=n[1],m=e.tooltips.coauth.bodyWidth-e.tooltips.coauth.XY[0]-e.tooltips.coauth.rightMenuWidth-15,u=e.tooltips.coauth.apiHeight-15,g=[],b=[31,20],f=d.asc_getX()+d.asc_getWidth()+3+b[0],C=d.asc_getY()+d.asc_getHeight()+3+b[1];f>m?(g[0]=void 0!==p?p.asc_getX():m-b[0]-3,C>u&&(g[0]-=b[0]+3),g[0]<0&&(g[0]=m-3-b[0])):g[0]=f-b[0],g[1]=C>u?u-3-b[1]:C-b[1],o.css({left:g[0],top:g[1]}),o.show()}},onHideSpecialPasteOptions:function(){var t=this.documentHolder.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},onToggleAutoCorrectOptions:function(t){if(!t){var e=this.documentHolder.cmpEl.find("#autocorrect-paste-container");return void(e.is(":visible")&&e.hide())}var i=this,n=i.documentHolder,o=t.asc_getCellCoord(),e=n.cmpEl.find("#autocorrect-paste-container"),s=t.asc_getOptions();if(e.length<1&&(i._arrAutoCorrectPaste=[],i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.UndoTableAutoExpansion]=i.txtUndoExpansion,i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.RedoTableAutoExpansion]=i.txtRedoExpansion,e=$('<div id="autocorrect-paste-container" style="position: absolute;"><div id="id-document-holder-btn-autocorrect-paste"></div></div>'),n.cmpEl.append(e),i.btnAutoCorrectPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),i.btnAutoCorrectPaste.render($("#id-document-holder-btn-autocorrect-paste"))),s.length>0){for(var a=i.btnAutoCorrectPaste.menu,l=0;l<a.items.length;l++)a.removeItem(a.items[l]),l--;_.each(s,function(t,e){var n=new Common.UI.MenuItem({caption:i._arrAutoCorrectPaste[t],value:t}).on("click",function(t,e){i.api.asc_applyAutoCorrectOptions(t.value),setTimeout(function(){a.hide()},100)});a.addItem(n)})}var r=i.tooltips.coauth.bodyWidth-i.tooltips.coauth.XY[0]-i.tooltips.coauth.rightMenuWidth-15,c=i.tooltips.coauth.apiHeight-15,h=[31,20],d=o.asc_getX()+o.asc_getWidth()+2+h[0],p=o.asc_getY()+o.asc_getHeight()+1+h[1];d>r||p>c||o.asc_getX()<0||o.asc_getY()<0?e.is(":visible")&&e.hide():(e.css({left:d-h[0],top:p-h[1]}),e.show())},onCellsRange:function(t){this.rangeSelectionMode=t!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(t){this.isEditFormula=t==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onChangeCropState:function(t){this.documentHolder.menuImgCrop.menu.items[0].setChecked(t,!0)},initEquationMenu:function(){if(this._currentMathObj){var t,e=this,i=e._currentMathObj.get_Type(),n=e._currentMathObj,o=[];switch(i){case Asc.c_oAscMathInterfaceType.Accent:t=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_AccentCharacter"}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.BorderBox:t=new Common.UI.MenuItem({caption:e.txtBorderProps,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.get_HideTop()?e.txtAddTop:e.txtHideTop,equationProps:{type:i,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:i,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:i,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:i,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:i,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:i,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:i,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:i,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Bar"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();s==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)):(s==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)));break;case Asc.c_oAscMathInterfaceType.Fraction:var a=n.get_FractionType();a!=Asc.c_oAscMathInterfaceFraction.Skewed&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Matrix:t=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),o.push(t),t=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:i,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:i,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!1}}]})}),o.push(t),t=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:i,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:i,callback:"delete_MatrixColumn"}}]})}),o.push(t),t=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:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),o.push(t),t=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:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.EqArray:t=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!1}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_Equation"}}),o.push(t),t=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:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),o.push(t),void 0!==n.get_HideUpper()&&(t=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideUpper",value:!n.get_HideUpper()}}),o.push(t)),void 0!==n.get_HideLower()&&(t=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideLower",value:!n.get_HideLower()}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!1}}),o.push(t),n.can_DeleteArgument()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_DelimiterArgument"}}),o.push(t)),t=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_DelimiterCharacters"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:i,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtMatchBrackets,equation:!0,disabled:!n.get_StretchBrackets()||e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets()&&n.get_MatchBrackets(),equationProps:{type:i,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Radical:void 0!==n.get_HideDegree()&&(t=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideDegree",value:!n.get_HideDegree()}}),o.push(t)),t=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Radical"}}),o.push(t)}return n.can_IncreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"increase_ArgumentSize"}}),o.push(t)),n.can_DecreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"decrease_ArgumentSize"}}),o.push(t)),n.can_InsertManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_ManualBreak"}}),o.push(t)),n.can_DeleteManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_ManualBreak"}}),o.push(t)),n.can_AlignToCharacter()&&(t=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"align_ToCharacter"}}),o.push(t)),o}},addEquationMenu:function(t){var e=this;e.clearEquationMenu(t);var i=e.documentHolder.textInShapeMenu,n=e.initEquationMenu();return n.length>0&&_.each(n,function(n,o){n.menu?_.each(n.menu.items,function(t){t.on("click",_.bind(e.equationCallback,e,t.options.equationProps))}):n.on("click",_.bind(e.equationCallback,e,n.options.equationProps)),i.insertItem(t,n),t++}),n.length},clearEquationMenu:function(t){for(var e=this,i=e.documentHolder.textInShapeMenu,n=t;n<i.items.length&&i.items[n].options.equation;n++)i.items[n].menu?_.each(i.items[n].menu.items,function(t){t.off("click")}):i.items[n].off("click"),i.removeItem(i.items[n]),n--},equationCallback:function(t){var e=this;if(t){var i;switch(t.type){case Asc.c_oAscMathInterfaceType.Accent:i=new CMathMenuAccent;break;case Asc.c_oAscMathInterfaceType.BorderBox:i=new CMathMenuBorderBox;break;case Asc.c_oAscMathInterfaceType.Box:i=new CMathMenuBox;break;case Asc.c_oAscMathInterfaceType.Bar:i=new CMathMenuBar;break;case Asc.c_oAscMathInterfaceType.Script:i=new CMathMenuScript;break;case Asc.c_oAscMathInterfaceType.Fraction:i=new CMathMenuFraction;break;case Asc.c_oAscMathInterfaceType.Limit:i=new CMathMenuLimit;break;case Asc.c_oAscMathInterfaceType.Matrix:i=new CMathMenuMatrix;break;case Asc.c_oAscMathInterfaceType.EqArray:i=new CMathMenuEqArray;break;case Asc.c_oAscMathInterfaceType.LargeOperator:i=new CMathMenuNary;break;case Asc.c_oAscMathInterfaceType.Delimiter:i=new CMathMenuDelimiter;break;case Asc.c_oAscMathInterfaceType.GroupChar:i=new CMathMenuGroupCharacter;break;case Asc.c_oAscMathInterfaceType.Radical:i=new CMathMenuRadical;break;case Asc.c_oAscMathInterfaceType.Common:i=new CMathMenuBase}i&&(i[t.callback](t.value),e.api.asc_SetMathProps(i))}Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},onTextInShapeAfterRender:function(t){var e=this.documentHolder,i=e.paraBulletsPicker.conf;e.paraBulletsPicker=new Common.UI.DataView({el:$("#id-docholder-menu-bullets"),parentMenu:e.menuParagraphBullets.menu,store:e.paraBulletsPicker.store,itemTemplate:_.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')}),e.paraBulletsPicker.on("item:click",_.bind(this.onSelectBullets,this)),i&&e.paraBulletsPicker.selectRecord(i.rec,!0)},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onOriginalSizeClick:function(t){if(this.api){var e=this.api.asc_getOriginalImageSize(),i=e.asc_getImageWidth(),n=e.asc_getImageHeight(),o=new Asc.asc_CImgProperty;o.asc_putWidth(i),o.asc_putHeight(n),o.put_ResetCrop(!0),this.api.asc_setGraphicObjectProps(o),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}},onImgReplace:function(t,e){var i=this;this.api&&("file"==e.value?setTimeout(function(){i.api&&i.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",i.documentHolder)},10):new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&i.api){var n=e.replace(/ /g,"");if(!_.isEmpty(n)){var o=new Asc.asc_CImgProperty;o.asc_putImageUrl(n),i.api.asc_setGraphicObjectProps(o)}}Common.NotificationCenter.trigger("edit:complete",i.documentHolder)}}).show())},onNumberFormatSelect:function(t,e){void 0!==e.value&&"advanced"!==e.value&&this.api&&this.api.asc_setCellFormat(e.options.format),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onCustomNumberFormat:function(t){var e=this,i=e.api.asc_getLocale();!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,i){i&&e.api.asc_setCellFormat(i.format),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},props:{format:t.options.numformat,formatInfo:t.options.numformatinfo,langId:i}}).show(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onNumberFormatOpenAfter:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo
|
|
|
;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);for(var o=this.api.asc_getFormatCells(n),s=0;s<t.items.length-2;s++)t.items[s].options.format=o[s]}var a=t.options.numformatinfo;a=a?a.asc_getType():-1;for(var s=0;s<t.items.length-2;s++){var l=t.items[s];l.options.exampleval=e.api.asc_getLocaleExample(l.options.format),$(l.el).find("label").text(l.options.exampleval),l.setChecked(a==l.value)}}},SetDisabled:function(t,e){this._isDisabled=t,this._canProtect=e},guestText:"Guest",textCtrlClick:"Click the link to open it or click and hold the mouse button to select the cell.",txtHeight:"Height",txtWidth:"Width",tipIsLocked:"This element is being edited by another user.",textChangeColumnWidth:"Column Width {0} symbols ({1} pixels)",textChangeRowHeight:"Row Height {0} points ({1} pixels)",textInsertLeft:"Insert Left",textInsertTop:"Insert Top",textSym:"sym",notcriticalErrorTitle:"Warning",errorInvalidLink:"The link reference does not exist. Please correct the link or delete it.",txtRemoveAccentChar:"Remove accent character",txtBorderProps:"Borders property",txtHideTop:"Hide top border",txtHideBottom:"Hide bottom border",txtHideLeft:"Hide left border",txtHideRight:"Hide right border",txtHideHor:"Hide horizontal line",txtHideVer:"Hide vertical line",txtHideLT:"Hide left top line",txtHideLB:"Hide left bottom line",txtAddTop:"Add top border",txtAddBottom:"Add bottom border",txtAddLeft:"Add left border",txtAddRight:"Add right border",txtAddHor:"Add horizontal line",txtAddVer:"Add vertical line",txtAddLT:"Add left top line",txtAddLB:"Add left bottom line",txtRemoveBar:"Remove bar",txtOverbar:"Bar over text",txtUnderbar:"Bar under text",txtRemScripts:"Remove scripts",txtRemSubscript:"Remove subscript",txtRemSuperscript:"Remove superscript",txtScriptsAfter:"Scripts after text",txtScriptsBefore:"Scripts before text",txtFractionStacked:"Change to stacked fraction",txtFractionSkewed:"Change to skewed fraction",txtFractionLinear:"Change to linear fraction",txtRemFractionBar:"Remove fraction bar",txtAddFractionBar:"Add fraction bar",txtRemLimit:"Remove limit",txtLimitOver:"Limit over text",txtLimitUnder:"Limit under text",txtHidePlaceholder:"Hide placeholder",txtShowPlaceholder:"Show placeholder",txtMatrixAlign:"Matrix alignment",txtColumnAlign:"Column alignment",txtTop:"Top",txtBottom:"Bottom",txtInsertEqBefore:"Insert equation before",txtInsertEqAfter:"Insert equation after",txtDeleteEq:"Delete equation",txtLimitChange:"Change limits location",txtHideTopLimit:"Hide top limit",txtShowTopLimit:"Show top limit",txtHideBottomLimit:"Hide bottom limit",txtShowBottomLimit:"Show bottom limit",txtInsertArgBefore:"Insert argument before",txtInsertArgAfter:"Insert argument after",txtDeleteArg:"Delete argument",txtHideOpenBracket:"Hide opening bracket",txtShowOpenBracket:"Show opening bracket",txtHideCloseBracket:"Hide closing bracket",txtShowCloseBracket:"Show closing bracket",txtStretchBrackets:"Stretch brackets",txtMatchBrackets:"Match brackets to argument height",txtGroupCharOver:"Char over text",txtGroupCharUnder:"Char under text",txtDeleteGroupChar:"Delete char",txtHideDegree:"Hide degree",txtShowDegree:"Show degree",txtIncreaseArg:"Increase argument size",txtDecreaseArg:"Decrease argument size",txtInsertBreak:"Insert manual break",txtDeleteBreak:"Delete manual break",txtAlignToChar:"Align to character",txtDeleteRadical:"Delete radical",txtDeleteChars:"Delete enclosing characters",txtDeleteCharsAndSeparators:"Delete enclosing characters and separators",insertText:"Insert",alignmentText:"Alignment",leftText:"Left",rightText:"Right",centerText:"Center",insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteText:"Delete",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",txtNoChoices:"There are no choices for filling the cell.<br>Only 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",txtKeepTextOnly:"Keep text only",txtUseTextImport:"Use text import wizard",txtUndoExpansion:"Undo table autoexpansion",txtRedoExpansion:"Redo table autoexpansion",txtAnd:"and",txtOr:"or",txtEquals:"Equals",txtNotEquals:"Does not equal",txtGreater:"Greater than",txtGreaterEquals:"Greater than or equal to",txtLess:"Less than",txtLessEquals:"Less than or equal to",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with",txtNotBegins:"Does not begin with",txtEnds:"Ends with",txtNotEnds:"Does not end with",txtContains:"Contains",txtNotContains:"Does not contain",txtFilterTop:"Top",txtFilterBottom:"Bottom",txtItems:"items",txtPercent:"percent",txtEqualsToCellColor:"Equals to cell color",txtEqualsToFontColor:"Equals to font color",txtAll:"(All)",txtBlanks:"(Blanks)",txtColumn:"Column",txtImportWizard:"Text Import Wizard"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.template",[],function(){return'<div class="ce-group-name">\r\n <input id="ce-cell-name" class="aslabel form-control" type="text">\r\n <div id="ce-cell-name-menu"></div>\r\n <button id="ce-func-label" type="button" class="btn small btn-toolbar"><i class="icon"> </i></button>\r\n</div>\r\n<div class="ce-group-expand">\r\n <button id="ce-btn-expand" type="button" class="btn"><span class="caret img-commonctrl"> </span></button>\r\n</div>\r\n<div class="ce-group-content">\r\n <textarea id="ce-cell-content" class="form-control" spellcheck="false" rows="1" cols="20"></textarea>\r\n</div>\r\n'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(t){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(t),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t)},render:function(){$(this.el).html(this.template()),this.btnNamedRanges=new Common.UI.Button({menu:new Common.UI.Menu({style:"min-width: 70px;max-width:400px;",maxHeight:250,items:[{caption:this.textManager,value:"manager"},{caption:"--"}]})}),this.btnNamedRanges.render($("#ce-cell-name-menu")),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-81),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var t=this;return this.$cellname.on("focus",function(e){var i=t.$cellname[0];i.selectionStart=0,i.selectionEnd=i.value.length,i.scrollLeft=i.scrollWidth}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(t){t&&this.$cellname.val("string"==typeof t?t:t.asc_getName())},cellNameDisabled:function(t){t?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(t)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.template",[],function(){return'<div class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textFilter %></label>\r\n <div id="name-manager-combo-filter" class="input-group-nr" style="width:210px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <div style="width: 169px;display: inline-block;"><span id="name-manager-sort-name" class="header-sorted">\r\n <label class="header"><%= scope.textRanges %></label><div style="width: 6px;height: 6px;"></div><span id="name-manager-sort-name-span" class="sort-direction img-commonctrl"></span>\r\n </span></div>\r\n <div style="width: 92px;display: inline-block;"><span id="name-manager-sort-scope" class="header-sorted">\r\n <label class="header"><%= scope.textScope %></label><div style="width: 6px;height: 6px;"></div><span id="name-manager-sort-scope-span" class="sort-direction img-commonctrl"></span>\r\n </span></div>\r\n <label class="header" style=""><%= scope.textDataRange %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <div id="name-manager-range-list" class="range-tableview" style="width:100%; height: 143px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <button type="button" class="btn btn-text-default" id="name-manager-btn-new" style="min-width: 100px;margin-right:5px;"><%= scope.textNew %></button>\r\n <button type="button" class="btn btn-text-default" id="name-manager-btn-edit" style="min-width: 100px;"><%= scope.textEdit %></button>\r\n </td>\r\n <td class="padding-large" style="text-align: right;width:90px;">\r\n <button type="button" class="btn btn-text-default" id="name-manager-btn-delete" style="min-width: 100px;"><%= scope.textDelete %></button>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("spreadsheeteditor/main/app/view/NameManagerDlg",["text!spreadsheeteditor/main/app/template/NameManagerDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/ListView","common/main/lib/component/InputField"],function(t){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:510,height:353},initialize:function(e){_.extend(this.options,{title:this.txtTitle,template:['<div class="box" style="height:'+(this.options.height-85)+'px;">','<div class="content-panel" style="padding: 0;">'+_.template(t)({scope:this})+"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+this.closeButtonText+"</button>","</div>"].join("")},e),this.api=e.api,this.handler=e.handler,this.sheets=e.sheets||[],this.sheetNames=e.sheetNames||[],this.ranges=e.ranges||[],this.props=e.props,this.sort=e.sort||{type:"name",direction:1},this.locked=e.locked||!1,this.userTooltip=!0,this.currentNamedRange=void 0,this.rangesStore=new Common.UI.DataViewStore,this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbFilter=new Common.UI.ComboBox({el:$("#name-manager-combo-filter"),menuStyle:"min-width: 100%;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textFilterAll},{value:1,displayValue:this.textFilterDefNames},{value:2,displayValue:this.textFilterTableNames},{value:3,displayValue:this.textFilterSheet},{value:4,displayValue:this.textFilterWorkbook}]}).on("selected",function(e,i){t.refreshRangeList(null,0)}),this.cmbFilter.setValue(0),this.rangeList=new Common.UI.ListView({el:$("#name-manager-range-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,emptyText:this.textEmpty,template:_.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:_.template(['<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">','<div class="listitem-icon <% if (isTable) {%>listitem-table<%} %>"></div>','<div style="width:141px;padding-right: 5px;"><%= name %></div>','<div style="width:94px;padding-right: 5px;"><%= scopeName %></div>','<div style="width:212px;"><%= range %></div>',"<% if (lock) { %>",'<div class="lock-user"><%=lockuser%></div>',"<% } %>","</div>"].join(""))}),this.rangeList.store.comparator=function(e,i){var n=e.get(t.sort.type).toLowerCase(),o=i.get(t.sort.type).toLowerCase();return n==o?0:n<o?-t.sort.direction:t.sort.direction},this.rangeList.on("item:select",_.bind(this.onSelectRangeItem,this)).on("item:keydown",_.bind(this.onKeyDown,this)).on("item:dblclick",_.bind(this.onDblClickItem,this)).on("entervalue",_.bind(this.onDblClickItem,this)),this.btnNewRange=new Common.UI.Button({el:$("#name-manager-btn-new")}),this.btnNewRange.on("click",_.bind(this.onEditRange,this,!1)),this.btnEditRange=new Common.UI.Button({el:$("#name-manager-btn-edit")}),this.btnEditRange.on("click",_.bind(this.onEditRange,this,!0)),this.btnDeleteRange=new Common.UI.Button({el:$("#name-manager-btn-delete")}),this.btnDeleteRange.on("click",_.bind(this.onDeleteRange,this)),$("#name-manager-sort-name").on("click",_.bind(this.onSortNames,this,"name")),$("#name-manager-sort-scope").on("click",_.bind(this.onSortNames,this,"scopeName")),this.spanSortName=$("#name-manager-sort-name-span"),this.spanSortScope=$("#name-manager-sort-scope-span"),"name"==this.sort.type?this.spanSortScope.addClass("hidden"):this.spanSortName.addClass("hidden"),this.sort.direction<0&&("name"==this.sort.type?this.spanSortName.addClass("sort-desc"):this.spanSortScope.addClass("sort-desc")),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},_setDefaults:function(t){this.refreshRangeList(this.ranges,0),this.api.asc_registerCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_registerCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList)},onRefreshDefNameList:function(){this.refreshRangeList(this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.All),this.currentNamedRange)},refreshRangeList:function(t,e){if(t){this.ranges=t;for(var i=[],n=0;n<this.ranges.length;n++){var o=this.ranges[n].asc_getScope(),s=this.ranges[n].asc_getIsLock();i.push({name:this.ranges[n].asc_getName(!0),scope:o,scopeName:null===o?this.textWorkbook:this.sheetNames[o],range:this.ranges[n].asc_getRef(),isTable:!0===this.ranges[n].asc_getIsTable(),lock:null!==s&&void 0!==s,lockuser:s?this.getUserName(s):this.guestText})}this.rangesStore.reset(i),this.rangeList.setEmptyText(this.rangesStore.length>0?this.textnoNames:this.textEmpty)}var a=this,l=this.rangeList.store,r=this.rangesStore.models,c=this.cmbFilter.getValue(),h=c<3?2==c:-1,d=c>2?4==c:-1;if(c>0&&(r=this.rangesStore.filter(function(t){return-1!==h?h===t.get("isTable"):-1!==d&&d===(null===t.get("scope"))})),l.reset(r,{silent:!1}),c=l.length,this.btnEditRange.setDisabled(!c),this.btnDeleteRange.setDisabled(!c),c>0){if(void 0!==e&&null!==e||(e=0),_.isNumber(e))e>c-1&&(e=c-1),this.rangeList.selectByIndex(e),setTimeout(function(){a.rangeList.scrollToRecord(l.at(e))},50);else if(e){var p=l.findWhere({name:e.asc_getName(!0),scope:e.asc_getScope()});p&&(this.rangeList.selectRecord(p),setTimeout(function(){a.rangeList.scrollToRecord(p)},50))}!0===this.userTooltip&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(a.onMouseOverLock,a)).on("mouseout",_.bind(a.onMouseOutLock,a))}_.delay(function(){a.rangeList.cmpEl.find(".listview").focus(),a.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(t,e,i){if(!0===this.userTooltip&&$(t.target).hasClass("lock-user")){var n=this,o=$(t.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=o.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),o.show(),setTimeout(function(){n.userTipHide()},5e3)}},userTipHide:function(){"object"==typeof this.userTooltip&&(this.userTooltip.remove(),this.userTooltip=void 0,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(t,e,i){"object"==typeof this.userTooltip&&this.userTipHide()},onEditRange:function(t){if(this.locked)return void Common.NotificationCenter.trigger("namedrange:locked");var e=this,i=e.$window.offset(),n=this.rangeList.getSelectedRec(),o=(_.indexOf(this.rangeList.store.models,n),t&&n?new Asc.asc_CDefName(n.get("name"),n.get("range"),n.get("scope"),n.get("isTable"),void 0,void 0,void 0,!0):null),s=new SSE.Views.NamedRangeEditDlg({api:e.api,sheets:this.sheets,props:t?o:this.props,isEdit:t,handler:function(i,n){"ok"==i&&n&&(t?(e.currentNamedRange=n,e.api.asc_editDefinedNames(o,n)):(e.cmbFilter.setValue(0),e.currentNamedRange=n,e.api.asc_setDefinedNames(n)))}}).on("close",function(){e.show(),_.delay(function(){e.rangeList.cmpEl.find(".listview").focus()},100,e)});e.hide(),s.show(i.left+65,i.top+77)},onDeleteRange:function(){var t=this.rangeList.getSelectedRec();t&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,t),this.api.asc_delDefinedNames(new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("isTable"),void 0,void 0,void 0,!0)))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(t){this.handler&&this.handler.call(this,t.currentTarget.attributes.result.value),this.close()},onSortNames:function(t){t!==this.sort.type?(this.sort={type:t,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var e="name"==t?this.spanSortName:this.spanSortScope;this.sort.direction>0?e.removeClass("sort-desc"):e.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(t){var e=SSE.getCollection("Common.Collections.Users");if(e){var i=e.findUser(t);if(i)return i.get("username")}return this.guestText},onSelectRangeItem:function(t,e,i){this.userTipHide();var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,i),this.btnEditRange.setDisabled(n.lock),this.btnDeleteRange.setDisabled(n.lock||n.isTable)}},hide:function(){this.userTipHide(),Common.UI.Window.prototype.hide.call(this)},close:function(){this.userTipHide(),this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},onKeyDown:function(t,e,i){i.keyCode!=Common.UI.Keys.DELETE||this.btnDeleteRange.isDisabled()||this.onDeleteRange()},onDblClickItem:function(t,e,i){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(t){this.locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},txtTitle:"Name Manager",closeButtonText:"Close",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.<br>Create at least one named range and it will appear in this field.",textnoNames:"No named ranges matching your filter could be found.",textFilterAll:"All",textFilterDefNames:"Defined names",textFilterTableNames:"Table names",textFilterSheet:"Names Scoped to Sheet",textFilterWorkbook:"Names Scoped to Workbook",textWorkbook:"Workbook",guestText:"Guest",tipIsLocked:"This element is being edited by another user."},SSE.Views.NameManagerDlg||{}))}),define("spreadsheeteditor/main/app/controller/CellEditor",["core","spreadsheeteditor/main/app/view/CellEditor","spreadsheeteditor/main/app/view/NameManagerDlg"],function(t){"use strict";SSE.Controllers.CellEditor=Backbone.Controller.extend({views:["CellEditor"],events:function(){return{"keyup input#ce-cell-name":_.bind(this.onCellName,this),"keyup textarea#ce-cell-content":_.bind(this.onKeyupCellEditor,this),"blur textarea#ce-cell-content":_.bind(this.onBlurCellEditor,this),"click button#ce-btn-expand":_.bind(this.expandEditorField,this),"click button#ce-func-label":_.bind(this.onInsertFunction,this)}},initialize:function(){this.addListeners({CellEditor:{},Viewport:{"layout:resizedrag":_.bind(this.onLayoutResize,this)},"Common.Views.Header":{"formulabar:hide":function(t){this.editor.setVisible(!t),Common.localStorage.setBool("sse-hidden-formula",t),Common.NotificationCenter.trigger("layout:changed","celleditor",t?"hidden":"showed")}.bind(this)}})},setApi:function(t){return this.api=t,this.api.isCEditorFocused=!1,this.api.asc_registerCallback("asc_onSelectionNameChanged",_.bind(this.onApiCellSelection,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onInputKeyDown",_.bind(this.onInputKeyDown,this)),this},setMode:function(t){this.mode=t,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge),this.mode.isEdit&&this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this))},onInputKeyDown:function(t){if(Common.UI.Keys.UP===t.keyCode||Common.UI.Keys.DOWN===t.keyCode||Common.UI.Keys.TAB===t.keyCode||Common.UI.Keys.RETURN===t.keyCode||Common.UI.Keys.ESC===t.keyCode||Common.UI.Keys.LEFT===t.keyCode||Common.UI.Keys.RIGHT===t.keyCode){var e=$("#menu-formula-selection");e.hasClass("open")&&e.find(".dropdown-menu").trigger("keydown",t)}},onLaunch:function(){this.editor=this.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(t){t==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):t==Asc.c_oAscCellEditorState.editInCell?this.api.isCEditorFocused="clear":t==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",t==Asc.c_oAscCellEditorState.editText)},onApiCellSelection:function(t){this.editor.updateCellInfo(t)},onApiSelectionChanged:function(t){var e=t.asc_getFlags().asc_getSelectionType(),i=!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()),n=e==Asc.c_oAscSelectionType.RangeChartText,o=e==Asc.c_oAscSelectionType.RangeChart,s=e==Asc.c_oAscSelectionType.RangeShapeText,a=e==Asc.c_oAscSelectionType.RangeShape,l=e==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o;this.editor.$btnfunc.toggleClass("disabled",l||r||i)},onApiDisconnect:function(){this.mode.isEdit=!1;var t=this.getApplication().getController("FormulaDialog");t&&t.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(t){this.editor.cellNameDisabled(t!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",t!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(t,e){"cell:edit"==e&&(this.editor.$el.height()>19?this.editor.$btnexpand.hasClass("btn-collapse")||this.editor.$btnexpand.addClass("btn-collapse"):this.editor.$btnexpand.removeClass("btn-collapse"))},onCellName:function(t){if(t.keyCode==Common.UI.Keys.RETURN){var e=this.editor.$cellname.val();e&&e.length&&this.api.asc_findCell(e),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){"clear"==this.api.isCEditorFocused?this.api.isCEditorFocused=void 0:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(t){t.keyCode!=Common.UI.Keys.RETURN||t.altKey||(this.api.isCEditorFocused="clear")},expandEditorField:function(){this.editor.$el.height()>19?(this.editor.keep_height=this.editor.$el.height(),this.editor.$el.height(19),this.editor.$btnexpand.removeClass("btn-collapse")):(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 t=this.getApplication().getController("FormulaDialog");t&&($("#ce-func-label",this.editor.el).blur(),t.showDialog())}},onNamedRangesMenu:function(t,e){var i=this;if("manager"==e.options.value){for(var n=this.api.asc_getWorksheetsCount(),o=-1,s=[],a=[];++o<n;)this.api.asc_isWorksheetHidden(o)||(a[o]=this.api.asc_getWorksheetName(o),s.push({displayValue:a[o],value:o}));new SSE.Views.NameManagerDlg({api:this.api,handler:function(t){Common.NotificationCenter.trigger("edit:complete",this.editor)},locked:this.namedrange_locked,sheets:s,sheetNames:a,ranges:this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.All),props:this.api.asc_getDefaultDefinedName(),sort:this.rangeListSort}).on("close",function(t){i.rangeListSort=t.getSettings()}).show()}else this.api.asc_findCell(e.caption),Common.NotificationCenter.trigger("edit:complete",this.editor)},onNameBeforeShow:function(){var t=this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook),e=this.editor.btnNamedRanges.menu,i="";e.removeItems(2,e.items.length-1),t.sort(function(t,e){var i=t.asc_getName(!0).toLowerCase(),n=e.asc_getName(!0).toLowerCase();return i==n?0:i<n?-1:1}),_.each(t,function(t,n){var o=t.asc_getName(!0);i!==o&&e.addItem(new Common.UI.MenuItem({caption:o})),i=o}),this.editor.btnNamedRanges.menu.items[1].setVisible(e.items.length>2)},onLockDefNameManager:function(t){this.namedrange_locked=t==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(t){_.extend(this.options,t||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textUrl+"</label>","</div>",'<div id="id-dlg-url" class="input-row"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",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||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){var t,e,i;return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['<div id="<%= id %>" class="asc-loadmask-body <%= cls %>" role="presentation" tabindex="-1">','<div class="asc-loadmask-image"></div>','<div class="asc-loadmask-title"><%= title %></div>',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.cls=this.options.cls,this.style=this.options.style,this.title=this.options.title,this.owner=this.options.owner},render:function(){return this},show:function(){if(!e&&!i){if(t=this.owner instanceof Common.UI.BaseView?$(this.owner.el):$(this.owner),t.hasClass("masked"))return this;var n=this;return e=$('<div class="asc-loadmask"></div>'),i=$(this.template({id:n.id,cls:n.cls,style:n.style,title:n.title})),t.addClass("masked"),t.append(e),t.append(i),i.css({top:Math.round(t.height()/2-(i.height()+parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(i.width()+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right")))/2)+"px"}),(t.height()<1||t.width()<1)&&i.css({visibility:"hidden"}),Common.util.Shortcuts.suspendEvents(),this}},hide:function(){t&&t.removeClass("masked"),e&&e.remove(),i&&i.remove(),e=null,i=null,Common.util.Shortcuts.resumeEvents()},setTitle:function(e){this.title=e,t&&t.hasClass("masked")&&i&&$(".asc-loadmask-title",i).html(e)},isVisible:function(){return!_.isEmpty(i)},updatePosition:function(){t&&t.hasClass("masked")&&i&&(i.css({top:Math.round(t.height()/2-(i.height()+parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(i.width()+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right")))/2)+"px"}),i.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['<div id="id-select-file-placeholder"></div>'].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),
|
|
|
t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),void 0===Common)var Common={};if(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'<section class="toolbar">\n <section class="box-tabs">\n <div class="extra left"></div>\n <%= tabsmarkup %>\n <div class="extra right"></div>\n </section>\n <section class="box-controls">\n <section class="panel static">\n <div class="group no-mask">\n <div class="elset">\n <span class="btn-slot" id="slot-btn-print"></span>\n </div>\n <div class="elset">\n <span class="btn-slot" id="slot-btn-save"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-copy"></span>\n <span class="btn-slot" id="slot-btn-paste"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-undo"></span>\n <span class="btn-slot" id="slot-btn-redo"></span>\n </div>\n </div>\n <div class="separator long"></div>\n </section>\n <section class="box-panels">\n <section class="panel" data-tab="home">\n <div class="group">\n <div class="elset font-attr-top">\n <span class="btn-slot" id="slot-field-fontname"></span>\n <span class="btn-slot" id="slot-field-fontsize"></span>\n <span class="btn-slot border" id="slot-btn-incfont"></span>\n <span class="btn-slot border" id="slot-btn-decfont"></span>\n </div>\n <div class="elset font-attr">\n <span class="btn-slot" id="slot-btn-bold"></span>\n <span class="btn-slot" id="slot-btn-italic"></span>\n <span class="btn-slot" id="slot-btn-underline"></span>\n <span class="btn-slot" id="slot-btn-strikeout"></span>\n <span class="btn-slot split" id="slot-btn-subscript"></span>\n <span class="btn-slot split" id="slot-btn-fontcolor"></span>\n <span class="btn-slot split" id="slot-btn-fillparag"></span>\n <span class="btn-slot split" id="slot-btn-borders"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-top"></span>\n <span class="btn-slot split" id="slot-btn-middle"></span>\n <span class="btn-slot split" id="slot-btn-bottom"></span>\n <span class="btn-slot split" id="slot-btn-wrap"></span>\n <span class="btn-slot split" id="slot-btn-text-orient"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-align-left"></span>\n <span class="btn-slot split" id="slot-btn-align-center"></span>\n <span class="btn-slot split" id="slot-btn-align-right"></span>\n <span class="btn-slot split" id="slot-btn-align-just"></span>\n <span class="btn-slot split" id="slot-btn-merge"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-formula"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-named-range"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split slot-sortdesc"></span>\n <span class="btn-slot slot-sortasc"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split slot-btn-setfilter"></span>\n <span class="btn-slot slot-btn-clear-filter"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot" id="slot-btn-format" style="width: 100%"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-percents"></span>\n <span class="btn-slot split" id="slot-btn-currency"></span>\n <span class="btn-slot split" id="slot-btn-digit-dec"></span>\n <span class="btn-slot" id="slot-btn-digit-inc"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-cell-ins"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-cell-del"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-clear"></span>\n <span class="btn-slot split" id="slot-btn-colorschemas"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-copystyle"></span>\n <span class="btn-slot split" id="slot-btn-table-tpl"></span>\n </div>\n </div>\n <div class="group" id="slot-field-styles" style="width: 100%; min-width: 160px;"></div>\n </section>\n <section class="panel" data-tab="ins">\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-instable"></span>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-insimage"></span>\n <span class="btn-slot text x-huge" id="slot-btn-insshape"></span>\n <span class="btn-slot text x-huge" id="slot-btn-instext"></span>\n <span class="btn-slot text x-huge" id="slot-btn-instextart"></span>\n <span class="btn-slot text x-huge" id="slot-btn-inschart"></span>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge slot-comment"></span>\n <span class="btn-slot text x-huge" id="slot-btn-inshyperlink"></span>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-insequation"></span>\n </div>\n </section>\n <section class="panel" data-tab="layout">\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-pagemargins"></span>\n <span class="btn-slot text x-huge" id="slot-btn-pageorient"></span>\n <span class="btn-slot text x-huge" id="slot-btn-pagesize"></span>\n <span class="btn-slot text x-huge" id="slot-btn-printarea"></span>\n <span class="btn-slot text x-huge" id="slot-btn-editheader"></span>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-img-align"></span>\n <span class="btn-slot text x-huge" id="slot-img-group"></span>\n <span class="btn-slot text x-huge" id="slot-img-movefrwd"></span>\n <span class="btn-slot text x-huge" id="slot-img-movebkwd"></span>\n </div>\n </section>\n <section class="panel" data-tab="formula">\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-additional-formula"></span>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-autosum"></span>\n <span class="btn-slot text x-huge" id="slot-btn-recent"></span>\n <span class="btn-slot text x-huge" id="slot-btn-financial"></span>\n <span class="btn-slot text x-huge" id="slot-btn-logical"></span>\n <span class="btn-slot text x-huge" id="slot-btn-text"></span>\n <span class="btn-slot text x-huge" id="slot-btn-datetime"></span>\n <span class="btn-slot text x-huge" id="slot-btn-lookup"></span>\n <span class="btn-slot text x-huge" id="slot-btn-math"></span>\n <span class="btn-slot text x-huge" id="slot-btn-more"></span>\n </div>\n </section>\n <section class="panel" data-tab="data">\n <div class="group">\n <div class="elset">\n <span class="btn-slot split slot-sortdesc"></span>\n <span class="btn-slot slot-sortasc"></span>\n </div>\n <div class="elset">\n <span class="btn-slot split slot-btn-setfilter"></span>\n <span class="btn-slot slot-btn-clear-filter"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-text-column"></span>\n </div>\n <div class="separator long"></div>\n <div class="group">\n <span class="btn-slot text x-huge" id="slot-btn-group"></span>\n <span class="btn-slot text x-huge" id="slot-btn-ungroup"></span>\n </div>\n \x3c!--<div class="group">--\x3e\n \x3c!--<div class="elset">--\x3e\n \x3c!--<span class="btn-slot" id="slot-btn-show-details" style="width:auto;"></span>--\x3e\n \x3c!--</div>--\x3e\n \x3c!--<div class="elset">--\x3e\n \x3c!--<span class="btn-slot" id="slot-btn-hide-details" style="width:auto;"></span>--\x3e\n \x3c!--</div>--\x3e\n \x3c!--</div>--\x3e\n </section>\n </section>\n </section>\n</section>'}),define("text!spreadsheeteditor/main/app/template/ToolbarAnother.template",[],function(){return'<div class="toolbar" style="height: 41px; padding: 10px 0;">\n <% if ( isEditDiagram ) { %>\n \x3c!-----------------------\x3e\n \x3c!-- Edit diagram mode --\x3e\n \x3c!-----------------------\x3e\n <section class="simple-bar">\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-copy"></span>\n <span class="btn-slot split" id="slot-btn-paste"></span>\n <span class="btn-slot split" id="slot-btn-undo"></span>\n <span class="btn-slot" id="slot-btn-redo"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-formula"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-digit-dec"></span>\n <span class="btn-slot split" id="slot-btn-digit-inc"></span>\n <span class="btn-slot" id="slot-btn-format" style="width: 84px; margin-left: 10px; vertical-align: middle;"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot border" id="slot-btn-chart" style="width: auto;"></span>\n </div>\n </div>\n <div class="group" style="width: 100%;"></div>\n </section>\n <% } else if ( isEditMailMerge ) { %>\n \x3c!-----------------------\x3e\n \x3c!-- Edit mail merge mode --\x3e\n \x3c!-----------------------\x3e\n <section class="simple-bar">\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-copy"></span>\n <span class="btn-slot split" id="slot-btn-paste"></span>\n <span class="btn-slot split" id="slot-btn-undo"></span>\n <span class="btn-slot" id="slot-btn-redo"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-sortdesc"></span>\n <span class="btn-slot" id="slot-btn-sortasc"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot split" id="slot-btn-setfilter"></span>\n <span class="btn-slot" id="slot-btn-clear-filter"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="group">\n <div class="elset">\n <span class="btn-slot" id="slot-btn-search"></span>\n </div>\n </div>\n <div class="group" style="width: 100%;"></div>\n </section>\n <% } %>\n</div>'}),define("text!spreadsheeteditor/main/app/template/ToolbarView.template",[],function(){return'<section class="toolbar toolbar-view">\n <section class="box-tabs">\n <div class="extra left"></div>\n <%= tabsmarkup %>\n <div class="extra right">\n </div>\n </section>\n <section class="box-controls">\n <section class="box-panels">\n </section>\n </section>\n</section>'}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i<n?-1:1}})}),void 0===Common)var Common={};if(define("common/main/lib/component/Button",["common/main/lib/component/BaseView","common/main/lib/component/ToggleManager"],function(){"use strict";window.createButtonSet=function(){function t(t){}t.prototype=new Array,t.prototype.constructor=t;var e=!1;t.prototype.add=function(t){t.setDisabled(e),this.push(t)},t.prototype.setDisabled=function(t){e=t,this.forEach(function(e){e.setDisabled(t)})},t.prototype.toggle=function(t,e){this.forEach(function(i){i.toggle(t,e)})},t.prototype.pressed=function(){return this.some(function(t){return t.pressed})},t.prototype.contains=function(t){return this.some(function(e){return e.id==t})},t.prototype.concat=function(){var t=Array.prototype.slice.call(arguments),e=Array.prototype.slice.call(this);return t.forEach(function(t){t instanceof Array?Array.prototype.push.apply(e,t):t&&e.push(t)}),e};var i=Object.create(t.prototype);for(var n in arguments)i.add(arguments[n]);return i};Common.UI.Button=Common.UI.BaseView.extend({options:{id:null,hint:!1,enableToggle:!1,allowDepress:!0,toggleGroup:null,cls:"",iconCls:"",caption:"",menu:null,disabled:!1,pressed:!1,split:!1,visible:!0},template:_.template(["<% var applyicon = function() { %>","<% if (iconImg) { print('<img src=\"' + iconImg + '\">'); } else { %>","<% if (iconCls != \"\") { if (/svgicon/.test(iconCls)) {print('<svg class=\"icon\"><use xlink:href=\"#' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + '\"></use></svg>');} else print('<i class=\"icon ' + iconCls + '\"> </i>'); }} %>","<% } %>","<% if ( !menu ) { %>",'<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>">',"<% applyicon() %>",'<span class="caption"><%= caption %></span>',"</button>","<% } else if (split == false) {%>",'<div class="btn-group" id="<%= id %>" style="<%= style %>">','<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown">',"<% applyicon() %>",'<span class="caption"><%= caption %></span>','<span class="inner-box-caret"><i class="caret img-commonctrl"></i></span>',"</button>","</div>","<% } else { %>",'<div class="btn-group split" id="<%= id %>" style="<%= style %>">','<button type="button" class="btn <%= cls %>">',"<% applyicon() %>",'<span class="caption"><%= caption %></span>',"</button>",'<button type="button" class="btn <%= cls %> dropdown-toggle" data-toggle="dropdown">','<i class="caret img-commonctrl"></i>','<span class="sr-only"></span>',"</button>","</div>","<% } %>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.id=e.options.id||Common.UI.getId(),e.hint=e.options.hint,e.enableToggle=e.options.enableToggle,e.allowDepress=e.options.allowDepress,e.cls=e.options.cls,e.iconCls=e.options.iconCls,e.menu=e.options.menu,e.split=e.options.split,e.toggleGroup=e.options.toggleGroup,e.disabled=e.options.disabled,e.visible=e.options.visible,e.pressed=e.options.pressed,e.caption=e.options.caption,e.template=e.options.template||e.template,e.style=e.options.style,e.rendered=!1,e.options.el&&e.render()},render:function(t){var e=this;if(e.trigger("render:before",e),e.cmpEl=$(e.el),t&&(e.setElement(t,!1),e.rendered||(/icon-top/.test(e.cls)&&e.caption&&/huge/.test(e.cls)&&(!0===e.split?(!!e.cls&&(e.cls=e.cls.replace(/\s?(?:x-huge|icon-top)/g,"")),this.template=_.template('<div class="btn-group x-huge split icon-top" id="<%= id %>" style="<%= style %>"><button type="button" class="btn <%= cls %> inner-box-icon"><span class="btn-fixflex-hcenter"><% if ( iconImg ) { %><img src="<%= iconImg %>"><% } else { %><% if (/svgicon/.test(iconCls)) {print(\'<svg width="26" height="26" class="icon"><use href="#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'"></use></svg>\');} else print(\'<i class="icon \' + iconCls + \'"> </i>\'); %><% } %></span></button><button type="button" class="btn <%= cls %> inner-box-caption dropdown-toggle" data-toggle="dropdown"><span class="btn-fixflex-vcenter"><span class="caption"><%= caption %></span><i class="caret img-commonctrl"></i></span></button></div>')):e.menu?this.template=_.template('<div class="btn-group icon-top" id="<%= id %>" style="<%= style %>"><button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown"><div class="inner-box-icon"><% if ( iconImg ) { %><img src="<%= iconImg %>"><% } else { %><% if (/svgicon/.test(iconCls)) {print(\'<svg width="26" height="26" class="icon"><use href="#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'"></use></svg>\');} else print(\'<i class="icon \' + iconCls + \'"> </i>\'); %><% } %></div><div class="inner-box-caption"><span class="caption"><%= caption %></span><i class="caret img-commonctrl"></i></div></button></div>'):this.template=_.template('<button type="button" class="btn <%= cls %>" id="<%= id %>" > <div class="inner-box-icon"><% if ( iconImg ) { %><img src="<%= iconImg %>"><% } else { %><% if (/svgicon/.test(iconCls)) {print(\'<svg width="26" height="26" class="icon"><use href="#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'"></use></svg>\');} else print(\'<i class="icon \' + iconCls + \'"> </i>\'); %><% } %></div><div class="inner-box-caption"><span class="caption"><%= caption %></span></div></button>')),e.cmpEl=$(this.template({id:e.id,cls:e.cls,iconCls:e.iconCls,iconImg:e.options.iconImg,menu:e.menu,split:e.split,disabled:e.disabled,pressed:e.pressed,caption:e.caption,style:e.style})),e.menu&&_.isObject(e.menu)&&_.isFunction(e.menu.render)&&e.menu.render(e.cmpEl),t.html(e.cmpEl),e.$icon=e.$el.find(".icon"))),!e.rendered){var i=e.cmpEl,n=i.hasClass("btn-group"),o=i.hasClass("split");if(e.options.hint){var s=e.cmpEl.closest(".asc-window");if("object"==typeof e.options.hint&&e.options.hint.length>1&&$("button",i).length>0){var a=$("button",i);e.btnEl=$(a[0]),e.btnMenuEl=$(a[1])}else e.btnEl=e.cmpEl,e.btnEl.attr("data-toggle","tooltip");e.btnEl.tooltip({
|
|
|
title:"string"==typeof e.options.hint?e.options.hint:e.options.hint[0],placement:e.options.hintAnchor||"cursor"}),e.btnMenuEl&&e.btnMenuEl.tooltip({title:e.options.hint[1],placement:e.options.hintAnchor||"cursor"}),s.length>0&&(e.btnEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),e.btnMenuEl&&e.btnMenuEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10))}_.isString(e.toggleGroup)&&(e.enableToggle=!0);var l,r=function(t){if(!e.disabled&&1==t.which){if(e.doToggle(),e.options.hint){var i=e.btnEl.data("bs.tooltip");i&&(void 0===i.dontShow&&(i.dontShow=!0),i.hide())}e.trigger("click",e,t)}},c=function(t,n,s){if(!t){var a=!1;$("button",i).each(function(t,e){if($(e).is(":hover"))return a=!0,!1}),a||(i.removeClass("over"),$("button",i).removeClass("over"))}if("button"==n){if(!t&&e.enableToggle&&e.allowDepress&&e.pressed)return;if(t&&!o&&e.enableToggle&&e.allowDepress&&!e.pressed)return void s.preventDefault();$("button:first",i).toggleClass("active",t)}else $("[data-toggle^=dropdown]",i).toggleClass("active",t);i.toggleClass("active",t)},h=function(t){if(!e.disabled&&1==t.which&&o){if(e.options.hint){var n=(e.btnMenuEl?e.btnMenuEl:e.btnEl).data("bs.tooltip");n&&(void 0===n.dontShow&&(n.dontShow=!0),n.hide())}var s=i.hasClass("open");c(!s,"arrow",t)}},d=function(t,e){o?c(e,"button",t):(i.toggleClass("active",e),$("button",i).toggleClass("active",e))},p=function(t){l=t.currentTarget.className.match(/dropdown/)?"arrow":"button",c(!0,l,t),$(document).on("mouseup",m)},m=function(t){c(!1,l,t),$(document).off("mouseup",m)},u=function(t,i){e.cmpEl.find(".dropdown-toggle").blur(),e.cmpEl.hasClass("active")!==e.pressed&&e.cmpEl.trigger("button.internal.active",[e.pressed])};n?(o&&($("[data-toggle^=dropdown]",i).on("mousedown",_.bind(h,this)),$("button",i).on("mousedown",_.bind(p,this)),e.options.width>0&&$("button:first",i).css("width",e.options.width-$("[data-toggle^=dropdown]",i).outerWidth())),i.on("hide.bs.dropdown",_.bind(c,e,!1,"arrow")),i.on("show.bs.dropdown",_.bind(c,e,!0,"arrow")),i.on("hidden.bs.dropdown",_.bind(u,e)),$("button:first",i).on("click",r)):i.on("click",r),i.on("button.internal.active",_.bind(d,e)),i.on("mouseover",function(t){e.disabled||(e.cmpEl.addClass("over"),e.trigger("mouseover",e,t))}),i.on("mouseout",function(t){e.cmpEl.removeClass("over"),e.disabled||e.trigger("mouseout",e,t)}),Common.UI.ToggleManager.register(e)}return e.rendered=!0,e.pressed&&e.toggle(e.pressed,!0),e.disabled&&e.setDisabled(!(e.disabled=!1)),e.visible||e.setVisible(e.visible),e.trigger("render:after",e),this},doToggle:function(){var t=this;!t.enableToggle||!1===t.allowDepress&&t.pressed||t.toggle()},toggle:function(t,e){var i=void 0===t?!this.pressed:!!t;this.pressed=i,this.cmpEl&&this.cmpEl.trigger("button.internal.active",[i]),e||this.trigger("toggle",this,i)},isActive:function(){return this.enableToggle?this.pressed:this.cmpEl.hasClass("active")},setDisabled:function(t){if(this.rendered&&this.disabled!=t){var e=this.cmpEl,i=e.hasClass("btn-group"),n=this;if((t=!0===t)!==e.hasClass("disabled")){var o=function(e){e.toggleClass("disabled",t),n.options.allowMouseEventsOnDisabled||(t?e.attr({disabled:t}):e.removeAttr("disabled"))};o(e),i&&o(e.children("button"))}if((t||!Common.Utils.isGecko)&&this.options.hint){var s=this.btnEl.data("bs.tooltip");s&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t)),this.btnMenuEl&&(s=this.btnMenuEl.data("bs.tooltip"))&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t))}if(t&&this.menu&&_.isObject(this.menu)&&this.menu.rendered&&this.menu.isVisible()&&setTimeout(function(){n.menu.hide()},1),n.options.signals){n.options.signals.indexOf("disabled")<0||n.trigger("disabled",n,t)}}this.disabled=t},isDisabled:function(){return this.disabled},setIconCls:function(t){var e=$(this.el).find(".icon"),i=this.iconCls;this.iconCls=t,e.removeClass(i),e.addClass(t||"")},setVisible:function(t){this.cmpEl&&this.cmpEl.toggleClass("hidden",!t),this.visible=t},isVisible:function(){return this.cmpEl?this.cmpEl.is(":visible"):$(this.el).is(":visible")},updateHint:function(t){if(this.options.hint=t,this.rendered){var e=this.cmpEl,i=e.closest(".asc-window");if(!this.btnEl)if("object"==typeof this.options.hint&&this.options.hint.length>1&&$("button",e).length>0){var n=$("button",e);this.btnEl=$(n[0]),this.btnMenuEl=$(n[1])}else this.btnEl=e,this.btnEl.attr("data-toggle","tooltip");if(this.btnEl.data("bs.tooltip")&&this.btnEl.removeData("bs.tooltip"),this.btnMenuEl&&this.btnMenuEl.data("bs.tooltip")&&this.btnMenuEl.removeData("bs.tooltip"),this.btnEl.tooltip({title:"string"==typeof t?t:t[0],placement:this.options.hintAnchor||"cursor"}),this.btnMenuEl&&this.btnMenuEl.tooltip({title:t[1],placement:this.options.hintAnchor||"cursor"}),i.length>0&&(this.btnEl.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10),this.btnMenuEl&&this.btnMenuEl.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10)),this.disabled||!Common.Utils.isGecko){var o=this.btnEl.data("bs.tooltip");o&&(this.disabled&&o.hide(),!Common.Utils.isGecko&&(o.enabled=!this.disabled)),this.btnMenuEl&&(o=this.btnMenuEl.data("bs.tooltip"))&&(this.disabled&&o.hide(),!Common.Utils.isGecko&&(o.enabled=!this.disabled))}}},setCaption:function(t){if(this.caption!=t&&(this.caption=t,this.rendered)){var e=this.cmpEl.find("button:first > .caption").addBack().filter("button > .caption");e.length>0?e.text(t):this.cmpEl.find("button:first").addBack().filter("button").text(t)}},setMenu:function(t){t&&_.isObject(t)&&_.isFunction(t.render)&&(this.menu=t,this.rendered&&this.menu.render(this.cmpEl))}})}),void 0===Common)var Common={};if(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(['<div class="palette-color">',"<% _.each(colors, function(color, index) { %>",'<span class="color-item" data-color="<%= color %>" style="background-color: #<%= color %>;"></span>',"<% }) %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),!e.rendered){this.cmpEl.on("click","span.color-item",_.bind(this.itemClick,this))}return e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'<div class="color-box">\r\n <div id="id-hsb-colorpicker" style="vertical-align:top;">\r\n </div>\r\n <div class="color-info" style="">\r\n <div style="margin-left:15px;">\r\n <label class="color-label"><%= txtNew %></label>\r\n <div id="field-new-color" class="color-cnt top"></div>\r\n <div id="field-start-color" class="color-cnt bottom"></div>\r\n <label class="color-label"><%= txtCurrent %></label>\r\n </div>\r\n <div style="padding:13px 0 2px 0;">\r\n <label class="input-label">R:</label>\r\n <div id="extended-spin-r" class="color-spin"></div>\r\n </div>\r\n <div style="padding:2px 0;">\r\n <label class="input-label">G:</label>\r\n <div id="extended-spin-g" class="color-spin"></div>\r\n </div>\r\n <div style="padding:2px 0;">\r\n <label class="input-label">B:</label>\r\n <div id="extended-spin-b" class="color-spin"></div>\r\n </div>\r\n <div style="padding:11px 0 0 0;">\r\n <label class="input-label" style="width:12px;">#:</label>\r\n <input id="extended-text-color" type="text" role="textbox" style="width:62px; height: 22px;">\r\n </div>\r\n </div>\r\n</div>\r\n<div class="footer center">\r\n <button class="btn normal dlg-btn primary" result="1"><%= txtAdd %></button>\r\n <button class="btn normal dlg-btn" result="0"><%= txtCancel %></button>\r\n</div>\r\n'}),void 0===Common)var Common={};if(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('<div class="hsb-colorpicker"><% if (this.showCurrentColor) { %><div class="top-panel"><span class="color-value"><span class="transparent-color img-colorpicker"></span></span><div class="color-text"></div></div><% } %><div><div class="cnt-hb img-colorpicker"><div class="cnt-hb-arrow img-colorpicker"></div></div><% if (this.changeSaturation) { %><div class="cnt-root"><div class="cnt-sat img-colorpicker"><div class="cnt-sat-arrow img-colorpicker"></div></div></div><% } %></div><% if (this.allowEmptyColor) { %><div class="empty-color"><%= this.textNoColor %></div><% } %></div>'),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n,o,s,a,l,r,c=this,h=($(this.el),0),d=100,p=100;c.allowEmptyColor=c.options.allowEmptyColor,c.changeSaturation=c.options.changeSaturation,c.showCurrentColor=c.options.showCurrentColor;var m=function(t,e){var i=new Common.Utils.RGBColor("hsb("+t.h+","+t.s+","+t.b+")"),n=i.toHex();c.color=e?"transparent":n,u(),c.trigger("changecolor",c,c.color)},u=function(){s.length>0&&a.length>0&&("transparent"==c.color?a.show():(s.css("background-color",c.color),a.hide())),n.length>0&&n.css("background-color",new Common.Utils.RGBColor("hsb("+h+", 100, 100)").toHex()),l.length>0&&(l[0].innerHTML="transparent"==c.color?c.textNoColor:c.color.toUpperCase()),e.length>0&&i.length>0&&(e.css("left",d+"%"),e.css("top",100-p+"%"),i.css("top",parseInt(100*h/360)+"%"))},g=function(t,i,o){if(e.length>0&&n.length>0){var s=[Math.max(0,Math.min(100,parseInt((t.pageX*Common.Utils.zoom()-n.offset().left)/n.width()*100))),Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-n.offset().top)/n.height()*100)))];e.css("left",s[0]+"%"),e.css("top",s[1]+"%"),d=s[0],p=100-s[1],m({h:h,s:d,b:p})}},b=function(t,e,n){if(i&&o){var s=Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",s+"%"),h=parseInt(360*s/100),m({h:h,s:d,b:p})}},f=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",b),b(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",b)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();m(e,!0)},x=function(t){var m,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),l=g.find(".color-text"),r=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",f)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),r.length>0&&(r.off("click"),r.on("click",y)),m="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),h=m.h,d=m.s,p=m.b,h==d&&h==p&&0==h&&(d=100),u())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),h=e.h,d=e.s,p=e.b,h==d&&h==p&&0==h&&(d=100),c.color=t,u()}},c.getColor=function(){return c.color},c.on("render:after",x),c.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&$(this.el).val(t)},getValue:function(){$(this.el).val()}})}),void 0===Common)var Common={};if(define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:1,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:2,maskExp:/[0-9]/,allowDecimal:!1}),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,void 0!==this.color&&this.setColor(this.color),this},onChangeColor:function(t,e){this.colorNew.css({"background-color":e}),this.stopevents=!0;var i=e.match(this.hexRe);this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),this.stopevents=!1},showColor:function(t,e){if(!this.stopevents){var i=this.spinR.getNumberValue(),n=null==i||i<0?0:i>255?255:i;e&&this.spinR.setValue(n,!0),n=n.toString(16),i=this.spinG.getNumberValue();var o=null==i||i<0?0:i>255?255:i;e&&this.spinG.setValue(o,!0),o=o.toString(16),i=this.spinB.getNumberValue();var s=null==i||i<0?0:i>255?255:i;e&&this.spinB.setValue(s,!0),s=s.toString(16);var a=(1==n.length?"0"+n:n)+(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s);this.colorsPicker.setColor("#"+a),"hex"!=t&&this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangingRGB:function(t,e,i,n){if(!this.stopevents){var o,s,a,l;switch(i=_.isEmpty(i)||isNaN(parseInt(i))?parseInt(e.getValue()):parseInt(i),t){case 1:o=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 2:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),s=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 3:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),a=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16)}var r=(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s)+(1==a.length?"0"+a:a);this.colorsPicker.setColor("#"+r),this.textColor.setValue(r.toUpperCase()),this.colorNew.css("background-color","#"+r)}},onChangeMaskedField:function(t,e){e=/^[a-fA-F0-9]{0,6}$/.test(e)?e:"000000",e="000000"+e;var i=e.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(t,e){/^[a-fA-F0-9]{0,6}$/.test(e)&&!_.isEmpty(e)||t.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var t=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return t?t[1]:null},setColor:function(t){var e=this;if(!0!==this.rendered)return void(this.color=t);var i=/#?([a-fA-F0-9]{6})/.test(t)?t:"ff0000";e.colorsPicker.setColor("#"+i),function(){"transparent"==t?e.colorSaved.addClass("color-transparent"):(e.colorSaved.removeClass("color-transparent"),e.colorSaved.css("background-color","#"+t)),e.colorNew.css("background-color","#"+i)}(),e.stopevents=!0;var n=e.hexRe.exec(i);e.spinR.setValue(parseInt(n[1],16)),e.spinG.setValue(parseInt(n[2],16)),e.spinB.setValue(parseInt(n[3],16)),e.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),e.stopevents=!1},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("#extended-text-color").focus()},50)},onPrimary:function(){return this.trigger("onmodalresult",1),this.close(!0),!1},cancelButtonText:"Cancel",addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.<br>Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.<br>Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))}),void 0===Common)var Common={};if(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('<div style="padding: 12px;"><% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %> <div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div><% } else if (me.isSeparator(item)) { %> </div><div class="palette-color-separator" style="width:100%;height:1px;float:left;border-bottom: 1px solid #E0E0E0"></div><div style="padding: 12px;"><% } else if (me.isColor(item)) { %> <a class="palette-color color-<%=item%>" style="background:#<%=item%>" hidefocus="on"><em><span style="background:#<%=item%>;" unselectable="on"> </span></em></a><% } else if (me.isTransparent(item)) { %><a class="color-<%=item%>" hidefocus="on"><em><span unselectable="on"> </span></em></a><% } else if (me.isEffect(item)) { %><a effectid="<%=item.effectId%>" effectvalue="<%=item.effectValue%>" class="palette-color-effect color-<%=item.color%>" style="background:#<%=item.color%>" hidefocus="on"><em><span style="background:#<%=item.color%>;" unselectable="on"> </span></em></a><% } else if (me.isCaption(item)) { %><div class="palette-color-caption" style="width:100%;float:left;font-size: 11px;"><%=item%></div><% } %><% }); %></div><% if (me.options.dynamiccolors!==undefined) { %><div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div><div style="padding: 12px;"><% for (var i=0; i<me.options.dynamiccolors; i++) { %><a class="color-dynamic-<%=i%> dynamic-empty-color" style="background:#ffffff" color="" hidefocus="on"><em><span unselectable="on"> </span></em></a><% } %><% } %></div>'),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);this.colors=e.options.colors||this.generateColorData(e.options.themecolors,e.options.effects,e.options.standardcolors,e.options.transparent),i.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(),i.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.on("click",_.bind(this.handleClick,this))},render:function(){return $(this.el).html(this.template({colors:this.colors})),this},isBlankSeparator:function(t){return"string"==typeof t&&"-"==t},isSeparator:function(t){return"string"==typeof t&&"--"==t},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isCaption:function(t){return"string"==typeof t&&"-"!=t&&"--"!=t&&!/[0-9A-F]{6}|transparent/.test(t)},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},updateCustomColors:function(){var t=$(this.el);if(t){var e=t.find("a."+this.selectedCls),i=e.length>0&&/color-dynamic/.test(e[0].className)?e.attr("color"):void 0;i&&(i=i.toUpperCase(),e.removeClass(this.selectedCls));var n=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");n=n?n.split(","):[];for(var o,s=-1,a=n.length<this.options.dynamiccolors?n.length:this.options.dynamiccolors;++s<a;)o=t.find(".color-dynamic-"+s),o.removeClass("dynamic-empty-color").attr("color",n[s]),o.find("span").css({"background-color":"#"+n[s]}),n[s]==i&&(o.addClass(this.selectedCls),i=void 0)}},handleClick:function(t){var e,i=this,n=$(t.target).closest("a");if(0!=n.length)if(n.hasClass("color-transparent"))$(i.el).find("a."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),i.value="transparent",i.trigger("select",i,"transparent");else if(n[0].className.search("color-dynamic")<0)if((!/^[a-fA-F0-9]{6}$/.test(i.value)||_.indexOf(i.colors,i.value)<0)&&(i.value=!1),$(i.el).find("a."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),e=n[0].className.match(i.colorRe)[1],n.hasClass("palette-color-effect")){var o=parseInt(n.attr("effectid"));e&&(i.value=e.toUpperCase(),i.trigger("select",i,{color:e,effectId:o}))}else/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),i.value=e,i.trigger("select",i,e));else/dynamic-empty-color/.test(n[0].className)?setTimeout(function(){i.addNewColor()},10):($(i.el).find("a."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),e=n.attr("color"),e&&i.trigger("select",i,e),i.value=e.toUpperCase())},setCustomColor:function(t){var e=$(this.el);if(t=/#?([a-fA-F0-9]{6})/.exec(t)){this.saveCustomColor(t[1]),e.find("a."+this.selectedCls).removeClass(this.selectedCls);var i=e.find(".dynamic-empty-color");0==i.length&&(this.updateCustomColors(),i=e.find(".color-dynamic-"+(this.options.dynamiccolors-1))),i.first().removeClass("dynamic-empty-color").addClass(this.selectedCls).attr("color",t[1]),i.first().find("span").css({"background-color":"#"+t[1]}),this.select(t[1],!0)}},saveCustomColor:function(t){var e="asc."+Common.localStorage.getId()+".colors.custom",i=Common.localStorage.getItem(e);i=i?i.split(","):[],i.push(t)>this.options.dynamiccolors&&i.shift(),Common.localStorage.setItem(e,i.join().toUpperCase())},addNewColor:function(t){var e=this,i=new Common.UI.ExtendedColorDialog({});i.on("onmodalresult",function(t){e._isdlgopen=!1,1==t&&(e.setCustomColor(i.getColor()),e.fireEvent("select",e,i.getColor()))}),e._isdlgopen=!0,i.setColor(void 0!==e.value&&!1!==e.value?e.value:void 0!==t?t:"000000"),i.show()},isDialogOpen:function(){return 1==this._isdlgopen},select:function(t,e){var i=$(this.el);if(i.find("a."+this.selectedCls).removeClass(this.selectedCls),"object"==typeof t){var n;void 0!==t.effectId?(n=i.find('a[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('a[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("a.color-transparent").addClass(this.selectedCls):i.find("a.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('a[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},selectByRGB:function(t,e){var i=$(this.el);i.find("a."+this.selectedCls).removeClass(this.selectedCls);var n="object"==typeof t?t.color:t;if(/#?[a-fA-F0-9]{6}/.test(n)&&(n=/#?([a-fA-F0-9]{6})/.exec(n)[1].toUpperCase()),/^[a-fA-F0-9]{6}|transparent$/.test(n)&&(n!=this.value||this.options.allowReselect)){var o="transparent"==n?i.find("a.color-transparent"):i.find("a.color-"+n).first();0==o.length&&(o=i.find("#"+n).first()),0==o.length&&(o=i.find('a[color="'+n+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=n),!0!==e&&this.fireEvent("select",this,n)}},updateColors:function(t,e,i){if(void 0!==t&&void 0!==e){var n=this,o=$(this.el);void 0===n.aColorElements&&(n.aColorElements=o.find("a.palette-color")),void 0===n.aEffectElements&&(n.aEffectElements=o.find("a.palette-color-effect"));for(var s,a=0,l=0,r=0;r<n.colors.length;r++)if("string"==typeof n.colors[r]&&/[0-9A-F]{6}/.test(n.colors[r])){if(a>=e.length)continue;s=$(n.aColorElements[a]),s.removeClass("color-"+n.colors[r]),n.colors[r]=e[a].toUpperCase(),s.addClass("color-"+n.colors[r]),s.css({background:"#"+n.colors[r]}),s.find("span").first().css({background:"#"+n.colors[r]}),a++}else if("object"==typeof n.colors[r]&&void 0!==n.colors[r].effectId){if(l>=t.length)continue;s=$(n.aEffectElements[l]),t[l].color=t[l].color.toUpperCase(),n.colors[r].color!==t[l].color&&(s.removeClass("color-"+n.colors[r].color),s.addClass("color-"+t[l].color),s.css({background:"#"+t[l].color}),s.find("span").first().css({background:"#"+t[l].color})),n.colors[r].effectId!==t[l].effectId&&s.attr("effectid",""+t[l].effectId),n.colors[r].effectValue!==t[l].effectValue&&s.attr("effectvalue",""+t[l].effectValue),n.colors[r]=t[l],l++}if(i)this.select(i,!0);else{var c=$(this.el).find("a."+this.selectedCls);c.length&&c.hasClass("palette-color-effect")&&(this.value=c[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=void 0}},clearSelection:function(t){$(this.el).find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0},generateColorData:function(t,e,i,n){var o=[],s=t>0&&e>0?t*e:0;if(t>0){o=[this.textThemeColors,"-"];for(var a=0;a<t;a++)o.push({color:"FFFFFF",effectId:1});e>0&&o.push("-");for(var a=0;a<s;a++)o.push({color:"FFFFFF",effectId:1});i&&o.push("-","--","-")}if(i){o.push(this.textStandartColors,"-"),n&&(o.push("transparent"),i--);for(var a=0;a<i;a++)o.push("FFFFFF")}return this.options.dynamiccolors&&(t||i)&&o.push("-","--"),o},textThemeColors:"Theme Colors",textStandartColors:"Standart Colors"},Common.UI.ThemeColorPalette||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){var t,e,i,n,o,s,a=0,l=0,r=function(e){t.setTableSize(Math.ceil((void 0===e.offsetX?e.originalEvent.layerX:e.offsetX*Common.Utils.zoom())/t.itemSize),Math.ceil((void 0===e.offsetY?e.originalEvent.layerY:e.offsetY*Common.Utils.zoom())/t.itemSize),e)},c=function(e){t.setTableSize(0,0,e)},h=function(e){t.trigger("select",t,a,l,e)};return{options:{itemSize:18,minRows:5,minColumns:5,maxRows:20,maxColumns:20},template:_.template(['<div style="width: 100%; height: 100%;">','<div class="dimension-picker-status">0x0</div>','<div class="dimension-picker-observecontainer">','<div class="dimension-picker-mousecatcher"></div>','<div class="dimension-picker-unhighlighted"></div>','<div class="dimension-picker-highlighted"></div>',"</div>","</div>"].join("")),initialize:function(d){Common.UI.BaseView.prototype.initialize.call(this,d),t=this,e=$(this.el),t.itemSize=t.options.itemSize,t.minRows=t.options.minRows,t.minColumns=t.options.minColumns,t.maxRows=t.options.maxRows,t.maxColumns=t.options.maxColumns,this.render(),e&&(i=e.find(".dimension-picker-mousecatcher"),n=e.find(".dimension-picker-unhighlighted"),o=e.find(".dimension-picker-highlighted"),s=e.find(".dimension-picker-status"),e.css({width:t.minColumns+"em"}),i.css("z-index",1),i.width(t.maxColumns+"em").height(t.maxRows+"em"),n.width(t.minColumns+"em").height(t.minRows+"em"),s.html(a+" x "+l),s.width(n.width())),i.on("mousemove",r),o.on("mousemove",r),n.on("mousemove",r),i.on("mouseleave",c),o.on("mouseleave",c),n.on("mouseleave",c),i.on("click",h),o.on("click",h),n.on("click",h)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(i,r,c){i>this.maxColumns&&(i=this.maxColumns),r>this.maxRows&&(r=this.maxRows),a==i&&l==r||(a=i,l=r,o.width(a+"em").height(l+"em"),n.width((a<t.minColumns?t.minColumns:a+1>t.maxColumns?t.maxColumns:a+1)+"em").height((l<t.minRows?t.minRows:l+1>t.maxRows?t.maxRows:l+1)+"em"),e.width(n.width()),s.html(a+" x "+l),s.width(n.width()),t.trigger("change",t,a,l,c))},getColumnsCount:function(){return a},getRowsCount:function(){return l}}}())}),void 0===Common)var Common={};var FONT_TYPE_RECENT=4;if(define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var t=Asc.FONT_THUMBNAIL_HEIGHT||26,e=window.devicePixelRatio>1,i=document.createElement("canvas"),n=i.getContext("2d"),o="../../../../sdkjs/common/Images/fonts_thumbnail.png",s="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png";return"object"==typeof window.AscDesktopEditor&&(o=window.AscDesktopEditor.getFontsSprite(),s=window.AscDesktopEditor.getFontsSprite(!0)),i.height=e?2*t:t,
|
|
|
i.width=e?604:302,{template:_.template(['<div class="input-group combobox fonts <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control" spellcheck="false"> ','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">','<li class="divider">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>">','<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"/>',"</li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(t){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(t,{displayField:"name",scroller:{wheelSpeed:20,alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(t.recent)?t.recent:5;var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(t){var e=null;return _.isUndefined(this._input)||(e=this._input.val()),Common.UI.ComboBox.prototype.render.call(this,t),this.setRawValue(e),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this._input.on("focus",_.bind(function(){this.inFormControl=!0},this)),this._input.on("blur",_.bind(function(){this.inFormControl=!1},this)),this},onAfterKeydownMenu:function(t){var e=this;return t.keyCode==Common.UI.Keys.RETURN?($(t.target).closest("input").length?this.lastValue!==this._input.val()&&this._input.trigger("change"):($(t.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur())),!1):t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen()?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10),!1):((t.keyCode==Common.UI.Keys.HOME&&!t.shiftKey||t.keyCode==Common.UI.Keys.END&&!t.shiftKey||t.keyCode==Common.UI.Keys.BACKSPACE&&!e._input.is(":focus"))&&this.isMenuOpen()&&(e._input.focus(),setTimeout(function(){e._input[0].selectionStart=e._input[0].selectionEnd=t.keyCode==Common.UI.Keys.HOME?0:e._input[0].value.length},10)),void this.updateVisibleFontsTiles())},onInputKeyUp:function(t){if(t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!==Common.UI.Keys.SHIFT&&t.keyCode!==Common.UI.Keys.CTRL&&t.keyCode!==Common.UI.Keys.ALT&&t.keyCode!==Common.UI.Keys.LEFT&&t.keyCode!==Common.UI.Keys.RIGHT&&t.keyCode!==Common.UI.Keys.HOME&&t.keyCode!==Common.UI.Keys.END&&t.keyCode!==Common.UI.Keys.ESC&&t.keyCode!==Common.UI.Keys.INSERT&&t.keyCode!==Common.UI.Keys.TAB&&(t.stopPropagation(),this.selectCandidate(t.keyCode==Common.UI.Keys.DELETE||t.keyCode==Common.UI.Keys.BACKSPACE),this._selectedItem)){var e=this;void 0===e._timerSelection&&(e._timerSelection=setInterval(function(){if(!(new Date-e._inInputKeyDown<100)&&e._selectedItem){clearInterval(e._timerSelection),e._timerSelection=void 0;var t=e._input[0],i=e._selectedItem.get(e.displayField),n=t.value;e.rendered&&(document.selection?document.selection.createRange().text=i:(t.selectionStart||"0"==t.selectionStart)&&(t.value=i,t.selectionStart=n.length,t.selectionEnd=i.length))}},10))}},onInputKeyDown:function(t){this._inInputKeyDown=new Date;var e=this;t.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10)):t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!=Common.UI.Keys.CTRL&&t.keyCode!=Common.UI.Keys.SHIFT&&t.keyCode!=Common.UI.Keys.ALT?(this.isMenuOpen()||t.ctrlKey||this.openMenu(),t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var i=t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):e.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");i=i.length>0?i.eq(0):t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li:not(.divider):first"):e.cmpEl.find("ul li:not(.divider):last"),i=i.find("a"),e._skipInputChange=!0,i.focus(),e.updateVisibleFontsTiles()},10):e._skipInputChange=!1):t.keyCode==Common.UI.Keys.RETURN&&this._input.val()===e.lastValue&&this._input.trigger("change",{reapply:!0})},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);if(this._isMouseDownMenu)return void(this._isMouseDownMenu=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));n[this.valueField]=i,n[this.displayField]=i,this.trigger("changed:before",this,n,t),t.isDefaultPrevented()||(this._selectedItem?(n[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(n[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(n[this.valueField]),n.isNewFont=!0,this.trigger("selected",this,n,t),this.closeMenu()),this.trigger("changed:after",this,n,t))}},getImageUri:function(o){if(o.cloneid){var s=$(this.el).find("ul > li#"+o.cloneid+" img");return null!=s?s[0].src:void 0}return e?(n.clearRect(0,0,604,2*t),n.drawImage(this.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*o.imgidx)):(n.clearRect(0,0,302,t),n.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*o.imgidx)),i.toDataURL()},getImageWidth:function(){return 302},getImageHeight:function(){return t},getListItemHeight:function(){return 26},loadSprite:function(t){t&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=t,this.spriteThumbs.src=window.devicePixelRatio>1?s:o)},fillFonts:function(t,e){var i=this;this.loadSprite(function(){if(i.store.set(t.toJSON()),i.rendered=!1,_.isUndefined(i.scroller)||(i.scroller.destroy(),delete i.scroller),i._scrollerIsInited=!1,i.render($(i.el)),i._fontsArray=i.store.toJSON(),i.recent>0){i.store.on("add",i.onInsertItem,i),i.store.on("remove",i.onRemoveItem,i),Common.Utils.InternalSettings.set(i.appPrefix+"-settings-recent-fonts",Common.localStorage.getItem(i.appPrefix+"-settings-recent-fonts"));var e=Common.Utils.InternalSettings.get(i.appPrefix+"-settings-recent-fonts");e=e?e.split(";"):[],e.reverse().forEach(function(t){t&&i.addItemToRecent(i.store.findWhere({name:t}),!0)})}})},onApiChangeFont:function(t){var e=this;setTimeout(function(){e.onApiChangeFontInternal(t)},100)},onApiChangeFontInternal:function(t){if(!this.inFormControl){var e=_.isFunction(t.get_Name)?t.get_Name():t.asc_getName();if(this.getRawValue()!==e){var i=this.store.findWhere({name:e});if($(".selected",$(this.el)).removeClass("selected"),i){this.setRawValue(i.get(this.displayField));var n=$("#"+i.get("id"),$(this.el)),o=$("ul.dropdown-menu",this.cmpEl);n&&o&&(n.addClass("selected"),this.recent<=0&&o.scrollTop(n.offset().top-o.offset().top))}else this.setRawValue(e)}}},itemClicked:function(t){Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments);var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['<li id="<%= item.id %>">','<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"/>',"</li>"].join(""))({item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(this.store.length<1)return void t.preventDefault();if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t,e){if(!(this.recent<1)){var i=this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT});i&&this.store.remove(i);var n=this.store.where({type:FONT_TYPE_RECENT});n.length<this.recent||this.store.remove(n[this.recent-1]);var o=t.clone();if(o.set({type:FONT_TYPE_RECENT,id:Common.UI.getId(),cloneid:t.id}),this.store.add(o,{at:0}),!e){var s=[];this.store.where({type:FONT_TYPE_RECENT}).forEach(function(t){s.push(t.get("name"))}),s=s.join(";"),Common.localStorage.setItem(this.appPrefix+"-settings-recent-fonts",s),Common.Utils.InternalSettings.set(this.appPrefix+"-settings-recent-fonts",s)}}},selectCandidate:function(t){var e=this,i=this._input.val().toLowerCase();this._fontsArray||(this._fontsArray=this.store.toJSON());var n=_.find(this._fontsArray,function(n){return t?n[e.displayField].toLowerCase()==i:0==n[e.displayField].toLowerCase().indexOf(i)});if(this._selectedItem=n?this.store.findWhere({id:n.id}):null,$(".selected",$(this.el)).removeClass("selected"),this._selectedItem){var o=$("#"+this._selectedItem.get("id"),$(this.el)),s=$("ul[role=menu]",$(this.el));if(o.length>0&&s.length>0){o.addClass("selected");var a=o.position().top,l=s.scrollTop();0!=a&&s.scrollTop(l+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,a=o.store.length,l=0;if(o.tiles||(o.tiles=[]),a!==o.tiles.length)for(s=o.tiles.length;s<a;++s)o.tiles.unshift(null);_.isUndefined(n)&&(n=parseInt($(o.el).find(".ps-scrollbar-x-rail").css("bottom")));var r=$(o.el).find(".dropdown-menu").height(),c=Math.max(Math.floor(r/26)+3,0),h=Math.max(Math.floor(-n/26)-1,0),d=h+c,p=$(o.el).find("a");for(s=0;s<a;++s)if(h<=s&&s<d){if(null===o.tiles[s]){var m=document.createElement("canvas"),u=m.getContext("2d");m.height=e?2*t:t,m.width=e?604:302,m.style.width="302px",m.style.height=t+"px",l=o.store.at(s).get("imgidx"),e?(u.clearRect(0,0,604,2*t),u.drawImage(o.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*l)):(u.clearRect(0,0,302,t),u.drawImage(o.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*l)),o.tiles[s]=m,$(p[s]).get(0).appendChild(m)}}else o.tiles[s]&&(o.tiles[s].parentNode.removeChild(o.tiles[s]),o.tiles[s]=null)},flushVisibleFontsTiles:function(){for(var t=this.tiles.length-1;t>=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['<div id="<%= id %>" class="combo-dataview <%= cls %>" style="<%= style %>">','<div class="view"></div> ','<div class="button"></div> ',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['<div class="style" id="<%= id %>">','<img src="<%= imageUrl %>" width="'+this.itemWidth+'" height="'+this.itemHeight+'"/>','<% if (typeof title !== "undefined") {%>','<span class="title"><%= title %></span>',"<% } %>","</div>"].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('<div class="menu-picker-container"></div>')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store,itemTemplate:_.template(['<div class="style" id="<%= id %>">','<img src="<%= imageUrl %>" width="'+this.itemWidth+'" height="'+this.itemHeight+'"/>','<% if (typeof title !== "undefined") {%>','<span class="title"><%= title %></span>',"<% } %>","</div>"].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e<this.minWidth)return;this.rootWidth==e&&this.rootHeight==i||(this.rootWidth=e,this.rootHeight=i,setTimeout(function(){t.openButton.menu.cmpEl.outerWidth(),t.rootWidth=t.cmpEl.width()},10),this.onResize())}},onResize:function(){if(this.openButton){var t=$("button",this.openButton.cmpEl);t&&t.css({width:$(".button",this.cmpEl).width(),height:$(".button",this.cmpEl).height()}),this.openButton.menu.hide();var e=this.menuPicker;if(e){var i=e.getSelectedRec();this.fillComboView(i||e.store.at(0),!!i,!0),e.onResize()}}this.isSuspendEvents||this.trigger("resize",this)},onBeforeShowMenu:function(t){var e=this;if(_.isFunction(e.beforeOpenHandler))e.beforeOpenHandler(e,t);else if(e.openButton.menu.cmpEl){var i=0;try{var n=$($(".dropdown-menu .dataview.inner .style",e.cmpEl)[0]);i=n?parseInt(n.css("margin-left"))+parseInt(n.css("margin-right")):0}catch(t){}e.openButton.menu.cmpEl.css({width:Math.round((e.cmpEl.width()+i*e.fieldPicker.store.length)/e.itemWidth-.2)*(e.itemWidth+i),"min-height":this.cmpEl.height()})}if(e.options.hint){var o=e.cmpEl.data("bs.tooltip");o&&(void 0===o.dontShow&&(o.dontShow=!0),o.hide())}this.menuPicker.selectedBeforeHideRec=null},onBeforeHideMenu:function(t){if(this.trigger("hide:before",this,t),Common.UI.Scroller.isMouseCapture()&&t.preventDefault(),this.isStylesNotClosable)return!1},onAfterShowMenu:function(t){var e=this;e.menuPicker.scroller&&e.menuPicker.scroller.update({includePadding:!0,suppressScrollX:!0,alwaysVisibleY:!0})},onAfterHideMenu:function(t,e){this.menuPicker.selectedBeforeHideRec=this.menuPicker.getSelectedRec(),this.showLast?this.menuPicker.showLastSelected():this.menuPicker.deselectAll(),this.trigger("hide:after",this,t,e)},onFieldPickerSelect:function(t,e,i){},onMenuPickerSelect:function(t,e,i,n){this.needFillComboView=this.disabled,this.disabled||!0===n||(this.fillComboView(i,!1),i&&!this.isSuspendEvents&&this.trigger("select",this,i))},onFieldPickerClick:function(t,e,i){if(!this.disabled){if(this.isSuspendEvents||this.trigger("click",this,i),this.options.hint){var n=this.cmpEl.data("bs.tooltip");n&&(void 0===n.dontShow&&(n.dontShow=!0),n.hide())}this.showLast||this.fieldPicker.deselectAll()}},onMenuPickerClick:function(t,e,i){this.disabled||this.isSuspendEvents||this.trigger("click",this,i)},onPickerItemContextMenu:function(t,e,i,n){if(!this.disabled)return this.isSuspendEvents||this.trigger("contextmenu",this,i,n),n.preventDefault(),n.stopPropagation(),!1},onPickerComboContextMenu:function(t){this.disabled||this.isSuspendEvents||this.trigger("contextmenu",this,void 0,t)},setDisabled:function(t){if(this.disabled=t,this.rendered&&(this.cmpEl.toggleClass("disabled",t),$("button",this.openButton.cmpEl).toggleClass("disabled",t),this.fieldPicker.setDisabled(t),this.needFillComboView&&!t)){var e=this.menuPicker;if(e){var i=e.getSelectedRec();this.fillComboView(i||e.store.at(0),!1)}}},isDisabled:function(){return this.disabled},fillComboView:function(t,e,i){if(!_.isUndefined(t)&&t instanceof Backbone.Model){this.needFillComboView=!this.isVisible();var n=this,o=n.menuPicker.store,s=$(n.fieldPicker.el);if(o){if(i||!n.fieldPicker.store.findWhere({id:t.get("id")})){if(void 0===n.itemMarginLeft){var a=$($(this.menuPicker.el).find(".inner > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=o.indexOf(t);if(l<0)return;var r=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),h=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l<c&&(l=Math.max(r-c,0));for(var d=l,p=0;d<r&&p<c;d++,p++)h.push(o.at(d));n.fieldPicker.store.reset(h)}if(e){var m=n.fieldPicker.store.findWhere({id:t.get("id")});m&&(n.suspendEvents(),n.fieldPicker.selectRecord(m,!0),n.resumeEvents())}}}},clearComboView:function(){this.fieldPicker.store.reset([])},selectByIndex:function(t){t<0&&this.fieldPicker.deselectAll(),this.menuPicker.selectByIndex(t)},setItemWidth:function(t){this.itemWidth!=t&&(this.itemWidth=window.devicePixelRatio>1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['<div class="synch-tip-root <% if (!!scope.options.extCls) {print(scope.options.extCls + " ");} %><%= scope.placement %>">','<div class="asc-synchronizetip">','<div class="tip-arrow <%= scope.placement %>"></div>',"<div>",'<div class="tip-text" style="width: 260px;"><%= scope.text %></div>','<div class="close img-commonctrl"></div>',"</div>","<% if ( scope.showLink ) { %>",'<div class="show-link"><label><%= scope.textLink %></label></div>',"<% } %>","</div>","</div>"].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.<br/>Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){this.fireEvent("change:compact",[$(t.target).data("tab")])}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('<section class="tabs"><a class="scroll left"></a><ul><% for(var i in items) { %><li class="ribtab<% if (items[i].haspanel===false) print(" x-lone") %><% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><a data-tab="<%= items[i].action %>" data-title="<%= items[i].caption %>"><%= items[i].caption %></a></li><% } %></ul><a class="scroll right"></a></section>')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab"),o=i.hasClass("x-lone");e.isFolded?i.hasClass("x-lone")?e.collapse():i.hasClass("active")?e.collapse():(e.setTab(n),e.processPanelVisible(null,!0)):i.hasClass("active")||o||(e.setTab(n),e.processPanelVisible(null,!0))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('<li class="ribtab" style="display: none;"><a data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');s.tabs[n+1]=t;var l=o(n),r=this.$tabs||this.$layout.find(".tabs"),c=r.find("a[data-tab="+l+"]");c.length&&(c.parent().after(a(t)),e&&(r=this.$panels||this.$layout.find(".box-panels > .panel"),c=r.filter("[data-tab="+l+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)<t||(n=this.$tabs.filter(":visible:last").get(0),o=n.getBoundingClientRect(),Math.round(o.right)>e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge;s||(s=e.get(0).getBoundingClientRect().right),s>i?e.hasClass("compactwidth")||(e.addClass("compactwidth"),o.rightedge=s):e.hasClass("compactwidth")&&e.removeClass("compactwidth")}}var n=this;n._timer_id&&clearTimeout(n._timer_id),!0===e?i():n._timer_id=setTimeout(function(){delete n._timer_id,i()},100)},setExtra:function(t,e){e&&(this.$tabs||("right"==t?this.$layout.find(".extra.right").html(e):"left"==t&&this.$layout.find(".extra.left").html(e)))},setVisible:function(t,e){t&&this.$tabs&&this.$tabs.find("> a[data-tab="+t+"]").parent().css("display",e?"":"none")}}}())}),define("spreadsheeteditor/main/app/view/Toolbar",["backbone","text!spreadsheeteditor/main/app/template/Toolbar.template","text!spreadsheeteditor/main/app/template/ToolbarAnother.template","text!spreadsheeteditor/main/app/template/ToolbarView.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","common/main/lib/component/Mixtbar"],function(t,e,i,n){"use strict";SSE.enumLock={editCell:"cell-editing",editFormula:"is-formula",editText:"is-text",editPivot:"is-pivot",selImage:"sel-image",selShape:"sel-shape",selShapeText:"sel-shape-txt",selChart:"sel-chart",selChartText:"sel-chart-txt",selRange:"sel-range",selRangeEdit:"sel-range-edit",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",commentLock:"can-comment",cantModifyFilter:"cant-filter",disableOnStart:"on-start",cantGroup:"cant-group",cantGroupUngroup:"cant-group-ungroup",docPropsLock:"doc-props-lock",printAreaLock:"print-area-lock",namedRangeLock:"named-range-lock",multiselectCols:"is-multiselect-cols",headerLock:"header-lock",sheetLock:"sheet-lock"},SSE.Views.Toolbar=Common.UI.Mixtbar.extend(_.extend({el:"#toolbar",template:_.template(e),events:{},initialize:function(){var t=this;return t.SchemeNames=[t.txtScheme1,t.txtScheme2,t.txtScheme3,t.txtScheme4,t.txtScheme5,t.txtScheme6,t.txtScheme7,t.txtScheme8,t.txtScheme9,t.txtScheme10,t.txtScheme11,t.txtScheme12,t.txtScheme13,t.txtScheme14,t.txtScheme15,t.txtScheme16,t.txtScheme17,t.txtScheme18,t.txtScheme19,t.txtScheme20,t.txtScheme21],t._state={hasCollaborativeChanges:void 0},t.btnSaveCls="btn-save",t.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),t.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:"@"},t.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"}],this},lockToolbar:function(t,e,i){Common.Utils.lockControls(t,e,i,this.lockControls)},applyLayout:function(t){function o(){return{isDummy:!0,on:function(){}}}var s=this,a=SSE.enumLock;if(s.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),s.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste",lock:[a.coAuth,a.lostConnect]}),s.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo",disabled:!0,lock:[a.lostConnect],signals:["disabled"]}),s.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo",disabled:!0,lock:[a.lostConnect],signals:["disabled"]}),t.isEditDiagram){s.$layout=$(_.template(i)(t)),s.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[a.editText,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.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:s.txtAdditional,value:"more"}]})}),s.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]});var l=_.template(["<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">','<div style="position: relative;"><div style="position: absolute; left: 0; width: 100px;"><%= scope.getDisplayValue(item) %></div>','<div style="display: inline-block; width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;"><%= item.exampleval ? item.exampleval : "" %></div>',"</div></a></li>","<% }); %>",'<li class="divider">','<li id="id-toolbar-mnu-item-more-formats" data-value="-1"><a tabindex="-1" type="menuitem">'+s.textMoreFormats+"</a></li>"].join(""));s.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:s.tipNumFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.coAuth],itemsTemplate:l,editable:!1,data:s.numFormatData}),s.btnEditChart=new Common.UI.Button({id:"id-toolbar-rtn-edit-chart",cls:"btn-toolbar btn-text-value",caption:s.tipEditChart,lock:[a.lostConnect],style:"width: 120px;"})}else if(t.isEditMailMerge)s.$layout=$(_.template(i)(t)),s.btnSearch=new Common.UI.Button({id:"id-toolbar-btn-search",cls:"btn-toolbar",iconCls:"btn-search",lock:[a.lostConnect]}),s.btnSortDown=new Common.UI.Button({id:"id-toolbar-btn-sort-down",cls:"btn-toolbar",iconCls:"btn-sort-down",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot]}),s.btnSortUp=new Common.UI.Button({id:"id-toolbar-btn-sort-up",cls:"btn-toolbar",iconCls:"btn-sort-up",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot]}),s.btnSetAutofilter=new Common.UI.Button({id:"id-toolbar-btn-setautofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot],enableToggle:!0}),s.btnClearAutofilter=new Common.UI.Button({id:"id-toolbar-btn-clearfilter",cls:"btn-toolbar",iconCls:"btn-clear-filter",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleDelFilter,a.editPivot]});else if(t.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(e),tabs:[{caption:s.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:s.textTabHome,action:"home",extcls:"canedit"},{caption:s.textTabInsert,action:"ins",extcls:"canedit"},{caption:s.textTabLayout,action:"layout",extcls:"canedit"},{caption:s.textTabFormula,action:"formula",extcls:"canedit"},{caption:s.textTabData,action:"data",extcls:"canedit"}]}),s.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:s.tipFontSize,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.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"},{value:96,displayValue:"96"}]}),s.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:s.tipFontName,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],store:new Common.Collections.Fonts}),s.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print no-mask",lock:[a.editCell,a.cantPrint,a.disableOnStart],signals:["disabled"]}),s.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"no-mask "+s.btnSaveCls,signals:["disabled"]}),s.btnCollabChanges=s.btnSave,s.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"btn-incfont",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect]}),s.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"btn-decfont",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect]}),s.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"btn-strikeout",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"btn-subscript",icls:"btn-subscript",split:!0,enableToggle:!0,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{caption:s.textSuperscript,iconCls:"mnu-text-superscript",icls:"btn-superscript",checkable:!0,allowDepress:!0,toggleGroup:"textsubscriptgroup",value:"super"},{caption:s.textSubscript,iconCls:"mnu-text-subscript",icls:"btn-subscript",checkable:!0,allowDepress:!0,toggleGroup:"textsubscriptgroup",value:"sub"}]})}),s.mnuTextColorPicker=o(),s.btnTextColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",split:!0,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-toolbar-menu-new-fontcolor" style="padding-left:12px;">'+s.textNewColor+"</a>")}]})}),s.mnuBackColorPicker=o(),s.btnBackColor=new Common.UI.Button({id:"id-toolbar-btn-fillparag",cls:"btn-toolbar",iconCls:"btn-fillparag",split:!0,lock:[a.selImage,a.editCell,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-paracolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-toolbar-menu-new-paracolor" style="padding-left:12px;">'+s.textNewColor+"</a>")}]})}),s.btnBorders=new Common.UI.Button({id:"id-toolbar-btn-borders",cls:"btn-toolbar",iconCls:"btn-border-out",icls:"btn-border-out",borderId:"outer",borderswidth:Asc.c_oAscBorderStyles.Thin,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],split:!0,menu:!0}),s.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"btn-align-left",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"btn-align-center",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"btn-align-right",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"btn-align-just",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnMerge=new Common.UI.Button({id:"id-toolbar-rtn-merge",cls:"btn-toolbar",iconCls:"btn-merge",enableToggle:!0,allowDepress:!0,split:!0,lock:[a.editCell,a.selShape,a.selShapeText,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.ruleMerge,a.editPivot],menu:new Common.UI.Menu({items:[{caption:s.txtMergeCenter,value:Asc.c_oAscMergeOptions.MergeCenter},{caption:s.txtMergeAcross,value:Asc.c_oAscMergeOptions.MergeAcross},{caption:s.txtMergeCells,value:Asc.c_oAscMergeOptions.Merge},{caption:s.txtUnmerge,value:Asc.c_oAscMergeOptions.None}]})}),s.btnAlignTop=new Common.UI.Button({id:"id-toolbar-rtn-valign-top",cls:"btn-toolbar",iconCls:"btn-valign-top",lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),s.btnAlignMiddle=new Common.UI.Button({id:"id-toolbar-rtn-valign-middle",cls:"btn-toolbar",iconCls:"btn-valign-middle",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"vAlignGroup"}),s.btnAlignBottom=new Common.UI.Button({id:"id-toolbar-rtn-valign-bottom",cls:"btn-toolbar",iconCls:"btn-valign-bottom",lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),s.btnWrap=new Common.UI.Button({id:"id-toolbar-rtn-wrap",cls:"btn-toolbar",iconCls:"btn-wrap",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],enableToggle:!0,allowDepress:!0}),s.btnTextOrient=new Common.UI.Button({id:"id-toolbar-rtn-textorient",cls:"btn-toolbar",iconCls:"btn-text-orient",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.textHorizontal,iconCls:"mnu-direct-horiz",checkable:!0,toggleGroup:"textorientgroup",value:"horiz"},{caption:s.textCounterCw,iconCls:"mnu-direct-ccw",checkable:!0,toggleGroup:"textorientgroup",value:"countcw"},{caption:s.textClockwise,iconCls:"mnu-direct-cw",checkable:!0,toggleGroup:"textorientgroup",value:"clockwise"},{caption:s.textRotateUp,iconCls:"mnu-direct-rup",checkable:!0,toggleGroup:"textorientgroup",value:"rotateup"},{caption:s.textRotateDown,iconCls:"mnu-direct-rdown",checkable:!0,toggleGroup:"textorientgroup",value:"rotatedown"}]})}),s.btnInsertImage=new Common.UI.Button({id:"tlbtn-insertimage",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertimage",caption:s.capInsertImage,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.mniImageFromFile,value:"file"},{caption:s.mniImageFromUrl,value:"url"},{caption:s.mniImageFromStorage,value:"storage"}]})}),s.btnInsertHyperlink=new Common.UI.Button({id:"tlbtn-insertlink",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-inserthyperlink",caption:s.capInsertHyperlink,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.selShape,a.cantHyperlink,a.multiselect,a.lostConnect,a.coAuth,a.editPivot]}),s.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertchart",lock:[a.editCell,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],caption:s.capInsertChart,menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:_.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),s.btnInsertShape=new Common.UI.Button({id:"tlbtn-insertshape",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertshape",enableToggle:!0,caption:s.capInsertShape,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),s.btnInsertText=new Common.UI.Button({id:"tlbtn-inserttext",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-text",caption:s.capInsertText,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],enableToggle:!0}),s.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-textart",caption:s.capInsertTextart,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:_.template('<div id="id-toolbar-menu-insart" style="width: 239px; margin-left: 5px;"></div>')}]})}),s.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertequation",caption:s.capInsertEquation,split:!0,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),s.btnTableTemplate=new Common.UI.Button({id:"id-toolbar-btn-ttempl",cls:"btn-toolbar",iconCls:"btn-ttempl",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.multiselect,a.cantModifyFilter],menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-table-templates" style="width: 288px; height: 300px; margin: 0px 4px;"></div>')}]})}),s.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-inserttable",caption:s.capInsertTable,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.multiselect,a.cantModifyFilter,a.ruleMerge,a.editPivot]}),s.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",enableKeyEvents:!0,itemWidth:112,itemHeight:38,menuMaxHeight:226,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],beforeOpenHandler:function(t){var e=this,i=e.openButton.menu;if(i.cmpEl){var n=$(e.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=n.is(":visible")?parseInt(n.css("width")):e.itemWidth+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right"))+parseInt(n.css("border-left-width"))+parseInt(n.css("border-right-width")),s=e.menuPicker.store.length>=6?6:e.menuPicker.store.length,a=Math.min(e.menuPicker.store.length,Math.round($(".dataview",$(e.fieldPicker.el)).width()/(-1+o)+.5));a=a<s?s:a,i.menuAlignEl=e.cmpEl,i.menuAlign="tl-tl";var l=e.cmpEl.width()-e.openButton.$el.width()-a*(-1+o)-1;i.setOffset(Math.min(l,0)),i.cmpEl.css({width:a*(o+-1),"min-height":e.cmpEl.height()})}}});var l=_.template(["<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">','<div style="position: relative;"><div style="position: absolute; left: 0; width: 100px;"><%= scope.getDisplayValue(item) %></div>','<div style="display: inline-block; width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;"><%= item.exampleval ? item.exampleval : "" %></div>',"</div></a></li>","<% }); %>",'<li class="divider">','<li id="id-toolbar-mnu-item-more-formats" data-value="-1"><a tabindex="-1" type="menuitem">'+s.textMoreFormats+"</a></li>"].join(""));s.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:s.tipNumFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.coAuth],itemsTemplate:l,editable:!1,data:s.numFormatData}),s.btnPercentStyle=new Common.UI.Button({id:"id-toolbar-btn-percent-style",cls:"btn-toolbar",iconCls:"btn-percent-style",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],styleName:"Percent"}),s.btnCurrencyStyle=new Common.UI.Button({id:"id-toolbar-btn-accounting-style",cls:"btn-toolbar",iconCls:"btn-currency-style",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],styleName:"Currency",split:!0,menu:new Common.UI.Menu({style:"min-width: 120px;",items:[{caption:s.txtDollar,value:1033},{caption:s.txtEuro,value:1031},{caption:s.txtPound,value:2057},{caption:s.txtRouble,value:1049},{caption:s.txtYen,value:1041},{caption:"--"},{caption:s.textMoreFormats,value:-1}]})}),s.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[a.editText,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.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:s.txtAdditional,value:"more"}]})}),s.btnNamedRange=new Common.UI.Button({id:"id-toolbar-btn-insertrange",cls:"btn-toolbar",iconCls:"btn-named-range",lock:[a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.selRangeEdit],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:s.txtManageRange,lock:[a.editCell],value:"manage"},{caption:s.txtNewRange,lock:[a.editCell],value:"new"},{caption:s.txtPasteRange,value:"paste"}]})}),s.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clear",cls:"btn-toolbar",iconCls:"btn-clearstyle",lock:[a.lostConnect,a.coAuth,a.selRangeEdit],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:s.txtClearAll,lock:[a.cantModifyFilter],value:Asc.c_oAscCleanOptions.All},{caption:s.txtClearText,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Text},{caption:s.txtClearFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth,a.cantModifyFilter],value:Asc.c_oAscCleanOptions.Format},{caption:s.txtClearComments,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Comments},{caption:s.txtClearHyper,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),s.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",lock:[a.editCell,a.lostConnect,a.coAuth,a.selChart],enableToggle:!0}),s.btnAddCell=new Common.UI.Button({id:"id-toolbar-btn-addcell",cls:"btn-toolbar",iconCls:"btn-addcell",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textInsRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:s.textInsDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:s.textEntireRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:s.textEntireCol,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),s.btnDeleteCell=new Common.UI.Button({id:"id-toolbar-btn-delcell",cls:"btn-toolbar",iconCls:"btn-delcell",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textDelLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:s.textDelUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:s.textEntireRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:s.textEntireCol,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),s.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",lock:[a.editCell,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[],restoreHeight:!0})}),s.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",lock:[a.editCell,a.selChart,a.selChartText,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.tipAlignLeft,iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",checked:!0,value:AscCommon.align_Left},{caption:s.tipAlignCenter,iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Center},{caption:s.tipAlignRight,iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Right},{caption:s.tipAlignJust,iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Justify}]})}),s.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",iconCls:"btn-valign-bottom",icls:"btn-valign-bottom",lock:[a.editCell,a.selChart,a.selChartText,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.tipAlignTop,iconCls:"mnu-valign-top",icls:"btn-valign-top",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Top},{caption:s.tipAlignMiddle,iconCls:"mnu-valign-middle",icls:"btn-valign-middle",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Center},{caption:s.tipAlignBottom,iconCls:"mnu-valign-bottom",icls:"btn-valign-bottom",checkable:!0,allowDepress:!0,checked:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Bottom}]})});var r=Common.localStorage.getItem("sse-hide-synch");s.showSynchTip=!(r&&1==parseInt(r)),s.btnPageOrient=new Common.UI.Button({id:"tlbtn-pageorient",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pageorient",caption:s.capBtnPageOrient,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:s.textPortrait,iconCls:"mnu-orient-portrait",checkable:!0,toggleGroup:"menuOrient",value:Asc.c_oAscPageOrientation.PagePortrait},{caption:s.textLandscape,iconCls:"mnu-orient-landscape",checkable:!0,toggleGroup:"menuOrient",value:Asc.c_oAscPageOrientation.PageLandscape}]})});var c=_.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div><% if (options.value !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;"><label style="display: block;">'+this.textTop+'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label><label style="display: block;">'+this.textLeft+'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><div style="display: inline-block;"><label style="display: block;">'+this.textBottom+'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[2]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label><label style="display: block;">'+this.textRight+"<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[3]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><% } %></a>");s.btnPageMargins=new Common.UI.Button({id:"tlbtn-pagemargins",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pagemargins",caption:s.capBtnMargins,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textMarginsLast,checkable:!0,template:c,toggleGroup:"menuPageMargins"},{caption:s.textMarginsNormal,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[19.1,17.8,19.1,17.8]},{caption:s.textMarginsNarrow,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[19.1,6.4,19.1,6.4]},{caption:s.textMarginsWide,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[25.4,25.4,25.4,25.4]},{caption:"--"},{caption:s.textPageMarginsCustom,value:"advanced"}]})});var h=_.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div><div><%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></div></a>');s.btnPageSize=new Common.UI.Button({id:"tlbtn-pagesize",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pagesize",caption:s.capBtnPageSize,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({restoreHeight:!0,items:[{caption:"US Letter",subtitle:"21,59cm x 27,94cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,279.4]},{caption:"US Legal",subtitle:"21,59cm x 35,56cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,355.6]},{caption:"A4",subtitle:"21cm x 29,7cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[210,297],checked:!0},{caption:"A5",subtitle:"14,81cm x 20,99cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[148,210]},{caption:"B5",subtitle:"17,6cm x 25,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[176,250]},{caption:"Envelope #10",subtitle:"10,48cm x 24,13cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[104.8,241.3]},{caption:"Envelope DL",subtitle:"11,01cm x 22,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[110,220]},{caption:"Tabloid",subtitle:"27,94cm x 43,17cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[279.4,431.8]},{caption:"A3",subtitle:"29,7cm x 42,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[297,420]},{caption:"Tabloid Oversize",subtitle:"30,48cm x 45,71cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[304.8,457.1]},{caption:"ROC 16K",subtitle:"19,68cm x 27,3cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[196.8,273]},{caption:"Envelope Choukei 3",subtitle:"11,99cm x 23,49cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[119.9,234.9]},{caption:"Super B/A3",subtitle:"33,02cm x 48,25cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[330.2,482.5]}]})}),s.mnuPageSize=s.btnPageSize.menu,s.btnPrintArea=new Common.UI.Button({id:"tlbtn-printarea",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-print-area",caption:s.capBtnPrintArea,lock:[a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.editCell,a.selRangeEdit,a.printAreaLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:s.textSetPrintArea,lock:[a.namedRangeLock],value:Asc.c_oAscChangePrintAreaType.set},{caption:s.textClearPrintArea,value:Asc.c_oAscChangePrintAreaType.clear},{caption:s.textAddPrintArea,lock:[a.namedRangeLock],value:Asc.c_oAscChangePrintAreaType.add}]})}),s.btnEditHeader=new Common.UI.Button({id:"tlbtn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-editheader",caption:s.capBtnInsHeader,lock:[a.editCell,a.selRangeEdit,a.headerLock,a.lostConnect,a.coAuth]}),s.btnImgAlign=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-align",caption:s.capImgAlign,lock:[a.selRange,a.selRangeEdit,a.cantGroup,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-group",caption:s.capImgGroup,lock:[a.selRange,a.selRangeEdit,a.cantGroupUngroup,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgForward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-frwd",caption:s.capImgForward,split:!0,lock:[a.selRange,a.selRangeEdit,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgBackward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-bkwd",caption:s.capImgBackward,lock:[a.selRange,a.selRangeEdit,a.lostConnect,a.coAuth,a.coAuthText],split:!0,menu:!0})}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(n),tabs:[{caption:s.textTabFile,action:"file",haspanel:!1}]});return t.isEdit&&(s.lockControls=[s.cmbFontName,s.cmbFontSize,s.btnIncFontSize,s.btnDecFontSize,s.btnBold,s.btnItalic,s.btnUnderline,s.btnStrikeout,s.btnSubscript,s.btnTextColor,s.btnHorizontalAlign,s.btnAlignLeft,s.btnAlignCenter,s.btnAlignRight,s.btnAlignJust,s.btnVerticalAlign,s.btnAlignTop,s.btnAlignMiddle,s.btnAlignBottom,s.btnWrap,s.btnTextOrient,s.btnBackColor,s.btnInsertTable,s.btnMerge,s.btnInsertFormula,s.btnNamedRange,s.btnIncDecimal,s.btnInsertShape,s.btnInsertEquation,s.btnInsertText,s.btnInsertTextArt,s.btnSortUp,s.btnSortDown,s.btnSetAutofilter,s.btnClearAutofilter,s.btnTableTemplate,s.btnPercentStyle,s.btnCurrencyStyle,s.btnDecDecimal,s.btnAddCell,s.btnDeleteCell,s.cmbNumberFormat,s.btnBorders,s.btnInsertImage,s.btnInsertHyperlink,s.btnInsertChart,s.btnColorSchemas,s.btnCopy,s.btnPaste,s.listStyles,s.btnPrint,s.btnClearStyle,s.btnCopyStyle,s.btnPageMargins,s.btnPageSize,s.btnPageOrient,s.btnPrintArea,s.btnImgAlign,s.btnImgBackward,s.btnImgForward,s.btnImgGroup,s.btnEditHeader],_.each(s.lockControls.concat([s.btnSave]),function(t){t&&_.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.lockToolbar(SSE.enumLock.disableOnStart,!0,{array:[s.btnPrint]}),this.on("render:after",_.bind(this.onToolbarAfterRender,this))),this},render:function(t){var e=this;if(e.isCompactView=t.isCompactView,this.fireEvent("render:before",[this]),t.isEdit?e.$el.html(e.rendererComponents(e.$layout)):(e.$layout.find(".canedit").hide(),e.$layout.addClass("folded"),e.$el.html(e.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(e,arguments)}}),t.isEdit){if(!t.isEditDiagram&&!t.isEditMailMerge){var i=Common.localStorage.getItem("sse-pgmargins-top"),n=Common.localStorage.getItem("sse-pgmargins-left"),o=Common.localStorage.getItem("sse-pgmargins-bottom"),s=Common.localStorage.getItem("sse-pgmargins-right");if(null!==i&&null!==n&&null!==o&&null!==s){var a=this.btnPageMargins.menu.items[0];a.options.value=a.value=[parseFloat(i),parseFloat(n),parseFloat(o),parseFloat(s)],a.setVisible(!0),$(a.el).html(a.template({id:Common.UI.getId(),caption:a.caption,options:a.options}))}else this.btnPageMargins.menu.items[0].setVisible(!1);this.btnInsertImage.menu.items[2].setVisible(t.canRequestInsertImage||t.fileChoiceUrl&&t.fileChoiceUrl.indexOf("{documentType}")>-1)}e.setTab("home")}return e.isCompactView&&e.setFolded(!0),this},onTabClick:function(t){var e=this,i=$(t.currentTarget).find("> a[data-tab]").data("tab"),n=e.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(e,arguments),n?e.fireEvent("file:close"):"file"==i&&(e.fireEvent("file:open"),e.setTab(i))},rendererComponents:function(t){var e=$(t),i=function(t,i){Common.Utils.injectComponent(e.find(t),i)};return i("#slot-field-fontname",this.cmbFontName),i("#slot-field-fontsize",this.cmbFontSize),i("#slot-btn-print",this.btnPrint),i("#slot-btn-save",this.btnSave),i("#slot-btn-undo",this.btnUndo),i("#slot-btn-redo",this.btnRedo),i("#slot-btn-copy",this.btnCopy),i("#slot-btn-paste",this.btnPaste),i("#slot-btn-incfont",this.btnIncFontSize),i("#slot-btn-decfont",this.btnDecFontSize),i("#slot-btn-bold",this.btnBold),i("#slot-btn-italic",this.btnItalic),i("#slot-btn-underline",this.btnUnderline),i("#slot-btn-strikeout",this.btnStrikeout),i("#slot-btn-subscript",this.btnSubscript),i("#slot-btn-fontcolor",this.btnTextColor),i("#slot-btn-fillparag",this.btnBackColor),
|
|
|
i("#slot-btn-borders",this.btnBorders),i("#slot-btn-align-left",this.btnAlignLeft),i("#slot-btn-align-center",this.btnAlignCenter),i("#slot-btn-align-right",this.btnAlignRight),i("#slot-btn-align-just",this.btnAlignJust),i("#slot-btn-merge",this.btnMerge),i("#slot-btn-top",this.btnAlignTop),i("#slot-btn-middle",this.btnAlignMiddle),i("#slot-btn-bottom",this.btnAlignBottom),i("#slot-btn-wrap",this.btnWrap),i("#slot-btn-text-orient",this.btnTextOrient),i("#slot-btn-insimage",this.btnInsertImage),i("#slot-btn-instable",this.btnInsertTable),i("#slot-btn-inshyperlink",this.btnInsertHyperlink),i("#slot-btn-insshape",this.btnInsertShape),i("#slot-btn-instext",this.btnInsertText),i("#slot-btn-instextart",this.btnInsertTextArt),i("#slot-btn-insequation",this.btnInsertEquation),i("#slot-btn-sortdesc",this.btnSortDown),i("#slot-btn-sortasc",this.btnSortUp),i("#slot-btn-setfilter",this.btnSetAutofilter),i("#slot-btn-clear-filter",this.btnClearAutofilter),i("#slot-btn-table-tpl",this.btnTableTemplate),i("#slot-btn-format",this.cmbNumberFormat),i("#slot-btn-percents",this.btnPercentStyle),i("#slot-btn-currency",this.btnCurrencyStyle),i("#slot-btn-digit-dec",this.btnDecDecimal),i("#slot-btn-digit-inc",this.btnIncDecimal),i("#slot-btn-formula",this.btnInsertFormula),i("#slot-btn-named-range",this.btnNamedRange),i("#slot-btn-clear",this.btnClearStyle),i("#slot-btn-copystyle",this.btnCopyStyle),i("#slot-btn-cell-ins",this.btnAddCell),i("#slot-btn-cell-del",this.btnDeleteCell),i("#slot-btn-colorschemas",this.btnColorSchemas),i("#slot-btn-search",this.btnSearch),i("#slot-btn-inschart",this.btnInsertChart),i("#slot-field-styles",this.listStyles),i("#slot-btn-chart",this.btnEditChart),i("#slot-btn-pageorient",this.btnPageOrient),i("#slot-btn-pagemargins",this.btnPageMargins),i("#slot-btn-pagesize",this.btnPageSize),i("#slot-btn-printarea",this.btnPrintArea),i("#slot-img-align",this.btnImgAlign),i("#slot-img-group",this.btnImgGroup),i("#slot-img-movefrwd",this.btnImgForward),i("#slot-img-movebkwd",this.btnImgBackward),i("#slot-btn-editheader",this.btnEditHeader),e},createDelayedElements:function(){function t(t,e){t&&t.updateHint(e)}var e=this;if(t(this.btnPrint,this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),t(this.btnSave,this.btnSaveTip),t(this.btnCopy,this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),t(this.btnPaste,this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),t(this.btnUndo,this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),t(this.btnRedo,this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),t(this.btnIncFontSize,this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),t(this.btnDecFontSize,this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),t(this.btnBold,this.textBold+Common.Utils.String.platformKey("Ctrl+B")),t(this.btnItalic,this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),t(this.btnUnderline,this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),t(this.btnStrikeout,this.textStrikeout),t(this.btnSubscript,this.textSubSuperscript),t(this.btnTextColor,this.tipFontColor),t(this.btnBackColor,this.tipPrColor),t(this.btnBorders,this.tipBorders),t(this.btnAlignLeft,this.tipAlignLeft),t(this.btnAlignCenter,this.tipAlignCenter),t(this.btnAlignRight,this.tipAlignRight),t(this.btnAlignJust,this.tipAlignJust),t(this.btnMerge,this.tipMerge),t(this.btnAlignTop,this.tipAlignTop),t(this.btnAlignMiddle,this.tipAlignMiddle),t(this.btnAlignBottom,this.tipAlignBottom),t(this.btnWrap,this.tipWrap),t(this.btnTextOrient,this.tipTextOrientation),t(this.btnInsertTable,this.tipInsertTable),t(this.btnInsertImage,this.tipInsertImage),t(this.btnInsertChart,this.tipInsertChartSpark),t(this.btnInsertText,this.tipInsertText),t(this.btnInsertTextArt,this.tipInsertTextart),t(this.btnInsertHyperlink,this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),t(this.btnInsertShape,this.tipInsertShape),t(this.btnInsertEquation,this.tipInsertEquation),t(this.btnSortDown,this.txtSortAZ),t(this.btnSortUp,this.txtSortZA),t(this.btnSetAutofilter,this.txtFilter+" (Ctrl+Shift+L)"),t(this.btnClearAutofilter,this.txtClearFilter),t(this.btnSearch,this.txtSearch),t(this.btnTableTemplate,this.txtTableTemplate),t(this.btnPercentStyle,this.tipDigStylePercent),t(this.btnCurrencyStyle,this.tipDigStyleAccounting),t(this.btnDecDecimal,this.tipDecDecimal),t(this.btnIncDecimal,this.tipIncDecimal),t(this.btnInsertFormula,this.txtFormula),t(this.btnNamedRange,this.txtNamedRange),t(this.btnClearStyle,this.tipClearStyle),t(this.btnCopyStyle,this.tipCopyStyle),t(this.btnAddCell,this.tipInsertOpt),t(this.btnDeleteCell,this.tipDeleteOpt),t(this.btnColorSchemas,this.tipColorSchemas),t(this.btnHorizontalAlign,this.tipHAligh),t(this.btnVerticalAlign,this.tipVAligh),t(this.btnPageOrient,this.tipPageOrient),t(this.btnPageSize,this.tipPageSize),t(this.btnPageMargins,this.tipPageMargins),t(this.btnPrintArea,this.tipPrintArea),t(this.btnEditHeader,this.tipEditHeader),this.btnBorders&&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:_.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 11px; height: 11px; margin: 2px 7px 0 -9px;"></span><%= caption %></a>'),menu:function(){var t=_.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div class="border-size-item" style="background-position: 0 -<%= options.offsety %>px;"></div></a>');return e.mnuBorderWidth=new Common.UI.Menu({style:"min-width: 100px;",menuAlign:"tl-tr",id:"toolbar-menu-borders-width",items:[{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thin,offsety:0,checked:!0},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Hair,offsety:20},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dotted,offsety:40},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dashed,offsety:60},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDot,offsety:80},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDotDot,offsety:100},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Medium,offsety:120},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashed,offsety:140},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDot,offsety:160},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDotDot,offsety:180},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thick,offsety:200}]}),e.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:_.template('<a id="<%= id %>"tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 11px; height: 11px; margin: 2px 7px 0 -9px; border-style: solid; border-width: 3px; border-color: #000;"></span><%= caption %></a>'),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-bordercolor" style="width: 169px; height: 220px; margin: 10px;"></div>'),stopPropagation:!0},{template:_.template('<a id="id-toolbar-menu-new-bordercolor" style="padding-left:12px;">'+this.textNewColor+"</a>"),stopPropagation:!0}]})})]}));var i=$('<div class="btn-color-value-line"></div>');$("button:first-child",this.btnBorders.cmpEl).append(i),i.css("background-color",this.btnBorders.currentColor||"transparent"),this.mnuBorderColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-bordercolor")})}this.btnInsertChart&&(this.mnuInsertChartPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insertchart"),parentMenu:this.btnInsertChart.menu,showLast:!1,restoreHeight:539,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn,headername:e.textCharts},{id:"menu-chart-group-line",caption:e.textLine},{id:"menu-chart-group-pie",caption:e.textPie},{id:"menu-chart-group-hbar",caption:e.textBar},{id:"menu-chart-group-area",caption:e.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:e.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:e.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:_.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})),this.mode.isEditMailMerge||this.mode.isEditDiagram||this.updateMetricUnit()},onToolbarAfterRender:function(t){if(this.btnTextColor&&this.btnTextColor.cmpEl){var e=$('<div class="btn-color-value-line"></div>');$("button:first-child",this.btnTextColor.cmpEl).append(e),e.css("background-color",this.btnTextColor.currentColor||"transparent"),this.mnuTextColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-fontcolor")})}if(this.btnBackColor&&this.btnBackColor.cmpEl){var e=$('<div class="btn-color-value-line"></div>');$("button:first-child",this.btnBackColor.cmpEl).append(e),e.css("background-color",this.btnBackColor.currentColor||"transparent"),this.mnuBackColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-paracolor"),transparent:!0})}},updateMetricUnit:function(){for(var t=this.btnPageMargins.menu.items,e=0;e<t.length;e++){var i=t[e];if(i.checkable){var n=i.checked;$(i.el).html(i.template({id:Common.UI.getId(),caption:i.caption,options:i.options})),n&&i.setChecked(n)}}t=this.btnPageSize.menu.items;for(var e=0;e<t.length;e++){var i=t[e];if(i.checkable){var n=i.checked;$(i.el).html(i.template({id:Common.UI.getId(),caption:i.caption,options:i.options})),n&&i.setChecked(n)}}},setApi:function(t){return this.api=t,this.mode.isEditMailMerge||this.mode.isEditDiagram||(this.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(this.onApiCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onSendThemeColorSchemes",_.bind(this.onApiSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onApiUsersChanged,this))),this},setMode:function(t){return t.isDisconnected?(this.lockToolbar(SSE.enumLock.lostConnect,!0),this.lockToolbar(SSE.enumLock.lostConnect,!0,{array:[this.btnEditChart,this.btnUndo,this.btnRedo]}),t.enableDownload||this.lockToolbar(SSE.enumLock.cantPrint,!0,{array:[this.btnPrint]})):(this.mode=t,this.lockToolbar(SSE.enumLock.cantPrint,!t.canPrint,{array:[this.btnPrint]})),this},onApiSendThemeColorSchemes:function(t){var e=this;this.mnuColorSchema=this.btnColorSchemas.menu,this.mnuColorSchema&&this.mnuColorSchema.items.length>0&&_.each(this.mnuColorSchema.items,function(t){t.remove()}),null==this.mnuColorSchema&&(this.mnuColorSchema=new Common.UI.Menu({restoreHeight:!0})),this.mnuColorSchema.items=[];var i=_.template(['<a id="<%= id %>" class="<%= options.cls %>" tabindex="-1" type="menuitem">','<span class="colors">',"<% _.each(options.colors, function(color) { %>",'<span class="color" style="background: <%= color %>;"></span>',"<% }) %>","</span>",'<span class="text"><%= caption %></span>',"</a>"].join(""));_.each(t,function(t,n){for(var o=t.get_colors(),s=[],a=2;a<7;a++){var l="#"+Common.Utils.ThemeColor.getHexColor(o[a].get_r(),o[a].get_g(),o[a].get_b());s.push(l)}21==n&&this.mnuColorSchema.addItem({caption:"--"});var r=t.get_name();this.mnuColorSchema.addItem({template:i,cls:"color-schemas-menu",colors:s,caption:n<21?e.SchemeNames[n]||r:r,value:r,checkable:!0,toggleGroup:"menuSchema"})},this)},onApiCollaborativeChanges:function(){this._state.hasCollaborativeChanges||this.btnCollabChanges.rendered&&(this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass("btn-synch"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges())},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnCollabChanges.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.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.$icon.hasClass("btn-synch")&&(t.btnCollabChanges.$icon.removeClass("btn-synch").addClass(this.btnSaveCls),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var e=[];_.each(t,function(t){t.asc_getView()||e.push(t)});var i=_.size(e),n=i>1?"btn-save-coauth":"btn-save";n!==this.btnSaveCls&&this.btnCollabChanges.rendered&&(this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),this.btnCollabChanges.$icon.hasClass("btn-synch")||(this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(n),this.btnCollabChanges.updateHint(this.btnSaveTip)),this.btnSaveCls=n)},onAppReady:function(t){if(this.mode.isEdit&&!this.mode.isEditMailMerge&&!this.mode.isEditDiagram){var e=this,i=SSE.getController("DocumentHolder").getView("DocumentHolder");e.btnImgForward.updateHint(e.tipSendForward),e.btnImgForward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeFront,iconCls:"mnu-arrange-front",value:Asc.c_oAscDrawingLayerType.BringToFront},{caption:i.textArrangeForward,iconCls:"mnu-arrange-forward",value:Asc.c_oAscDrawingLayerType.BringForward}]})),e.btnImgBackward.updateHint(e.tipSendBackward),e.btnImgBackward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeBack,iconCls:"mnu-arrange-back",value:Asc.c_oAscDrawingLayerType.SendToBack},{caption:i.textArrangeBackward,iconCls:"mnu-arrange-backward",value:Asc.c_oAscDrawingLayerType.SendBackward}]})),e.btnImgAlign.updateHint(e.tipImgAlign),e.btnImgAlign.setMenu(new Common.UI.Menu({items:[{caption:i.textShapeAlignLeft,iconCls:"mnu-img-align-left",value:0},{caption:i.textShapeAlignCenter,iconCls:"mnu-img-align-center",value:4},{caption:i.textShapeAlignRight,iconCls:"mnu-img-align-right",value:1},{caption:i.textShapeAlignTop,iconCls:"mnu-img-align-top",value:3},{caption:i.textShapeAlignMiddle,iconCls:"mnu-img-align-middle",value:5},{caption:i.textShapeAlignBottom,iconCls:"mnu-img-align-bottom",value:2},{caption:"--"},{caption:i.txtDistribHor,iconCls:"mnu-distrib-hor",value:6},{caption:i.txtDistribVert,iconCls:"mnu-distrib-vert",value:7}]})),e.btnImgGroup.updateHint(e.tipImgGroup),e.btnImgGroup.setMenu(new Common.UI.Menu({items:[{caption:i.txtGroup,iconCls:"mnu-group",value:"grouping"},{caption:i.txtUngroup,iconCls:"mnu-ungroup",value:"ungrouping"}]}))}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",textSubSuperscript:"Subscript/Superscript",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 Image",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",tipInsertTextart:"Insert Text Art",tipInsertShape:"Insert Autoshape",tipDigStylePercent:"Percent Style",tipDigStyleAccounting:"Accounting Style",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:"Image from file",mniImageFromUrl:"Image from url",textNewColor:"Add New Custom Color",tipInsertChart:"Insert Chart",tipEditChart:"Edit Chart",textPrint:"Print",textPrintOptions:"Print Options",tipColorSchemas:"Change Color Scheme",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",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",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",textMoreFormats:"More formats",capInsertText:"Text",capInsertTextart:"Text Art",capInsertImage:"Image",capInsertShape:"Shape",capInsertChart:"Chart",capInsertHyperlink:"Hyperlink",capInsertEquation:"Equation",capBtnComment:"Comment",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textSurface:"Surface",tipChangeChart:"Change Chart Type",textTabCollaboration:"Collaboration",textTabProtect:"Protection",textTabLayout:"Layout",capBtnPageOrient:"Orientation",capBtnMargins:"Margins",capBtnPageSize:"Size",tipImgAlign:"Align objects",tipImgGroup:"Group objects",tipSendForward:"Bring forward",tipSendBackward:"Send backward",capImgAlign:"Align",capImgGroup:"Group",capImgForward:"Bring Forward",capImgBackward:"Send Backward",tipPageSize:"Page Size",tipPageOrient:"Page Orientation",tipPageMargins:"Page Margins",textMarginsLast:"Last Custom",textMarginsNormal:"Normal",textMarginsNarrow:"Narrow",textMarginsWide:"Wide",textPageMarginsCustom:"Custom margins",textTop:"Top: ",textLeft:"Left: ",textBottom:"Bottom: ",textRight:"Right: ",textPortrait:"Portrait",textLandscape:"Landscape",mniImageFromStorage:"Image from Storage",capBtnPrintArea:"Print Area",textSetPrintArea:"Set Print Area",textClearPrintArea:"Clear Print Area",textAddPrintArea:"Add to Print Area",tipPrintArea:"Print Area",capBtnInsHeader:"Header/Footer",tipEditHeader:"Edit header or footer",textTabData:"Data",capInsertTable:"Table",tipInsertTable:"Insert table",textTabFormula:"Formula"},SSE.Views.Toolbar||{}))}),define("spreadsheeteditor/main/app/model/TableTemplate",["backbone"],function(t){"use strict";SSE.Models=SSE.Models||{},SSE.Models.TableTemplate=t.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(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},SSE.Collections.TableTemplates=t.Collection.extend({model:SSE.Models.TableTemplate})}),define("spreadsheeteditor/main/app/view/PivotTable",["common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboDataView","common/main/lib/component/Layout"],function(t){"use strict";SSE.Views.PivotTable=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;this.btnAddPivot.on("click",function(e){t.fireEvent("pivottable:create")}),this.btnPivotLayout.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:layout",[i.value])}),this.btnPivotBlankRows.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:blankrows",[i.value])}),this.btnPivotSubtotals.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:subtotals",[i.value])}),this.btnPivotGrandTotals.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:grandtotals",[i.value])}),this.btnRefreshPivot.on("click",function(e){t.fireEvent("pivottable:refresh")}),this.btnSelectPivot.on("click",function(e){t.fireEvent("pivottable:select")}),this.chRowHeader.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[0,i])}),this.chColHeader.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[1,i])}),this.chRowBanded.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[2,i])}),this.chColBanded.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[3,i])}),this.pivotStyles.on("click",function(e,i){t.fireEvent("pivottable:style",[i])}),this.pivotStyles.openButton.menu.on("show:after",function(){t.pivotStyles.menuPicker.scroller.update({alwaysVisibleY:!0})})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.lockedControls=[],this.chRowHeader=new Common.UI.CheckBox({labelText:this.textRowHeader}),this.lockedControls.push(this.chRowHeader),this.chColHeader=new Common.UI.CheckBox({labelText:this.textColHeader}),this.lockedControls.push(this.chColHeader),this.chRowBanded=new Common.UI.CheckBox({labelText:this.textRowBanded}),this.lockedControls.push(this.chRowBanded),this.chColBanded=new Common.UI.CheckBox({labelText:this.textColBanded}),this.lockedControls.push(this.chColBanded),this.btnAddPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-add-pivot",caption:this.txtCreate,disabled:!0}),this.btnPivotLayout=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pivot-layout",caption:this.capLayout,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniLayoutCompact,value:0},{caption:this.mniLayoutOutline,value:1},{caption:this.mniLayoutTabular,value:2},{caption:"--"},{caption:this.mniLayoutRepeat,value:3},{caption:this.mniLayoutNoRepeat,value:4}]})}),this.btnPivotBlankRows=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-blank-rows",caption:this.capBlankRows,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniInsertBlankLine,value:"insert"},{caption:this.mniRemoveBlankLine,value:"remove"}]})}),this.btnPivotSubtotals=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-subtotals",caption:this.capSubtotals,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniNoSubtotals,value:0},{caption:this.mniBottomSubtotals,value:1},{caption:this.mniTopSubtotals,value:2}]})}),this.btnPivotGrandTotals=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-grand-totals",caption:this.capGrandTotals,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniOffTotals,value:0},{caption:this.mniOnTotals,value:1},{caption:this.mniOnRowsTotals,value:2},{caption:this.mniOnColumnsTotals,value:3}]})}),this.btnRefreshPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-update-pivot",caption:this.txtRefresh,disabled:!0}),this.btnSelectPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-select-pivot",caption:this.txtSelect}),this.lockedControls.push(this.btnSelectPivot),this.pivotStyles=new Common.UI.ComboDataView({cls:"combo-pivot-template",enableKeyEvents:!0,itemWidth:61,itemHeight:49,menuMaxHeight:300}),this.lockedControls.push(this.pivotStyles),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){i.btnAddPivot.updateHint(i.tipCreatePivot),i.btnRefreshPivot.updateHint(i.tipRefresh),i.btnSelectPivot.updateHint(i.tipSelect),i.btnPivotLayout.updateHint(i.capLayout),i.btnPivotBlankRows.updateHint(i.capBlankRows),i.btnPivotSubtotals.updateHint(i.tipSubtotals),i.btnPivotGrandTotals.updateHint(i.tipGrandTotals),t.call(i)})},getPanel:function(){return this.$el=$(_.template('<section id="pivot-table-panel" class="panel" data-tab="pivot"><div class="group"><span id="slot-btn-select-pivot" class="btn-slot text x-huge"></span></div><div class="separator long"/><div class="group"><div class="elset"><span class="btn-slot text" id="slot-chk-header-row"></span></div><div class="elset"><span class="btn-slot text" id="slot-chk-header-column"></span></div></div><div class="group"><div class="elset"><span class="btn-slot text" id="slot-chk-banded-row"></span></div><div class="elset"><span class="btn-slot text" id="slot-chk-banded-column"></span></div></div><div class="group" id="slot-field-pivot-styles" style="width: 347px;"></div></section>')({})),this.chRowHeader.render(this.$el.find("#slot-chk-header-row")),
|
|
|
this.chColHeader.render(this.$el.find("#slot-chk-header-column")),this.chRowBanded.render(this.$el.find("#slot-chk-banded-row")),this.chColBanded.render(this.$el.find("#slot-chk-banded-column")),this.btnAddPivot.render(this.$el.find("#slot-btn-add-pivot")),this.btnRefreshPivot.render(this.$el.find("#slot-btn-refresh-pivot")),this.btnSelectPivot.render(this.$el.find("#slot-btn-select-pivot")),this.btnPivotLayout.render(this.$el.find("#slot-btn-pivot-report-layout")),this.btnPivotBlankRows.render(this.$el.find("#slot-btn-pivot-blank-rows")),this.btnPivotSubtotals.render(this.$el.find("#slot-btn-pivot-subtotals")),this.btnPivotGrandTotals.render(this.$el.find("#slot-btn-pivot-grand-totals")),this.pivotStyles.render(this.$el.find("#slot-field-pivot-styles")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},txtCreate:"Insert Table",tipCreatePivot:"Insert Pivot Table",textRowHeader:"Row Headers",textColHeader:"Column Headers",textRowBanded:"Banded Rows",textColBanded:"Banded Columns",capBlankRows:"Blank Rows",mniInsertBlankLine:"Insert Blank Line after Each Item",mniRemoveBlankLine:"Remove Blank Line after Each Item",capGrandTotals:"Grand Totals",mniOffTotals:"Off for Rows and Columns",mniOnTotals:"On for Rows and Columns",mniOnRowsTotals:"On for Rows Only",mniOnColumnsTotals:"On for Columns Only",capLayout:"Report Layout",capSubtotals:"Subtotals",mniLayoutCompact:"Show in Compact Form",mniLayoutOutline:"Show in Outline Form",mniLayoutTabular:"Show in Tabular Form",mniLayoutRepeat:"Repeat All Item Labels",mniLayoutNoRepeat:"Don't Repeat All Item Labels",mniNoSubtotals:"Don't Show Subtotals",mniBottomSubtotals:"Show all Subtotals at Bottom of Group",mniTopSubtotals:"Show all Subtotals at Top of Group",txtRefresh:"Refresh",tipRefresh:"Update the information from data source",tipGrandTotals:"Show or hide grand totals",tipSubtotals:"Show or hide subtotals",txtSelect:"Select",tipSelect:"Select entire pivot table"}}(),SSE.Views.PivotTable||{}))}),define("spreadsheeteditor/main/app/controller/PivotTable",["core","spreadsheeteditor/main/app/view/PivotTable"],function(){"use strict";SSE.Controllers.PivotTable=Backbone.Controller.extend(_.extend({models:[],views:["PivotTable"],sdkViewName:"#id_main",initialize:function(){this.addListeners({PivotTable:{"pivottable:rowscolumns":_.bind(this.onCheckTemplateChange,this),"pivottable:create":_.bind(this.onCreateClick,this),"pivottable:refresh":_.bind(this.onRefreshClick,this),"pivottable:select":_.bind(this.onSelectClick,this),"pivottable:style":_.bind(this.onPivotStyleSelect,this),"pivottable:layout":_.bind(this.onPivotLayout,this),"pivottable:blankrows":_.bind(this.onPivotBlankRows,this),"pivottable:subtotals":_.bind(this.onPivotSubtotals,this),"pivottable:grandtotals":_.bind(this.onPivotGrandTotals,this)}})},onLaunch:function(){this._state={TableName:"",TemplateName:"",RowHeader:void 0,RowBanded:void 0,ColHeader:void 0,ColBanded:void 0,DisabledControls:!1},this._originalProps=null,this.view=this.createView("PivotTable"),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.SetDisabled,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.SetDisabled,this)),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)))},setMode:function(t){return this.appConfig=t,this},SetDisabled:function(){this.view&&this.view.SetDisabled(!0)},onCheckTemplateChange:function(t,e){switch(t){case 0:this._originalProps.asc_getStyleInfo().asc_setShowRowHeaders(this.api,this._originalProps,"checked"==e);break;case 1:this._originalProps.asc_getStyleInfo().asc_setShowColHeaders(this.api,this._originalProps,"checked"==e);break;case 2:this._originalProps.asc_getStyleInfo().asc_setShowRowStripes(this.api,this._originalProps,"checked"==e);break;case 3:this._originalProps.asc_getStyleInfo().asc_setShowColStripes(this.api,this._originalProps,"checked"==e)}Common.NotificationCenter.trigger("edit:complete",this)},onCreateClick:function(t,e){Common.NotificationCenter.trigger("edit:complete",this)},onRefreshClick:function(t,e){Common.NotificationCenter.trigger("edit:complete",this)},onSelectClick:function(t,e){this.api&&this._originalProps.asc_select(this.api),Common.NotificationCenter.trigger("edit:complete",this)},onPivotStyleSelect:function(t){this.api&&this._originalProps.asc_getStyleInfo().asc_setName(this.api,this._originalProps,t.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},onPivotBlankRows:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},onPivotLayout:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},onPivotGrandTotals:function(t){if(this.api){var e=new Asc.CT_pivotTableDefinition;e.asc_setColGrandTotals(1==t||2==t),e.asc_setRowGrandTotals(1==t||3==t),this._originalProps.asc_set(this.api,e)}Common.NotificationCenter.trigger("edit:complete",this)},onPivotSubtotals:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},ChangeSettings:function(t){if(t){this._originalProps=t;var e=this.view,i=!1,n=t.asc_getStyleInfo(),o=n.asc_getShowRowHeaders();if(this._state.RowHeader!==o&&(e.chRowHeader.setValue(o,!0),this._state.RowHeader=o,i=!0),o=n.asc_getShowColHeaders(),this._state.ColHeader!==o&&(e.chColHeader.setValue(o,!0),this._state.ColHeader=o,i=!0),o=n.asc_getShowColStripes(),this._state.ColBanded!==o&&(e.chColBanded.setValue(o,!0),this._state.ColBanded=o,i=!0),o=n.asc_getShowRowStripes(),this._state.RowBanded!==o&&(e.chRowBanded.setValue(o,!0),this._state.RowBanded=o,i=!0),o=t.asc_getColGrandTotals(),this._state.ColGrandTotals!==o&&(this._state.ColGrandTotals=o,i=!0),o=t.asc_getRowGrandTotals(),this._state.RowGrandTotals!==o&&(this._state.RowGrandTotals=o,i=!0),i&&this.onApiInitPivotStyles(this.api.asc_getTablePictures(this._originalProps,!0)),o=n.asc_getName(),this._state.TemplateName!==o||this._isTemplatesChanged){e.pivotStyles.suspendEvents();var s=e.pivotStyles.menuPicker.store.findWhere({name:o});e.pivotStyles.menuPicker.selectRecord(s),e.pivotStyles.resumeEvents(),this._isTemplatesChanged&&(s?e.pivotStyles.fillComboView(e.pivotStyles.menuPicker.getSelectedRec(),!0):e.pivotStyles.fillComboView(e.pivotStyles.menuPicker.store.at(0),!0)),this._state.TemplateName=o}this._isTemplatesChanged=!1}},onSendThemeColors:function(){this.view.pivotStyles&&this._originalProps&&(this.onApiInitPivotStyles(this.api.asc_getTablePictures(this._originalProps,!0)),this.view.pivotStyles.menuPicker.scroller.update({alwaysVisibleY:!0}))},onApiInitPivotStyles:function(t){var e=this.view.pivotStyles;this._isTemplatesChanged=!0;var i=e.menuPicker.store.length;if(i>0&&i==t.length){var n=e.menuPicker.store.models;_.each(t,function(t,e){n[e].set("imageUrl",t.asc_getImage())})}else{e.menuPicker.store.reset([]);var o=[];_.each(t,function(t){o.push({id:Common.UI.getId(),name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),e.menuPicker.store.add(o)}},onSelectionChanged:function(t){if(!this.rangeSelectionMode&&this.appConfig.isEdit){var e=(t.asc_getFlags().asc_getSelectionType(),t.asc_getPivotTableInfo());this.view.SetDisabled(!e||t.asc_getLockedPivotTable()),e&&this.ChangeSettings(e)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){new Promise(function(t){t()}).then(function(){})}},SSE.Controllers.PivotTable||{}))}),void 0===Common)var Common={};if(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(t){_.extend(this.options,{title:this.txtFormat},t),this.template=['<div class="box">','<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row" id="id-dlg-tableoptions-title" style="margin-top: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),this.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTable,this.selectionType=Asc.c_oAscSelectionType.RangeCells,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild(),e=this;e.inputRange=new Common.UI.InputField({el:$("#id-dlg-tableoptions-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),e.cbTitle=new Common.UI.CheckBox({el:$("#id-dlg-tableoptions-title"),labelText:this.txtTitle}),t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){var e=this;if(t.api){if(e.api=t.api,t.range)e.cbTitle.setVisible(!1),e.setHeight(130),e.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTableChangeRange,e.inputRange.setValue(t.range),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,t.range);else{var i=e.api.asc_getAddFormatTableOptions();e.inputRange.setValue(i.asc_getRange()),e.cbTitle.setValue(i.asc_getIsTitle()),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,i.asc_getRange())}t.title&&e.setTitle(t.title),t.selectionType&&(e.selectionType=t.selectionType),e.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),e.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.FormatTable)}e.inputRange.validation=function(t){return e.api.asc_checkDataRange(e.checkRangeType,t,!1)!=Asc.c_oAscError.ID.DataRangeError||e.txtInvalidRange}},getSettings:function(){if(this.checkRangeType==Asc.c_oAscSelectionDialogType.FormatTable){var t=this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());return t.asc_setIsTitle(this.cbTitle.checked),{selectionType:this.selectionType,range:t}}return{selectionType:this.selectionType,range:this.inputRange.getValue()}},onApiRangeChanged:function(t){this.inputRange.setValue(t.asc_getName()),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error"),this.selectionType=t.asc_getType()},isRangeValid:function(){var t=this.api.asc_checkDataRange(this.checkRangeType,this.inputRange.getValue(),!0);if(t==Asc.c_oAscError.ID.No)return!0;switch(t){case Asc.c_oAscError.ID.AutoFilterDataRangeError:Common.UI.warning({msg:this.errorAutoFilterDataRange});break;case Asc.c_oAscError.ID.FTChangeTableRangeError:Common.UI.warning({msg:this.errorFTChangeTableRangeError});break;case Asc.c_oAscError.ID.FTRangeIncludedOtherTables:Common.UI.warning({msg:this.errorFTRangeIncludedOtherTables});break;case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:Common.UI.warning({msg:this.errorMultiCellFormula})}return!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onClose:function(t){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)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.isRangeValid())return;this.options.handler.call(this,this,t)}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.<br>Select a uniform data range inside or outside the table and try again.",errorFTChangeTableRangeError:"Operation could not be completed for the selected cell range.<br>Select a range so that the first table row was on the same row<br>and the resulting table overlapped the current one.",errorFTRangeIncludedOtherTables:"Operation could not be completed for the selected cell range.<br>Select a range which does not include other tables.",errorMultiCellFormula:"Multi-cell array formulas are not allowed in 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(t){var e=this;_.extend(this.options,{title:this.txtTitleNew,template:['<div class="box" style="height:'+(e.options.height-85)+'px;">','<div class="content-panel" style="padding: 0;"><div class="inner-content">','<div class="settings-panel active">','<table cols="2" style="width: 100%;">',"<tr>",'<td colspan=2 class="padding-small">','<label class="header">',e.textName,"</label>",'<div id="named-range-txt-name" class="input-row" style="width:100%;"></div>',"</td>","</tr>","<tr>",'<td colspan=2 class="padding-small">','<label class="header">',e.textScope,"</label>",'<div id="named-range-combo-scope" class="input-group-nr" style="width:100%;"></div>',"</td>","</tr>","<tr>","<td colspan=2 >",'<label class="header">',e.textDataRange,"</label>","</td>","</tr>","<tr>",'<td class="padding-small">','<div id="named-range-txt-range" class="input-row" style="margin-right: 10px;"></div>',"</td>",'<td class="padding-small" style="text-align: right;" width="100">','<button type="button" class="btn btn-text-default" id="named-range-btn-data" style="min-width: 100px;width: auto;">',e.textSelectData,"</button>","</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+e.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+e.cancelButtonText+"</button>","</div>"].join("")},t),this.api=t.api,this.handler=t.handler,this.isEdit=t.isEdit||!1,this.sheets=t.sheets||[],this.props=t.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 t=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(e){var i=t.api.asc_checkDefinedName(e,-255==t.cmbScope.getValue()?null:t.cmbScope.getValue());if(!0===i.asc_getStatus())return!0;switch(i.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:return t.textIsLocked;case Asc.c_oAscDefinedNameReason.Existed:return!(!t.isEdit||t.props.asc_getName(!0).toLowerCase()!=e.toLowerCase())||t.textExistName;case Asc.c_oAscDefinedNameReason.NameReserved:return!t.isEdit||t.textReservedName;default:return t.textInvalidName}}}),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(e){return!!_.isEmpty(e)||(!!(t.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,e,!1)!==Asc.c_oAscError.ID.DataRangeError||t.isEdit&&t.props.asc_getRef().toLowerCase()==e.toLowerCase())||t.textInvalidRange)}}),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 t=this;_.delay(function(){t.inputName.cmpEl.find("input").focus()},200)},_setDefaults:function(t){if(this.cmbScope.setData([{value:-255,displayValue:this.strWorkbook}].concat(this.sheets)),t){var e=t.asc_getScope();this.cmbScope.setValue(null===e?-255:e),e=t.asc_getName(!0),_.isEmpty(e)||this.inputName.setValue(e),e=t.asc_getRef(),this.txtDataRange.setValue(e||""),this.dataRangeValid=e,this.txtDataRange.setDisabled(this.isEdit&&t.asc_getIsTable()),this.btnSelectData.setDisabled(this.isEdit&&t.asc_getIsTable())}else this.cmbScope.setValue(-255);this.cmbScope.setDisabled(this.isEdit)},onSelectData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.dataRangeValid=e.getSettings(),t.txtDataRange.setValue(t.dataRangeValid),t.txtDataRange.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+65,n.top+77),i.setSettings({api:t.api,range:_.isEmpty(t.txtDataRange.getValue())||1!=t.txtDataRange.checkValidate()?t.dataRangeValid:t.txtDataRange.getValue(),type:Asc.c_oAscSelectionDialogType.Chart})}},getSettings:function(){return new Asc.asc_CDefName(this.inputName.getValue(),this.txtDataRange.getValue(),-255==this.cmbScope.getValue()?null:this.cmbScope.getValue(),this.props.asc_getIsTable(),void 0,void 0,void 0,!0)},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onDlgBtnClick:function(t){var e=this,i="object"==typeof t?t.currentTarget.attributes.result.value:t;if("ok"==i){if(this.locked)return void Common.UI.alert({msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(t){e.close()}});var n=this.inputName.checkValidate(),o=this.txtDataRange.checkValidate();if(!0!==n)return void this.inputName.cmpEl.find("input").focus();if(!0!==o)return void this.txtDataRange.cmpEl.find("input").focus();this.handler&&this.handler.call(this,i,"ok"==i?this.getSettings():void 0)}this.close()},onLockDefNameManager:function(t){this.locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onRefreshDefNameList:function(t){var e=this;this.isEdit&&Common.Utils.InternalSettings.get("sse-settings-coauthmode")&&t&&t.asc_getIsLock()&&t.asc_getName(!0).toLowerCase()==this.props.asc_getName(!0).toLowerCase()&&(null===t.asc_getScope()&&null===this.props.asc_getScope()||t.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(t){e.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<br>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(t){var e=this;_.extend(this.options,{title:this.txtTitle,template:['<div class="box" style="height:'+(e.options.height-85)+'px;">','<div class="content-panel" style="padding: 0;"><div class="inner-content">','<div class="settings-panel active">','<table cols="1" style="width: 100%;">',"<tr>",'<td class="padding-small">','<label class="input-label">',e.textNames,"</label>",'<div id="named-range-paste-list" class="range-tableview" style="width:100%; height: 150px;"></div>',"</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+e.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+e.cancelButtonText+"</button>","</div>"].join("")},t),this.handler=t.handler,this.ranges=t.ranges||[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.rangeList=new Common.UI.ListView({el:$("#named-range-paste-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:_.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:_.template(['<div style="pointer-events:none;">','<div id="<%= id %>" class="list-item" style="pointer-events:none;width: 100%;display:inline-block;">','<div class="listitem-icon <% if (isTable) {%>listitem-table<%} %>"></div>','<div style="width:186px;padding-right: 5px;"><%= name %></div>',"</div>","</div>"].join(""))}),this.rangeList.store.comparator=function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i<n?-1:1},this.rangeList.on("item:dblclick",_.bind(this.onDblClickFunction,this)),this.rangeList.on("entervalue",_.bind(this.onPrimary,this)),this.afterRender()},afterRender:function(){this._setDefaults()},_setDefaults:function(){if(this.ranges){for(var t=this,e=[],i="",n=0;n<this.ranges.length;n++){var o=this.ranges[n].asc_getName(!0);o!==i&&e.push({name:o,scope:this.ranges[n].asc_getScope(),range:this.ranges[n].asc_getRef(),isTable:!0===this.ranges[n].asc_getIsTable()}),i=o}this.rangeList.store.reset(e),this.rangeList.store.sort(),this.rangeList.store.length>0&&this.rangeList.selectByIndex(0),this.rangeList.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t.rangeList.cmpEl.find(".listview").focus()},100,this)}},getSettings:function(){var t=this.rangeList.getSelectedRec();return t?new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("isTable"),void 0,void 0,void 0,!0):null},onPrimary:function(){return this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close(),!1},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),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(t){var e=this;e.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}],e.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"}],e.CurrencySymbolsData=null,e.langId=1033,_.extend(this.options,{title:this.textTitle,template:['<div class="box" style="height:'+(e.options.height-85)+'px;">','<div class="content-panel" style="padding: 0 10px;"><div class="inner-content">','<div class="settings-panel active">','<table cols="1" style="width: 100%;">',"<tr>",'<td style="width:170px;padding-bottom: 3px;">','<label class="header">',e.textCategory,"</label>",'<div id="format-settings-combo-format" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>","<tr>",'<td class="padding-large" style="white-space: nowrap;">','<label style="vertical-align: middle; margin-right: 4px;">'+e.txtSample+"</label>",'<label id="format-settings-label-example" style="vertical-align: middle; max-width: 220px; overflow: hidden; text-overflow: ellipsis;">100</label>',"</td>","</tr>","<tr>",'<td class="padding-small">',"</td>","</tr>",'<tr class="format-decimal">','<td class="padding-large" style="vertical-align: bottom;">','<label class="header">',e.textDecimal,"</label>",'<div id="format-settings-spin-decimal"></div>',"</td>","</tr>",'<tr class="format-separator">','<td class="padding-large">','<div id="format-settings-checkbox-separator"></div>',"</td>","</tr>",'<tr class="format-symbols">','<td class="padding-large">','<label class="header">',e.textSymbols,"</label>",'<div id="format-settings-combo-symbols" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-decimal">','<td class="padding-large format-negative">','<label class="header">',e.textFormat,"</label>",'<div id="format-settings-combo-negative" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-type">','<td class="padding-large">','<label class="header">',e.textFormat,"</label>",'<div id="format-settings-combo-type" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-code">','<td colspan="1" class="padding-large">','<label class="header">',e.textFormat,"</label>",'<div id="format-settings-combo-code" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+e.textOk+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+e.textCancel+"</button>","</div>"].join("")},t),this.api=t.api,this.handler=t.handler,this.props=t.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);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(t){if(t&&t.formatInfo&&(this.langId&&(this.langId=t.langId),this.cmbFormat.setValue(t.formatInfo.asc_getType(),this.txtCustom),t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Custom&&t.format&&(this.CustomFormat=this.Format=t.format),this.onFormatSelect(this.cmbFormat,this.cmbFormat.getSelectedRecord(),null,t.formatInfo),this._state.hasDecimal&&this.spnDecimal.setValue(t.formatInfo.asc_getDecimalPlaces()),this._state.hasSeparator&&this.chSeparator.setValue(t.formatInfo.asc_getSeparator()),this._state.hasSymbols&&this.cmbSymbols.setValue(t.formatInfo.asc_getSymbol()),t.format)){if(this._state.hasNegative){
|
|
|
var e=this.cmbNegative.store.findWhere({value:t.format});e?this.cmbNegative.selectRecord(e):this.cmbNegative.setValue(this.api.asc_getLocaleExample(t.format))}else if(this._state.hasType){var e=this.cmbType.store.findWhere({value:t.format});e?this.cmbType.selectRecord(e):t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Fraction?this.cmbType.setValue(this.txtCustom):t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Time?this.cmbType.setValue(this.api.asc_getLocaleExample(t.format,1.534)):this.cmbType.setValue(this.api.asc_getLocaleExample(t.format,38822))}this.Format=t.format,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))}},getSettings:function(){return{format:this.Format}},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onNegativeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSymbolsSelect:function(t,e){var i=this,n=new Asc.asc_CFormatCellsInfo;n.asc_setType(this.FormatType),n.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),n.asc_setSeparator(!1),n.asc_setSymbol(e.value);var o=this.api.asc_getFormatCells(n),s=[];o.forEach(function(t){s.push({value:t,displayValue:i.api.asc_getLocaleExample(t,-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=o[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onDecimalChange:function(t,e,i,n){var o=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(t.getNumberValue()),s.asc_setSeparator(this.FormatType==Asc.c_oAscNumFormatType.Number&&"checked"==this.chSeparator.getValue()),s.asc_setSymbol((this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting)&&this.cmbSymbols.getValue());var a=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 l=[];a.forEach(function(t){l.push({value:t,displayValue:o.api.asc_getLocaleExample(t,-1234.1234567890124)})}),this.cmbNegative.setData(l),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=a[0]}else this.Format=a[0];this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSeparatorChange:function(t,e,i,n){var o=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),s.asc_setSeparator("checked"==t.getValue());var a=this.api.asc_getFormatCells(s),l=[];a.forEach(function(t){l.push({value:t,displayValue:o.api.asc_getLocaleExample(t,-1234.1234567890124)})}),this.cmbNegative.setData(l),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=a[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onTypeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onCodeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onFormatSelect:function(t,e,i,n){if(e){this.FormatType=e.value;var o=e.value==Asc.c_oAscNumFormatType.Number||e.value==Asc.c_oAscNumFormatType.Scientific||e.value==Asc.c_oAscNumFormatType.Accounting||e.value==Asc.c_oAscNumFormatType.Currency||e.value==Asc.c_oAscNumFormatType.Percent,s=e.value==Asc.c_oAscNumFormatType.Number||e.value==Asc.c_oAscNumFormatType.Currency||e.value==Asc.c_oAscNumFormatType.Accounting,a=e.value==Asc.c_oAscNumFormatType.Number,l=e.value==Asc.c_oAscNumFormatType.Date||e.value==Asc.c_oAscNumFormatType.Time||e.value==Asc.c_oAscNumFormatType.Fraction,r=e.value==Asc.c_oAscNumFormatType.Accounting||e.value==Asc.c_oAscNumFormatType.Currency,c=e.value==Asc.c_oAscNumFormatType.Custom,h=this,d=n?n.asc_getDecimalPlaces():this.spnDecimal.getNumberValue(),p=n?n.asc_getSeparator():"checked"==this.chSeparator.getValue(),m=n?n.asc_getSymbol():this.langId;if(e.value!==Asc.c_oAscNumFormatType.Custom){var u=new Asc.asc_CFormatCellsInfo;if(u.asc_setType(e.value),u.asc_setDecimalPlaces(o?d:0),u.asc_setSeparator(!!a&&p),s||e.value==Asc.c_oAscNumFormatType.Date||e.value==Asc.c_oAscNumFormatType.Time){if(r){if(!h.CurrencySymbolsData){h.CurrencySymbolsData=[{value:null,displayValue:h.txtNone}];var g=this.api.asc_getCurrencySymbols();for(var b in g)g.hasOwnProperty(b)&&h.CurrencySymbolsData.push({value:parseInt(b),displayValue:g[b]+" "+Common.util.LanguageInfo.getLocalLanguageName(b)[1]});this.cmbSymbols.setData(this.CurrencySymbolsData),this.cmbSymbols.setValue(m)}u.asc_setSymbol(this.cmbSymbols.getValue())}var f=this.api.asc_getFormatCells(u),C=[],v=e.value==Asc.c_oAscNumFormatType.Date?38822:e.value==Asc.c_oAscNumFormatType.Time?1.534:parseFloat("-1234.12345678901234567890");f.forEach(function(t){C.push({value:t,displayValue:h.api.asc_getLocaleExample(t,v)})}),s?(this.cmbNegative.setData(C),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(C),this.cmbType.selectRecord(this.cmbType.store.at(0))),this.Format=f[0]}else e.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(u)[0]}else{var u=new Asc.asc_CFormatCellsInfo;u.asc_setType(Asc.c_oAscNumFormatType.Custom),u.asc_setSymbol(m);var f=this.api.asc_getFormatCells(u),C=[],_=!!this.CustomFormat;f.forEach(function(t){C.push({value:t,displayValue:t}),h.CustomFormat==t&&(_=!1)}),_&&C.push({value:this.CustomFormat,displayValue:this.CustomFormat}),this.cmbCode.setData(C),this.cmbCode.setValue(this.Format)}this.lblExample.text(this.api.asc_getLocaleExample(this.Format)),this._decimalPanel.toggleClass("hidden",!o),this._negativePanel.css("visibility",s?"":"hidden"),this._separatorPanel.toggleClass("hidden",!a),this._typePanel.toggleClass("hidden",!l),this._symbolsPanel.toggleClass("hidden",!r),this._codePanel.toggleClass("hidden",!c),this._state={hasDecimal:o,hasNegative:s,hasSeparator:a,hasType:l,hasSymbols:r,hasCode:c}}},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:",txtNone:"None"},SSE.Views.FormatSettingsDialog||{}))}),define("spreadsheeteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";SSE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:215,header:!0,style:"min-width: 216px;",cls:"modal-dlg",id:"window-page-margins"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box" style="height: 85px;">','<table cols="2" style="width: 100%;margin-bottom: 10px;">',"<tr>",'<td style="padding-right: 10px;padding-bottom: 8px;">','<label class="input-label">'+this.textTop+"</label>",'<div id="page-margins-spin-top"></div>',"</td>",'<td style="padding-bottom: 8px;">','<label class="input-label">'+this.textBottom+"</label>",'<div id="page-margins-spin-bottom"></div>',"</td>","</tr>","<tr>",'<td class="padding-small" style="padding-right: 10px;">','<label class="input-label">'+this.textLeft+"</label>",'<div id="page-margins-spin-left"></div>',"</td>",'<td class="padding-small">','<label class="input-label">'+this.textRight+"</label>",'<div id="page-margins-spin-right"></div>',"</td>","</tr>","</table>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.maxMarginsW=this.maxMarginsH=0,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnTop=new Common.UI.MetricSpinner({el:$("#page-margins-spin-top"),step:.1,width:86,defaultUnit:"cm",value:"0",maxValue:48.25,minValue:0}),this.spinners.push(this.spnTop),this.spnBottom=new Common.UI.MetricSpinner({el:$("#page-margins-spin-bottom"),step:.1,width:86,defaultUnit:"cm",value:"0",maxValue:48.25,minValue:0}),this.spinners.push(this.spnBottom),this.spnLeft=new Common.UI.MetricSpinner({el:$("#page-margins-spin-left"),step:.1,width:86,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnLeft),this.spnRight=new Common.UI.MetricSpinner({el:$("#page-margins-spin-right"),step:.1,width:86,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnRight);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.updateMetricUnit()},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},setSettings:function(t){if(t){var e=t.asc_getPageMargins();this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getTop()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getBottom()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getLeft()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getRight()),!0)}},getSettings:function(){var t=new Asc.asc_CPageMargins;return t.asc_setTop(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())),t.asc_setBottom(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())),t.asc_setLeft(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())),t.asc_setRight(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())),t},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName())}},textTitle:"Margins",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",cancelButtonText:"Cancel",okButtonText:"Ok"},SSE.Views.PageMarginsDialog||{}))}),define("spreadsheeteditor/main/app/view/HeaderFooterDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts"],function(){"use strict";SSE.Views.HeaderFooterDialog=Common.UI.Window.extend(_.extend({options:{width:647,style:"min-width: 350px;",cls:"modal-dlg enable-key-events",animate:{mask:!1}},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.api=this.options.api,this.props=this.options.props,this.fontStore=this.options.fontStore,this.isFooter=!1,this.currentCanvas=null,this.headerControls=[],this.footerControls=[],this._state={clrtext:void 0,bold:void 0,italic:void 0,underline:void 0,strikeout:void 0,subscript:void 0,superscript:void 0,fontsize:void 0,fontname:"Arial"},this.template=['<div class="box" style="height: 400px;">','<table cols="2" style="width: 450px;margin-bottom: 30px;">',"<tr>",'<td style="padding-bottom: 8px;">','<div id="id-dlg-hf-ch-first"></div>',"</td>",'<td style="padding-bottom: 8px;">','<div id="id-dlg-hf-ch-scale"></div>',"</td>","</tr>","<tr>","<td>",'<div id="id-dlg-hf-ch-odd"></div>',"</td>","<td>",'<div id="id-dlg-hf-ch-align"></div>',"</td>","</tr>","</table>",'<div class="input-row" style="margin-bottom: 15px; border-bottom: 1px solid #cfcfcf;">','<button type="button" class="btn btn-text-default auto" id="id-dlg-hf-btn-all" style="border-radius: 0;">',this.textAll,"</button>",'<button type="button" class="btn btn-text-default auto hidden" id="id-dlg-hf-btn-odd" style="border-radius: 0;">',this.textOdd,"</button>",'<button type="button" class="btn btn-text-default auto hidden" id="id-dlg-hf-btn-even" style="border-radius: 0; margin-left:-1px;">',this.textEven,"</button>",'<button type="button" class="btn btn-text-default auto hidden" id="id-dlg-hf-btn-first" style="border-radius: 0; margin-left:-1px;">',this.textFirst,"</button>","</div>",'<label style="display: block; margin-bottom: 3px;">'+this.textHeader+"</label>",'<div id="id-dlg-h-presets" class="input-row" style="display: inline-block; vertical-align: middle;"></div>','<div id="id-dlg-h-insert" class="input-row" style="display: inline-block; vertical-align: middle; margin-left: 2px;"></div>','<div id="id-dlg-h-fonts" class="input-row" style="display: inline-block; vertical-align: middle; margin-left: 2px;"></div>','<div id="id-dlg-h-font-size" class="input-row" style="display: inline-block; vertical-align: middle; margin-left: 2px;"></div>','<div id="id-dlg-h-textcolor" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-h-bold" style="display: inline-block;margin-left: 2px;"></div>','<div id="id-dlg-h-italic" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-h-underline" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-h-strikeout" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-h-subscript" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-h-superscript" style="display: inline-block;margin-left: 6px;"></div>','<div style="margin-top: 7px;">','<div style="display: inline-block;margin-right: -1px;">','<div style="border: 1px solid #cbcbcb;width: 205px; height: 92px; position:relative; overflow:hidden;">','<div id="header-left-img" style="width: 190px; height: 100%;"></div>',"</div>","</div>",'<div style="display: inline-block;margin-right: -1px;">','<div style="border: 1px solid #cbcbcb;width: 205px; height: 92px; position:relative; overflow:hidden;">','<div id="header-center-img" style="width: 190px; height: 100%;"></div>',"</div>","</div>",'<div style="display: inline-block;">','<div style="border: 1px solid #cbcbcb;width: 205px; height: 92px; position:relative; overflow:hidden;">','<div id="header-right-img" style="width: 190px; height: 100%;"></div>',"</div>","</div>","</div>",'<label style="display: block; margin-top: 10px;margin-bottom: 3px;">'+this.textFooter+"</label>",'<div id="id-dlg-f-presets" class="input-row" style="display: inline-block; vertical-align: middle;"></div>','<div id="id-dlg-f-insert" class="input-row" style="display: inline-block; vertical-align: middle; margin-left: 2px;"></div>','<div id="id-dlg-f-fonts" class="input-row" style="display: inline-block; vertical-align: middle; margin-left: 2px;"></div>','<div id="id-dlg-f-font-size" class="input-row" style="display: inline-block; vertical-align: middle; margin-left: 2px;"></div>','<div id="id-dlg-f-textcolor" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-f-bold" style="display: inline-block;margin-left: 2px;"></div>','<div id="id-dlg-f-italic" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-f-underline" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-f-strikeout" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-f-subscript" style="display: inline-block;margin-left: 6px;"></div>','<div id="id-dlg-f-superscript" style="display: inline-block;margin-left: 6px;"></div>','<div style="margin-top: 7px;">','<div style="display: inline-block;margin-right: -1px;">','<div style="border: 1px solid #cbcbcb;width: 205px; height: 92px; position:relative; overflow:hidden;">','<div id="footer-left-img" style="width: 190px; height: 100%;"></div>',"</div>","</div>",'<div style="display: inline-block;margin-right: -1px;">','<div style="border: 1px solid #cbcbcb;width: 205px; height: 92px; position:relative; overflow:hidden;">','<div id="footer-center-img" style="width: 190px; height: 100%;"></div>',"</div>","</div>",'<div style="display: inline-block;">','<div style="border: 1px solid #cbcbcb;width: 205px; height: 92px; position:relative; overflow:hidden;">','<div id="footer-right-img" style="width: 190px; height: 100%;"></div>',"</div>","</div>","</div>","</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();this.chFirstPage=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-first"),labelText:this.textDiffFirst}),this.chFirstPage.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue(),s=this.HFObject?this.HFObject.setDifferentFirst(o):null;if(s){var a=this;return void this.showError(function(){t.setValue(!o,!0),_.delay(function(){a.onCanvasClick(s)},50)})}this.btnFirst.setVisible(o),!o&&this.btnFirst.isActive()&&(this.btnAll.isVisible()?this.btnAll.toggle(!0):this.btnOdd.toggle(!0))},this)),this.chOddPage=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-odd"),labelText:this.textDiffOdd}),this.chOddPage.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue(),s=this.HFObject?this.HFObject.setDifferentOddEven(o):null;if(s){var a=this;return void this.showError(function(){t.setValue(!o,!0),_.delay(function(){a.onCanvasClick(s)},50)})}this.btnOdd.setVisible(o),this.btnEven.setVisible(o),this.btnAll.setVisible(!o),o||!this.btnOdd.isActive()&&!this.btnEven.isActive()||this.btnAll.toggle(!0),o&&this.btnAll.isActive()&&this.btnOdd.toggle(!0)},this)),this.chScale=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-scale"),labelText:this.textScale}),this.chScale.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();this.HFObject&&this.HFObject.setScaleWithDoc(o)},this)),this.chAlign=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-align"),labelText:this.textAlign}),this.chAlign.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();this.HFObject&&this.HFObject.setAlignWithMargins(o)},this)),this.btnAll=new Common.UI.Button({el:$("#id-dlg-hf-btn-all"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1,pressed:!0}),this.btnAll.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.odd)),this.btnOdd=new Common.UI.Button({el:$("#id-dlg-hf-btn-odd"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnOdd.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.odd)),this.btnEven=new Common.UI.Button({el:$("#id-dlg-hf-btn-even"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnEven.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.even)),this.btnFirst=new Common.UI.Button({el:$("#id-dlg-hf-btn-first"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnFirst.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.first)),this.cmbPresetsH=new Common.UI.ComboBox({el:$("#id-dlg-h-presets"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-height: 200px;",editable:!1,scrollAlwaysVisible:!0,data:[]}),this.cmbPresetsH.on("selected",_.bind(this.onPresetSelect,this,!1)),this.cmbPresetsH.setValue(this.textPresets),this.cmbPresetsF=new Common.UI.ComboBox({el:$("#id-dlg-f-presets"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-height: 200px;",editable:!1,scrollAlwaysVisible:!0,data:[]}),this.cmbPresetsF.on("selected",_.bind(this.onPresetSelect,this,!0)),this.cmbPresetsF.setValue(this.textPresets);var i=[{displayValue:this.textPageNum,value:Asc.c_oAscHeaderFooterField.pageNumber},{displayValue:this.textPageCount,value:Asc.c_oAscHeaderFooterField.pageCount},{displayValue:this.textDate,value:Asc.c_oAscHeaderFooterField.date},{displayValue:this.textTime,value:Asc.c_oAscHeaderFooterField.time},{displayValue:this.textFileName,value:Asc.c_oAscHeaderFooterField.fileName},{displayValue:this.textSheet,value:Asc.c_oAscHeaderFooterField.sheetName}];this.cmbInsertH=new Common.UI.ComboBox({el:$("#id-dlg-h-insert"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-heigh: 100px;",editable:!1,data:i}),this.cmbInsertH.on("selected",_.bind(this.onObjectSelect,this)),this.cmbInsertH.setValue(this.textInsert),this.headerControls.push(this.cmbInsertH),this.cmbInsertF=new Common.UI.ComboBox({el:$("#id-dlg-f-insert"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-heigh: 100px;",editable:!1,data:i}),this.cmbInsertF.on("selected",_.bind(this.onObjectSelect,this)),this.cmbInsertF.setValue(this.textInsert),this.footerControls.push(this.cmbInsertF),this.cmbFonts=[],this.cmbFonts.push(new Common.UI.ComboBoxFonts({el:$("#id-dlg-h-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName})),this.cmbFonts[0].on("selected",_.bind(this.onFontSelect,this)),this.headerControls.push(this.cmbFonts[0]),this.cmbFonts.push(new Common.UI.ComboBoxFonts({el:$("#id-dlg-f-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName})),this.cmbFonts[1].on("selected",_.bind(this.onFontSelect,this)),this.footerControls.push(this.cmbFonts[1]),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),i=[{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"}],this.cmbFontSize=[],this.cmbFontSize.push(new Common.UI.ComboBox({el:$("#id-dlg-h-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:i})),this.cmbFontSize[0].on("selected",_.bind(this.onFontSizeSelect,this)),this.cmbFontSize[0].on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize[0].on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),this.cmbFontSize[0].setValue(this._state.fontsize),this.headerControls.push(this.cmbFontSize[0]),this.cmbFontSize.push(new Common.UI.ComboBox({el:$("#id-dlg-f-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:i})),this.cmbFontSize[1].on("selected",_.bind(this.onFontSizeSelect,this)),this.cmbFontSize[1].on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize[1].on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),this.cmbFontSize[1].setValue(this._state.fontsize),this.footerControls.push(this.cmbFontSize[1]),this.btnBold=[],this.btnBold.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:this.textBold})),this.btnBold[0].render($("#id-dlg-h-bold")),this.btnBold[0].on("click",_.bind(this.onBoldClick,this)),this.headerControls.push(this.btnBold[0]),this.btnBold.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:this.textBold})),this.btnBold[1].render($("#id-dlg-f-bold")),this.btnBold[1].on("click",_.bind(this.onBoldClick,this)),this.footerControls.push(this.btnBold[1]),this.btnItalic=[],this.btnItalic.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:this.textItalic})),this.btnItalic[0].render($("#id-dlg-h-italic")),this.btnItalic[0].on("click",_.bind(this.onItalicClick,this)),this.headerControls.push(this.btnItalic[0]),this.btnItalic.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:this.textItalic})),this.btnItalic[1].render($("#id-dlg-f-italic")),this.btnItalic[1].on("click",_.bind(this.onItalicClick,this)),this.footerControls.push(this.btnItalic[1]),this.btnUnderline=[],this.btnUnderline.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0,hint:this.textUnderline})),this.btnUnderline[0].render($("#id-dlg-h-underline")),this.btnUnderline[0].on("click",_.bind(this.onUnderlineClick,this)),this.headerControls.push(this.btnUnderline[0]),this.btnUnderline.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0,hint:this.textUnderline})),this.btnUnderline[1].render($("#id-dlg-f-underline")),this.btnUnderline[1].on("click",_.bind(this.onUnderlineClick,this)),this.footerControls.push(this.btnUnderline[1]),this.btnStrikeout=[],this.btnStrikeout.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0,hint:this.textStrikeout})),this.btnStrikeout[0].render($("#id-dlg-h-strikeout")),this.btnStrikeout[0].on("click",_.bind(this.onStrikeoutClick,this)),this.headerControls.push(this.btnStrikeout[0]),this.btnStrikeout.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0,hint:this.textStrikeout})),this.btnStrikeout[1].render($("#id-dlg-f-strikeout")),this.btnStrikeout[1].on("click",_.bind(this.onStrikeoutClick,this)),this.footerControls.push(this.btnStrikeout[1]),this.btnSuperscript=[],this.btnSuperscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSuperscript})),this.btnSuperscript[0].render($("#id-dlg-h-superscript")),this.btnSuperscript[0].on("click",_.bind(this.onSuperscriptClick,this)),this.headerControls.push(this.btnSuperscript[0]),this.btnSuperscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSuperscript})),this.btnSuperscript[1].render($("#id-dlg-f-superscript")),this.btnSuperscript[1].on("click",_.bind(this.onSuperscriptClick,this)),this.footerControls.push(this.btnSuperscript[1]),this.btnSubscript=[],this.btnSubscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSubscript})),this.btnSubscript[0].render($("#id-dlg-h-subscript")),this.btnSubscript[0].on("click",_.bind(this.onSubscriptClick,this)),this.headerControls.push(this.btnSubscript[0]),this.btnSubscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSubscript})),this.btnSubscript[1].render($("#id-dlg-f-subscript")),this.btnSubscript[1].on("click",_.bind(this.onSubscriptClick,this)),this.footerControls.push(this.btnSubscript[1]);var n=function(e,i){if(e&&e.cmpEl){e.currentColor="#000000";var n=$('<div class="btn-color-value-line"></div>');$("button:first-child",e.cmpEl).append(n),n.css("background-color",e.currentColor);var o=new Common.UI.ThemeColorPalette({el:$(i)});o.currentColor=e.currentColor}return e.menu.cmpEl.on("click",i+"-new",_.bind(function(){o.addNewColor("object"==typeof e.color?e.color.color:e.color)},t)),o.on("select",_.bind(t.onColorSelect,t,e)),o};this.btnTextColor=[],this.btnTextColor.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-fontcolor",hint:this.textColor,split:!0,menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-dlg-h-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-dlg-h-menu-fontcolor-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})),this.btnTextColor[0].render($("#id-dlg-h-textcolor")),this.btnTextColor[0].on("click",_.bind(this.onTextColor,this)),this.mnuTextColorPicker=[],this.mnuTextColorPicker.push(n(this.btnTextColor[0],"#id-dlg-h-menu-fontcolor")),this.headerControls.push(this.btnTextColor[0]),this.btnTextColor.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-fontcolor",hint:this.textColor,split:!0,menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-dlg-f-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-dlg-f-menu-fontcolor-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})),this.btnTextColor[1].render($("#id-dlg-f-textcolor")),this.btnTextColor[1].on("click",_.bind(this.onTextColor,this)),this.mnuTextColorPicker.push(n(this.btnTextColor[1],"#id-dlg-f-menu-fontcolor")),this.footerControls.push(this.btnTextColor[1]),this.btnOk=new Common.UI.Button({el:e.find(".primary")}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.scrollers=[],this.initCanvas("#header-left-img"),this.initCanvas("#header-center-img"),this.initCanvas("#header-right-img"),this.initCanvas("#footer-left-img"),this.initCanvas("#footer-center-img"),this.initCanvas("#footer-right-img"),this.wrapEvents={onApiEditorSelectionChanged:_.bind(this.onApiEditorSelectionChanged,this),onApiResizeEditorHeight:_.bind(this.onApiResizeEditorHeight,this),onUpdateEditorCursorPosition:_.bind(this.onUpdateEditorCursorPosition,this)},this.afterRender()},initCanvas:function(t){var e=this.$window.find(t);e.on("click",_.bind(this.onCanvasClick,this,t)),this.canvasBoxHeight=e.height(),this.scrollers[t]=new Common.UI.Scroller({el:e.parent(),minScrollbarLength:20}),this.scrollers[t].update(),this.scrollers[t].scrollTop(0)},show:function(){Common.UI.Window.prototype.show.apply(this,arguments)},close:function(){this.api.asc_unregisterCallback("asc_onEditorSelectionChanged",this.wrapEvents.onApiEditorSelectionChanged),this.api.asc_unregisterCallback("asc_resizeEditorHeight",this.wrapEvents.onApiResizeEditorHeight),this.api.asc_unregisterCallback("asc_updateEditorCursorPosition",this.wrapEvents.onUpdateEditorCursorPosition),Common.UI.Window.prototype.close.apply(this,arguments),this.HFObject&&this.HFObject.destroy()},afterRender:function(){this.api.asc_registerCallback("asc_onEditorSelectionChanged",this.wrapEvents.onApiEditorSelectionChanged),this.api.asc_registerCallback("asc_resizeEditorHeight",this.wrapEvents.onApiResizeEditorHeight),this.api.asc_registerCallback("asc_updateEditorCursorPosition",this.wrapEvents.onUpdateEditorCursorPosition),this.cmbFonts[0].fillFonts(this.fontStore),this.cmbFonts[0].selectRecord(this.fontStore.findWhere({name:this._state.fontname})||this.fontStore.at(0)),this.cmbFonts[1].fillFonts(this.fontStore),this.cmbFonts[1].selectRecord(this.fontStore.findWhere({name:this._state.fontname})||this.fontStore.at(0)),this.updateThemeColors(),this.HFObject=new AscCommonExcel.CHeaderFooterEditor(["header-left-img","header-center-img","header-right-img","footer-left-img","footer-center-img","footer-right-img"],205),this._setDefaults(this.props),this.editorCanvas=this.$window.find("#ce-canvas-menu")
|
|
|
;var t=this;_.delay(function(){t.onCanvasClick("#header-left-img")},500)},_setDefaults:function(t){var e=[];this.HFObject.getTextPresetsArr().forEach(function(t,i){e.push({displayValue:t,value:i})}),this.cmbPresetsH.setData(e),this.cmbPresetsH.setValue(this.textPresets),this.cmbPresetsF.setData(e),this.cmbPresetsF.setValue(this.textPresets),this.chOddPage.setValue(this.HFObject.getDifferentOddEven()),this.chFirstPage.setValue(this.HFObject.getDifferentFirst()),this.chAlign.setValue(this.HFObject.getAlignWithMargins()),this.chScale.setValue(this.HFObject.getScaleWithDoc());var i="checked"==this.chOddPage.getValue();this.btnOdd.setVisible(i),this.btnEven.setVisible(i),this.btnAll.setVisible(!i),i?this.btnOdd.toggle(!0):this.btnAll.toggle(!0),i="checked"==this.chFirstPage.getValue(),this.btnFirst.setVisible(i)},updateThemeColors:function(){this.mnuTextColorPicker[0].updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.mnuTextColorPicker[1].updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},getSettings:function(){return{}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.HFObject){var e=this.HFObject.destroy("ok"==t);if(e){var i=this;return void this.showError(function(){_.delay(function(){i.onCanvasClick(e)},50)})}this.HFObject=null}this.options.handler&&this.options.handler.call(this,this,t),this.close()},showError:function(t){Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.textMaxError,callback:t})},scrollerUpdate:function(){for(var t in this.scrollers)this.scrollers[t]&&this.scrollers[t].update()},scrollerScrollTop:function(){for(var t in this.scrollers)this.scrollers[t]&&this.scrollers[t].scrollTop(0)},onCanvasClick:function(t,e){if(this.HFObject){t=t||"#header-left-img";var i=this.currentCanvas!==t;if(i){this.currentCanvas=t,this.isFooter="#footer-left-img"==t||"#footer-center-img"==t||"#footer-right-img"==t;var n=this;this.headerControls.forEach(function(t){t.setDisabled(n.isFooter)}),this.footerControls.forEach(function(t){t.setDisabled(!n.isFooter)})}if(e){var o=$(e.currentTarget).parent(),s=o.offset();this.HFObject.click(t,e.pageX*Common.Utils.zoom()-s.left,e.pageY*Common.Utils.zoom()-s.top+o.scrollTop())}else this.HFObject.click(t);i&&this.scrollerUpdate()}},onApiResizeEditorHeight:function(t){if(this.editorCanvas){var e=this.editorCanvas.height();e!=this.editorCanvasHeight&&(this.editorCanvasHeight=e,this.scrollers[this.currentCanvas]&&this.scrollers[this.currentCanvas].update())}},onUpdateEditorCursorPosition:function(t,e){if(this.editorCanvas){var i=this.currentCanvas;if(this.scrollers[i]){var n=this.scrollers[i].getScrollTop();t+e>n+this.canvasBoxHeight?this.scrollers[i].scrollTop(t+e-this.canvasBoxHeight):t<n&&this.scrollers[i].scrollTop(t)}}},onPresetSelect:function(t,e,i){e.setValue(this.textPresets),this.HFObject&&this.HFObject.applyPreset(i.value,!!t),this.onCanvasClick(t?"#footer-left-img":"#header-left-img")},onObjectSelect:function(t,e){t.setValue(this.textInsert),this.HFObject&&this.HFObject.addField(e.value),this.onCanvasClick(this.currentCanvas)},onFontSelect:function(t,e){this.HFObject&&this.HFObject.setFontName(e.name),this.onCanvasClick(this.currentCanvas)},onFontSizeSelect:function(t,e){this.HFObject&&this.HFObject.setFontSize(e.value),this.onCanvasClick(this.currentCanvas)},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(i.value)))return o=e.getValue(),e.setRawValue(o),n.preventDefault(),!1}else o=parseFloat(i.value),o=o>409?409:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.HFObject&&this.HFObject.setFontSize(o)},onBoldClick:function(t,e){this.HFObject&&(this.HFObject.setBold(t.pressed),this.scrollerUpdate())},onItalicClick:function(t,e){this.HFObject&&(this.HFObject.setItalic(t.pressed),this.scrollerUpdate())},onUnderlineClick:function(t,e){this.HFObject&&(this.HFObject.setUnderline(t.pressed),this.scrollerUpdate())},onStrikeoutClick:function(t,e){this.HFObject&&(this.HFObject.setStrikeout(t.pressed),this.scrollerUpdate())},onSuperscriptClick:function(t,e){this.HFObject&&(this.HFObject.setSuperscript(t.pressed),this.scrollerUpdate())},onSubscriptClick:function(t,e){this.HFObject&&(this.HFObject.setSubscript(t.pressed),this.scrollerUpdate())},onTextColor:function(){var t=this.mnuTextColorPicker[this.isFooter?1:0];t.trigger("select",t,t.currentColor,!0)},onColorSelect:function(t,e,i){var n="object"==typeof i?i.color:i;t.currentColor=i,$(".btn-color-value-line",t.cmpEl).css("background-color","#"+n),e.currentColor=i,this.HFObject&&this.HFObject.setTextColor(Common.Utils.ThemeColor.getRgbColor(i)),this.onCanvasClick(this.currentCanvas)},onPageTypeToggle:function(t,e,i){if(!this._pagetype&&i&&this.HFObject){var n=this.HFObject.getPageType(),o=this.HFObject.switchHeaderFooterType(t);if(o){this._pagetype=!0;var s=this;return void this.showError(function(){switch(n){case Asc.c_oAscHeaderFooterType.odd:s.btnOdd.isVisible()?s.btnOdd.toggle(!0):s.btnAll.toggle(!0);break;case Asc.c_oAscHeaderFooterType.even:s.btnEven.toggle(!0);break;case Asc.c_oAscHeaderFooterType.first:s.btnFirst.toggle(!0)}_.delay(function(){s.onCanvasClick(o)},50),s._pagetype=!1})}this.scrollerScrollTop(),this.onCanvasClick(this.currentCanvas,void 0,!0)}},onApiChangeFont:function(t){this.cmbFonts[this.isFooter?1:0].onApiChangeFont(t)},onApiEditorSelectionChanged:function(t){var e,i=this.isFooter?1:0;t.asc_getName()!=this.cmbFonts[i].getValue()&&Common.NotificationCenter.trigger("fonts:change",t),e=t.asc_getBold(),this.btnBold[i].isActive()!==e&&this.btnBold[i].toggle(!0===e,!0),e=t.asc_getItalic(),this.btnItalic[i].isActive()!==e&&this.btnItalic[i].toggle(!0===e,!0),e=t.asc_getUnderline(),this.btnUnderline[i].isActive()!==e&&this.btnUnderline[i].toggle(!0===e,!0),e=t.asc_getStrikeout(),this.btnStrikeout[i].isActive()!==e&&this.btnStrikeout[i].toggle(!0===e,!0),e=t.asc_getSubscript(),this.btnSubscript[i].isActive()!==e&&this.btnSubscript[i].toggle(!0===e,!0),e=t.asc_getSuperscript(),this.btnSuperscript[i].isActive()!==e&&this.btnSuperscript[i].toggle(!0===e,!0);var n=t.asc_getSize();this.cmbFontSize[i].getValue()!==n&&this.cmbFontSize[i].setValue(void 0!==n?n:"");var o,s,a=this.mnuTextColorPicker[i];if(s=t.asc_getColor(),s&&(o=s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())),_.isObject(o)){for(var l=!1,r=0;r<10;r++)if(Common.Utils.ThemeColor.ThemeValues[r]==o.effectValue){a.select(o,!0),l=!0;break}l||a.clearSelection()}else a.select(o,!0)},cancelButtonText:"Cancel",okButtonText:"Ok",tipFontName:"Font",tipFontSize:"Font size",textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",textTitle:"Header/Footer Settings",textHeader:"Header",textFooter:"Footer",textLeft:"Left",textCenter:"Center",textRight:"Right",textPageNum:"Page number",textPageCount:"Page count",textDate:"Date",textTime:"Time",textFileName:"File name",textSheet:"Sheet name",textColor:"Text color",textNewColor:"Add New Custom Color",textInsert:"Insert",textPresets:"Presets",textDiffFirst:"Different first page",textDiffOdd:"Different odd and even pages",textScale:"Scale with document",textAlign:"Align with page margins",textFirst:"First page",textOdd:"Odd page",textEven:"Even page",textAll:"All pages",textMaxError:"The text string you entered is too long. Reduce the number of characters used."},SSE.Views.HeaderFooterDialog||{}))}),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/view/SelectFileDlg","common/main/lib/util/define","spreadsheeteditor/main/app/view/Toolbar","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/controller/PivotTable","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","spreadsheeteditor/main/app/view/PageMarginsDialog","spreadsheeteditor/main/app/view/HeaderFooterDialog"],function(){"use strict";SSE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){var t=this;this.addListeners({Toolbar:{"change:compact":this.onClickChangeCompact.bind(t)},FileMenu:{"menu:hide":t.onFileMenu.bind(t,"hide"),"menu:show":t.onFileMenu.bind(t,"show")},Statusbar:{"sheet:changed":_.bind(this.onApiSheetChanged,this)},"Common.Views.Header":{"toolbar:setcompact":this.onChangeViewMode.bind(this),print:function(t){this.getApplication().getController("Main").onPrint()},save:function(t){this.api.asc_Save()},undo:this.onUndo,redo:this.onRedo,downloadas:function(t){var e,i=this.getApplication().getController("Main"),n=i.appOptions.spreadsheet.fileType;n&&(e=Asc.c_oAscFileType[n.toUpperCase()]);var o=[Asc.c_oAscFileType.XLSX,Asc.c_oAscFileType.ODS,Asc.c_oAscFileType.CSV,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.XLTX,Asc.c_oAscFileType.OTS];(!e||o.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PDF),e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?Common.NotificationCenter.trigger("download:settings",this.toolbar,e):i.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e))},"go:editor":function(){Common.Gateway.requestEditRights()}},DataTab:{"data:sort":this.onSortType,"data:setfilter":this.onAutoFilter,"data:clearfilter":this.onClearFilter}}),Common.NotificationCenter.on("page:settings",_.bind(this.onApiSheetChanged,this)),Common.NotificationCenter.on("formula:settings",_.bind(this.applyFormulaSettings,this)),this.editMode=!0,this._isAddingShape=!1,this._state={activated:!1,prstyle:void 0,clrtext:void 0,pralign:void 0,clrback:void 0,valign:void 0,can_undo:void 0,can_redo:void 0,bold:void 0,italic:void 0,underline:void 0,strikeout:void 0,subscript:void 0,superscript:void 0,wrap:void 0,merge:void 0,angle:void 0,controlsdisabled:{rows:void 0,cols:void 0,cells_right:void 0,cells_down:void 0,filters:void 0},selection_type:void 0,filter:void 0,filterapplied:!1,tablestylename:void 0,tablename:void 0,namedrange_locked:!1,fontsize:void 0,multiselect:!1,sparklines_disabled:!1,numformatinfo:void 0,numformattype:void 0,numformat:void 0,langId:void 0,pgsize:[0,0],pgmargins:void 0,pgorient:void 0,lock_doc:void 0};var e=function(e,i){var n=$(e.target),o=n.closest("#editor_sdk"),s=n.closest("button").attr("id");void 0===s&&(s=n.closest(".btn-group").attr("id")),t.api&&t.api.asc_isAddAutoshape()&&(o.length<=0||"cancel"==i)&&(t.toolbar.btnInsertText.pressed&&s!=t.toolbar.btnInsertText.id||t.toolbar.btnInsertShape.pressed&&s!=t.toolbar.btnInsertShape.id?(t._isAddingShape=!1,t._addAutoshape(!1),t.toolbar.btnInsertShape.toggle(!1,!0),t.toolbar.btnInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",t.toolbar)):t.toolbar.btnInsertShape.pressed&&s==t.toolbar.btnInsertShape.id&&_.defer(function(){t.api.asc_endAddShape(),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},100))};this.checkInsertAutoshape=function(t){e({},t.action)},this._addAutoshape=function(t,i){this.api&&(t?(this.api.asc_startAddShape(i),$(document.body).on("mouseup",e)):(this.api.asc_endAddShape(),$(document.body).off("mouseup",e)))},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",e)}},onLaunch:function(){this.toolbar=this.createView("Toolbar"),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("app:face",this.onAppShowed.bind(this))},setMode:function(t){this.mode=t,this.toolbar.applyLayout(t)},attachUIEvents:function(t){var e=this;e.appConfig.isEditDiagram?(t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),t.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),t.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),t.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),t.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),t.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),t.cmbNumberFormat.cmpEl&&t.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),t.btnEditChart.on("click",_.bind(this.onEditChart,this))):e.appConfig.isEditMailMerge?(t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnSearch.on("click",_.bind(this.onSearch,this)),t.btnSortDown.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),t.btnSortUp.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),t.btnSetAutofilter.on("click",_.bind(this.onAutoFilter,this)),t.btnClearAutofilter.on("click",_.bind(this.onClearFilter,this))):(t.btnPrint.on("click",_.bind(this.onPrint,this)),t.btnPrint.on("disabled",_.bind(this.onBtnChangeState,this,"print:disabled")),t.btnSave.on("click",_.bind(this.onSave,this)),t.btnSave.on("disabled",_.bind(this.onBtnChangeState,this,"save:disabled")),t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnUndo.on("disabled",_.bind(this.onBtnChangeState,this,"undo:disabled")),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnRedo.on("disabled",_.bind(this.onBtnChangeState,this,"redo:disabled")),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnIncFontSize.on("click",_.bind(this.onIncreaseFontSize,this)),t.btnDecFontSize.on("click",_.bind(this.onDecreaseFontSize,this)),t.btnBold.on("click",_.bind(this.onBold,this)),t.btnItalic.on("click",_.bind(this.onItalic,this)),t.btnUnderline.on("click",_.bind(this.onUnderline,this)),t.btnStrikeout.on("click",_.bind(this.onStrikeout,this)),t.btnSubscript.on("click",_.bind(this.onSubscript,this)),t.btnSubscript.menu.on("item:click",_.bind(this.onSubscriptMenu,this)),t.btnTextColor.on("click",_.bind(this.onTextColor,this)),t.btnBackColor.on("click",_.bind(this.onBackColor,this)),t.mnuTextColorPicker.on("select",_.bind(this.onTextColorSelect,this)),t.mnuBackColorPicker.on("select",_.bind(this.onBackColorSelect,this)),t.btnBorders.on("click",_.bind(this.onBorders,this)),t.btnBorders.rendered&&(t.btnBorders.menu.on("item:click",_.bind(this.onBordersMenu,this)),t.mnuBorderWidth.on("item:toggle",_.bind(this.onBordersWidth,this)),t.mnuBorderColorPicker.on("select",_.bind(this.onBordersColor,this))),t.btnAlignLeft.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Left)),t.btnAlignCenter.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Center)),t.btnAlignRight.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Right)),t.btnAlignJust.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Justify)),t.btnHorizontalAlign.menu.on("item:click",_.bind(this.onHorizontalAlignMenu,this)),t.btnVerticalAlign.menu.on("item:click",_.bind(this.onVerticalAlignMenu,this)),t.btnMerge.on("click",_.bind(this.onMergeCellsMenu,this,t.btnMerge.menu,t.btnMerge.menu.items[0])),t.btnMerge.menu.on("item:click",_.bind(this.onMergeCellsMenu,this)),t.btnAlignTop.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Top)),t.btnAlignMiddle.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Center)),t.btnAlignBottom.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Bottom)),t.btnWrap.on("click",_.bind(this.onWrap,this)),t.btnTextOrient.menu.on("item:click",_.bind(this.onTextOrientationMenu,this)),t.btnInsertTable.on("click",_.bind(this.onBtnInsertTableClick,this)),t.btnInsertImage.menu.on("item:click",_.bind(this.onInsertImageMenu,this)),t.btnInsertHyperlink.on("click",_.bind(this.onHyperlink,this)),t.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),t.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),t.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),t.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),t.btnTableTemplate.menu.on("show:after",_.bind(this.onTableTplMenuOpen,this)),t.btnPercentStyle.on("click",_.bind(this.onNumberFormat,this)),t.btnCurrencyStyle.on("click",_.bind(this.onNumberFormat,this)),t.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),t.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),t.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),t.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),t.btnNamedRange.menu.on("item:click",_.bind(this.onNamedRangeMenu,this)),t.btnNamedRange.menu.on("show:after",_.bind(this.onNamedRangeMenuOpen,this)),t.btnClearStyle.menu.on("item:click",_.bind(this.onClearStyleMenu,this)),t.btnAddCell.menu.on("item:click",_.bind(this.onCellInsertMenu,this)),t.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),t.btnDeleteCell.menu.on("item:click",_.bind(this.onCellDeleteMenu,this)),t.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),t.btnColorSchemas.menu.on("show:after",_.bind(this.onColorSchemaShow,this)),t.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),t.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),t.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),t.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.listStyles.on("click",_.bind(this.onListStyleSelect,this)),t.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),t.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),t.cmbNumberFormat.cmpEl&&t.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),t.btnCurrencyStyle.menu.on("item:click",_.bind(this.onNumberFormatMenu,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)),t.btnPageOrient.menu.on("item:click",_.bind(this.onPageOrientSelect,this)),t.btnPageMargins.menu.on("item:click",_.bind(this.onPageMarginsSelect,this)),t.mnuPageSize.on("item:click",_.bind(this.onPageSizeClick,this)),t.btnPrintArea.menu.on("item:click",_.bind(this.onPrintAreaClick,this)),t.btnPrintArea.menu.on("show:after",_.bind(this.onPrintAreaMenuOpen,this)),t.btnImgGroup.menu.on("item:click",_.bind(this.onImgGroupSelect,this)),t.btnImgBackward.menu.on("item:click",_.bind(this.onImgArrangeSelect,this)),t.btnImgForward.menu.on("item:click",_.bind(this.onImgArrangeSelect,this)),t.btnImgAlign.menu.on("item:click",_.bind(this.onImgAlignSelect,this)),t.btnImgForward.on("click",this.onImgArrangeSelect.bind(this,"forward")),t.btnImgBackward.on("click",this.onImgArrangeSelect.bind(this,"backward")),t.btnEditHeader.on("click",_.bind(this.onEditHeaderClick,this)),Common.Gateway.on("insertimage",_.bind(this.insertImage,this)),this.onSetupCopyStyleButton())},setApi:function(t){this.api=t;var e=SSE.getController("Main").appOptions;e.isEditDiagram||e.isEditMailMerge||(this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this)),this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onContextMenu,this))),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,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_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onApiZoomChange,this)),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this))},onApiChangeFont:function(t){!this.getApplication().getController("Main").isModalShowed&&this.toolbar.cmbFontName.onApiChangeFont(t)},onContextMenu:function(){this.toolbar.collapse()},onPrint:function(t){Common.NotificationCenter.trigger("print",this.toolbar)},onSave:function(t){if(this.api){var e=this.api.asc_isDocumentCanSave(),i=this.toolbar.btnCollabChanges&&this.toolbar.btnCollabChanges.$icon.hasClass("btn-synch");if(!e&&!i&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onBtnChangeState:function(t){if(/\:disabled$/.test(t)){var e=arguments[2];this.toolbar.fireEvent(t,[e])}},onUndo:function(t,e){this.api&&this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(t,e){this.api&&this.api.asc_Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(t,e){var i=this;if(i.api){if(t?i.api.asc_Copy():i.api.asc_Paste())Common.component.Analytics.trackEvent("ToolBar","Copy Warning");else{var n=Common.localStorage.getItem("sse-hide-copywarning");n&&1==parseInt(n)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",i.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},onIncreaseFontSize:function(t){this.api&&this.api.asc_increaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecreaseFontSize:function(t){this.api&&this.api.asc_decreaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(t,e){this._state.bold=void 0,this.api&&this.api.asc_setCellBold(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(t,e){this._state.italic=void 0,this.api&&this.api.asc_setCellItalic(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(t,e){this._state.underline=void 0,this.api&&this.api.asc_setCellUnderline(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Underline")},onStrikeout:function(t,e){this._state.strikeout=void 0,this.api&&this.api.asc_setCellStrikeout(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Strikeout")},onSubscriptMenu:function(t,e){var i=this.toolbar.btnSubscript;"sub"==e.value?(this._state.subscript=void 0,this.api.asc_setCellSubscript(e.checked)):(this._state.superscript=void 0,this.api.asc_setCellSuperscript(e.checked)),e.checked&&(i.$icon.removeClass(i.options.icls).addClass(e.options.icls),i.options.icls=e.options.icls),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","sub"==e.value?"Subscript":"Superscript")},onSubscript:function(t,e){var i="btn-subscript"==t.options.icls;i?(this._state.subscript=void 0,this.api.asc_setCellSubscript(t.pressed)):(this._state.superscript=void 0,this.api.asc_setCellSuperscript(t.pressed)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar",i?"Subscript":"Superscript")},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(t,e,i){this._state.clrtext_asccolor=this._state.clrtext=void 0;var n="object"==typeof e?e.color:e;this.toolbar.btnTextColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+n),this.toolbar.mnuTextColorPicker.currentColor=e,this.api&&(this.toolbar.btnTextColor.ischanged=!0!==i,this.api.asc_setCellTextColor(Common.Utils.ThemeColor.getRgbColor(e)),this.toolbar.btnTextColor.ischanged=!1),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onBackColorSelect:function(t,e,i){this._state.clrshd_asccolor=this._state.clrback=void 0;var n="object"==typeof e?e.color:e;this.toolbar.btnBackColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color","transparent"==n?"transparent":"#"+n),this.toolbar.mnuBackColorPicker.currentColor=e,this.api&&(this.toolbar.btnBackColor.ischanged=!0!==i,this.api.asc_setCellBackgroundColor("transparent"==e?null:Common.Utils.ThemeColor.getRgbColor(e)),this.toolbar.btnBackColor.ischanged=!1),Common.component.Analytics.trackEvent("ToolBar","Background Color")},onNewTextColor:function(t,e){this.toolbar.mnuTextColorPicker.addNewColor()},onNewBackColor:function(t,e){this.toolbar.mnuBackColorPicker.addNewColor()},onNewBorderColor:function(t,e){this.toolbar.btnBorders.menu.hide(),this.toolbar.btnBorders.toggle(!1,!0),this.toolbar.mnuBorderColorPicker.addNewColor()},onBorders:function(t){var e;_.each(t.menu.items,function(i){if(t.options.borderId==i.options.borderId)return e=i,!1}),e&&this.onBordersMenu(t.menu,e)},onBordersMenu:function(t,e){var i=this;if(i.api&&!_.isUndefined(e.options.borderId)){var n=i.toolbar.btnBorders,o=[],s=n.options.borderswidth,a=n.options.borderscolor;n.rendered&&(n.$icon.removeClass(n.options.icls).addClass(e.options.icls),n.options.icls=e.options.icls),n.options.borderId=e.options.borderId,"inner"==e.options.borderId?(o[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,a)):"all"==e.options.borderId?(o[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,a)):"outer"==e.options.borderId?(o[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,a)):"none"!=e.options.borderId&&(o[e.options.borderId]=new Asc.asc_CBorder(s,a)),i.api.asc_setCellBorders(o),Common.NotificationCenter.trigger("edit:complete",i.toolbar),Common.component.Analytics.trackEvent("ToolBar","Borders")}},onBordersWidth:function(t,e,i){i&&(this.toolbar.btnBorders.options.borderswidth=e.value,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Width"))},onBordersColor:function(t,e){$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+("object"==typeof e?e.color:e)),this.toolbar.mnuBorderColor.onUnHoverItem(),this.toolbar.btnBorders.options.borderscolor=Common.Utils.ThemeColor.getRgbColor(e),this.toolbar.mnuBorderColorPicker.currentColor=e,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Color")},onHorizontalAlign:function(t,e,i){this._state.pralign=void 0,this.api&&(this.api.asc_setCellAlign(e.pressed?t:null),this.toolbar.btnWrap.allowDepress=!(t==AscCommon.align_Justify)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal align")},onHorizontalAlignMenu:function(t,e){var i=this.toolbar.btnHorizontalAlign;i.$icon.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-align-left",i.$icon.addClass(i.options.icls),this._state.pralign=void 0,this.api&&this.api.asc_setCellAlign(e.checked?e.value:null),this.toolbar.btnWrap.allowDepress=!(e.value==AscCommon.align_Justify),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onVerticalAlignMenu:function(t,e){var i=this.toolbar.btnVerticalAlign;i.$icon.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-valign-bottom",i.$icon.addClass(i.options.icls),this._state.valign=void 0,this.api&&this.api.asc_setCellVertAlign(e.checked?e.value:Asc.c_oAscVAlign.Bottom),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical Align")},onVerticalAlign:function(t,e,i){this._state.valign=void 0,this.api&&this.api.asc_setCellVertAlign(e.pressed?t:Asc.c_oAscVAlign.Bottom),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical align")},onMergeCellsMenu:function(t,e){function i(t){n._state.merge=void 0,n.api.asc_mergeCells(t),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge")}var n=this;if(n.api){n.api.asc_getCellInfo().asc_getFlags().asc_getMerge()!==Asc.c_oAscMergeOptions.Merge&&n.api.asc_mergeCellsDataLost(e.value)?Common.UI.warning({msg:n.warnMergeLostData,buttons:["yes","no"],primary:"yes",callback:function(t){"yes"==t?i(e.value):(n.toolbar.btnMerge.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge"))}}):i(e.value)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge cells")},onWrap:function(t,e){this._state.wrap=void 0,this.api&&this.api.asc_setCellTextWrap(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Wrap")},onTextOrientationMenu:function(t,e){if(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeShapeText){var i=Asc.c_oAscVertDrawingText.normal;switch(e.value){case"rotateup":i=Asc.c_oAscVertDrawingText.vert270;break;case"rotatedown":i=Asc.c_oAscVertDrawingText.vert}var n=new Asc.asc_CImgProperty;n.asc_putVert(i),this.api.asc_setGraphicObjectProps(n)}else{var i=0;switch(e.value){case"countcw":i=45;break;case"clockwise":i=-45;break;case"rotateup":i=90;break;case"rotatedown":i=-90
|
|
|
}this._state.angle=void 0,this.api&&this.api.asc_setCellAngle(i)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Text orientation")},onBtnInsertTableClick:function(t,e){this.api&&this._setTableFormat(this.api.asc_getDefaultTableStyle()),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table")},onInsertImageMenu:function(t,e,i){var n=this;"file"===e.value?(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")):"url"===e.value?new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t){if(n.api){var i=e.replace(/\s/g,"");_.isEmpty(i)?Common.UI.warning({msg:this.textEmptyImgUrl}):(n.toolbar.fireEvent("insertimage",n.toolbar),n.api.asc_addImageDrawingObject(i),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",n.toolbar)}}}).show():"storage"===e.value&&(this.toolbar.mode.canRequestInsertImage?Common.Gateway.requestInsertImage():new Common.Views.SelectFileDlg({fileChoiceUrl:this.toolbar.mode.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","ImagesOnly")}).on("selectfile",function(t,e){n.insertImage(e)}).show())},insertImage:function(t){t&&t.url&&(this.toolbar.fireEvent("insertimage",this.toolbar),this.api.asc_addImageDrawingObject(t.url,void 0,t.token),Common.component.Analytics.trackEvent("ToolBar","Image"))},onHyperlink:function(t){var e,i,n=this;if(n.api){for(var o=n.api.asc_getWorksheetsCount(),s=-1,a=[];++s<o;)this.api.asc_isWorksheetHidden(s)||a.push({displayValue:n.api.asc_getWorksheetName(s),value:n.api.asc_getWorksheetName(s)});var l=function(t,e){"ok"==e&&(i=t.getSettings(),n.api.asc_insertHyperlink(i)),Common.NotificationCenter.trigger("edit:complete",n.toolbar)},r=n.api.asc_getCellInfo(),c=r.asc_getFlags().asc_getSelectionType();i=r.asc_getHyperlink(),e=new SSE.Views.HyperlinkSettingsDialog({api:n.api,handler:l}),e.show(),e.setSettings({sheets:a,currentSheet:n.api.asc_getWorksheetName(n.api.asc_getActiveWorksheetIndex()),props:i,text:r.asc_getText(),isLock:r.asc_getFlags().asc_getLockText(),allowInternal:c!==Asc.c_oAscSelectionType.RangeImage&&c!==Asc.c_oAscSelectionType.RangeShape&&c!==Asc.c_oAscSelectionType.RangeShapeText&&c!==Asc.c_oAscSelectionType.RangeChart&&c!==Asc.c_oAscSelectionType.RangeChartText})}Common.component.Analytics.trackEvent("ToolBar","Add Hyperlink")},onEditChart:function(t){if(this.editMode){var e=this,i=e.api.asc_getCellInfo();if(i.asc_getFlags().asc_getSelectionType()!=Asc.c_oAscSelectionType.RangeImage){var n;if(e.api){n=e.api.asc_getChartObject();for(var o=e.api.asc_getGraphicObjectProps(),s=null,a=0;a<o.length;a++)if(o[a].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image){var l=o[a].asc_getObjectValue();l.asc_getChartProperties()&&(s=l)}if(n){var r=e.toolbar.mode.isEditDiagram||i.asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeChart||i.asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeChartText;new SSE.Views.ChartSettingsDlg({chartSettings:n,imageSettings:s,isChart:!0,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(r?e.api.asc_editChartDrawingObject(i.chartSettings):e.api.asc_addChartDrawingObject(i.chartSettings),i.imageSettings&&e.api.asc_setGraphicObjectProps(i.imageSettings)),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show()}}}}},onSelectChart:function(t,e,i,n){if(this.editMode&&i){var o=this,s=o.api.asc_getCellInfo(),a=s.asc_getFlags().asc_getSelectionType(),l=i.get("group"),r="menu-chart-group-sparkcolumn"==l||"menu-chart-group-sparkline"==l||"menu-chart-group-sparkwin"==l;if(a!=Asc.c_oAscSelectionType.RangeImage&&o.api){var c;if(!r||a!=Asc.c_oAscSelectionType.RangeCells&&a!=Asc.c_oAscSelectionType.RangeCol&&a!=Asc.c_oAscSelectionType.RangeRow&&a!=Asc.c_oAscSelectionType.RangeMax){if(!r){var h=a==Asc.c_oAscSelectionType.RangeChart||a==Asc.c_oAscSelectionType.RangeChartText;if(c=o.api.asc_getChartObject(!0)){h?c.changeType(i.get("type")):c.putType(i.get("type"));var d=c.getRange(),p=o.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,d,!0,!c.getInColumns(),c.getType());p==Asc.c_oAscError.ID.No?h?o.api.asc_editChartDrawingObject(c):o.api.asc_addChartDrawingObject(c):Common.UI.warning({msg:p==Asc.c_oAscError.ID.StockChartError?o.errorStockChart:p==Asc.c_oAscError.ID.MaxDataSeriesError?o.errorMaxRows:o.txtInvalidRange,callback:function(){_.defer(function(t){Common.NotificationCenter.trigger("edit:complete",o.toolbar)})}})}}}else{var m=s.asc_getSparklineInfo();if(m){var c=new Asc.sparklineGroup;c.asc_setType(i.get("type")),this.api.asc_setSparklineGroup(m.asc_getId(),c)}}}"click"!==n.type&&o.toolbar.btnInsertChart.menu.hide(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onBtnInsertTextClick:function(t,e){this.api&&this._addAutoshape(t.pressed,"textRect"),this.toolbar.btnInsertShape.pressed&&this.toolbar.btnInsertShape.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Text")},onInsertShapeHide:function(t,e){this.toolbar.btnInsertShape.pressed&&!this._isAddingShape&&this.toolbar.btnInsertShape.toggle(!1,!0),this._isAddingShape=!1,Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSortType:function(t,e){if(this.api){var i=this.api.asc_sortCellsRangeExpand();if(i){var n={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){"expand"!=e&&"sort"!=e||this.api.asc_sortColFilter(t,"",void 0,void 0,"expand"==e)},this)};Common.UI.alert(n)}else this.api.asc_sortColFilter(t,"",void 0,void 0,null!==i)}},onSearch:function(t,e){this.getApplication().getController("LeftMenu").showSearchDlg(!0)},onAutoFilter:function(t){var e=this._state.filter;this._state.filter=void 0,this.api&&(this._state.tablename||e?this.api.asc_changeAutoFilter(this._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!e):this.api.asc_addAutoFilter()),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Auto filter")},onClearFilter:function(t){this.api&&this.api.asc_clearFilter(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Clear filter")},onNumberFormat:function(t){this.api&&this.api.asc_setCellStyle(t.options.styleName),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatMenu:function(t,e){if(this.api)if(-1==e.value)if(this._state.numformatinfo&&this._state.numformatinfo.asc_getType()==Asc.c_oAscNumFormatType.Accounting)this.onCustomNumberFormat();else{var i=this.api.asc_getLocale();!i&&(i=this.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)):1033);var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.Accounting),n.asc_setSeparator(!1),n.asc_setSymbol(i);var o=this.api.asc_getFormatCells(n);this.onCustomNumberFormat(o&&o.length>0?o[0]:void 0,n)}else{var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.Accounting),n.asc_setSeparator(!1),n.asc_setSymbol(e.value);var o=this.api.asc_getFormatCells(n);o&&o.length>0&&this.api.asc_setCellFormat(o[0])}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatSelect:function(t,e){e?this.api&&this.api.asc_setCellFormat(e.format):this.onCustomNumberFormat(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onCustomNumberFormat:function(t,e){var i=this,n=i.api.asc_getLocale();!n&&(n=i.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(i.toolbar.mode.lang)):1033),new SSE.Views.FormatSettingsDialog({api:i.api,handler:function(t,e){e&&i.api.asc_setCellFormat(e.format),Common.NotificationCenter.trigger("edit:complete",i.toolbar)},props:{format:t||i._state.numformat,formatInfo:e||i._state.numformatinfo,langId:n}}).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatOpenBefore:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.toolbar.mode.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);var o=this.api.asc_getFormatCells(n);e.toolbar.numFormatData.forEach(function(t,i){e.toolbar.numFormatData[i].format=o[i]})}e.toolbar.numFormatData.forEach(function(t,i){t.exampleval=e.api.asc_getLocaleExample(t.format)}),e.toolbar.cmbNumberFormat.setData(e.toolbar.numFormatData),e.toolbar.cmbNumberFormat.setValue(e._state.numformattype,e.toolbar.txtCustom)}},onDecrement:function(t){this.api&&this.api.asc_decreaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Decrement")},onIncrement:function(t){this.api&&this.api.asc_increaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Increment")},onInsertFormulaMenu:function(t,e,i){if(this.api)if("more"===e.value){var n=this.getApplication().getController("FormulaDialog");n&&n.showDialog()}else e.value=e.value||"SUM",this.toolbar.fireEvent("function:apply",[{name:this.api.asc_getFormulaLocaleName(e.value),origin:e.value},!0]),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Insert formula")},onNamedRangeMenu:function(t,e,i){if(this.api){var n=this;if("paste"===e.value)new SSE.Views.NamedRangePasteDlg({handler:function(t,e){"ok"==t&&e&&(n.api.asc_insertFormula(e.asc_getName(!0),e.asc_getIsTable()?Asc.c_oAscPopUpSelectorType.Table:Asc.c_oAscPopUpSelectorType.Range,!1),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range")),Common.NotificationCenter.trigger("edit:complete",n.toolbar)},ranges:n.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook)}).show(),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range");else{var o=n.api.asc_getWorksheetsCount(),s=-1,a=[],l=[];if("new"===e.value){if(this._state.namedrange_locked)return void Common.NotificationCenter.trigger("namedrange:locked");for(;++s<o;)this.api.asc_isWorksheetHidden(s)||a.push({displayValue:n.api.asc_getWorksheetName(s),value:s});new SSE.Views.NamedRangeEditDlg({api:n.api,handler:function(t,e){"ok"==t&&e&&(n.api.asc_setDefinedNames(e),Common.component.Analytics.trackEvent("ToolBar","New Named Range")),Common.NotificationCenter.trigger("edit:complete",n.toolbar)},sheets:a,props:n.api.asc_getDefaultDefinedName(),isEdit:!1}).show()}else{for(var r=this.getApplication().getController("CellEditor");++s<o;)this.api.asc_isWorksheetHidden(s)||(l[s]=n.api.asc_getWorksheetName(s),a.push({displayValue:l[s],value:s}));new SSE.Views.NameManagerDlg({api:n.api,handler:function(t){Common.component.Analytics.trackEvent("ToolBar","Name Manager"),Common.NotificationCenter.trigger("edit:complete",n.toolbar)},locked:n._state.namedrange_locked,sheets:a,sheetNames:l,ranges:n.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.All),props:n.api.asc_getDefaultDefinedName(),sort:r.rangeListSort}).on("close",function(t){r.rangeListSort=t.getSettings()}).show()}}}},onNamedRangeMenuOpen:function(){if(this.api){var t=this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook);this.toolbar.btnNamedRange.menu.items[2].setDisabled(t.length<1)}},onClearStyleMenu:function(t,e,i){this.api&&this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Clear")},onCopyStyleToggle:function(t,e,i){this.api&&this.api.asc_formatPainter(e?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),this.modeAlwaysSetStyle=e},onCellInsertMenu:function(t,e,i){this.api&&this.api.asc_insertCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Cell insert")},onCellDeleteMenu:function(t,e,i){this.api&&this.api.asc_deleteCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Cell delete")},onColorSchemaClick:function(t,e){this.api&&(this.api.asc_ChangeColorScheme(e.value),Common.component.Analytics.trackEvent("ToolBar","Color Scheme")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onColorSchemaShow:function(t){if(this.api){var e=this.api.asc_GetCurrentColorSchemeName(),i=_.find(t.items,function(t){return t.value==e});i?i.setChecked(!0):t.clearAll()}},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onFontNameSelect:function(t,e){this.api&&(e.isNewFont?!this.getApplication().getController("Main").isModalShowed&&Common.UI.warning({width:500,closable:!1,msg:this.confirmAddFontName,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){"yes"==t?(this.api.asc_setCellFontName(e.name),Common.component.Analytics.trackEvent("ToolBar","Font Name")):this.toolbar.cmbFontName.setValue(this.api.asc_getCellInfo().asc_getFont().asc_getName()),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0})},this)}):(this.api.asc_setCellFontName(e.name),Common.component.Analytics.trackEvent("ToolBar","Font Name"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0})},onComboOpen:function(t,e){_.delay(function(){var i=$("input",e.cmpEl).select();t?i.focus():e.isMenuOpen()||i.one("mouseup",function(t){t.preventDefault()})},10)},onFontSizeSelect:function(t,e){this._state.fontsize=void 0,this.api&&this.api.asc_setCellFontSize(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(i.value)))return o=this._getApiTextSize(),Common.UI.warning({msg:this.textFontSizeErr,callback:function(){_.defer(function(t){$("input",e.cmpEl).focus()})}}),e.setRawValue(o),n.preventDefault(),!1}else o=parseFloat(i.value),o=o>409?409:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.asc_setCellFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onListStyleSelect:function(t,e){this._state.prstyle=void 0,this.api&&(this.api.asc_setCellStyle(e.get("name")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style"))},createDelayedElements:function(){var t=this;this.toolbar.createDelayedElements(),this.attachUIEvents(this.toolbar),this.appConfig.isEditDiagram||this.appConfig.isEditMailMerge||(this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onUpdateSheetViewSettings",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onEditorSelectionChanged",_.bind(this.onApiEditorSelectionChanged,this)),this.api.asc_registerCallback("asc_onUpdateDocumentProps",_.bind(this.onUpdateDocumentProps,this)),this.api.asc_registerCallback("asc_onLockDocumentProps",_.bind(this.onApiLockDocumentProps,this)),this.api.asc_registerCallback("asc_onUnLockDocumentProps",_.bind(this.onApiUnLockDocumentProps,this))),this.appConfig.isEditMailMerge||this.applyFormulaSettings(),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_onStopFormatPainter",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+l,ctrl+l":function(e){if(t.editMode&&!t._state.multiselect&&t.appConfig.canModifyFilter){var i=t.api.asc_getCellInfo(),n=i.asc_getAutoFilterInfo(),o=i.asc_getFormatTableInfo();n=n?n.asc_getIsAutoFilter():null,null===n||o||t._setTableFormat(t.api.asc_getDefaultTableStyle())}return!1},"command+shift+l,ctrl+shift+l":function(e){if(t.editMode&&t.api&&!t._state.multiselect&&t.appConfig.canModifyFilter){var i=t._state.filter;t._state.filter=void 0,t._state.tablename||i?t.api.asc_changeAutoFilter(t._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!i):t.api.asc_addAutoFilter()}return!1},"command+s,ctrl+s":function(e){t.onSave(),e.preventDefault(),e.stopPropagation()},"command+k,ctrl+k":function(e){!t.editMode||t.toolbar.mode.isEditMailMerge||t.toolbar.mode.isEditDiagram||t.api.isCellEdited||t._state.multiselect||t._state.inpivot||t.getApplication().getController("LeftMenu").leftMenu.menuFile.isVisible()||t.onHyperlink(),e.preventDefault()},"command+1,ctrl+1":function(e){return!t.editMode||t.toolbar.mode.isEditMailMerge||t.api.isCellEdited||t.toolbar.cmbNumberFormat.isDisabled()||t.onCustomNumberFormat(),!1}}}),this.onApiSelectionChanged(this.api.asc_getCellInfo()),this.attachToControlEvents(),this.onApiSheetChanged(),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},onChangeViewMode:function(t,e){this.toolbar.setFolded(e),this.toolbar.fireEvent("view:compact",[this,e]),Common.localStorage.setBool("sse-compact-toolbar",e),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onClickChangeCompact:function(t){"file"!=t&&Common.Utils.asyncCall(function(){this.onChangeViewMode(null,!this.toolbar.isCompact())},this)},fillTableTemplates:function(){if(this.toolbar.btnTableTemplate.rendered){var t=this;_.isUndefined(this.toolbar.mnuTableTemplatePicker)&&(this.toolbar.mnuTableTemplatePicker=function(e,i){var n=new Common.UI.DataView({el:e,parentMenu:i,restoreHeight:300,style:"max-height: 300px;",store:t.getCollection("TableTemplates"),itemTemplate:_.template('<div class="item-template"><img src="<%= imageUrl %>" id="<%= id %>" style="width:61px;height:46px;"></div>')});return n.on("item:click",function(e,i,n){t.api&&(t._state.tablestylename=null,t._setTableFormat(n?n.get("name"):t.api.asc_getDefaultTableStyle()),Common.NotificationCenter.trigger("edit:complete",t.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table Templates"))}),n.scroller&&n.scroller.update({alwaysVisibleY:!0}),n}($("#id-toolbar-menu-table-templates"),this.toolbar.btnTableTemplate.menu))}},onTableTplMenuOpen:function(t){this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));var e=this.toolbar.mnuTableTemplatePicker.scroller;e&&(e.update({alwaysVisibleY:!0}),e.scrollTop(0));var i=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:this._state.tablestylename});i?this.toolbar.mnuTableTemplatePicker.selectRecord(i):this.toolbar.mnuTableTemplatePicker.deselectAll()},onSendThemeColors:function(){this.toolbar.btnTableTemplate.rendered&&this.toolbar.btnTableTemplate.cmpEl.hasClass("open")&&this.onTableTplMenuOpen()},onApiInitTableTemplates:function(t){var e=this.getCollection("TableTemplates");if(e){var i=[];_.each(t,function(t){i.push({name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),e.reset(),e.add(i)}this.fillTableTemplates()},onApiInitEditorStyles:function(t){window.styles_loaded=!1;var e=this,i=e.toolbar.listStyles;if(!i)return void(e.styles=t);i.menuPicker.store.reset([]);var n=this.getApplication().getController("Main");_.each(t,function(t){i.menuPicker.store.add({imageUrl:t.asc_getImage(),name:t.asc_getName(),tip:n.translationTable[t.get_Name()]||t.get_Name(),uid:Common.UI.getId()})}),i.menuPicker.store.length>0&&i.rendered&&(i.fillComboView(i.menuPicker.store.at(0),!0),i.selectByIndex(0)),window.styles_loaded=!0},onApiCoAuthoringDisconnect:function(t){this.toolbar.setMode({isDisconnected:!0,enableDownload:!!t}),this.editMode=!1},onApiChartDblClick:function(){this.onEditChart(this.btnInsertChart)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.btnUndo.setDisabled(!e),this._state.can_undo=e):this._state.can_redo!==e&&(this.toolbar.btnRedo.setDisabled(!e),this._state.can_redo=e)},setDisabledComponents:function(t,e){_.each([].concat(t),function(t){t.isDisabled()!==e&&t.setDisabled(e)})},onApiEditCell:function(t){if(!($(".asc-window.enable-key-events:visible").length>0)){var e=this.toolbar;if(e.mode.isEditDiagram||e.mode.isEditMailMerge)i=t==Asc.c_oAscCellEditorState.editStart,e.lockToolbar(SSE.enumLock.editCell,t==Asc.c_oAscCellEditorState.editStart,{array:[e.btnDecDecimal,e.btnIncDecimal,e.cmbNumberFormat]});else if(t==Asc.c_oAscCellEditorState.editStart||t==Asc.c_oAscCellEditorState.editEnd){e.lockToolbar(SSE.enumLock.editCell,t==Asc.c_oAscCellEditorState.editStart,{array:[e.btnClearStyle.menu.items[1],e.btnClearStyle.menu.items[2],e.btnClearStyle.menu.items[3],e.btnClearStyle.menu.items[4],e.btnNamedRange.menu.items[0],e.btnNamedRange.menu.items[1]],merge:!0,clear:[SSE.enumLock.editFormula,SSE.enumLock.editText]});var i=t==Asc.c_oAscCellEditorState.editStart;i?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"),i&&(e.listStyles.suspendEvents(),e.listStyles.menuPicker.selectRecord(null),e.listStyles.resumeEvents(),this._state.prstyle=void 0)}else{if(t==Asc.c_oAscCellEditorState.editText)var n=!0,o=!1;else t==Asc.c_oAscCellEditorState.editFormula?n=!(o=!0):t==Asc.c_oAscCellEditorState.editEmptyCell&&(n=o=!1);e.lockToolbar(SSE.enumLock.editFormula,o,{array:[e.cmbFontName,e.cmbFontSize,e.btnIncFontSize,e.btnDecFontSize,e.btnBold,e.btnItalic,e.btnUnderline,e.btnStrikeout,e.btnSubscript,e.btnTextColor]}),e.lockToolbar(SSE.enumLock.editText,n,{array:[e.btnInsertFormula].concat(e.btnsFormula)})}this._state.coauthdisable=void 0,this._state.selection_type=void 0,this.checkInsertAutoshape({action:"cancel"})}},onApiZoomChange:function(t,e){},onApiSheetChanged:function(){if(this.toolbar.mode&&this.toolbar.mode.isEdit&&!this.toolbar.mode.isEditDiagram&&!this.toolbar.mode.isEditMailMerge){var t=this.api.asc_getActiveWorksheetIndex(),e=this.api.asc_getPageOptions(t),i=e.asc_getPageSetup();this.onApiPageOrient(i.asc_getOrientation()),this.onApiPageSize(i.asc_getWidth(),i.asc_getHeight()),this.onApiPageMargins(e.asc_getPageMargins()),this.api.asc_isLayoutLocked(t)?this.onApiLockDocumentProps(t):this.onApiUnLockDocumentProps(t),this.toolbar.lockToolbar(SSE.enumLock.printAreaLock,this.api.asc_isPrintAreaLocked(t),{array:[this.toolbar.btnPrintArea]})}},onUpdateDocumentProps:function(t){t==this.api.asc_getActiveWorksheetIndex()&&this.onApiSheetChanged()},onApiPageSize:function(t,e){void 0!==this._state.pgorient&&(Math.abs(this._state.pgsize[0]-t)>.1||Math.abs(this._state.pgsize[1]-e)>.1)&&(this._state.pgsize=[t,e],this.toolbar.mnuPageSize&&(this.toolbar.mnuPageSize.clearAll(),_.each(this.toolbar.mnuPageSize.items,function(i){if(i.value&&"object"==typeof i.value&&Math.abs(i.value[0]-t)<.1&&Math.abs(i.value[1]-e)<.1)return i.setChecked(!0),!1},this)))},onApiPageMargins:function(t){if(t){var e=t.asc_getLeft(),i=t.asc_getTop(),n=t.asc_getRight(),o=t.asc_getBottom();(!this._state.pgmargins||Math.abs(this._state.pgmargins[0]-i)>.1||Math.abs(this._state.pgmargins[1]-e)>.1||Math.abs(this._state.pgmargins[2]-o)>.1||Math.abs(this._state.pgmargins[3]-n)>.1)&&(this._state.pgmargins=[i,e,o,n],this.toolbar.btnPageMargins.menu&&(this.toolbar.btnPageMargins.menu.clearAll(),_.each(this.toolbar.btnPageMargins.menu.items,function(t){if(t.value&&"object"==typeof t.value&&Math.abs(t.value[0]-i)<.1&&Math.abs(t.value[1]-e)<.1&&Math.abs(t.value[2]-o)<.1&&Math.abs(t.value[3]-n)<.1)return t.setChecked(!0),!1},this)))}},onApiPageOrient:function(t){this._state.pgorient!==t&&(this.toolbar.btnPageOrient.menu.items[t==Asc.c_oAscPageOrientation.PagePortrait?0:1].setChecked(!0),this._state.pgorient=t)},onApiLockDocumentProps:function(t){!0!==this._state.lock_doc&&t==this.api.asc_getActiveWorksheetIndex()&&(this.toolbar.lockToolbar(SSE.enumLock.docPropsLock,!0,{array:[this.toolbar.btnPageSize,this.toolbar.btnPageMargins,this.toolbar.btnPageOrient]}),this._state.lock_doc=!0)},onApiUnLockDocumentProps:function(t){!1!==this._state.lock_doc&&t==this.api.asc_getActiveWorksheetIndex()&&(this.toolbar.lockToolbar(SSE.enumLock.docPropsLock,!1,{array:[this.toolbar.btnPageSize,this.toolbar.btnPageMargins,this.toolbar.btnPageOrient]}),this._state.lock_doc=!1)},onApiEditorSelectionChanged:function(t){if(this.editMode&&!($(".asc-window.enable-key-events:visible").length>0)){var e,i=this.toolbar;if(t.asc_getName()!=i.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",t),!i.mode.isEditMailMerge&&!i.mode.isEditDiagram){e=t.asc_getBold(),this._state.bold!==e&&(i.btnBold.toggle(!0===e,!0),this._state.bold=e),e=t.asc_getItalic(),this._state.italic!==e&&(i.btnItalic.toggle(!0===e,!0),this._state.italic=e),e=t.asc_getUnderline(),this._state.underline!==e&&(i.btnUnderline.toggle(!0===e,!0),this._state.underline=e),e=t.asc_getStrikeout(),this._state.strikeout!==e&&(i.btnStrikeout.toggle(!0===e,!0),this._state.strikeout=e);var n=t.asc_getSubscript(),o=t.asc_getSuperscript();if(this._state.subscript!==n||this._state.superscript!==o){var s=o?0:n?1:-1,a=i.btnSubscript;a.toggle(s>-1,!0),s<0?a.menu.clearAll():(a.menu.items[s].setChecked(!0),a.rendered&&a.$icon&&(a.$icon.removeClass(a.options.icls),a.options.icls=a.menu.items[s].options.icls,a.$icon.addClass(a.options.icls))),this._state.subscript=n,this._state.superscript=o}}var l=t.asc_getSize();this._state.fontsize!==l&&(i.cmbFontSize.setValue(void 0!==l?l:""),this._state.fontsize=l);var r,c,h=this.toolbar.mnuTextColorPicker;if(!i.btnTextColor.ischanged&&!h.isDummy){c=t.asc_getColor(),c&&(r=c.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(c.get_r(),c.get_g(),c.get_b()),effectValue:c.get_value()}:Common.Utils.ThemeColor.getHexColor(c.get_r(),c.get_g(),c.get_b()));var d=typeof r;if(d!==typeof this._state.clrtext||"object"==d&&(r.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(r.color)<0)||"object"!=d&&void 0!==this._state.clrtext&&this._state.clrtext.indexOf(r)<0){if(_.isObject(r)){for(var p=!1,m=0;m<10;m++)if(Common.Utils.ThemeColor.ThemeValues[m]==r.effectValue){h.select(r,!0),p=!0;break}p||h.clearSelection()}else h.select(r,!0);this._state.clrtext=r}this._state.clrtext_asccolor=c}}},onApiSelectionChanged:function(t){if(this.editMode&&!($(".asc-window.enable-key-events:visible").length>0)){if(this.toolbar.mode.isEditDiagram)return this.onApiSelectionChanged_DiagramEditor(t);if(this.toolbar.mode.isEditMailMerge)return this.onApiSelectionChanged_MailMergeEditor(t);var e,i=t.asc_getFlags().asc_getSelectionType(),n=!this.toolbar.mode.isEditMailMerge&&!this.toolbar.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()),o=this._disableEditOptions(i,n),s=this.toolbar,a=t.asc_getFont(),l=!1,r=a.asc_getName();r!=s.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",a);var c=a.asc_getSize();this._state.fontsize!==c&&(s.cmbFontSize.setValue(void 0!==c?c:""),this._state.fontsize=c),s.lockToolbar(SSE.enumLock.cantHyperlink,i==Asc.c_oAscSelectionType.RangeShapeText&&!1===this.api.asc_canAddShapeHyperlink(),{array:[s.btnInsertHyperlink]}),l=i==Asc.c_oAscSelectionType.RangeCells||i==Asc.c_oAscSelectionType.RangeCol||i==Asc.c_oAscSelectionType.RangeRow||i==Asc.c_oAscSelectionType.RangeMax,s.lockToolbar(SSE.enumLock.selRange,l,{array:[s.btnImgAlign,s.btnImgBackward,s.btnImgForward,s.btnImgGroup]});var h=this.api.asc_canGroupGraphicsObjects(),d=this.api.asc_canUnGroupGraphicsObjects();s.lockToolbar(SSE.enumLock.cantGroupUngroup,!h&&!d,{array:[s.btnImgGroup]}),s.btnImgGroup.menu.items[0].setDisabled(!h),s.btnImgGroup.menu.items[1].setDisabled(!d),s.lockToolbar(SSE.enumLock.cantGroup,!h,{array:[s.btnImgAlign]});var p=this.api.asc_getSelectedDrawingObjectsCount();if(s.btnImgAlign.menu.items[7].setDisabled(p<3),s.btnImgAlign.menu.items[8].setDisabled(p<3),!o){if(!s.mode.isEditMailMerge&&!s.mode.isEditDiagram){e=a.asc_getBold(),this._state.bold!==e&&(s.btnBold.toggle(!0===e,!0),this._state.bold=e),e=a.asc_getItalic(),this._state.italic!==e&&(s.btnItalic.toggle(!0===e,!0),this._state.italic=e),e=a.asc_getUnderline(),this._state.underline!==e&&(s.btnUnderline.toggle(!0===e,!0),this._state.underline=e),e=a.asc_getStrikeout(),this._state.strikeout!==e&&(s.btnStrikeout.toggle(!0===e,!0),this._state.strikeout=e);var m=a.asc_getSubscript(),u=a.asc_getSuperscript();if(this._state.subscript!==m||this._state.superscript!==u){var g=u?0:m?1:-1,b=s.btnSubscript;b.toggle(g>-1,!0),g<0?b.menu.clearAll():(b.menu.items[g].setChecked(!0),b.rendered&&(b.$icon.removeClass(b.options.icls),b.options.icls=b.menu.items[g].options.icls,b.$icon.addClass(b.options.icls))),this._state.subscript=m,this._state.superscript=u}}var f,C,v=this.toolbar.mnuTextColorPicker,y=this.toolbar.mnuBackColorPicker;if(!s.btnTextColor.ischanged&&!v.isDummy){C=a.asc_getColor(),C&&(f=C.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()),effectValue:C.get_value()}:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()));var x=typeof f,w=typeof this._state.clrtext;if(x!==w||"object"==x&&(f.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(f.color)<0)||"object"!=x&&void 0!==this._state.clrtext&&this._state.clrtext.indexOf(f)<0){if(_.isObject(f)){for(var S=!1,A=0;A<10;A++)if(Common.Utils.ThemeColor.ThemeValues[A]==f.effectValue){v.select(f,!0),S=!0;break}S||v.clearSelection()}else v.select(f,!0);this._state.clrtext=f}this._state.clrtext_asccolor=C}if(!s.btnBackColor.ischanged&&!y.isDummy){if(C=t.asc_getFill().asc_getColor(),f=C?C.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()),effectValue:C.get_value()}:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()):"transparent",x=typeof f,w=typeof this._state.clrback,x!==w||"object"==x&&(f.effectValue!==this._state.clrback.effectValue||this._state.clrback.color.indexOf(f.color)<0)||"object"!=x&&void 0!==this._state.clrback&&this._state.clrback.indexOf(f)<0){if(_.isObject(f)){var S=!1;for(A=0;A<10;A++)if(Common.Utils.ThemeColor.ThemeValues[A]==f.effectValue){y.select(f,!0),S=!0;break}S||y.clearSelection()}else y.select(f,!0);this._state.clrback=f}this._state.clrshd_asccolor=C}var k=i==Asc.c_oAscSelectionType.RangeChart||i==Asc.c_oAscSelectionType.RangeChartText;if(k!==this._state.in_chart&&(s.btnInsertChart.updateHint(k?s.tipChangeChart:s.tipInsertChart),this._state.in_chart=k),!k){if(!s.mode.isEditDiagram){var T=t.asc_getAutoFilterInfo(),I=t.asc_getFormatTableInfo();if(!s.mode.isEditMailMerge){
|
|
|
if(r=t.asc_getHorAlign(),this._state.pralign!==r){this._state.pralign=r;var E,g=-1;switch(r){case AscCommon.align_Left:g=0,E="btn-align-left";break;case AscCommon.align_Center:g=1,E="btn-align-center";break;case AscCommon.align_Right:g=2,E="btn-align-right";break;case AscCommon.align_Justify:g=3,E="btn-align-just";break;default:g=-255,E="btn-align-left"}g<0?-255==g&&(s.btnAlignRight.toggle(!1,!0),s.btnAlignLeft.toggle(!1,!0),s.btnAlignCenter.toggle(!1,!0),s.btnAlignJust.toggle(!1,!0),s.btnHorizontalAlign.menu.clearAll()):(s.btnAlignRight.toggle(2===g,!0),s.btnAlignLeft.toggle(0===g,!0),s.btnAlignCenter.toggle(1===g,!0),s.btnAlignJust.toggle(3===g,!0),s.btnHorizontalAlign.menu.items[g].setChecked(!0,!1));var P=this.toolbar.btnHorizontalAlign;P.rendered&&(P.$icon.removeClass(P.options.icls).addClass(E),P.options.icls=E)}if(l=r==AscCommon.align_Justify||i==Asc.c_oAscSelectionType.RangeShapeText,s.btnTextOrient.menu.items[1].setDisabled(l),s.btnTextOrient.menu.items[2].setDisabled(l),r=t.asc_getVertAlign(),this._state.valign!==r){switch(this._state.valign=r,g=-1,E="",r){case Asc.c_oAscVAlign.Top:g=0,E="btn-valign-top";break;case Asc.c_oAscVAlign.Center:g=1,E="btn-valign-middle";break;case Asc.c_oAscVAlign.Bottom:g=2,E="btn-valign-bottom"}if(g>-1){s.btnAlignTop.toggle(0===g,!0),s.btnAlignMiddle.toggle(1===g,!0),s.btnAlignBottom.toggle(2===g,!0),s.btnVerticalAlign.menu.items[g].setChecked(!0,!1);var M=this.toolbar.btnVerticalAlign;M.rendered&&(M.$icon.removeClass(M.options.icls).addClass(E),M.options.icls=E)}}l=this._state.controlsdisabled.filters||null!==I||T&&null===T.asc_getIsAutoFilter(),s.lockToolbar(SSE.enumLock.ruleMerge,l,{array:[s.btnMerge,s.btnInsertTable]}),e=t.asc_getFlags().asc_getMerge(),this._state.merge!==e&&(s.btnMerge.toggle(e===Asc.c_oAscMergeOptions.Merge,!0),this._state.merge=e),s.btnWrap.isDisabled()||(e=t.asc_getFlags().asc_getWrapText(),this._state.wrap!==e&&(s.btnWrap.toggle(!0===e,!0),this._state.wrap=e))}e=T?T.asc_getIsAutoFilter():null,this._state.filter!==e&&(s.btnsSetAutofilter.toggle(!0===e,!0),this._state.filter=e),l=this._state.controlsdisabled.filters||null===e,s.lockToolbar(SSE.enumLock.ruleFilter,l,{array:s.btnsSetAutofilter.concat(s.btnsSortDown,s.btnsSortUp,s.btnTableTemplate,s.btnInsertTable)}),e=I?I.asc_getTableStyleName():null,this._state.tablestylename!==e&&this.toolbar.mnuTableTemplatePicker&&(e=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:e}),e?(this.toolbar.mnuTableTemplatePicker.selectRecord(e),this._state.tablestylename=e.get("name")):(s.mnuTableTemplatePicker.deselectAll(),this._state.tablestylename=null)),l=this._state.controlsdisabled.filters||!T||!0!==T.asc_getIsApplyAutoFilter(),s.lockToolbar(SSE.enumLock.ruleDelFilter,l,{array:s.btnsClearAutofilter});var D=this._state.tablename;this._state.tablename=I?I.asc_getTableName():void 0;var F=this._state.filterapplied;this._state.filterapplied=this._state.filter&&T.asc_getIsApplyAutoFilter(),this._state.tablename===D&&this._state.filterapplied===F||this.getApplication().getController("Statusbar").onApiFilterInfo(!l),this._state.multiselect=t.asc_getFlags().asc_getMultiselect(),s.lockToolbar(SSE.enumLock.multiselect,this._state.multiselect,{array:[s.btnTableTemplate,s.btnInsertHyperlink,s.btnInsertTable]}),this._state.inpivot=!!t.asc_getPivotTableInfo(),s.lockToolbar(SSE.enumLock.editPivot,this._state.inpivot,{array:s.btnsSetAutofilter.concat(s.btnsClearAutofilter,s.btnsSortDown,s.btnsSortUp,s.btnMerge,s.btnInsertHyperlink,s.btnInsertTable)}),l=!this.appConfig.canModifyFilter,s.lockToolbar(SSE.enumLock.cantModifyFilter,l,{array:s.btnsSetAutofilter.concat(s.btnsSortDown,s.btnsSortUp,s.btnTableTemplate,s.btnClearStyle.menu.items[0],s.btnClearStyle.menu.items[2],s.btnInsertTable)})}if(e=t.asc_getNumFormatInfo(),e&&(this._state.numformat=t.asc_getNumFormat(),this._state.numformatinfo=e,e=e.asc_getType(),this._state.numformattype!==e&&(s.cmbNumberFormat.setValue(e,s.txtCustom),this._state.numformattype=e)),i==Asc.c_oAscSelectionType.RangeShapeText)for(var U=this.api.asc_getGraphicObjectProps(),A=0;A<U.length;++A)U[A].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&(e=U[A].asc_getObjectValue().asc_getVert());else e=t.asc_getAngle();if(this._state.angle!==e){switch(s.btnTextOrient.menu.clearAll(),e){case 45:s.btnTextOrient.menu.items[1].setChecked(!0,!0);break;case-45:s.btnTextOrient.menu.items[2].setChecked(!0,!0);break;case 90:case Asc.c_oAscVertDrawingText.vert270:s.btnTextOrient.menu.items[3].setChecked(!0,!0);break;case-90:case Asc.c_oAscVertDrawingText.vert:s.btnTextOrient.menu.items[4].setChecked(!0,!0);break;default:s.btnTextOrient.menu.items[0].setChecked(!0,!0)}this._state.angle=e}if(e=t.asc_getStyleName(),this._state.prstyle!=e&&!this.toolbar.listStyles.isDisabled()){var V=this.toolbar.listStyles;if(V.rendered){V.suspendEvents();var R=V.menuPicker.store.findWhere({name:e});this._state.prstyle=V.menuPicker.store.length>0?e:void 0,V.menuPicker.selectRecord(R),V.resumeEvents()}}e=i==Asc.c_oAscSelectionType.RangeRow,this._state.controlsdisabled.rows!==e&&(this._state.controlsdisabled.rows=e,s.btnAddCell.menu.items[3].setDisabled(e),s.btnDeleteCell.menu.items[3].setDisabled(e)),e=i==Asc.c_oAscSelectionType.RangeCol,this._state.controlsdisabled.cols!==e&&(this._state.controlsdisabled.cols=e,s.btnAddCell.menu.items[2].setDisabled(e),s.btnDeleteCell.menu.items[2].setDisabled(e)),e=T&&T.asc_getIsApplyAutoFilter(),this._state.controlsdisabled.cells_right!==(this._state.controlsdisabled.rows||e)&&(this._state.controlsdisabled.cells_right=this._state.controlsdisabled.rows||e,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||e)&&(this._state.controlsdisabled.cells_down=this._state.controlsdisabled.cols||e,s.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down),s.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down)),s.lockToolbar(SSE.enumLock.commentLock,i==Asc.c_oAscSelectionType.RangeCells&&(t.asc_getComments().length>0||t.asc_getLocked()),{array:this.btnsComment}),s.lockToolbar(SSE.enumLock.headerLock,t.asc_getLockedHeaderFooter(),{array:[this.toolbar.btnEditHeader]})}}}},onApiSelectionChanged_DiagramEditor:function(t){if(this.editMode&&!this.api.isCellEdited&&!this.api.isRangeSelection){var e=this,i=t.asc_getFlags().asc_getSelectionType();if(!function(t,i){var n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&e._state.selection_type===t&&e._state.coauthdisable===i)return t===Asc.c_oAscSelectionType.RangeImage;if(r){c=e.api.asc_getGraphicObjectProps().some(function(t){return t.asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&t.asc_getObjectValue().asc_getLocked()})}var h=SSE.enumLock,d=t;switch(t){case Asc.c_oAscSelectionType.RangeImage:d=h.selImage;break;case Asc.c_oAscSelectionType.RangeShape:d=h.selShape;break;case Asc.c_oAscSelectionType.RangeShapeText:d=h.selShapeText;break;case Asc.c_oAscSelectionType.RangeChart:d=h.selChart;break;case Asc.c_oAscSelectionType.RangeChartText:d=h.selChartText}return e.toolbar.lockToolbar(d,d!=t,{clear:[h.selImage,h.selChart,h.selChartText,h.selShape,h.selShapeText,h.coAuth]}),e.toolbar.lockToolbar(SSE.enumLock.coAuthText,c),l}(i,!1)&&i!=Asc.c_oAscSelectionType.RangeChart&&i!=Asc.c_oAscSelectionType.RangeChartText){var n=t.asc_getNumFormatInfo();n&&(this._state.numformat=t.asc_getNumFormat(),this._state.numformatinfo=n,n=n.asc_getType(),this._state.numformattype!==n&&(e.toolbar.cmbNumberFormat.setValue(n,e.toolbar.txtCustom),this._state.numformattype=n))}}},onApiSelectionChanged_MailMergeEditor:function(t){if(this.editMode&&!this.api.isCellEdited&&!this.api.isRangeSelection){var e,i=this,n=t.asc_getFlags().asc_getSelectionType(),o=function(t,e){var n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&i._state.selection_type===t&&i._state.coauthdisable===e)return t===Asc.c_oAscSelectionType.RangeImage;if(r){c=i.api.asc_getGraphicObjectProps().some(function(t){return t.asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&t.asc_getObjectValue().asc_getLocked()})}return i.toolbar.lockToolbar(SSE.enumLock.coAuthText,c),l}(n,!1),s=!1;if(!o&&n!=Asc.c_oAscSelectionType.RangeChart&&n!=Asc.c_oAscSelectionType.RangeChartText&&!i.toolbar.mode.isEditDiagram){var a=t.asc_getAutoFilterInfo();e=a?a.asc_getIsAutoFilter():null,this._state.filter!==e&&(i.toolbar.btnSetAutofilter.toggle(!0===e,!0),this._state.filter=e),s=this._state.controlsdisabled.filters||null===e,i.toolbar.lockToolbar(SSE.enumLock.ruleFilter,s,{array:[i.toolbar.btnSetAutofilter,i.toolbar.btnSortDown,i.toolbar.btnSortUp]}),s=this._state.controlsdisabled.filters||!a||!0!==a.asc_getIsApplyAutoFilter(),i.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter,s,{array:[i.toolbar.btnClearAutofilter]})}}},onApiStyleChange:function(){this.toolbar.btnCopyStyle.toggle(!1,!0),this.modeAlwaysSetStyle=!1},updateThemeColors:function(){var t=function(t,e){if(t){for(var i,n=Common.Utils.ThemeColor.getEffectColors(),o=0;o<n.length;o++)"object"==typeof t.currentColor&&void 0===i&&t.currentColor.effectId==n[o].effectId&&(i=n[o]);t.updateColors(n,Common.Utils.ThemeColor.getStandartColors()),void 0===t.currentColor?t.currentColor=e:void 0!==i&&(t.currentColor=i)}};t(this.toolbar.mnuTextColorPicker,Common.Utils.ThemeColor.getStandartColors()[1]),void 0===this.toolbar.btnTextColor.currentColor?this.toolbar.btnTextColor.currentColor=Common.Utils.ThemeColor.getStandartColors()[1]:this.toolbar.btnTextColor.currentColor=this.toolbar.mnuTextColorPicker.currentColor.color||this.toolbar.mnuTextColorPicker.currentColor,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+this.toolbar.btnTextColor.currentColor),t(this.toolbar.mnuBackColorPicker,Common.Utils.ThemeColor.getStandartColors()[3]),void 0===this.toolbar.btnBackColor.currentColor?this.toolbar.btnBackColor.currentColor=Common.Utils.ThemeColor.getStandartColors()[3]:this.toolbar.btnBackColor.currentColor=this.toolbar.mnuBackColorPicker.currentColor.color||this.toolbar.mnuBackColorPicker.currentColor,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color","transparent"==this.toolbar.btnBackColor.currentColor?"transparent":"#"+this.toolbar.btnBackColor.currentColor),void 0===this._state.clrtext_asccolor&&void 0===this._state.clrshd_asccolor||(this._state.clrtext=void 0,this._state.clrback=void 0,this.onApiSelectionChanged(this.api.asc_getCellInfo())),this._state.clrtext_asccolor=void 0,this._state.clrshd_asccolor=void 0,this.toolbar.mnuBorderColorPicker&&(t(this.toolbar.mnuBorderColorPicker,Common.Utils.ThemeColor.getEffectColors()[1]),this.toolbar.btnBorders.options.borderscolor=this.toolbar.mnuBorderColorPicker.currentColor.color||this.toolbar.mnuBorderColorPicker.currentColor,$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+this.toolbar.btnBorders.options.borderscolor))},hideElements:function(t){if(_.isUndefined(t.compact)||this.onChangeViewMode(t.compact),!_.isUndefined(t.formula)){var e=this.getApplication().getController("CellEditor").getView("CellEditor");e&&e.setVisible(!t.formula),Common.NotificationCenter.trigger("layout:changed","celleditor",t.formula?"hidden":"showed")}_.isUndefined(t.headings)||this.api&&this.api.asc_setDisplayHeadings(!t.headings),_.isUndefined(t.gridlines)||this.api&&this.api.asc_setDisplayGridlines(!t.gridlines),_.isUndefined(t.freezepanes)||this.api&&this.api.asc_freezePane(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},fillAutoShapes:function(){for(var t=this,e=this.getApplication().getCollection("ShapeGroups"),i=0;i<e.length;i++){var n=e.at(i),o=new Common.UI.MenuItem({caption:n.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-shapegroup'+i+'" class="menu-shape" style="width: '+(n.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});t.toolbar.btnInsertShape.menu.addItem(o);new Common.UI.DataView({el:$("#id-toolbar-menu-shapegroup"+i),store:n.get("groupStore"),parentMenu:o.menu,showLast:!1,itemTemplate:_.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class="icon"><use xlink:href="#svg-icon-<%= data.shapeType %>"></use></svg></div>')}).on("item:click",function(e,i,n,o){t.api&&(n&&(t._addAutoshape(!0,n.get("data").shapeType),t._isAddingShape=!0),t.toolbar.btnInsertText.pressed&&t.toolbar.btnInsertText.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertShape.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Shape"))})}},fillTextArt:function(){if(this.toolbar.btnInsertTextArt.rendered){var t=this;if(this.toolbar.mnuTextArtPicker){var e=this.getApplication().getCollection("Common.Collections.TextArt").models,i=this.toolbar.mnuTextArtPicker.store.length;if(i>0&&i==e.length){var n=this.toolbar.mnuTextArtPicker.store.models;_.each(e,function(t,e){n[e].set("imageUrl",t.get("imageUrl"))})}else this.toolbar.mnuTextArtPicker.store.reset(e)}else this.toolbar.mnuTextArtPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insart"),store:this.getApplication().getCollection("Common.Collections.TextArt"),parentMenu:this.toolbar.btnInsertTextArt.menu,showLast:!1,itemTemplate:_.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>" style="width:50px;height:50px;"></div>')}),this.toolbar.mnuTextArtPicker.on("item:click",function(e,i,n,o){n&&(t.toolbar.fireEvent("inserttextart",t.toolbar),t.api.asc_addTextArt(n.get("data"))),t.toolbar.btnInsertShape.pressed&&t.toolbar.btnInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertTextArt.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertTextArt),Common.component.Analytics.trackEvent("ToolBar","Add Text Art")})}},fillEquations:function(){if(this.toolbar.btnInsertEquation.rendered&&!(this.toolbar.btnInsertEquation.menu.items.length>0)){var t=this,e=this.getApplication().getCollection("EquationGroups");t.equationPickers=[],t.toolbar.btnInsertEquation.menu.removeAll();for(var i=0;i<e.length;++i){var n=e.at(i),o=new Common.UI.MenuItem({caption:n.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-equationgroup'+i+'" class="menu-shape" style="width:'+(n.get("groupWidth")+8)+"px; "+n.get("groupHeight")+'margin-left:5px;"></div>')}]})});t.toolbar.btnInsertEquation.menu.addItem(o);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-equationgroup"+i),store:n.get("groupStore"),parentMenu:o.menu,showLast:!1,itemTemplate:_.template('<div class="item-equation" style="background-position:<%= posX %>px <%= posY %>px;" ><div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">')});n.get("groupHeight").length&&(t.equationPickers.push(s),t.toolbar.btnInsertEquation.menu.on("show:after",function(){if(t.equationPickers.length){var e=$(this.el).find(".over").find(".menu-shape");if(e.length)for(var i=0;i<t.equationPickers.length;++i)if(e[0].id==t.equationPickers[i].el.id)return t.equationPickers[i].scroller.update({alwaysVisibleY:!0}),void t.equationPickers.splice(i,1)}})),s.on("item:click",function(e,i,n,o){t.api&&(n&&t.api.asc_AddMath(n.get("data").equationType),t.toolbar.btnInsertText.pressed&&t.toolbar.btnInsertText.toggle(!1,!0),t.toolbar.btnInsertShape.pressed&&t.toolbar.btnInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertEquation.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertEquation),Common.component.Analytics.trackEvent("ToolBar","Add Equation"))})}}},onInsertEquationClick:function(){this.api&&(this.api.asc_AddMath(),Common.component.Analytics.trackEvent("ToolBar","Add Equation")),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertEquation)},onMathTypes:function(t){var e=[],i=this.getCollection("EquationGroups");i.reset();var n={};n[Common.define.c_oAscMathMainType.Symbol]=[this.textSymbols,11],n[Common.define.c_oAscMathMainType.Fraction]=[this.textFraction,4],n[Common.define.c_oAscMathMainType.Script]=[this.textScript,4],n[Common.define.c_oAscMathMainType.Radical]=[this.textRadical,4],n[Common.define.c_oAscMathMainType.Integral]=[this.textIntegral,3,!0],n[Common.define.c_oAscMathMainType.LargeOperator]=[this.textLargeOperator,5,!0],n[Common.define.c_oAscMathMainType.Bracket]=[this.textBracket,4,!0],n[Common.define.c_oAscMathMainType.Function]=[this.textFunction,3,!0],n[Common.define.c_oAscMathMainType.Accent]=[this.textAccent,4],n[Common.define.c_oAscMathMainType.LimitLog]=[this.textLimitAndLog,3],n[Common.define.c_oAscMathMainType.Operator]=[this.textOperator,4],n[Common.define.c_oAscMathMainType.Matrix]=[this.textMatrix,4,!0];var o={},s="",a="";for(s in Common.define.c_oAscMathType)if(Common.define.c_oAscMathType.hasOwnProperty(s)){var l=s.split("_");a=2==l.length&&"Symbol"==l[0]?"txt"+l[0]+"_"+l[1].toLocaleLowerCase():"txt"+s,o[Common.define.c_oAscMathType[s]]=this[a]}var r,c=0,h=0,d=0,p=0,m=0,u=null,g=null,b=null;if(t&&(h=t.get_Data().length)){for(var f=0;f<h;++f)if(c=t.get_Data()[f].get_Id(),p=t.get_Data()[f].get_W(),m=t.get_Data()[f].get_H(),u=new Backbone.Collection([],{model:SSE.Models.EquationModel})){var C=0,v=0,_=0;for(d=t.get_Data()[f].get_Data().length,r=0;r<d;++r){g=t.get_Data()[f].get_Data()[r],v=g.get_Data().length;for(var y=0;y<v;++y)b=g.get_Data()[y],_=b.get_Id(),a="",o.hasOwnProperty(_)&&(a=o[_]),u.add({data:{equationType:_},tip:a,allowSelected:!0,selected:!1,width:g.get_W(),height:g.get_H(),posX:-b.get_X(),posY:-b.get_Y()});C+=v}p=n[c][1]*(p+10);var x=parseInt(370/(m+10))*(m+10);e.push({groupName:n[c][0],groupStore:u,groupWidth:p,groupHeight:n[c][2]?" height:"+x+"px!important; ":""})}i.add(e),this.fillEquations()}},attachToControlEvents:function(){},_disableEditOptions:function(t,e){if(this.api.isCellEdited)return!0;if(this.api.isRangeSelection)return!0;var i=this.toolbar,n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&this._state.selection_type===t&&this._state.coauthdisable===e)return t===Asc.c_oAscSelectionType.RangeImage;if(r)for(var h=this.api.asc_getGraphicObjectProps(),d=0;d<h.length;++d)h[d].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&(c=c||h[d].asc_getObjectValue().asc_getLocked());if(e)i.lockToolbar(SSE.enumLock.coAuth,e);else{var p=SSE.enumLock,m=t;switch(t){case Asc.c_oAscSelectionType.RangeImage:m=p.selImage;break;case Asc.c_oAscSelectionType.RangeShape:m=p.selShape;break;case Asc.c_oAscSelectionType.RangeShapeText:m=p.selShapeText;break;case Asc.c_oAscSelectionType.RangeChart:m=p.selChart;break;case Asc.c_oAscSelectionType.RangeChartText:m=p.selChartText}this.appConfig.isEditDiagram||this.appConfig.isEditMailMerge||i.lockToolbar(m,m!=t,{array:[i.btnClearStyle.menu.items[1],i.btnClearStyle.menu.items[2],i.btnClearStyle.menu.items[3],i.btnClearStyle.menu.items[4]],merge:!0,clear:[p.selImage,p.selChart,p.selChartText,p.selShape,p.selShapeText,p.coAuth]}),i.lockToolbar(SSE.enumLock.coAuthText,c),i.lockToolbar(SSE.enumLock.coAuthText,c&&(t==Asc.c_oAscSelectionType.RangeChart||t==Asc.c_oAscSelectionType.RangeChartText),{array:[i.btnInsertChart]})}return this._state.controlsdisabled.filters=l||r||e,(l||r||e)&&(i.listStyles&&(i.listStyles.suspendEvents(),i.listStyles.menuPicker.selectRecord(null),i.listStyles.resumeEvents()),this._state.prstyle=void 0),this._state.selection_type=t,this._state.coauthdisable=e,l},_getApiTextSize:function(){var t=this.api.asc_getCellInfo();return t?t.asc_getFont().asc_getSize():12},_setTableFormat:function(t){var e=this;if(!0!==e.api.isRangeSelection)if(e.api.asc_getCellInfo().asc_getFormatTableInfo())if(e._state.filter=void 0,e._state.tablename)e.api.asc_changeAutoFilter(e._state.tablename,Asc.c_oAscChangeFilterOptions.style,t);else{var i=e.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType();i==Asc.c_oAscSelectionType.RangeMax||i==Asc.c_oAscSelectionType.RangeRow||i==Asc.c_oAscSelectionType.RangeCol?Common.UI.warning({title:e.textLongOperation,msg:e.warnLongOperation,buttons:["ok","cancel"],callback:function(i){"ok"==i&&setTimeout(function(){e.toolbar.fireEvent("inserttable",e.toolbar),e.api.asc_addAutoFilter(t)},1),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}):(e.toolbar.fireEvent("inserttable",e.toolbar),e.api.asc_addAutoFilter(t))}else{var n=function(i,n){if("ok"==n)if(e._state.filter=void 0,e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),e._state.tablename)e.api.asc_changeAutoFilter(e._state.tablename,Asc.c_oAscChangeFilterOptions.style,t);else{var o=i.getSettings();o.selectionType==Asc.c_oAscSelectionType.RangeMax||o.selectionType==Asc.c_oAscSelectionType.RangeRow||o.selectionType==Asc.c_oAscSelectionType.RangeCol?Common.UI.warning({title:e.textLongOperation,msg:e.warnLongOperation,buttons:["ok","cancel"],callback:function(i){"ok"==i&&setTimeout(function(){e.toolbar.fireEvent("inserttable",e.toolbar),e.api.asc_addAutoFilter(t,o.range)},1),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}):(e.toolbar.fireEvent("inserttable",e.toolbar),e.api.asc_addAutoFilter(t,o.range))}Common.NotificationCenter.trigger("edit:complete",e.toolbar)},o=new SSE.Views.TableOptionsDialog({handler:n});o.show(),o.setSettings({api:e.api,selectionType:e.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()})}},onHideMenus:function(t){Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0})},onSetupCopyStyleButton:function(){this.modeAlwaysSetStyle=!1;var t=this;Common.NotificationCenter.on({"edit:complete":function(){t.api&&t.modeAlwaysSetStyle&&(t.api.asc_formatPainter(AscCommon.c_oAscFormatPainterState.kOff),t.toolbar.btnCopyStyle.toggle(!1,!0),t.modeAlwaysSetStyle=!1)}}),$(t.toolbar.btnCopyStyle.cmpEl).dblclick(function(){t.api&&(t.modeAlwaysSetStyle=!0,t.toolbar.btnCopyStyle.toggle(!0,!0),t.api.asc_formatPainter(AscCommon.c_oAscFormatPainterState.kMultiple))})},onCellsRange:function(t){this.api.isRangeSelection=t!=Asc.c_oAscSelectionDialogType.None,this.onApiEditCell(this.api.isRangeSelection?Asc.c_oAscCellEditorState.editStart:Asc.c_oAscCellEditorState.editEnd);var e=this.toolbar;e.lockToolbar(SSE.enumLock.selRangeEdit,this.api.isRangeSelection),this.setDisabledComponents([e.btnUndo],this.api.isRangeSelection||!this.api.asc_getCanUndo()),this.setDisabledComponents([e.btnRedo],this.api.isRangeSelection||!this.api.asc_getCanRedo()),this.onApiSelectionChanged(this.api.asc_getCellInfo())},onLockDefNameManager:function(t){this._state.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager,this.toolbar.lockToolbar(SSE.enumLock.printAreaLock,this.api.asc_isPrintAreaLocked(this.api.asc_getActiveWorksheetIndex()),{array:[this.toolbar.btnPrintArea]}),this.toolbar.lockToolbar(SSE.enumLock.namedRangeLock,this._state.namedrange_locked,{array:[this.toolbar.btnPrintArea.menu.items[0],this.toolbar.btnPrintArea.menu.items[2]]})},activateControls:function(){this.toolbar.lockToolbar(SSE.enumLock.disableOnStart,!1,{array:[this.toolbar.btnPrint]}),this._state.activated=!0},DisableToolbar:function(t,e){void 0!==e&&(this.editMode=!e),t=t||!this.editMode;var i=$(".toolbar-mask");if(!(t&&i.length>0||!t&&0==i.length)){var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",t),this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen,t),t?(i=$("<div class='toolbar-mask'>").appendTo(n.$el.find(".toolbar")),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")):(i.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(){if(this.toolbar.btnInsertFormula&&this.toolbar.btnInsertFormula.rendered)for(var t=this.toolbar.btnInsertFormula.menu.items,e=0;e<Math.min(4,t.length);e++)t[e].setCaption(this.api.asc_getFormulaLocaleName(t[e].value))},onAppShowed:function(t){var e=this;e.appConfig=t;var i=!t.isEdit;!t.isEdit||t.isEditDiagram||t.isEditMailMerge||(Common.localStorage.itemExists("sse-compact-toolbar")?i=Common.localStorage.getBool("sse-compact-toolbar"):t.customization&&t.customization.compactToolbar&&(i=!0)),e.toolbar.render(_.extend({isCompactView:i},t)),Common.Utils.asyncCall(function(){if(t.isEdit&&(e.toolbar.setMode(t),e.toolbar.btnSave&&e.toolbar.btnSave.on("disabled",_.bind(e.onBtnChangeState,e,"save:disabled")),e.toolbar.btnUndo&&e.toolbar.btnUndo.on("disabled",_.bind(e.onBtnChangeState,e,"undo:disabled")),e.toolbar.btnRedo&&e.toolbar.btnRedo.on("disabled",_.bind(e.onBtnChangeState,e,"redo:disabled")),e.toolbar.btnPrint&&e.toolbar.btnPrint.on("disabled",_.bind(e.onBtnChangeState,e,"print:disabled")),e.toolbar.setApi(e.api),!t.isEditDiagram&&!t.isEditMailMerge)){var i=e.getApplication().getController("DataTab");i.setApi(e.api).setConfig({toolbar:e}),i=i.getView("DataTab"),Array.prototype.push.apply(e.toolbar.lockControls,i.getButtons()),e.toolbar.btnsSortDown=i.getButtons("sort-down"),e.toolbar.btnsSortUp=i.getButtons("sort-up"),e.toolbar.btnsSetAutofilter=i.getButtons("set-filter"),e.toolbar.btnsClearAutofilter=i.getButtons("clear-filter");var n=e.getApplication().getController("FormulaDialog");n.setConfig({toolbar:e}),n=n.getView("FormulaTab"),e.toolbar.btnsFormula=n.getButtons("formula"),Array.prototype.push.apply(e.toolbar.lockControls,n.getButtons()),t.isOffline||(o={action:"pivot",caption:e.textPivot},(s=e.getApplication().getController("PivotTable").createToolbarPanel())&&(e.toolbar.addTab(o,s,5),e.toolbar.setVisible("pivot",!0)));var o={action:"review",caption:e.toolbar.textTabCollaboration},s=e.getApplication().getController("Common.Controllers.ReviewChanges").createToolbarPanel();if(s&&e.toolbar.addTab(o,s,6),!t.customization||!t.customization.compactHeader){e.toolbar.btnPrint.$el.parents(".group").hide().next().hide();var a=e.toolbar.btnUndo.$el.hide().next().hide().parent();e.toolbar.btnPaste.$el.detach().appendTo(a),e.toolbar.btnCopy.$el.removeClass("split")}t.isDesktopApp&&t.canProtect&&(o={action:"protect",caption:e.toolbar.textTabProtect},(s=e.getApplication().getController("Common.Controllers.Protection").createToolbarPanel())&&e.toolbar.addTab(o,s,7))}})},onAppReady:function(t){var e=this;if(e.appOptions=t,this.btnsComment=[],t.canCoAuthoring&&t.canComments){var i=SSE.enumLock;if(this.btnsComment=Common.Utils.injectButtons(this.toolbar.$el.find(".slot-comment"),"tlbtn-addcomment-","btn-menu-comments",this.toolbar.capBtnComment,[i.lostConnect,i.commentLock,i.editCell]),this.btnsComment.length){var n=SSE.getController("Common.Controllers.Comments").getView();Array.prototype.push.apply(e.toolbar.lockControls,this.btnsComment),this.btnsComment.forEach(function(t){t.updateHint(n.textHintAddComment),t.on("click",function(t,i){Common.NotificationCenter.trigger("app:comment:add","toolbar",e.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()!=Asc.c_oAscSelectionType.RangeCells)})},this)}}Common.Utils.asyncCall(function(){t.isEdit&&e.toolbar.onAppReady(t)})},onFileMenu:function(t){"show"==t?this.toolbar.isTabActive("file")||this.toolbar.setTab("file"):this.toolbar.isTabActive("file")&&this.toolbar.setTab()},onPageSizeClick:function(t,e,i){this.api&&i&&(this._state.pgsize=[0,0],this.api.asc_changeDocSize(e.value[0],e.value[1],this.api.asc_getActiveWorksheetIndex()),Common.component.Analytics.trackEvent("ToolBar","Page Size")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPageMarginsSelect:function(t,e){if(this.api){if(this._state.pgmargins=void 0,"advanced"!==e.value)this.api.asc_changePageMargins(e.value[1],e.value[3],e.value[0],e.value[2],this.api.asc_getActiveWorksheetIndex());else{var i,n,o=this;i=new SSE.Views.PageMarginsDialog({handler:function(t,e){if("ok"==e){n=t.getSettings();var i=o.toolbar.btnPageMargins.menu.items[0];i.setVisible(!0),i.setChecked(!0),i.options.value=i.value=[n.asc_getTop(),n.asc_getLeft(),n.asc_getBottom(),n.asc_getRight()],$(i.el).html(i.template({id:Common.UI.getId(),caption:i.caption,options:i.options})),Common.localStorage.setItem("sse-pgmargins-top",n.asc_getTop()),Common.localStorage.setItem("sse-pgmargins-left",n.asc_getLeft()),Common.localStorage.setItem("sse-pgmargins-bottom",n.asc_getBottom()),Common.localStorage.setItem("sse-pgmargins-right",n.asc_getRight()),o.api.asc_changePageMargins(n.asc_getLeft(),n.asc_getRight(),n.asc_getTop(),n.asc_getBottom(),o.api.asc_getActiveWorksheetIndex()),Common.NotificationCenter.trigger("edit:complete",o.toolbar)}}}),i.show(),i.setSettings(o.api.asc_getPageOptions(o.api.asc_getActiveWorksheetIndex()))}Common.component.Analytics.trackEvent("ToolBar","Page Margins")}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPageOrientSelect:function(t,e){this._state.pgorient=void 0,this.api&&e.checked&&this.api.asc_changePageOrient(e.value==Asc.c_oAscPageOrientation.PagePortrait,this.api.asc_getActiveWorksheetIndex()),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Page Orientation")},onImgGroupSelect:function(t,e){this.api&&this.api["grouping"==e.value?"asc_groupGraphicsObjects":"asc_unGroupGraphicsObjects"](),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Objects Group")},onImgArrangeSelect:function(t,e){this.api&&("forward"==t?this.api.asc_setSelectedDrawingObjectLayer(Asc.c_oAscDrawingLayerType.BringForward):"backward"==t?this.api.asc_setSelectedDrawingObjectLayer(Asc.c_oAscDrawingLayerType.SendBackward):this.api.asc_setSelectedDrawingObjectLayer(e.value)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Objects Arrange")},onImgAlignSelect:function(t,e){this.api&&(e.value>-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.component.Analytics.trackEvent("ToolBar","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.component.Analytics.trackEvent("ToolBar","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.component.Analytics.trackEvent("ToolBar","Distribute"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPrintAreaClick:function(t,e){this.api&&(this.api.asc_ChangePrintArea(e.value),Common.component.Analytics.trackEvent("ToolBar","Print Area")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPrintAreaMenuOpen:function(){this.api&&this.toolbar.btnPrintArea.menu.items[2].setVisible(this.api.asc_CanAddPrintArea())},onEditHeaderClick:function(t){var e=this;if(_.isUndefined(e.fontStore)){e.fontStore=new Common.Collections.Fonts;var i=e.toolbar.cmbFontName.store.toJSON(),n=[];_.each(i,function(t,e){t.cloneid||n.push(_.clone(t))}),e.fontStore.add(n)}new SSE.Views.HeaderFooterDialog({api:e.api,fontStore:e.fontStore,handler:function(t,e){Common.NotificationCenter.trigger("edit:complete")}}).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},textEmptyImgUrl:"You need to specify image URL.",warnMergeLostData:"Operation can destroy data in the selected cells.<br>Continue?",textWarning:"Warning",
|
|
|
textFontSizeErr:"The entered value is incorrect.<br>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.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?",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",textLongOperation:"Long operation",warnLongOperation:"The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?",txtInvalidRange:"ERROR! Invalid cells range",errorMaxRows:"ERROR! The maximum number of data series per chart is 255.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",textPivot:"Pivot Table"},SSE.Controllers.Toolbar||{}))}),define("text!spreadsheeteditor/main/app/template/StatusBar.template",[],function(){return'\r\n<div class="statusbar">\r\n <div id="status-tabs-scroll" class="status-group">\r\n <button id="status-btn-tabfirst" type="button" class="btn small btn-toolbar"><i class="icon btn-tab-first"> </i></button>\r\n <button id="status-btn-tabback" type="button" class="btn small btn-toolbar"><i class="icon btn-tab-back"> </i></button>\r\n <button id="status-btn-tabnext" type="button" class="btn small btn-toolbar"><i class="icon btn-tab-next"> </i></button>\r\n <button id="status-btn-tablast" type="button" class="btn small btn-toolbar"><i class="icon btn-tab-last"> </i></button>\r\n </div>\r\n <div id="status-addtabs-box" class="status-group">\r\n <button id="status-btn-addtab" type="button" class="btn small btn-toolbar"><i class="icon btn-zoom-up"> </i></button>\r\n </div>\r\n <div id="status-zoom-box" class="status-group">\r\n <div class="separator short" />\r\n <button id="status-btn-zoomdown" type="button" class="btn small btn-toolbar"><i class="icon btn-zoom-down"> </i></button>\r\n <div class="cnt-zoom">\r\n <div class="dropdown-toggle" data-toggle="dropdown">\r\n <label id="status-label-zoom" class="status-label">Zoom 100%</label>\r\n </div>\r\n </div>\r\n <button id="status-btn-zoomup" type="button" class="btn small btn-toolbar" style="margin-right:40px;"><i class="icon btn-zoom-up"> </i></button>\r\n </div>\r\n <div id="status-math-box" class="status-group">\r\n <div class="separator short" style="margin-right: 12px;" />\r\n <label id="status-math-average">AVERAGE: 10</label>\r\n <label id="status-math-count">COUNT: 3</label>\r\n <label id="status-math-min">MIN: 1</label>\r\n <label id="status-math-max">MAX: 5</label>\r\n <label id="status-math-sum">SUM: 5</label>\r\n </div>\r\n <div id="status-filtered-box" class="status-group">\r\n <div class="separator short" style="margin-right: 12px;" />\r\n <label id="status-filtered-records"></label>\r\n </div>\r\n <div id="status-sheets-bar-box">\r\n <div id="status-sheets-bar" class="status-group">\r\n </div>\r\n </div>\r\n</div>\r\n'}),void 0===Common)var Common={};define("common/main/lib/component/Tab",["common/main/lib/component/BaseView"],function(t){"use strict";var e=function(t){return this.active=!1,this.label="Tab",this.cls="",this.template=_.template(['<li class="<% if(active){ %>active<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',"<a><%- label %></a>","</li>"].join("")),this.initialize.call(this,t),this};_.extend(e.prototype,{initialize:function(t){_.extend(this,t)},render:function(){var t=this.template(this);return this.$el=$(t),this.rendered=!0,this.disable(this.disabled),this},isActive:function(){return this.$el.hasClass("active")},activate:function(){this.$el.hasClass("active")||this.$el.addClass("active")},deactivate:function(){this.$el.removeClass("active")},on:function(){this.$el.on.apply(this,arguments)},disable:function(t){this.disabled=t,this.rendered&&(t&&!this.$el.hasClass("disabled")?this.$el.addClass("disabled"):this.$el.removeClass("disabled"))},addClass:function(t){t.length&&!this.$el.hasClass(t)&&this.$el.addClass(t)},removeClass:function(t){t.length&&this.$el.hasClass(t)&&this.$el.removeClass(t)},hasClass:function(t){return this.$el.hasClass(t)},setCaption:function(t){this.$el.find("> a").text(t)}}),Common.UI.Tab=e}),define("common/main/lib/component/TabBar",["common/main/lib/component/BaseView","common/main/lib/component/Tab"],function(){"use strict";var t={bind:function(){this.o||(this.o=$({})),this.o.on.apply(this.o,arguments)},unbind:function(){this.o&&this.o.off.apply(this.o,arguments)},trigger:function(){this.o||(this.o=$({})),this.o.trigger.apply(this.o,arguments)}},e=function(t){this.initialize.call(this,t)};_.extend(e.prototype,t),e.prototype.initialize=function(t){this.bar=t.bar},e.prototype.attach=function(t){t.changeState=$.proxy(function(){this.trigger("tab:change",t),this.bar.$el.find("ul > li.active").removeClass("active"),t.activate(),this.bar.trigger("tab:changed",this.bar,this.bar.tabs.indexOf(t),t)},this);var e=new function(){return{bounds:[],drag:void 0,calculateBounds:function(){var t=this,e=t.bar.tabs.length,i=t.bar.$bar.get(0).getBoundingClientRect();if(i){t.bounds=[],t.scrollLeft=t.bar.$bar.scrollLeft(),t.bar.scrollX=this.scrollLeft;for(var n=0;n<e;++n)this.bounds.push(t.bar.tabs[n].$el.get(0).getBoundingClientRect());t.tabBarLeft=t.bounds[0].left,t.tabBarRight=t.bounds[e-1].right,t.tabBarRight=Math.min(t.tabBarRight,i.right-1)}},setAbsTabs:function(){for(var t=this,e=null,i=this.bounds.length,n=0;n<i;++n)e=t.bar.tabs[n].$el,e.css("position","absolute"),e.css("left",t.bounds[n].left-t.tabBarLeft-this.scrollLeft+"px"),e.hasClass("active")?e.css("top","1px"):e.css("top","0px")},updatePositions:function(){this.drag.place=void 0;var t,e,i,n=-1,o=-this.scrollLeft,s=this.bounds.length,a=this.drag.tab.$el.get(0).getBoundingClientRect();if(this.drag.moveX-this.drag.mouseX>0){for(t=s-1;t>=0;--t)if(e=this.bounds[t],i=.5*(e.right+e.left),a.left<i&&i<a.right){n=t;break}if(-1===n)for(t=s-1;t>=0;--t)if(e=a,i=.5*(e.right+e.left),this.bounds[t].left<i&&i<this.bounds[t].right){n=t;break}}else{for(t=0;t<s;++t)if(e=this.bounds[t],i=.5*(e.right+e.left),a.left<i&&i<a.right){n=t;break}if(-1===n)for(t=0;t<s;++t)if(e=a,i=.5*(e.right+e.left),this.bounds[t].left<i&&i<this.bounds[t].right){n=t;break}}if(-1!==n)for(this.drag.place=n,t=0;t<s;++t)t===n&&n<this.drag.index&&(o+=this.drag.tabWidth),n>this.drag.index&&t===n+1&&(o+=this.drag.tabWidth),t!==this.drag.index?(this.bar.tabs[t].$el.css("left",o+"px"),o+=this.bounds[t].width):this.drag.index===n&&(o+=this.drag.tabWidth)},setHook:function(t,e,i){function n(){if(!_.isUndefined(a.drag)){a.drag.tab.removeClass("dragged"),a.drag.tab.$el.css("z-index",""),a.bar.dragging=!1;for(var t=null,e=a.bar.tabs.length-1;e>=0;--e)(t=a.bar.tabs[e].$el)&&(t.css("top",""),t.css("position",""),t.css("left",""));_.isUndefined(a.drag.place)?(a.bar.trigger("tab:move",a.drag.index),a.bar.$bar.scrollLeft(a.scrollLeft),a.bar.scrollX=void 0):(a.bar.trigger("tab:move",a.drag.index,a.drag.place),a.bar.$bar.scrollLeft(a.scrollLeft),a.bar.scrollX=void 0),a.drag=void 0}}function o(t){if(!_.isUndefined(a.drag)){a.drag.moveX=t.clientX*Common.Utils.zoom();var e=Math.max(a.drag.moveX-a.drag.anchorX-a.tabBarLeft-a.scrollLeft,0);e=Math.min(e,a.tabBarRight-a.tabBarLeft-a.drag.tabWidth-a.scrollLeft),a.drag.tab.$el.css("left",e+"px"),a.drag.tab.$el.css("z-index","100"),a.updatePositions()}}function s(t){t.preventDefault()}var a=this;if(!_.isUndefined(e)&&!_.isUndefined(i)&&e.tabs.length>1){i.addClass("dragged");var l=e.tabs.indexOf(i),r=t.clientX*Common.Utils.zoom();a.bar=e,a.drag={tab:i,index:l},e.dragging=!0,this.calculateBounds(),this.setAbsTabs(),a.drag.moveX=r,a.drag.mouseX=r,a.drag.anchorX=r-this.bounds[l].left,a.drag.tabWidth=this.bounds[l].width,document.addEventListener("dragstart",s),$(document).on("mousemove.tabbar",o),$(document).on("mouseup.tabbar",function(t){n(),$(document).off("mouseup.tabbar"),$(document).off("mousemove.tabbar"),document.removeEventListener("dragstart",s)})}}}};t.$el.on({click:$.proxy(function(){t.disabled||t.$el.hasClass("active")||("manual"==t.control?this.bar.trigger("tab:manual",this.bar,this.bar.tabs.indexOf(t),t):t.changeState()),!t.disabled&&Common.NotificationCenter.trigger("edit:complete",this.bar)},this),dblclick:$.proxy(function(){this.trigger("tab:dblclick",this,this.tabs.indexOf(t),t)},this.bar),contextmenu:$.proxy(function(){this.trigger("tab:contextmenu",this,this.tabs.indexOf(t),t)},this.bar),mousedown:$.proxy(function(i){this.bar.options.draggable&&!_.isUndefined(e)&&3!==i.which&&(t.isLockTheDrag||e.setHook(i,this.bar,t))},this)})},e.prototype.detach=function(t){t.$el.off()},Common.UI.TabBar=Common.UI.BaseView.extend({config:{placement:"top",items:[],draggable:!1},tabs:[],template:_.template('<ul class="nav nav-tabs <%= placement %>" />'),initialize:function(t){_.extend(this.config,t),Common.UI.BaseView.prototype.initialize.call(this,t),this.saved=[]},render:function(){this.$el.html(this.template(this.config)),this.$bar=this.$el.find("ul");var t=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";return function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(this.$bar[0],t,_.bind(this._onMouseWheel,this)),this.manager=new e({bar:this}),this.insert(-1,this.config.items),this.insert(-1,this.saved),delete this.saved,Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this)),this.rendered=!0,this},_onMouseWheel:function(t){var e=this.checkInvisible(!0);(t.detail&&-t.detail||t.wheelDelta)>0?e.last&&this.setTabVisible("forward"):e.first&&this.setTabVisible("backward")},onProcessMouse:function(t){if("mouseup"==t.type&&this.dragging){var e=this.getActive(!0);e&&e.mouseup()}},add:function(t){return this.insert(-1,t)>0},insert:function(t,e){var i=0;if(e&&(e instanceof Array||(e=[e]),e.length)){if(i=e.length,this.rendered){var n,o=this;if(t<0||t>o.tabs.length)for(var s=0;s<e.length;s++)n=new Common.UI.Tab(e[s]),o.$bar.append(n.render().$el),o.tabs.push(n),o.manager.attach(n);else for(s=e.length;s-- >0;)n=new Common.UI.Tab(e[s]),0===t?(o.$bar.prepend(n.render().$el),o.tabs.unshift(n)):(o.$bar.find("li:nth-child("+t+")").before(n.render().$el),o.tabs.splice(t,0,n)),o.manager.attach(n)}else this.saved.push(e);this.checkInvisible()}return i},remove:function(t){if(t>=0&&t<this.tabs.length){var e=this.tabs.splice(t,1)[0];this.manager.detach(e),e.$el.remove(),this.checkInvisible()}},empty:function(t){var e=this;this.tabs.forEach(function(t){e.manager.detach(t)}),this.$bar.empty(),e.tabs=[],this.checkInvisible(t)},setActive:function(t){if(t instanceof Common.UI.Tab)e=t;else if("number"==typeof t&&t>=0&&t<this.tabs.length)var e=this.tabs[t];!e||"manual"==e.control||e.disabled||e.$el.hasClass("active")||e.changeState(),this.checkInvisible()},getActive:function(t){return t?this.$bar.find("> li.active"):this.$bar.find("> li.active").index()},getAt:function(t){return t>=0&&t<this.tabs.length?this.tabs[t]:void 0},getCount:function(){return this.tabs.length},addClass:function(t){t.length&&!this.$bar.hasClass(t)&&this.$bar.addClass(t)},removeClass:function(t){t.length&&this.$bar.hasClass(t)&&this.$bar.removeClass(t)},hasClass:function(t){return this.$bar.hasClass(t)},setTabVisible:function(t,e){if(t<=0||"first"==t)this.$bar.scrollLeft(0),this.checkInvisible(e);else if(t>=this.tabs.length-1||"last"==t){var i=this.tabs[this.tabs.length-1].$el;this.$bar.scrollLeft(this.$bar.scrollLeft()+(i.position().left+parseInt(i.css("width"))-this.$bar.width())+1),this.checkInvisible(e)}else{var i,n,o,s=this.$bar.width();if("forward"==t){for(var a=0;a<this.tabs.length;a++)if(i=this.tabs[a].$el,(n=i.position().left+parseInt(i.css("width")))>s){this.$bar.scrollLeft(this.$bar.scrollLeft()+(n-s)+20),this.checkInvisible(e);break}}else if("backward"==t){for(a=this.tabs.length;a-- >0;)if(i=this.tabs[a].$el,(o=i.position().left)<0){this.$bar.scrollLeft(this.$bar.scrollLeft()+o-26),this.checkInvisible(e);break}}else"number"==typeof t&&(i=this.tabs[t].$el,o=i.position().left,n=o+parseInt(i.css("width")),o<0?(this.$bar.scrollLeft(this.$bar.scrollLeft()+o-26),this.checkInvisible(e)):n>s&&(this.$bar.scrollLeft(this.$bar.scrollLeft()+(n-s)+20),this.checkInvisible(e)))}},checkInvisible:function(t){var e={first:!this.isTabVisible(0),last:!this.isTabVisible(this.tabs.length-1)};return!t&&this.fireEvent("tab:invisible",this,e),e},hasInvisible:function(){for(var t=this.$bar.offset().left,e=t+this.$bar.width(),i=this.tabs.length;i-- >0;)if(!this.isTabVisible(i,t,e))return!0;return!1},isTabVisible:function(t){var e,i,n,o,s=arguments[1]||this.$bar.offset().left,a=arguments[2]||s+this.$bar.width();return t<this.tabs.length&&t>=0&&(n=this.tabs[t].$el,o=n.get(0).getBoundingClientRect(),e=o.left,i=o.right,!(e<s||i>a))}})}),define("spreadsheeteditor/main/app/view/Statusbar",["text!spreadsheeteditor/main/app/template/StatusBar.template","tip","common/main/lib/component/TabBar","common/main/lib/component/Menu","common/main/lib/component/Window","common/main/lib/component/ThemeColorPalette"],function(t){"use strict";if(SSE.Views.Statusbar)var e=SSE.Views.Statusbar.RenameDialog,i=SSE.Views.Statusbar.CopyDialog;SSE.Views.Statusbar=Common.UI.BaseView.extend(_.extend({el:"#statusbar",template:_.template(t),events:function(){return{"click #status-btn-tabfirst":_.bind(this.onBtnTabScroll,this,"first"),"click #status-btn-tabback":_.bind(this.onBtnTabScroll,this,"backward"),"click #status-btn-tabnext":_.bind(this.onBtnTabScroll,this,"forward"),"click #status-btn-tablast":_.bind(this.onBtnTabScroll,this,"last")}},api:void 0,initialize:function(t){_.extend(this,t)},render:function(){var t=this;$(this.el).html(this.template({scope:this})),this.editMode=!1,this.btnZoomDown=new Common.UI.Button({el:$("#status-btn-zoomdown",this.el),hint:this.tipZoomOut+" (Ctrl+-)",hintAnchor:"top"}),this.btnZoomUp=new Common.UI.Button({el:$("#status-btn-zoomup",this.el),hint:this.tipZoomIn+" (Ctrl++)",hintAnchor:"top-right"}),this.btnScrollFirst=new Common.UI.Button({el:$("#status-btn-tabfirst",this.el),hint:this.tipFirst,disabled:!0,hintAnchor:"top"}),this.btnScrollBack=new Common.UI.Button({el:$("#status-btn-tabback",this.el),hint:this.tipPrev,disabled:!0,hintAnchor:"top"}),this.btnScrollNext=new Common.UI.Button({el:$("#status-btn-tabnext",this.el),hint:this.tipNext,disabled:!0,hintAnchor:"top"}),this.btnScrollLast=new Common.UI.Button({el:$("#status-btn-tablast",this.el),hint:this.tipLast,disabled:!0,hintAnchor:"top"}),this.btnAddWorksheet=new Common.UI.Button({el:$("#status-btn-addtab",this.el),hint:this.tipAddTab,disabled:!0,hintAnchor:"top"}),this.cntZoom=new Common.UI.Button({el:$(".cnt-zoom",this.el),hint:this.tipZoomFactor,hintAnchor:"top"}),this.cntZoom.cmpEl.on({"show.bs.dropdown":function(){_.defer(function(){t.cntZoom.cmpEl.find("ul").focus()},100)},"hide.bs.dropdown":function(){_.defer(function(){t.api.asc_enableKeyEvents(!0)},100)}}),this.zoomMenu=new Common.UI.Menu({style:"margin-top:-5px;",menuAlign:"bl-tl",items:[{caption:"50%",value:50},{caption:"75%",value:75},{caption:"100%",value:100},{caption:"125%",value:125},{caption:"150%",value:150},{caption:"175%",value:175},{caption:"200%",value:200}]}),this.zoomMenu.render($(".cnt-zoom",this.el)),this.zoomMenu.cmpEl.attr({tabindex:-1}),this.labelZoom=$("#status-label-zoom",this.$el),this.tabBarBox=$("#status-sheets-bar-box",this.el),this.tabbar=new Common.UI.TabBar({el:"#status-sheets-bar",placement:"bottom",draggable:!1}).render(),this.tabbar.on({"tab:invisible":_.bind(this.onTabInvisible,this),"tab:changed":_.bind(this.onSheetChanged,this),"tab:contextmenu":_.bind(this.onTabMenu,this),"tab:dblclick":_.bind(function(){t.editMode&&t.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.Chart&&t.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.FormatTable&&t.fireEvent("sheet:changename")},this),"tab:move":_.bind(function(e,i){t.tabBarScroll={scrollLeft:t.tabbar.scrollX},_.isUndefined(i)||e===i||(e<i&&++i,t.fireEvent("sheet:move",[!1,!0,e,i]))},this)});var e=new Common.UI.Menu({maxHeight:260,menuAlign:"tl-tr"}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0})});e.on("item:click",function(e,i,n){t.fireEvent("show:hidden",[t,i.value])});var i=new Common.UI.Menu({menuAlign:"tl-tr",cls:"color-tab",items:[{template:_.template('<div id="id-tab-menu-color" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-tab-menu-new-color" style="padding-left:12px;">'+t.textNewColor+"</a>")}]});return t.mnuTabColor=function(){return{isDummy:!0,on:function(){}}}(),this.tabMenu=new Common.UI.Menu({menuAlign:"bl-tl",items:[{caption:this.itemInsert,value:"ins"},{caption:this.itemDelete,value:"del"},{caption:this.itemRename,value:"ren"},{caption:this.itemCopy,value:"copy"},{caption:this.itemMove,value:"move"},{caption:this.itemHide,value:"hide"},{caption:this.itemHidden,menu:e},{caption:this.itemTabColor,menu:i}]}).on("render:after",function(e){var i=$('<div class="btn-color-value-line"></div>');$("button:first-child",e.cmpEl).append(i),i.css("background-color",e.currentColor||"transparent"),t.mnuTabColor=new Common.UI.ThemeColorPalette({el:$("#id-tab-menu-color"),transparent:!0}),t.mnuTabColor.on("select",function(e,i){t.fireEvent("sheet:setcolor",[i])})}),this.tabbar.$el.append('<div class="dropdown-toggle" data-toggle="dropdown" style="width:0; height:0;"/>'),this.tabMenu.render(this.tabbar.$el),this.tabMenu.cmpEl.attr({tabindex:-1}),this.tabMenu.on("show:after",_.bind(this.onTabMenuAfterShow,this)),this.tabMenu.on("hide:after",_.bind(this.onTabMenuAfterHide,this)),this.tabMenu.on("item:click",_.bind(this.onTabMenuClick,this)),this.boxMath=$("#status-math-box",this.el),this.labelSum=$("#status-math-sum",this.boxMath),this.labelCount=$("#status-math-count",this.boxMath),this.labelAverage=$("#status-math-average",this.boxMath),this.labelMin=$("#status-math-min",this.boxMath),this.labelMax=$("#status-math-max",this.boxMath),this.boxMath.hide(),this.boxFiltered=$("#status-filtered-box",this.el),this.labelFiltered=$("#status-filtered-records",this.boxFiltered),this.boxFiltered.hide(),this.boxZoom=$("#status-zoom-box",this.el),this.boxZoom.find(".separator").css("border-left-color","transparent"),this},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.update,this)),this},setMode:function(t){this.mode=_.extend({},this.mode,t),this.btnAddWorksheet.setVisible(this.mode.isEdit),this.btnAddWorksheet.setDisabled(this.mode.isDisconnected),this.updateTabbarBorders()},setVisible:function(t){t?this.show():this.hide()},update:function(){var t=this;if(this.tabbar.empty(!0),this.tabMenu.items[6].menu.removeAll(),this.tabMenu.items[6].hide(),this.btnAddWorksheet.setDisabled(!0),this.api){for(var e,i,n=this.api.asc_getWorksheetsCount(),o=-1,s=[],a=[],l=this.api.asc_getActiveWorksheetIndex();++o<n;)i=t.api.asc_isWorksheetLockedOrDeleted(o),e={sheetindex:o,active:l==o,label:t.api.asc_getWorksheetName(o),cls:i?"coauth-locked":"",isLockTheDrag:i},this.api.asc_isWorksheetHidden(o)?s.push(e):a.push(e);s.length&&(s.forEach(function(e){t.tabMenu.items[6].menu.addItem(new Common.UI.MenuItem({style:"white-space: pre-wrap",caption:Common.Utils.String.htmlEncode(e.label),value:e.sheetindex}))}),this.tabMenu.items[6].show()),this.tabbar.add(a),_.isUndefined(this.tabBarScroll)||(this.tabbar.$bar.scrollLeft(this.tabBarScroll.scrollLeft),
|
|
|
this.tabBarScroll=void 0),this.tabbar.isTabVisible(l)||this.tabbar.setTabVisible(l),this.btnAddWorksheet.setDisabled(t.mode.isDisconnected||t.api.asc_isWorkbookLocked()),$("#status-label-zoom").text(Common.Utils.String.format(this.zoomText,Math.floor(100*(this.api.asc_getZoom()+.005)))),t.fireEvent("sheet:changed",[t,l]),t.fireEvent("sheet:updateColors",[!0]),Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+t.api.asc_getActiveWorksheetId()],!1)}},setMathInfo:function(t){t.count>1?(this.boxMath.is(":visible")||this.boxMath.show(),this.labelCount.text(this.textCount+": "+t.count),this.labelMin.text(t.min&&t.min.length?this.textMin+": "+t.min:""),this.labelMax.text(t.max&&t.max.length?this.textMax+": "+t.max:""),this.labelSum.text(t.sum&&t.sum.length?this.textSum+": "+t.sum:""),this.labelAverage.text(t.average&&t.average.length?this.textAverage+": "+t.average:"")):this.boxMath.is(":visible")&&this.boxMath.hide();var e=this;_.delay(function(){e.onTabInvisible(void 0,e.tabbar.checkInvisible(!0))},30)},setFilteredInfo:function(t,e){if(t>0&&e>0)this.boxFiltered.is(":visible")||this.boxFiltered.show(),this.labelFiltered.text(Common.Utils.String.format(this.filteredRecordsText,t,e));else if(t)this.boxFiltered.is(":visible")||this.boxFiltered.show(),this.labelFiltered.text(this.filteredText);else if(void 0!==t&&null!==t)this.boxFiltered.is(":visible")&&this.boxFiltered.hide();else{var i=this.api.asc_getCellInfo().asc_getAutoFilterInfo(),n=!i||!0!==i.asc_getIsApplyAutoFilter();this.setFilteredInfo(!n)}var o=this;_.delay(function(){o.onTabInvisible(void 0,o.tabbar.checkInvisible(!0))},30)},onSheetChanged:function(t,e,i){this.api.asc_showWorksheet(i.sheetindex),this.hasTabInvisible&&!this.tabbar.isTabVisible(e)&&this.tabbar.setTabVisible(e),this.fireEvent("sheet:changed",[this,i.sheetindex]),this.fireEvent("sheet:updateColors",[!0])},onTabMenu:function(t,e,i){if(this.mode.isEdit&&!this.isEditFormula&&this.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.Chart&&this.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.FormatTable&&!this.mode.isDisconnected&&i&&i.sheetindex>=0){var n=i.$el.get(0).getBoundingClientRect(),o=(i.$el.offset(),i.$el.parent().offset());i.isActive()||this.tabbar.setActive(i);var s=this.api.asc_isWorksheetLockedOrDeleted(i.sheetindex),a=this.api.asc_isWorkbookLocked();this.tabMenu.items[0].setDisabled(a),this.tabMenu.items[1].setDisabled(s),this.tabMenu.items[2].setDisabled(s),this.tabMenu.items[3].setDisabled(s),this.tabMenu.items[4].setDisabled(s),this.tabMenu.items[5].setDisabled(s),this.tabMenu.items[6].setDisabled(a),this.tabMenu.items[7].setDisabled(s),this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!1),this.tabMenu.atposition=function(){return{top:n.top,left:n.left-o.left-2}}(),this.tabMenu.hide(),this.tabMenu.show();var l=this.tabMenu;_.defer(function(){l.cmpEl.focus()},10)}},onTabMenuAfterShow:function(t){t.atposition&&t.setOffset(t.atposition.left),this.enableKeyEvents=!0},onTabMenuAfterHide:function(){_.isUndefined(this.enableKeyEvents)||(this.api&&this.api.asc_enableKeyEvents(this.enableKeyEvents),this.enableKeyEvents=void 0)},onTabMenuClick:function(t,e){e&&this.api&&(this.enableKeyEvents="ins"===e.value||"hide"===e.value)},onTabInvisible:function(t,e){this.btnScrollFirst.isDisabled()!==!e.first&&(this.btnScrollFirst.setDisabled(!e.first),this.btnScrollBack.setDisabled(!e.first)),this.btnScrollNext.isDisabled()!==!e.last&&(this.btnScrollNext.setDisabled(!e.last),this.btnScrollLast.setDisabled(!e.last)),this.hasTabInvisible=e.first||e.last},onBtnTabScroll:function(t,e){this.tabbar.setTabVisible(t)},updateTabbarBorders:function(){var t=parseInt(this.boxZoom.css("width")),e=!1;this.boxMath.is(":visible")&&(t+=parseInt(this.boxMath.css("width")),e=!0),this.boxFiltered.is(":visible")&&(t+=parseInt(this.boxFiltered.css("width")),e=!0),this.boxZoom.find(".separator").css("border-left-color",e?"":"transparent"),this.tabBarBox.css("right",t+"px")},changeViewMode:function(t){t?this.tabBarBox.css("left","152px"):this.tabBarBox.css("left",""),this.tabbar.options.draggable=t,this.editMode=t},tipZoomIn:"Zoom In",tipZoomOut:"Zoom Out",tipZoomFactor:"Magnification",tipFirst:"First Sheet",tipLast:"Last Sheet",tipPrev:"Previous Sheet",tipNext:"Next Sheet",tipAddTab:"Add Worksheet",itemInsert:"Insert",itemDelete:"Delete",itemRename:"Rename",itemCopy:"Copy",itemMove:"Move",itemHide:"Hide",itemHidden:"Hidden",itemTabColor:"Tab Color",textNoColor:"No Color",textNewColor:"Add New Custom Color",zoomText:"Zoom {0}%",textSum:"SUM",textCount:"COUNT",textAverage:"AVERAGE",textMin:"MIN",textMax:"MAX",filteredRecordsText:"{0} of {1} records filtered",filteredText:"Filter mode"},SSE.Views.Statusbar||{})),SSE.Views.Statusbar.RenameDialog=Common.UI.Window.extend(_.extend({options:{header:!1,width:280,cls:"modal-dlg"},template:'<div class="box"><div class="input-row"><label><%= label %></label></div><div class="input-row" id="txt-sheet-name" /></div><div class="footer right"><button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button><button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button></div>',initialize:function(t){_.extend(this.options,t||{},{label:this.labelSheetName,btns:{ok:this.okButtonText,cancel:this.cancelButtonText}}),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.txtName=new Common.UI.InputField({el:t.find("#txt-sheet-name"),style:"width:100%;",value:Common.Utils.String.htmlEncode(this.options.current),allowBlank:!1,maxLength:31,validation:_.bind(this.nameValidator,this)})},show:function(t,e){Common.UI.Window.prototype.show.apply(this,arguments);var i=this.txtName.$el.find("input");_.delay(function(t){i.focus(),i.select()},100,this)},onBtnClick:function(t){this.doClose(t.currentTarget.attributes.result.value)},doClose:function(t){if("ok"==t&&!0!==this.txtName.checkValidate())return void _.delay(function(t){t.txtName.focus()},100,this);this.options.handler&&this.options.handler.call(this,t,this.txtName.getValue()),this.close()},onPrimary:function(t){return this.doClose("ok"),!1},nameValidator:function(t){var e=this.options.names;if(!e&&this.options.api){var i=this.options.api,n=i.asc_getActiveWorksheetIndex(),o=i.asc_getWorksheetsCount();for(e=[];o--;)n!==o&&e.push(i.asc_getWorksheetName(o).toLowerCase())}if(e)for(var s=t.toLowerCase(),a=e.length-1;a>=0;--a)if(e[a]===s)return this.errNameExists;return t.length>2&&'"'==t[0]&&'"'==t[t.length-1]||(!/[:\\\/\*\?\[\]\']/.test(t)||this.errNameWrongChar)},errNameExists:"Worksheet with such name already exist.",errNameWrongChar:"A sheet name cannot contains characters: \\, /, *, ?, [, ], :",labelSheetName:"Sheet Name"},e||{})),SSE.Views.Statusbar.CopyDialog=Common.UI.Window.extend(_.extend({options:{width:270,height:300,cls:"modal-dlg"},template:'<div class="box"><div class="input-row"><label><%= label %></label></div><div id="status-list-names" style="height: 170px;"/></div><div class="footer center"><button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button><button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button></div>',initialize:function(t){_.extend(this.options,t||{},{label:t.ismove?this.textMoveBefore:this.textCopyBefore,btns:{ok:this.okButtonText,cancel:this.cancelButtonText}}),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this));var e=[];this.options.names.forEach(function(t){e.push(new Common.UI.DataViewModel(t))},this),e.length&&e.push(new Common.UI.DataViewModel({value:this.options.ismove?this.itemMoveToEnd:this.itemCopyToEnd,inindex:-255})),this.listNames=new Common.UI.ListView({el:$("#status-list-names",t),store:new Common.UI.DataViewStore(e),itemTemplate:_.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= Common.Utils.String.htmlEncode(value) %></div>')}),this.listNames.selectByIndex(0),this.listNames.on("entervalue",_.bind(this.onPrimary,this)),this.listNames.on("item:dblclick",_.bind(this.onPrimary,this)),this.mask=$(".modals-mask"),this.mask.on("mousedown",_.bind(this.onUpdateFocus,this))},show:function(t,e){Common.UI.Window.prototype.show.apply(this,arguments),_.delay(function(t){t.listNames.$el.find(".listview").focus()},100,this)},hide:function(){Common.UI.Window.prototype.hide.apply(this,arguments),this.mask.off("mousedown",_.bind(this.onUpdateFocus,this))},onBtnClick:function(t){var e=this.listNames.getSelectedRec();this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,e.get("inindex")),this.close()},onPrimary:function(){this.options.handler&&this.options.handler.call(this,"ok",this.listNames.getSelectedRec().get("inindex")),this.close()},onUpdateFocus:function(){_.delay(function(t){t.listNames.$el.find(".listview").focus()},100,this)},itemCopyToEnd:"(Copy to end)",itemMoveToEnd:"(Move to end)",textCopyBefore:"Copy before sheet",textMoveBefore:"Move before sheet"},i||{}))}),define("spreadsheeteditor/main/app/controller/Statusbar",["core","spreadsheeteditor/main/app/view/Statusbar"],function(){"use strict";SSE.Controllers.Statusbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Statusbar"],initialize:function(){this.addListeners({Statusbar:{"show:hidden":_.bind(function(t,e){this.hideWorksheet(!1,e)},this),"sheet:changename":_.bind(function(){this.api.asc_closeCellEditor(),this.renameWorksheet()},this),"sheet:setcolor":_.bind(this.setWorksheetColor,this),"sheet:updateColors":_.bind(this.updateTabsColors,this),"sheet:move":_.bind(this.moveWorksheet,this)}})},events:function(){return{"click #status-btn-zoomdown":_.bind(this.zoomDocument,this,"down"),"click #status-btn-zoomup":_.bind(this.zoomDocument,this,"up"),"click .cnt-zoom":_.bind(this.onZoomShow,this)}},onLaunch:function(){this.statusbar=this.createView("Statusbar").render(),this.statusbar.$el.css("z-index",10),this.statusbar.labelZoom.css("min-width",80),this.statusbar.zoomMenu.on("item:click",_.bind(this.menuZoomClick,this)),this.bindViewEvents(this.statusbar,this.events),$("#id-tab-menu-new-color",this.statusbar.$el).on("click",_.bind(this.onNewBorderColor,this))},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onZoomChange,this)),this.api.asc_registerCallback("asc_onSelectionMathChanged",_.bind(this.onApiMathChanged,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),this.api.asc_registerCallback("asc_onUpdateTabColor",_.bind(this.onApiUpdateTabColor,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onWorkbookLocked",_.bind(this.onWorkbookLocked,this)),this.api.asc_registerCallback("asc_onWorksheetLocked",_.bind(this.onWorksheetLocked,this)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onFilterInfo",_.bind(this.onApiFilterInfo,this)),this.api.asc_registerCallback("asc_onActiveSheetChanged",_.bind(this.onApiActiveSheetChanged,this)),this.statusbar.setApi(t)},zoomDocument:function(t,e){switch(t){case"up":var i=Math.floor(10*this.api.asc_getZoom())/10;i+=.1,!(i>2)&&this.api.asc_setZoom(i);break;case"down":i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,!(i<.5)&&this.api.asc_setZoom(i)}Common.NotificationCenter.trigger("edit:complete",this.statusbar)},menuZoomClick:function(t,e){this.api.asc_setZoom(e.value/100),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},onZoomChange:function(t,e){this.statusbar.labelZoom.text(Common.Utils.String.format(this.zoomText,Math.floor(100*(t+.005))))},onApiDisconnect:function(){this.SetDisabled(!0)},SetDisabled:function(t){this.statusbar.setMode({isDisconnected:t}),this.statusbar.update()},onWorkbookLocked:function(t){this.statusbar.tabbar[t?"addClass":"removeClass"]("coauth-locked"),this.statusbar.btnAddWorksheet.setDisabled(t||this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.Chart||this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable);for(var e,i=this.statusbar.tabbar.getCount();i-- >0;)e=this.statusbar.tabbar.getAt(i),e.sheetindex>=0||e.disable(t)},onWorksheetLocked:function(t,e){for(var i,n=this.statusbar.tabbar.getCount(),o=n;o-- >0;)if(i=this.statusbar.tabbar.getAt(o),t==i.sheetindex){i[e?"addClass":"removeClass"]("coauth-locked"),i.isLockTheDrag=e||this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable;break}},onApiMathChanged:function(t){this.statusbar.setMathInfo({count:t.asc_getCount(),average:t.asc_getAverage(),min:t.asc_getMin(),max:t.asc_getMax(),sum:t.asc_getSum()}),this.statusbar.updateTabbarBorders()},onApiFilterInfo:function(t,e){this.statusbar.setFilteredInfo(t,e),this.statusbar.updateTabbarBorders()},onApiEditCell:function(t){var e=t==Asc.c_oAscCellEditorState.editFormula,i=t!=Asc.c_oAscCellEditorState.editEnd,n=$(".statusbar-mask"),o=this.statusbar;o.isEditFormula=e,o.btnZoomUp.setDisabled(i),o.btnZoomDown.setDisabled(i),o.labelZoom[i?"addClass":"removeClass"]("disabled"),e&&n.length>0||!e&&0==n.length||(o.$el.find(".statusbar").toggleClass("masked",e),e?n=$("<div class='statusbar-mask'>").appendTo(o.$el):n.remove())},createDelayedElements:function(){this.statusbar.$el.css("z-index",""),this.statusbar.tabMenu.on("item:click",_.bind(this.onTabMenu,this)),this.statusbar.btnAddWorksheet.on("click",_.bind(this.onAddWorksheetClick,this)),Common.NotificationCenter.on("window:resize",_.bind(this.onWindowResize,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onRangeDialogMode,this))},onWindowResize:function(t){this.statusbar.onTabInvisible(void 0,this.statusbar.tabbar.checkInvisible(!0))},onRangeDialogMode:function(t){var e=this.statusbar.tabbar.hasClass("coauth-locked"),i=this.api.asc_getActiveWorksheetIndex();this.statusbar.btnAddWorksheet.setDisabled(e||t!=Asc.c_oAscSelectionDialogType.None);for(var n,o=this.statusbar.tabbar.getCount();o-- >0;)n=this.statusbar.tabbar.getAt(o),n.sheetindex!==i&&n.disable(t==Asc.c_oAscSelectionDialogType.FormatTable),n.isLockTheDrag=n.hasClass("coauth-locked")||t!=Asc.c_oAscSelectionDialogType.None;this.statusbar.rangeSelectionMode=t},onTabMenu:function(t,e,i){var n=this;switch(e.value){case"ins":setTimeout(function(){n.api.asc_insertWorksheet(n.createSheetName())},1);break;case"del":this.deleteWorksheet();break;case"ren":this.renameWorksheet();break;case"copy":this.moveWorksheet(!1);break;case"move":this.moveWorksheet(!0);break;case"hide":setTimeout(function(){n.hideWorksheet(!0)},1)}},createSheetName:function(){for(var t=[],e=this.api.asc_getWorksheetsCount();e--;)t.push(this.api.asc_getWorksheetName(e).toLowerCase());for(var i,n=0;++n<1e3&&(i=this.strSheet+n,!(t.indexOf(i.toLowerCase())<0)););return i},createCopyName:function(t){for(var e=this.api.asc_getWorksheetsCount(),i=[];e--;)i.push(this.api.asc_getWorksheetName(e).toLowerCase());for(var n,o=/^(.*)\((\d)\)$/.exec(t),s=o?o[1]:t+" ",a=1;++a<1e3&&(n=s+"("+a+")",!(i.indexOf(n.toLowerCase())<0)););return n},deleteWorksheet:function(){var t=this;1==this.statusbar.tabbar.tabs.length?Common.UI.warning({msg:this.errorLastSheet}):Common.UI.warning({msg:this.warnDeleteSheet,buttons:["ok","cancel"],callback:function(e){"ok"!=e||t.api.asc_deleteWorksheet()||_.delay(function(){Common.UI.error({msg:t.errorRemoveSheet})},10)}})},hideWorksheet:function(t,e){if(t)1==this.statusbar.tabbar.tabs.length?Common.UI.warning({msg:this.errorLastSheet}):this.api.asc_hideWorksheet(e);else{this.api.asc_showWorksheet(e),this.loadTabColor(e);var i=this;setTimeout(function(){i.statusbar.tabMenu.hide()},1)}},renameWorksheet:function(){var t=this,e=t.api.asc_getWorksheetsCount(),i=null;if(e>0){var n=t.api.asc_getActiveWorksheetIndex();if(t.api.asc_isWorksheetLockedOrDeleted(n))return;if(!Common.Utils.InternalSettings.get("sse-settings-coauthmode"))for(i=[];e--;)n!==e&&i.push(t.api.asc_getWorksheetName(e).toLowerCase());var o=t.statusbar.tabbar.tabs[t.statusbar.tabbar.getActive()],s=t.statusbar.$el.position().top-115,a=o.$el.offset().left,l=t.api.asc_getWorksheetName(t.api.asc_getActiveWorksheetIndex()),r=new SSE.Views.Statusbar.RenameDialog({current:l,names:i,api:t.api,handler:function(e,i){"ok"==e&&i!=l&&t.api.asc_renameWorksheet(i),t.api.asc_enableKeyEvents(!0)}});if("number"==typeof r.options.width){var c=$("body").width();a+r.options.width>c&&(a=c-r.options.width-5)}r.show(a,s)}},moveWorksheet:function(t,e,i,n){for(var o=this,s=o.api.asc_getWorksheetsCount(),a=[],l=-1;++l<s;)this.api.asc_isWorksheetHidden(l)||a.push({value:o.api.asc_getWorksheetName(l),inindex:l});if(!_.isUndefined(e))return o.api.asc_showWorksheet(a[i].inindex),Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+this.api.asc_getActiveWorksheetId()]),void(_.isUndefined(n)||o.api.asc_moveWorksheet(a.length===n?s:a[n].inindex));new SSE.Views.Statusbar.CopyDialog({title:t?o.statusbar.itemMove:o.statusbar.itemCopy,ismove:t,names:a,handler:function(e,i){if("ok"==e)if(t)o.api.asc_moveWorksheet(-255==i?s:i);else{var n=o.createCopyName(o.api.asc_getWorksheetName(o.api.asc_getActiveWorksheetIndex()));o.api.asc_copyWorksheet(-255==i?s:i,n)}o.api.asc_enableKeyEvents(!0)}}).show()},onAddWorksheetClick:function(t,e,i){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_addWorksheet(this.createSheetName()),Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+this.api.asc_getActiveWorksheetId()],!1)),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},selectTab:function(t){if(this.api){if(!this.api.asc_isWorksheetHidden(t)){var e=_.findWhere(this.statusbar.tabbar.tabs,{sheetindex:t});e&&this.statusbar.tabbar.setActive(e)}}},moveCurrentTab:function(t){if(this.api){var e=0,i=this.statusbar.tabbar,n=this.api.asc_getActiveWorksheetIndex(),o=i.tabs.length;this.statusbar.tabMenu.hide(),this.api.asc_closeCellEditor();for(var s=0;s<o;++s)if(i.tabs[s].sheetindex===n){e=s,t>0?++e>=o&&(e=0):--e<0&&(e=o-1),i.setActive(e),this.api.asc_showWorksheet(i.getAt(e).sheetindex);break}}},onApiUpdateTabColor:function(t){this.loadTabColor(t)},setWorksheetColor:function(t){if(this.api){var e=this.api.asc_getActiveWorksheetIndex(),i=_.findWhere(this.statusbar.tabbar.tabs,{sheetindex:e});if(i)if("transparent"===t)this.api.asc_setWorksheetTabColor(e,null),i.$el.find("a").css("box-shadow","");else{var n=Common.Utils.ThemeColor.getRgbColor(t);n&&(this.api.asc_setWorksheetTabColor(e,n),this.setTabLineColor(i,n))}}},updateThemeColors:function(){this.statusbar&&function(t,e){if(t){for(var i,n=Common.Utils.ThemeColor.getEffectColors(),o=0;o<n.length;++o)"object"==typeof t.currentColor&&void 0===i&&t.currentColor.effectId==n[o].effectId&&(i=n[o]);t.updateColors(n,Common.Utils.ThemeColor.getStandartColors()),void 0===t.currentColor?t.currentColor=n[e]:void 0!==i&&(t.currentColor=i)}}(this.statusbar.mnuTabColor,1)},onNewBorderColor:function(){this.statusbar&&this.statusbar.mnuTabColor&&this.statusbar.mnuTabColor.addNewColor()},updateTabsColors:function(t){var e=-1,i=-1,n=null,o=null,s=!1,a=this.api.asc_getWorksheetsCount(),l=this.api.asc_getActiveWorksheetIndex();if(!_.isUndefined(t)){if(this.application.getController("Toolbar"))if(this.statusbar.mnuTabColor.updateCustomColors(),n=this.api.asc_getWorksheetTabColor(l),n&&(o=n.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()),effectValue:n.get_value()}:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b())),_.isObject(o)){var r=!1;for(e=0;e<10;e++)if(Common.Utils.ThemeColor.ThemeValues[e]===o.effectValue){this.statusbar.mnuTabColor.select(o,!0),r=!0;break}r||this.statusbar.mnuTabColor.clearSelection()}else this.statusbar.mnuTabColor.select(o||"transparent",!0)}for(e=-1;++e<a;)++i,s=this.api.asc_isWorksheetHidden(e),s&&--i,s||this.setTabLineColor(this.statusbar.tabbar.getAt(i),this.api.asc_getWorksheetTabColor(e))},loadTabColor:function(t){if(this.api&&!this.api.asc_isWorksheetHidden(t)){var e=_.findWhere(this.statusbar.tabbar.tabs,{sheetindex:t});e&&this.setTabLineColor(e,this.api.asc_getWorksheetTabColor(t))}},setTabLineColor:function(t,e){t&&(e=null!==e?"#"+Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()):"",e.length?(e=t.isActive()?"0px 3px 0 "+e+" inset":"0px 3px 0 "+Common.Utils.RGBColor(e).toRGBA(.7)+" inset",t.$el.find("a").css("box-shadow",e)):t.$el.find("a").css("box-shadow",""))},onZoomShow:function(t){if(t.target.classList.contains("disabled"))return!1},onError:function(t,e,i){t==Asc.c_oAscError.ID.LockedWorksheetRename&&this.statusbar.update()},onApiActiveSheetChanged:function(t){this.statusbar.tabMenu.hide()},zoomText:"Zoom {0}%",errorLastSheet:"Workbook must have at least one visible worksheet.",errorRemoveSheet:"Can't delete the worksheet.",warnDeleteSheet:"The worksheet maybe has data. Proceed operation?",strSheet:"Sheet"},SSE.Controllers.Statusbar||{}))}),define("spreadsheeteditor/main/app/view/Spellcheck",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Button","common/main/lib/component/ListView","common/main/lib/component/InputField","common/main/lib/component/ComboBox","common/main/lib/component/ComboDataView"],function(t){"use strict";SSE.Views.Spellcheck=Common.UI.BaseView.extend(_.extend({el:"#left-panel-spellcheck",template:_.template(['<div id="spellcheck-box" class="layout-ct vbox active" style="padding: 20px 15px 0; width: 100%; position: relative;overflow: hidden;">','<div id="spellcheck-header" style="font-size: 14px; padding-bottom: 16px;"><%= scope.txtSpelling %></div>','<div style="display: flex; width: 100%; padding-bottom: 8px;"><div id="spellcheck-current-word" style="vertical-align: top; width: 100%; display: inline-block;"></div><div id="spellcheck-next" style="display: inline-block;"></div></div>','<div id="spellcheck-suggestions-list" style="width: 100%; height: 116px; background-color: #fff; margin-bottom: 8px;"></div>','<div id="spellcheck-change" style="display: inline-block; padding-bottom: 16px;"></div><div id="spellcheck-ignore" class="padding-large" style="margin-left: 9px; display: inline-block;"></div>','<button class="btn btn-text-default auto" id="spellcheck-add-to-dictionary" style="min-width: 110px; display: block; margin-bottom: 16px;"><%= scope.txtAddToDictionary %></button>','<label class="header" style=" display: block;"><%= scope.txtDictionaryLanguage %></label><div id="spellcheck-dictionary-language" style="margin-top: 3px; padding-bottom: 16px;display: flex;"></div>','<div id="spellcheck-complete" style="display: flex;" class="hidden"><i class="img-commonctrl img-complete" style="display: inline-block;margin-right: 10px;"></i><%= scope.txtComplete %></div>',"</div>"].join("")),initialize:function(t){_.extend(this,t),Common.UI.BaseView.prototype.initialize.call(this,arguments)},render:function(t){return t=t||this.el,this.$el=$(t),this.$el.html(this.template({scope:this})),this.currentWord=new Common.UI.InputField({el:$("#spellcheck-current-word"),allowBlank:!0,validateOnBlur:!1,disabled:!0}),this.buttonNext=new Common.UI.Button({style:"margin-left: 5px; width: 22px; height: 22px; border: 1px solid #cfcfcf;",cls:"btn-toolbar bg-white",iconCls:"btn-spellcheck-next",hint:this.txtNextTip}),this.buttonNext.render($("#spellcheck-next")),this.suggestionList=new Common.UI.ListView({el:$("#spellcheck-suggestions-list"),emptyText:this.noSuggestions,store:new Common.UI.DataViewStore,scrollAlwaysVisible:!0}),this.btnChange=new Common.UI.Button({cls:"btn-text-split-default",caption:this.textChange,split:!0,width:110,disabled:!0,menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:this.textChange,value:0},{caption:this.textChangeAll,value:1}]})}),this.btnChange.render($("#spellcheck-change")),this.btnIgnore=new Common.UI.Button({cls:"btn-text-split-default",caption:this.textIgnore,split:!0,width:110,disabled:!0,menu:new Common.UI.Menu({style:"min-width: 110px;",items:[{caption:this.textIgnore,value:0},{caption:this.textIgnoreAll,value:1}]})}),this.btnIgnore.render($("#spellcheck-ignore")),this.cmbDictionaryLanguage=new Common.UI.ComboBox({el:$("#spellcheck-dictionary-language"),style:"width: 100%",menuStyle:"width: 100%;max-height: 163px;",editable:!1,cls:"input-group-nr",scroller:{suppressScrollX:!0}}),this.btnToDictionary=new Common.UI.Button({el:$("#spellcheck-add-to-dictionary"),disabled:!0}),this.lblComplete=this.$el.find("#spellcheck-complete"),this.trigger("render:after",this),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el.find("#spellcheck-box"),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.fireEvent("show",this)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},ChangeSettings:function(t){},txtSpelling:"Spelling",noSuggestions:"No spelling suggestions",textChange:"Change",textChangeAll:"Change All",textIgnore:"Ignore",textIgnoreAll:"Ignore All",txtAddToDictionary:"Add To Dictionary",txtDictionaryLanguage:"Dictionary Language",txtComplete:"Spellcheck has been complete",txtNextTip:"Go to the next word"},SSE.Views.Spellcheck||{}))}),define("spreadsheeteditor/main/app/controller/Spellcheck",["core","spreadsheeteditor/main/app/view/Spellcheck"],function(){"use strict";SSE.Controllers.Spellcheck=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Spellcheck"],initialize:function(){var t=this;this.addListeners({Spellcheck:{show:function(){t._initSettings&&t.loadLanguages(),t.onClickNext()},hide:function(){}}})},events:function(){},onLaunch:function(){this.panelSpellcheck=this.createView("Spellcheck",{}),this.panelSpellcheck.on("render:after",_.bind(this.onAfterRender,this)),this._isDisabled=!1,this._initSettings=!0},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onSpellCheckVariantsFound",_.bind(this.onSpellCheckVariantsFound,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this},setMode:function(t){return this.mode=t,this.panelSpellcheck&&this.panelSpellcheck.btnToDictionary.setVisible(t.isDesktopApp),this},onAfterRender:function(t){t.buttonNext.on("click",_.bind(this.onClickNext,this)),t.btnToDictionary.on("click",_.bind(this.onDictionary,this)),t.cmbDictionaryLanguage.on("selected",_.bind(this.onSelectLanguage,this)),t.btnChange.on("click",_.bind(this.onClickChange,this)),t.btnIgnore.on("click",_.bind(this.onClickIgnore,this)),t.btnChange.menu.on("item:click",_.bind(this.onClickChangeMenu,this)),t.btnIgnore.menu.on("item:click",_.bind(this.onClickIgnoreMenu,this))},onClickNext:function(){this.api&&this.api.asc_nextWord()},onDictionary:function(){if(this.api){var t=this.panelSpellcheck.currentWord.getValue();t&&this.api.asc_spellCheckAddToDictionary(t)}},SetDisabled:function(t){this._isDisabled=t},setLanguages:function(t){this.languages=t,this._initSettings=!0},loadLanguages:function(){var t=Common.localStorage.getItem("sse-spellcheck-locale");t=t?parseInt(t):this.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)):1033;var e=this.panelSpellcheck.cmbDictionaryLanguage;if(this.languages&&this.languages.length>0){var i,n=[],o=Common.util.LanguageInfo.getLanguages();this.languages.forEach(function(t){t=parseInt(t),o.hasOwnProperty(t)&&(i=o[t],n.push({displayValue:i[1],shortName:i[0],value:t}))}),n.sort(function(t,e){return t.shortName<e.shortName?-1:t.shortName>e.shortName?1:0}),e.setData(n);var s=e.store.findWhere({value:t});!s&&o[t]&&(t=o[t][0].split(/[\-\_]/)[0],s=e.store.find(function(e){return 0==e.get("shortName").indexOf(t)})),e.setValue(s?s.get("value"):n[0].value),t=e.getValue()}else e.setValue(Common.util.LanguageInfo.getLocalLanguageName(t)[1]),e.setDisabled(!0);this.api.asc_setDefaultLanguage(t),this._initSettings=!1},onSelectLanguage:function(t,e){var i=e.value;this.api&&i&&(this.api.asc_setDefaultLanguage(i),Common.localStorage.setItem("sse-spellcheck-locale",this.panelSpellcheck.cmbDictionaryLanguage.getValue()))},onClickChange:function(t,e){if(this.api){var i=this.panelSpellcheck.suggestionList.getSelectedRec();i&&this.api.asc_replaceMisspelledWord(i.get("value"),this._currentSpellObj)}},onClickChangeMenu:function(t,e){if(this.api){var i=this.panelSpellcheck.suggestionList.getSelectedRec();0==e.value?i&&this.api.asc_replaceMisspelledWord(i.get("value"),this._currentSpellObj):1==e.value&&i&&this.api.asc_replaceMisspelledWord(i.get("value"),this._currentSpellObj,!0)}},onClickIgnore:function(){this.api&&this.api.asc_ignoreMisspelledWord(this._currentSpellObj,!1)},onClickIgnoreMenu:function(t,e){this.api&&(0==e.value?this.api.asc_ignoreMisspelledWord(this._currentSpellObj,!1):1==e.value&&this.api.asc_ignoreMisspelledWord(this._currentSpellObj,!0))},onSpellCheckVariantsFound:function(t){this._currentSpellObj=t;var e,i=[];if(t){e=t.get_Word();var n=t.get_Variants();n&&n.forEach(function(t){var e=new Common.UI.DataViewModel;e.set({value:t}),i.push(e)})}var o=this.api.isCellEdited;this.panelSpellcheck.currentWord.setValue(e||""),this.panelSpellcheck.suggestionList.store.reset(i),i.length>0&&this.panelSpellcheck.suggestionList.selectByIndex(0),this.panelSpellcheck.currentWord.setDisabled(!e||o),this.panelSpellcheck.btnChange.setDisabled(i.length<1||o),this.panelSpellcheck.btnIgnore.setDisabled(!e||o),this.panelSpellcheck.btnToDictionary.setDisabled(!e||o),this.panelSpellcheck.lblComplete.toggleClass("hidden",!t||!!e),this.panelSpellcheck.buttonNext.setDisabled(!this.panelSpellcheck.lblComplete.hasClass("hidden"))},onApiEditCell:function(t){t==Asc.c_oAscCellEditorState.editEnd?(this.panelSpellcheck.buttonNext.setDisabled(!this.panelSpellcheck.lblComplete.hasClass("hidden")),this.panelSpellcheck.cmbDictionaryLanguage.setDisabled(!1)):(this.panelSpellcheck.buttonNext.setDisabled(!0),this.panelSpellcheck.currentWord.setDisabled(!0),this.panelSpellcheck.btnChange.setDisabled(!0),this.panelSpellcheck.btnIgnore.setDisabled(!0),this.panelSpellcheck.btnToDictionary.setDisabled(!0),this.panelSpellcheck.cmbDictionaryLanguage.setDisabled(!0))}},SSE.Controllers.Spellcheck||{}))}),define("text!spreadsheeteditor/main/app/template/RightMenu.template",[],function(){
|
|
|
return'<div id="view-right-menu" class="tool-menu right">\n <div class="right-panel">\n <div id="id-table-settings" class="settings-panel">\n </div>\n <div id="id-shape-settings" class="settings-panel">\n </div>\n <div id="id-image-settings" class="settings-panel">\n </div>\n <div id="id-chart-settings" class="settings-panel">\n </div>\n <div id="id-paragraph-settings" class="settings-panel">\n </div>\n <div id="id-textart-settings" class="settings-panel">\n </div>\n <div id="id-pivot-settings" class="settings-panel">\n </div>\n <div id="id-signature-settings" class="settings-panel">\n </div>\n <div id="id-cell-settings" class="settings-panel">\n </div>\n </div>\n <div class="tool-menu-btns">\n <div class="ct-btn-category arrow-left" />\n <button id="id-right-menu-cell" class="btn btn-category arrow-left" content-target="id-cell-settings"><i class="icon img-toolbarmenu btn-menu-cell"> </i></button>\n <button id="id-right-menu-table" class="btn btn-category arrow-left" content-target="id-table-settings"><i class="icon img-toolbarmenu btn-menu-table"> </i></button>\n <button id="id-right-menu-shape" class="btn btn-category arrow-left" content-target="id-shape-settings"><i class="icon img-toolbarmenu btn-menu-shape"> </i></button>\n <button id="id-right-menu-image" class="btn btn-category arrow-left" content-target="id-image-settings"><i class="icon img-toolbarmenu btn-menu-image"> </i></button>\n <button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><i class="icon img-toolbarmenu btn-menu-chart"> </i></button>\n <button id="id-right-menu-text" class="btn btn-category arrow-left" content-target="id-paragraph-settings"><i class="icon img-toolbarmenu btn-menu-text"> </i></button>\n <button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><i class="icon img-toolbarmenu btn-menu-textart"> </i></button>\n <button id="id-right-menu-pivot" class="btn btn-category arrow-left hidden" content-target="id-pivot-settings"><i class="icon img-toolbarmenu btn-menu-pivot"> </i></button>\n <button id="id-right-menu-signature" class="btn btn-category arrow-left hidden" content-target="id-signature-settings"><i class="icon img-toolbarmenu btn-menu-signature"> </i></button>\n </div>\n</div>'}),define("text!spreadsheeteditor/main/app/template/ParagraphSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.strLineHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <div id="paragraph-combo-line-rule" style="width: 85px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <div id="paragraph-spin-line-height"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.strParagraphSpacing %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.strSpacingBefore %></label>\r\n <div id="paragraph-spin-spacing-before"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.strSpacingAfter %></label>\r\n <div id="paragraph-spin-spacing-after"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center" colspan=2>\r\n <label class="link" id="paragraph-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'});var c_paragraphLinerule={LINERULE_LEAST:0,LINERULE_AUTO:1,LINERULE_EXACT:2};if(define("spreadsheeteditor/main/app/view/ParagraphSettings",["text!spreadsheeteditor/main/app/template/ParagraphSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced"],function(t,e,i,n){"use strict";SSE.Views.ParagraphSettings=n.View.extend(i.extend({el:"#id-paragraph-settings",template:i.template(t),events:{},options:{alias:"ParagraphSettings"},initialize:function(){this._initSettings=!0,this._state={LineRule:c_paragraphLinerule.LINERULE_AUTO,LineHeight:1.5,LineSpacingBefore:0,LineSpacingAfter:.35,DisabledControls:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this.render()},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#paragraph-advanced-link")},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onParaSpacingLine",i.bind(this._onLineSpacing,this)),this},onNumLineHeightChange:function(t,e,i,n){""!==this.cmbLineRule.getRawValue()&&(this.api&&this.api.asc_putPrLineSpacing(this.cmbLineRule.getValue(),this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),Common.NotificationCenter.trigger("edit:complete",this))},onNumSpacingBeforeChange:function(t,e,i,n){if(this.api){t.getNumberValue()<0?this.api.asc_putLineSpacingBeforeAfter(0,-1):this.api.asc_putLineSpacingBeforeAfter(0,Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}Common.NotificationCenter.trigger("edit:complete",this)},onNumSpacingAfterChange:function(t,e,i,n){if(this.api){t.getNumberValue()<0?this.api.asc_putLineSpacingBeforeAfter(1,-1):this.api.asc_putLineSpacingBeforeAfter(1,Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}Common.NotificationCenter.trigger("edit:complete",this)},onLineRuleSelect:function(t,e){this.api&&this.api.asc_putPrLineSpacing(e.value,e.defaultValue),this.numLineHeight.setDefaultUnit(e.defaultUnit),this.numLineHeight.setMinValue(e.minValue),this.numLineHeight.setStep(e.step),Common.NotificationCenter.trigger("edit:complete",this)},_onLineSpacing:function(t){if(!this._initSettings){var e=t.asc_getLineRule(),i=t.asc_getLine();if(this._state.LineRule!==e){var n,o=this.cmbLineRule.store.findWhere((n={},n.value=e,n));o||(o=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(null!==e?e:""),this.numLineHeight.setMinValue(o.get("minValue")),this.numLineHeight.setDefaultUnit(o.get("defaultUnit")),this.numLineHeight.setStep(o.get("step")),this._state.LineRule=e}if(Math.abs(this._state.LineHeight-i)>.001||(null===this._state.LineHeight||null===i)&&this._state.LineHeight!==i){var s="";e==c_paragraphLinerule.LINERULE_AUTO?s=i:null!==e&&null!==i&&(s=Common.Utils.Metric.fnRecalcFromMM(i)),this.numLineHeight.setValue(null!==s?s:"",!0),this._state.LineHeight=i}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){var e={Line:t.asc_getSpacing().asc_getLine(),Before:t.asc_getSpacing().asc_getBefore(),After:t.asc_getSpacing().asc_getAfter(),LineRule:t.asc_getSpacing().asc_getLineRule()};if(this._state.LineRule!==e.LineRule){var i,n=this.cmbLineRule.store.findWhere((i={},i.value=e.LineRule,i));n||(n=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(null!==e.LineRule?e.LineRule:""),this.numLineHeight.setMinValue(n.get("minValue")),this.numLineHeight.setDefaultUnit(n.get("defaultUnit")),this.numLineHeight.setStep(n.get("step")),this._state.LineRule=e.LineRule}if(Math.abs(this._state.LineHeight-e.Line)>.001||(null===this._state.LineHeight||null===e.Line)&&this._state.LineHeight!==e.Line){var o="";e.LineRule==c_paragraphLinerule.LINERULE_AUTO?o=e.Line:null!==e.LineRule&&null!==e.Line&&(o=Common.Utils.Metric.fnRecalcFromMM(e.Line)),this.numLineHeight.setValue(null!==o?o:"",!0),this._state.LineHeight=e.Line}(Math.abs(this._state.LineSpacingBefore-e.Before)>.001||(null===this._state.LineSpacingBefore||null===e.Before)&&this._state.LineSpacingBefore!==e.Before)&&(this.numSpacingBefore.setValue(null!==e.Before?e.Before<0?e.Before:Common.Utils.Metric.fnRecalcFromMM(e.Before):"",!0),this._state.LineSpacingBefore=e.Before),(Math.abs(this._state.LineSpacingAfter-e.After)>.001||(null===this._state.LineSpacingAfter||null===e.After)&&this._state.LineSpacingAfter!==e.After)&&(this.numSpacingAfter.setValue(null!==e.After?e.After<0?e.After:Common.Utils.Metric.fnRecalcFromMM(e.After):"",!0),this._state.LineSpacingAfter=e.After)}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01)}if(this.cmbLineRule){var i=this.cmbLineRule.store.at(1);if(i.set({defaultUnit:Common.Utils.Metric.getCurrentMetricName(),minValue:parseFloat(Common.Utils.Metric.fnRecalcFromMM(.3).toFixed(2)),step:Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01}),null!==this._state.LineRule){var n;i=this.cmbLineRule.store.findWhere((n={},n.value=this._state.LineRule,n)),i||(i=this.cmbLineRule.store.at(0)),this.numLineHeight.setDefaultUnit(i.get("defaultUnit")),this.numLineHeight.setStep(i.get("step"))}}},createDelayedControls:function(){this._arrLineRule=[{displayValue:this.textAuto,defaultValue:1,value:c_paragraphLinerule.LINERULE_AUTO,minValue:.5,step:.01,defaultUnit:""},{displayValue:this.textExact,defaultValue:5,value:c_paragraphLinerule.LINERULE_EXACT,minValue:.03,step:.01,defaultUnit:"cm"}],this.cmbLineRule=new Common.UI.ComboBox({el:e("#paragraph-combo-line-rule"),cls:"input-group-nr",menuStyle:"min-width: 85px;",editable:!1,data:this._arrLineRule}),this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO),this.lockedControls.push(this.cmbLineRule),this.numLineHeight=new Common.UI.MetricSpinner({el:e("#paragraph-spin-line-height"),step:.01,width:85,value:"1.5",defaultUnit:"",maxValue:132,minValue:.5}),this.lockedControls.push(this.numLineHeight),this.numSpacingBefore=new Common.UI.MetricSpinner({el:e("#paragraph-spin-spacing-before"),step:.1,width:85,value:"0 cm",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.spinners.push(this.numSpacingBefore),this.lockedControls.push(this.numSpacingBefore),this.numSpacingAfter=new Common.UI.MetricSpinner({el:e("#paragraph-spin-spacing-after"),step:.1,width:85,value:"0.35 cm",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.spinners.push(this.numSpacingAfter),this.lockedControls.push(this.numSpacingAfter),this.numLineHeight.on("change",i.bind(this.onNumLineHeightChange,this)),this.numSpacingBefore.on("change",i.bind(this.onNumSpacingBeforeChange,this)),this.numSpacingAfter.on("change",i.bind(this.onNumSpacingAfterChange,this)),this.cmbLineRule.on("selected",i.bind(this.onLineRuleSelect,this)),this.cmbLineRule.on("hide:after",i.bind(this.onHideMenus,this)),e(this.el).on("click","#paragraph-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.asc_getGraphicObjectProps();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].asc_getObjectType(),o=i[s].asc_getObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new SSE.Views.ParagraphSettingsAdvanced({paragraphProps:o,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.borderAdvancedProps=i.borderProps,e.api.asc_setGraphicObjectProps(i.paragraphProps)),Common.NotificationCenter.trigger("edit:complete",e)}}).show();break}}}},onHideMenus:function(t,e,i){i||Common.NotificationCenter.trigger("edit:complete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},strParagraphSpacing:"Paragraph Spacing",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto"},SSE.Views.ParagraphSettings||{}))}),define("text!spreadsheeteditor/main/app/template/ImageSettings.template",[],function(){return'<table cols="3">\r\n <tr>\r\n <td colspan=3>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="image-spin-width"></div>\r\n </td>\r\n <td class="padding-small" width="28px" style="vertical-align: bottom;">\r\n <div id="image-button-ratio"></div>\r\n </td>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="image-spin-height"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="2">\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <button type="button" class="btn btn-text-default" id="image-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="image-button-crop" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textRotation %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textRotate90 %></label>\r\n <div>\r\n <div id="image-button-270" style="display: inline-block;margin-right: 4px;"></div>\r\n <div id="image-button-90" style="display: inline-block;"></div>\r\n </div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textFlip %></label>\r\n <div>\r\n <div id="image-button-fliph" style="display: inline-block;margin-right: 4px;"></div>\r\n <div id="image-button-flipv" style="display: inline-block;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header" id="image-lbl-replace"><%= scope.textInsert %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="50%">\r\n <button type="button" class="btn btn-text-default" id="image-button-from-file" style="width:85px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td width="50%">\r\n <button type="button" class="btn btn-text-default" id="image-button-from-url" style="width:85px;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <button type="button" class="btn btn-text-default hidden" id="image-button-edit-object" style="width:100px;"><%= scope.textEdit %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center" colspan=2>\r\n <label class="link" id="image-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("spreadsheeteditor/main/app/view/ImageSettings",["text!spreadsheeteditor/main/app/template/ImageSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/view/ImageFromUrlDialog","spreadsheeteditor/main/app/view/ImageSettingsAdvanced"],function(t,e,i,n){"use strict";SSE.Views.ImageSettings=n.View.extend(i.extend({el:"#id-image-settings",template:i.template(t),events:{},options:{alias:"ImageSettings"},initialize:function(){this._initSettings=!0,this._nRatio=1,this._state={Width:0,Height:0,DisabledControls:!1,keepRatio:!1,isOleObject:!1,cropMode:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render()},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#image-advanced-link")},setApi:function(t){if(void 0!=t)return this.api=t,this.api&&this.api.asc_registerCallback("asc_ChangeCropState",i.bind(this._changeCropState,this)),this},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},createDelayedControls:function(){var t=this;this.spnWidth=new Common.UI.MetricSpinner({el:e("#image-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:e("#image-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render(e("#image-button-ratio")),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",i.bind(function(t,e){if(t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this.api){var i=new Asc.asc_CImgProperty;i.asc_putLockAspect(t.pressed),this.api.asc_setGraphicObjectProps(i)}},this)),this.btnOriginalSize=new Common.UI.Button({el:e("#image-button-original-size")}),this.lockedControls.push(this.btnOriginalSize),this.btnInsertFromFile=new Common.UI.Button({el:e("#image-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:e("#image-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnEditObject=new Common.UI.Button({el:e("#image-button-edit-object")}),this.lockedControls.push(this.btnEditObject),this.spnWidth.on("change",i.bind(this.onWidthChange,this)),this.spnHeight.on("change",i.bind(this.onHeightChange,this)),this.btnOriginalSize.on("click",i.bind(this.setOriginalSize,this)),this.btnInsertFromFile.on("click",i.bind(function(t){this._isFromFile||(this._isFromFile=!0,this.api&&this.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",this),this._isFromFile=!1)},this)),this.btnEditObject.on("click",i.bind(function(t){this.api&&this.api.asc_startEditCurrentOleObject(),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this.lblReplace=e("#image-lbl-replace"),this.btnCrop=new Common.UI.Button({cls:"btn-text-split-default",caption:this.textCrop,split:!0,enableToggle:!0,allowDepress:!0,pressed:this._state.cropMode,width:100,menu:new Common.UI.Menu({style:"min-width: 100px;",items:[{caption:this.textCrop,checkable:!0,allowDepress:!0,checked:this._state.cropMode,value:0},{caption:this.textCropFill,value:1},{caption:this.textCropFit,value:2}]})}),this.btnCrop.render(e("#image-button-crop")),this.btnCrop.on("click",i.bind(this.onCrop,this)),this.btnCrop.menu.on("item:click",i.bind(this.onCropMenu,this)),this.lockedControls.push(this.btnCrop),this.btnRotate270=new Common.UI.Button({cls:"btn-toolbar",iconCls:"rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.render(e("#image-button-270",t.$el)),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({cls:"btn-toolbar",iconCls:"rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.render(e("#image-button-90",t.$el)),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({cls:"btn-toolbar",iconCls:"flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.render(e("#image-button-flipv",t.$el)),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({cls:"btn-toolbar",iconCls:"flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.render(e("#image-button-fliph",t.$el)),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),e(this.el).on("click","#image-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.asc_getGraphicObjectProps();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].asc_getObjectType(),o=i[s].asc_getObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){new SSE.Views.ImageSettingsAdvanced({imageProps:o,api:e.api,handler:function(t,i){"ok"==t&&e.api&&e.api.asc_setGraphicObjectProps(i.imageProps),Common.NotificationCenter.trigger("edit:complete",e)}}).show();break}}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.asc_CImgProperty(t);var e=t.asc_getWidth();(Math.abs(this._state.Width-e)>.001||(null===this._state.Width||null===e)&&this._state.Width!==e)&&(this.spnWidth.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Width=e),e=t.asc_getHeight(),(Math.abs(this._state.Height-e)>.001||(null===this._state.Height||null===e)&&this._state.Height!==e)&&(this.spnHeight.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Height=e),t.asc_getHeight()>0&&(this._nRatio=t.asc_getWidth()/t.asc_getHeight()),e=t.asc_getLockAspect(),this._state.keepRatio!==e&&(this.btnRatio.toggle(e),this._state.keepRatio=e),this.btnOriginalSize.setDisabled(null===t.asc_getImageUrl()||void 0===t.asc_getImageUrl()||this._locked);var i=t.asc_getPluginGuid();if(e=null!==i&&void 0!==i,this._state.isOleObject!==e&&(this.btnInsertFromUrl.setVisible(!e),this.btnInsertFromFile.setVisible(!e),this.btnEditObject.setVisible(e),this.lblReplace.text(e?this.textEditObject:this.textInsert),this.btnRotate270.setDisabled(e),this.btnRotate90.setDisabled(e),this.btnFlipV.setDisabled(e),this.btnFlipH.setDisabled(e),this._state.isOleObject=e),this._state.isOleObject){var n=SSE.getCollection("Common.Collections.Plugins").findWhere({guid:i});this.btnEditObject.setDisabled(null===n||void 0===n||this._locked)}else this.btnInsertFromUrl.setDisabled(null===i||this._locked),this.btnInsertFromFile.setDisabled(null===i||this._locked)}},onWidthChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnHeight.getNumberValue();if(this.btnRatio.pressed&&(s=o/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)),this.api){var a=new Asc.asc_CImgProperty;a.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(o)),a.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(s)),this.api.asc_setGraphicObjectProps(a)}Common.NotificationCenter.trigger("edit:complete",this)},onHeightChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnWidth.getNumberValue();if(this.btnRatio.pressed&&(s=o*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this.api){var a=new Asc.asc_CImgProperty;a.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(s)),a.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(o)),this.api.asc_setGraphicObjectProps(a)}Common.NotificationCenter.trigger("edit:complete",this)},setOriginalSize:function(){if(this.api){var t=this.api.asc_getOriginalImageSize(),e=t.asc_getImageWidth(),i=t.asc_getImageHeight(),n=new Asc.asc_CImgProperty;n.asc_putWidth(e),n.asc_putHeight(i),n.put_ResetCrop(!0),this.api.asc_setGraphicObjectProps(n),Common.NotificationCenter.trigger("edit:complete",this)}},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)){var s=new Asc.asc_CImgProperty;s.asc_putImageUrl(o),t.api.asc_setGraphicObjectProps(s)}}Common.NotificationCenter.trigger("edit:complete",t)}}).show()},_changeCropState:function(t){this._state.cropMode=t,this.btnCrop&&(this.btnCrop.toggle(t,!0),this.btnCrop.menu.items[0].setChecked(t,!0))},onCrop:function(t,e){this.api&&(t.pressed?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),Common.NotificationCenter.trigger("edit:complete",this)},onCropMenu:function(t,e){this.api&&(1==e.value?this.api.asc_cropFill():2==e.value?this.api.asc_cropFit():e.checked?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),Common.NotificationCenter.trigger("edit:complete",this)},onBtnRotateClick:function(t){var e=new Asc.asc_CImgProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.api.asc_setGraphicObjectProps(e),Common.NotificationCenter.trigger("edit:complete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CImgProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.asc_setGraphicObjectProps(e),Common.NotificationCenter.trigger("edit:complete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||(this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)),this.btnCrop.setDisabled(t||!this.api.asc_canEditCrop()))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textOriginalSize:"Default Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textEditObject:"Edit Object",textEdit:"Edit",textAdvanced:"Show advanced settings",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",textCrop:"Crop",textCropFill:"Fill",textCropFit:"Fit"},SSE.Views.ImageSettings||{}))}),define("text!spreadsheeteditor/main/app/template/ChartSettings.template",[],function(){
|
|
|
return'<table cols="3" id="chart-panel-size">\r\n <tr>\r\n <td colspan=3>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="chart-spin-width"></div>\r\n </td>\r\n <td class="padding-small" width="28px" style="vertical-align: bottom;">\r\n <div id="chart-button-ratio"></div>\r\n </td>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="chart-spin-height"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1" id="chart-panel-types">\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textType %></label>\r\n <div id="chart-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header" style=""><%= scope.textStyle %></label>\r\n <div class="" id="chart-combo-style" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textRanges %></label>\r\n <button type="button" class="btn btn-text-default" id="chart-btn-select-data" style="min-width: 100px; width: auto; display: block;"><%= scope.textSelectData %></button>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1" id="spark-panel-types">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textType %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="spark-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textStyle %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label" style=""><%= scope.strTemplate %></label>\r\n <div class="" id="spark-combo-style" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;vertical-align: middle;width:55px;">\r\n <label class="input-label" style=""><%= scope.strSparkColor %></label>\r\n <div id="spark-color-btn" style=""></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strLineWeight %></label>\r\n <div id="spark-combo-line-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1" id="spark-panel-points">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header" style="margin-bottom: 4px;"><%= scope.textShow %></label>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-high" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-high-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-low" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-low-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-negative" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-negative-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-first" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-first-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-last" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-last-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <div id="spark-checkbox-markers" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-markers-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1">\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center">\r\n <label class="link" id="chart-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template",[],function(){return'<div id="id-chart-settings-dlg-style" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="1" style="">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textType %></label>\r\n <div id="chart-dlg-button-type" style="margin-right: 15px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 >\r\n <label class="header"><%= scope.textDataRange %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="200">\r\n <div id="chart-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div>\r\n </td>\r\n <td class="padding-small" style="text-align: right;">\r\n <button type="button" class="btn btn-text-default" id="chart-dlg-btn-data" style="min-width: 100px;width: auto;"><%= scope.textSelectData %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="input-label"><%= scope.textDataSeries %></label>\r\n <div id="chart-dlg-combo-range" class="input-group-nr" style="width:120px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-layout" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textChartTitle %></label>\r\n <div id="chart-dlg-combo-chart-title" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textLegendPos %></label>\r\n <div id="chart-dlg-combo-legend-pos" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textDataLabels %></label>\r\n <div id="chart-dlg-combo-data-labels" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td rowspan="2" class="padding-small" width="50%">\r\n <div id="chart-dlg-check-series" style="margin: 20px 0 9px 7px;"></div>\r\n <div id="chart-dlg-check-category" style="margin: 0 0 9px 7px;"></div>\r\n <div id="chart-dlg-check-value" style="margin: 0 0 5px 7px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textSeparator %></label>\r\n <div id="chart-dlg-txt-separator" class="input-row" style="margin-right: 7px;"/>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="50%">\r\n <label id="chart-dlg-label-lines" class="input-label"><%= scope.textLines %></label>\r\n <div id="chart-dlg-combo-lines" class="input-group-nr padding-small" style="margin-right: 7px;"></div>\r\n </td>\r\n <td style="vertical-align: bottom;" width="50%">\r\n <div id="chart-dlg-check-markers" style="margin: 0 0 12px 7px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2">\r\n <label class="header padding-small" style="padding-top: 8px;"><%= scope.textAxisSettings %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textHorAxis %></label>\r\n <div id="chart-dlg-combo-hor-show" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textVertAxis %></label>\r\n <div id="chart-dlg-combo-vert-show" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="50%">\r\n <label class="input-label"><%= scope.textHorTitle %></label>\r\n <div id="chart-dlg-combo-hor-title" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-large" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textVertTitle %></label>\r\n <div id="chart-dlg-combo-vert-title" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2">\r\n <label class="header padding-small"><%= scope.textGridLines %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textHorGrid %></label>\r\n <div id="chart-dlg-combo-hor-grid" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textVertGrid %></label>\r\n <div id="chart-dlg-combo-vert-grid" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-vert" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header padding-small"><%= scope.textAxisOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="100">\r\n <label class="input-label"><%= scope.textMinValue %></label>\r\n </td>\r\n <td class="padding-small" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-mintype"></div>\r\n </td>\r\n <td class="padding-small" width="90">\r\n <div id="chart-dlg-input-min-value"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="100">\r\n <label class="input-label"><%= scope.textMaxValue %></label>\r\n </td>\r\n <td class="padding-large" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-maxtype"></div>\r\n </td>\r\n <td class="padding-large" width="90">\r\n <div id="chart-dlg-input-max-value"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="100">\r\n <label class="input-label"><%= scope.textAxisCrosses %></label>\r\n </td>\r\n <td class="padding-large" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-v-crosstype"></div>\r\n </td>\r\n <td class="padding-large" width="90">\r\n <div id="chart-dlg-input-v-axis-crosses"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textUnits %></label>\r\n <div id="chart-dlg-combo-units" class="input-group-nr" style="width:140px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="chart-dlg-check-v-reverse"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textTickOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textMajorType %></label>\r\n <div id="chart-dlg-combo-v-major-type" class="input-group-nr"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label" style="margin-left: 15px;"><%= scope.textMinorType %></label>\r\n <div id="chart-dlg-combo-v-minor-type" class="input-group-nr" style="margin-left: 15px;" />\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textLabelOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="input-label"><%= scope.textLabelPos %></label>\r\n <div id="chart-dlg-combo-v-label-pos" class="input-group-nr" style="width:140px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-hor" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header padding-small"><%= scope.textAxisOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="100">\r\n <label class="input-label"><%= scope.textAxisCrosses %></label>\r\n </td>\r\n <td class="padding-small" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-h-crosstype"></div>\r\n </td>\r\n <td class="padding-small" width="90">\r\n <div id="chart-dlg-input-h-axis-crosses"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large" width="140">\r\n <label class="input-label"><%= scope.textAxisPos %></label>\r\n <div id="chart-dlg-combo-axis-pos" class="input-group-nr" style="width:140px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="chart-dlg-check-h-reverse"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textTickOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="140">\r\n <label class="input-label"><%= scope.textMajorType %></label>\r\n <div id="chart-dlg-combo-h-major-type" class="input-group-nr"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label" style="margin-left: 15px;"><%= scope.textMinorType %></label>\r\n <div id="chart-dlg-combo-h-minor-type" class="input-group-nr" style="margin-left: 15px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="100%" colspan="2">\r\n <label class="input-label"><%= scope.textMarksInterval %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="140">\r\n <div id="chart-dlg-input-marks-interval"></div>\r\n </td>\r\n <td class="padding-large">\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textLabelOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="140">\r\n <label class="input-label"><%= scope.textLabelPos %></label>\r\n <div id="chart-dlg-combo-h-label-pos" class="input-group-nr"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label" style="margin-left: 15px;"><%= scope.textLabelDist %></label>\r\n <div id="chart-dlg-input-label-dist" style="margin-left: 15px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="100%" colspan="2">\r\n <label class="input-label"><%= scope.textLabelInterval %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="140">\r\n <div id="chart-dlg-combo-label-int" class="input-group-nr"></div>\r\n </td>\r\n <td style="vertical-align: bottom;">\r\n <div id="chart-dlg-input-label-int" style="margin-left: 15px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-spark-settings-dlg-style" class="settings-panel">\r\n <div class="inner-content padding-large">\r\n <table cols="2" style="">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textType %></label>\r\n <div id="spark-dlg-button-type" style="margin-right: 15px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textStyle %></label>\r\n <div id="spark-dlg-combo-style" style="width: 190px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n \x3c!--<div class="padding-large" >--\x3e\r\n \x3c!--<label class="header padding-small" style="display: block;"><%= scope.textSparkRanges %></label>--\x3e\r\n \x3c!--<div id="spark-dlg-radio-group" class="padding-small" style="display: block;"></div>--\x3e\r\n \x3c!--<div id="spark-dlg-radio-single" style="display: block;"></div>--\x3e\r\n \x3c!--</div>--\x3e\r\n <table cols="2" style="width: 100%;">\r\n \x3c!--<tr>--\x3e\r\n \x3c!--<td colspan=2 >--\x3e\r\n \x3c!--<label class="header"><%= scope.textDataRange %></label>--\x3e\r\n \x3c!--</td>--\x3e\r\n \x3c!--</tr>--\x3e\r\n \x3c!--<tr>--\x3e\r\n \x3c!--<td class="padding-small" width="200">--\x3e\r\n \x3c!--<div id="spark-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div>--\x3e\r\n \x3c!--</td>--\x3e\r\n \x3c!--<td class="padding-small" style="text-align: right;">--\x3e\r\n \x3c!--<button type="button" class="btn btn-text-default" id="spark-dlg-btn-data" style="min-width: 100px;"><%= scope.textSelectData %></button>--\x3e\r\n \x3c!--</td>--\x3e\r\n \x3c!--</tr>--\x3e\r\n \x3c!--<tr>--\x3e\r\n \x3c!--<td colspan=2 >--\x3e\r\n \x3c!--<label class="header"><%= scope.textLocationRange %></label>--\x3e\r\n \x3c!--</td>--\x3e\r\n \x3c!--</tr>--\x3e\r\n \x3c!--<tr>--\x3e\r\n \x3c!--<td class="padding-large" width="200">--\x3e\r\n \x3c!--<div id="spark-dlg-txt-location" class="input-row" style="margin-right: 10px;"></div>--\x3e\r\n \x3c!--</td>--\x3e\r\n \x3c!--<td class="padding-large" style="text-align: right;">--\x3e\r\n \x3c!--<button type="button" class="btn btn-text-default" id="spark-dlg-btn-location-data" style="min-width: 100px;"><%= scope.textSelectData %></button>--\x3e\r\n \x3c!--</td>--\x3e\r\n \x3c!--</tr>--\x3e\r\n \x3c!--<tr>--\x3e\r\n \x3c!--<td colspan=2 class="padding-large"></td>--\x3e\r\n \x3c!--</tr>--\x3e\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textEmptyCells %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="230">\r\n <label class="input-label"><%= scope.textShowEmptyCells %></label>\r\n <div id="spark-dlg-combo-empty" class="input-group-nr" style="margin-right: 10px;"></div>\r\n </td>\r\n <td></td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <div id="spark-dlg-check-show-data"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-spark-settings-dlg-axis" class="settings-panel">\r\n <div class="inner-content">\r\n <div class="padding-large" >\r\n <label class="header padding-small" style="display: block;"><%= scope.textHorAxis %></label>\r\n <div id="spark-dlg-check-show" class="padding-small" style="display: block;"></div>\r\n <div id="spark-dlg-check-reverse" class="padding-small" style="display: block;"></div>\r\n </div>\r\n <table cols="3" style="width: 100%">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header padding-small"><%= scope.textVertAxis %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="100">\r\n <label class="input-label"><%= scope.textMinValue %></label>\r\n </td>\r\n <td class="padding-small" width="115" style="padding-right: 10px;">\r\n <div id="spark-dlg-combo-mintype"></div>\r\n </td>\r\n <td class="padding-small" width="90">\r\n <div id="spark-dlg-input-min-value"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="100">\r\n <label class="input-label"><%= scope.textMaxValue %></label>\r\n </td>\r\n <td class="padding-large" width="115" style="padding-right: 10px;">\r\n <div id="spark-dlg-combo-maxtype"></div>\r\n </td>\r\n <td class="padding-large" width="90">\r\n <div id="spark-dlg-input-max-value"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-alttext" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="1" width="100%">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textAltTitle %></label>\r\n <div id="chart-advanced-alt-title"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textAltDescription %></label>\r\n <textarea id="chart-advanced-alt-description" class="form-control" style="width: 100%; height: 120px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),void 0===Common)var Common={};if(define("spreadsheeteditor/main/app/view/CellRangeDialog",["common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";SSE.Views.CellRangeDialog=Common.UI.Window.extend(_.extend({options:{width:350,cls:"modal-dlg",modal:!1},initialize:function(t){_.extend(this.options,{title:this.txtTitle},t),this.template=['<div class="box">','<div id="id-dlg-cell-range" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();this.inputRange=new Common.UI.InputField({el:$("#id-dlg-cell-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){var e=this;this.inputRange.setValue(t.range?t.range:""),void 0===t.type&&(t.type=Asc.c_oAscSelectionDialogType.Chart),t.api&&(e.api=t.api,e.api.asc_setSelectionDialogMode(t.type,t.range?t.range:""),e.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),e.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),Common.NotificationCenter.trigger("cells:range",t.type)),e.inputRange.validation=function(i){return t.validation?t.validation.call(e,i):e.api.asc_checkDataRange(t.type,i,!1)!=Asc.c_oAscError.ID.DataRangeError||e.txtInvalidRange}},getSettings:function(){return this.inputRange.getValue()},onApiRangeChanged:function(t){this.inputRange.setValue(t.asc_getName()),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error")},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onClose:function(t){this.api&&this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.None),SSE.getController("RightMenu").SetDisabled(!1)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputRange.checkValidate())return;this.options.handler.call(this,this,t)}this.close()},show:function(){Common.UI.Window.prototype.show.call(this),SSE.getController("RightMenu").SetDisabled(!0)},txtTitle:"Select Data Range",textCancel:"Cancel",txtEmpty:"This field is required",txtInvalidRange:"ERROR! Invalid cells range",errorMaxRows:"ERROR! The maximum number of data series per chart is 255.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price."},SSE.Views.CellRangeDialog||{}))}),define("spreadsheeteditor/main/app/view/ChartSettingsDlg",["text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/CheckBox","common/main/lib/component/InputField","spreadsheeteditor/main/app/view/CellRangeDialog"],function(t){"use strict";SSE.Views.ChartSettingsDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:322,height:535,toggleGroup:"chart-settings-dlg-group",storageName:"sse-chart-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-chart-settings-dlg-style",panelCaption:this.textTypeData},{panelId:"id-chart-settings-dlg-layout",panelCaption:this.textLayout},{panelId:"id-chart-settings-dlg-vert",panelCaption:this.textVertAxis},{panelId:"id-chart-settings-dlg-hor",panelCaption:this.textHorAxis},{panelId:"id-spark-settings-dlg-style",panelCaption:this.textTypeData},{panelId:"id-spark-settings-dlg-axis",panelCaption:this.textAxisOptions},{panelId:"id-chart-settings-dlg-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),this.options.handler=function(t,i){return"ok"==t&&!this.isRangeValid()||void(e.handler&&e.handler.call(this,t,i))},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._state={
|
|
|
ChartType:Asc.c_oAscChartTypeSettings.barNormal,SparkType:-1},this._noApply=!0,this._changedProps=null,this.api=this.options.api,this.chartSettings=this.options.chartSettings,this.imageSettings=this.options.imageSettings,this.sparklineStyles=this.options.sparklineStyles,this.isChart=this.options.isChart,this.vertAxisProps=null,this.horAxisProps=null,this.currentAxisProps=null,this.dataRangeValid="",this.sparkDataRangeValid="",this.dataLocationRangeValid="",this.currentChartType=this._state.ChartType,this.storageName=this.isChart?"sse-chart-settings-adv-category":"sse-spark-settings-adv-category"},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.getChild();this.btnChartType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist bar-normal",menu:new Common.UI.Menu({style:"width: 435px; padding-top: 12px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('<div id="id-chart-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),this.btnChartType.on("render:after",function(e){t.mnuChartTypePicker=new Common.UI.DataView({el:$("#id-chart-dlg-menu-type"),parentMenu:e.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:t.textColumn},{id:"menu-chart-group-line",caption:t.textLine},{id:"menu-chart-group-pie",caption:t.textPie},{id:"menu-chart-group-hbar",caption:t.textBar},{id:"menu-chart-group-area",caption:t.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:t.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:t.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]),itemTemplate:_.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnChartType.render($("#chart-dlg-button-type")),this.mnuChartTypePicker.on("item:click",_.bind(this.onSelectType,this,this.btnChartType)),this.cmbDataDirect=new Common.UI.ComboBox({el:$("#chart-dlg-combo-range"),menuStyle:"min-width: 120px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textDataRows},{value:1,displayValue:this.textDataColumns}]}),this.txtDataRange=new Common.UI.InputField({el:$("#chart-dlg-txt-range"),name:"range",style:"width: 100%;",allowBlank:!0,validateOnChange:!0}),this.btnSelectData=new Common.UI.Button({el:$("#chart-dlg-btn-data")}),this.btnSelectData.on("click",_.bind(this.onSelectData,this)),this.cmbChartTitle=new Common.UI.ComboBox({el:$("#chart-dlg-combo-chart-title"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartTitleShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartTitleShowSettings.overlay,displayValue:this.textOverlay},{value:Asc.c_oAscChartTitleShowSettings.noOverlay,displayValue:this.textNoOverlay}]}),this.cmbLegendPos=new Common.UI.ComboBox({el:$("#chart-dlg-combo-legend-pos"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartLegendShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartLegendShowSettings.bottom,displayValue:this.textLegendBottom},{value:Asc.c_oAscChartLegendShowSettings.top,displayValue:this.textLegendTop},{value:Asc.c_oAscChartLegendShowSettings.right,displayValue:this.textLegendRight},{value:Asc.c_oAscChartLegendShowSettings.left,displayValue:this.textLegendLeft},{value:Asc.c_oAscChartLegendShowSettings.leftOverlay,displayValue:this.textLeftOverlay},{value:Asc.c_oAscChartLegendShowSettings.rightOverlay,displayValue:this.textRightOverlay}]}),this.cmbHorTitle=new Common.UI.ComboBox({el:$("#chart-dlg-combo-hor-title"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartHorAxisLabelShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartHorAxisLabelShowSettings.noOverlay,displayValue:this.textNoOverlay}]}).on("selected",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putHorAxisLabel(e.value)},this)),this.cmbVertTitle=new Common.UI.ComboBox({el:$("#chart-dlg-combo-vert-title"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartVertAxisLabelShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartVertAxisLabelShowSettings.rotated,displayValue:this.textRotated},{value:Asc.c_oAscChartVertAxisLabelShowSettings.horizontal,displayValue:this.textHorizontal}]}).on("selected",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putVertAxisLabel(e.value)},this)),this.cmbHorShow=new Common.UI.ComboBox({el:$("#chart-dlg-combo-hor-show"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:!0,displayValue:this.textShow},{value:!1,displayValue:this.textHide}]}).on("selected",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putShowHorAxis(e.value)},this)),this.cmbVertShow=new Common.UI.ComboBox({el:$("#chart-dlg-combo-vert-show"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:!0,displayValue:this.textShow},{value:!1,displayValue:this.textHide}]}).on("selected",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putShowVerAxis(e.value)},this)),this.cmbHorGrid=new Common.UI.ComboBox({el:$("#chart-dlg-combo-hor-grid"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscGridLinesSettings.none,displayValue:this.textNone},{value:Asc.c_oAscGridLinesSettings.major,displayValue:this.textMajor},{value:Asc.c_oAscGridLinesSettings.minor,displayValue:this.textMinor},{value:Asc.c_oAscGridLinesSettings.majorMinor,displayValue:this.textMajorMinor}]}).on("selected",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putHorGridLines(e.value)},this)),this.cmbVertGrid=new Common.UI.ComboBox({el:$("#chart-dlg-combo-vert-grid"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscGridLinesSettings.none,displayValue:this.textNone},{value:Asc.c_oAscGridLinesSettings.major,displayValue:this.textMajor},{value:Asc.c_oAscGridLinesSettings.minor,displayValue:this.textMinor},{value:Asc.c_oAscGridLinesSettings.majorMinor,displayValue:this.textMajorMinor}]}).on("selected",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putVertGridLines(e.value)},this)),this.cmbDataLabels=new Common.UI.ComboBox({el:$("#chart-dlg-combo-data-labels"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartDataLabelsPos.none,displayValue:this.textNone},{value:Asc.c_oAscChartDataLabelsPos.ctr,displayValue:this.textCenter},{value:Asc.c_oAscChartDataLabelsPos.inBase,displayValue:this.textInnerBottom},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop},{value:Asc.c_oAscChartDataLabelsPos.outEnd,displayValue:this.textOuterTop}]}),this.cmbDataLabels.on("selected",_.bind(t.onSelectDataLabels,this)),this.txtSeparator=new Common.UI.InputField({el:$("#chart-dlg-txt-separator"),name:"range",style:"width: 100%;",allowBlank:!0,blankError:this.txtEmpty}),this.chSeriesName=new Common.UI.CheckBox({el:$("#chart-dlg-check-series"),labelText:this.textSeriesName}),this.chCategoryName=new Common.UI.CheckBox({el:$("#chart-dlg-check-category"),labelText:this.textCategoryName}),this.chValue=new Common.UI.CheckBox({el:$("#chart-dlg-check-value"),labelText:this.textValue}),this.cmbLines=new Common.UI.ComboBox({el:$("#chart-dlg-combo-lines"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textNone},{value:1,displayValue:this.textStraight},{value:2,displayValue:this.textSmooth}]}).on("selected",_.bind(function(t,e){this.chartSettings&&(this.chartSettings.putLine(0!==e.value),e.value>0&&this.chartSettings.putSmooth(2==e.value))},this)),this.chMarkers=new Common.UI.CheckBox({el:$("#chart-dlg-check-markers"),labelText:this.textMarkers}).on("change",_.bind(function(t,e){this.chartSettings&&this.chartSettings.putShowMarker("checked"==e)},this)),this.lblLines=$("#chart-dlg-label-lines"),this.cmbMinType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-mintype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscValAxisRule.auto},{displayValue:this.textFixed,value:Asc.c_oAscValAxisRule.fixed}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&(this.currentAxisProps.putMinValRule(e.value),e.value==Asc.c_oAscValAxisRule.auto&&this.spnMinValue.setValue(this._originalAxisVValues.minAuto,!0))},this)),this.spnMinValue=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-min-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""}).on("change",_.bind(function(t,e,i){this.cmbMinType.suspendEvents(),this.cmbMinType.setValue(Asc.c_oAscValAxisRule.fixed),this.cmbMinType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putMinValRule(Asc.c_oAscValAxisRule.fixed),this.currentAxisProps.putMinVal(t.getNumberValue()))},this)),this.cmbMaxType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-maxtype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscValAxisRule.auto},{displayValue:this.textFixed,value:Asc.c_oAscValAxisRule.fixed}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&(this.currentAxisProps.putMaxValRule(e.value),e.value==Asc.c_oAscValAxisRule.auto&&this.spnMaxValue.setValue(this._originalAxisVValues.maxAuto,!0))},this)),this.spnMaxValue=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-max-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""}).on("change",_.bind(function(t,e,i){this.cmbMaxType.suspendEvents(),this.cmbMaxType.setValue(Asc.c_oAscValAxisRule.fixed),this.cmbMaxType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putMaxValRule(Asc.c_oAscValAxisRule.fixed),this.currentAxisProps.putMaxVal(t.getNumberValue()))},this)),this.cmbVCrossType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-crosstype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscCrossesRule.auto},{displayValue:this.textValue,value:Asc.c_oAscCrossesRule.value},{displayValue:this.textMinValue,value:Asc.c_oAscCrossesRule.minValue},{displayValue:this.textMaxValue,value:Asc.c_oAscCrossesRule.maxValue}]}).on("selected",_.bind(function(t,e){if(this.currentAxisProps){this.currentAxisProps.putCrossesRule(e.value);switch(e.value){case Asc.c_oAscCrossesRule.minValue:this.spnVAxisCrosses.setValue(this.spnMinValue.getNumberValue(),!0);break;case Asc.c_oAscCrossesRule.maxValue:this.spnVAxisCrosses.setValue(this.spnMaxValue.getNumberValue(),!0);break;case Asc.c_oAscCrossesRule.auto:this.spnVAxisCrosses.setValue(this._originalAxisVValues.crossesAuto,!0)}}},this)),this.spnVAxisCrosses=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-v-axis-crosses"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""}).on("change",_.bind(function(t,e,i){this.cmbVCrossType.suspendEvents(),this.cmbVCrossType.setValue(Asc.c_oAscCrossesRule.value),this.cmbVCrossType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putCrossesRule(Asc.c_oAscCrossesRule.value),this.currentAxisProps.putCrosses(t.getNumberValue()))},this)),this.cmbUnits=new Common.UI.ComboBox({el:$("#chart-dlg-combo-units"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscValAxUnits.none},{displayValue:this.textHundreds,value:Asc.c_oAscValAxUnits.HUNDREDS},{displayValue:this.textThousands,value:Asc.c_oAscValAxUnits.THOUSANDS},{displayValue:this.textTenThousands,value:Asc.c_oAscValAxUnits.TEN_THOUSANDS},{displayValue:this.textHundredThousands,value:Asc.c_oAscValAxUnits.HUNDRED_THOUSANDS},{displayValue:this.textMillions,value:Asc.c_oAscValAxUnits.MILLIONS},{displayValue:this.textTenMillions,value:Asc.c_oAscValAxUnits.TEN_MILLIONS},{displayValue:this.textHundredMil,value:Asc.c_oAscValAxUnits.HUNDRED_MILLIONS},{displayValue:this.textBillions,value:Asc.c_oAscValAxUnits.BILLIONS},{displayValue:this.textTrillions,value:Asc.c_oAscValAxUnits.TRILLIONS}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putDispUnitsRule(e.value)},this)),this.chVReverse=new Common.UI.CheckBox({el:$("#chart-dlg-check-v-reverse"),labelText:this.textReverse}).on("change",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putInvertValOrder("checked"==e)},this)),this.cmbVMajorType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-major-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putMajorTickMark(e.value)},this)),this.cmbVMinorType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-minor-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putMinorTickMark(e.value)},this)),this.cmbVLabelPos=new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-label-pos"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE},{displayValue:this.textLow,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW},{displayValue:this.textHigh,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH},{displayValue:this.textNextToAxis,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putTickLabelsPos(e.value)},this)),this.cmbHCrossType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-crosstype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscCrossesRule.auto},{displayValue:this.textValue,value:Asc.c_oAscCrossesRule.value},{displayValue:this.textMinValue,value:Asc.c_oAscCrossesRule.minValue},{displayValue:this.textMaxValue,value:Asc.c_oAscCrossesRule.maxValue}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&(this.currentAxisProps.putCrossesRule(e.value),e.value==Asc.c_oAscCrossesRule.auto?this.spnHAxisCrosses.setValue(this._originalAxisHValues.crossesAuto,!0):e.value==Asc.c_oAscCrossesRule.minValue?this.spnHAxisCrosses.setValue(this._originalAxisHValues.minAuto,!0):e.value==Asc.c_oAscCrossesRule.maxValue&&this.spnHAxisCrosses.setValue(this._originalAxisHValues.maxAuto,!0))},this)),this.spnHAxisCrosses=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-h-axis-crosses"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""}).on("change",_.bind(function(t,e,i){this.cmbHCrossType.suspendEvents(),this.cmbHCrossType.setValue(Asc.c_oAscCrossesRule.value),this.cmbHCrossType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putCrossesRule(Asc.c_oAscCrossesRule.value),this.currentAxisProps.putCrosses(t.getNumberValue()))},this)),this.cmbAxisPos=new Common.UI.ComboBox({el:$("#chart-dlg-combo-axis-pos"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textOnTickMarks,value:Asc.c_oAscLabelsPosition.byDivisions},{displayValue:this.textBetweenTickMarks,value:Asc.c_oAscLabelsPosition.betweenDivisions}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putLabelsPosition(e.value)},this)),this.chHReverse=new Common.UI.CheckBox({el:$("#chart-dlg-check-h-reverse"),labelText:this.textReverse}).on("change",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putInvertCatOrder("checked"==e)},this)),this.cmbHMajorType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-major-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putMajorTickMark(e.value)},this)),this.cmbHMinorType=new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-minor-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putMinorTickMark(e.value)},this)),this.spnMarksInterval=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-marks-interval"),width:140,maxValue:1e6,minValue:1,step:1,defaultUnit:"",value:""}).on("change",_.bind(function(t,e,i){this.currentAxisProps&&this.currentAxisProps.putIntervalBetweenTick(t.getNumberValue())},this)),this.cmbHLabelPos=new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-label-pos"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE},{displayValue:this.textLow,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW},{displayValue:this.textHigh,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH},{displayValue:this.textNextToAxis,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&this.currentAxisProps.putTickLabelsPos(e.value)},this)),this.spnLabelDist=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-label-dist"),width:140,maxValue:1e3,minValue:0,step:1,defaultUnit:"",value:""}).on("change",_.bind(function(t,e,i){this.currentAxisProps&&this.currentAxisProps.putLabelsAxisDistance(t.getNumberValue())},this)),this.spnLabelInterval=new Common.UI.MetricSpinner({el:$("#chart-dlg-input-label-int"),width:140,maxValue:1e6,minValue:1,step:1,defaultUnit:"",value:""}).on("change",_.bind(function(t,e,i){this.cmbLabelInterval.suspendEvents(),this.cmbLabelInterval.setValue(Asc.c_oAscBetweenLabelsRule.manual),this.cmbLabelInterval.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putIntervalBetweenLabelsRule(Asc.c_oAscBetweenLabelsRule.manual),this.currentAxisProps.putIntervalBetweenLabels(t.getNumberValue()))},this)),this.cmbLabelInterval=new Common.UI.ComboBox({el:$("#chart-dlg-combo-label-int"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscBetweenLabelsRule.auto},{displayValue:this.textManual,value:Asc.c_oAscBetweenLabelsRule.manual}]}).on("selected",_.bind(function(t,e){this.currentAxisProps&&(this.currentAxisProps.putIntervalBetweenLabelsRule(e.value),e.value==Asc.c_oAscBetweenLabelsRule.auto&&this.spnLabelInterval.setValue(1,!0))},this)),this.btnsCategory[2].on("click",_.bind(this.onVCategoryClick,this)),this.btnsCategory[3].on("click",_.bind(this.onHCategoryClick,this)),this.btnSparkType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist spark-column",menu:new Common.UI.Menu({style:"width: 200px; padding-top: 12px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('<div id="id-spark-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 0 10px;"></div>')}]})}),this.btnSparkType.on("render:after",function(e){t.mnuSparkTypePicker=new Common.UI.DataView({el:$("#id-spark-dlg-menu-type"),parentMenu:e.menu,restoreHeight:120,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-sparkcolumn",inline:!0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:t.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:t.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:t.textWinLossSpark}]),itemTemplate:_.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnSparkType.render($("#spark-dlg-button-type")),this.mnuSparkTypePicker.on("item:click",_.bind(this.onSelectSparkType,this,this.btnSparkType)),this.cmbSparkStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:272,enableKeyEvents:!0,cls:"combo-spark-style",minWidth:190}),this.cmbSparkStyle.render($("#spark-dlg-combo-style")),this.cmbSparkStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbSparkStyle.on("click",_.bind(this.onSelectSparkStyle,this)),this.cmbSparkStyle.openButton.menu.on("show:after",function(){t.cmbSparkStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this._arrEmptyCells=[{value:Asc.c_oAscEDispBlanksAs.Gap,displayValue:this.textGaps},{value:Asc.c_oAscEDispBlanksAs.Zero,displayValue:this.textZero},{value:Asc.c_oAscEDispBlanksAs.Span,displayValue:this.textEmptyLine}],this.cmbEmptyCells=new Common.UI.ComboBox({el:$("#spark-dlg-combo-empty"),menuStyle:"min-width: 220px;",editable:!1,cls:"input-group-nr"}),this.cmbEmptyCells.on("selected",_.bind(function(t,e){this._changedProps&&this._changedProps.asc_setDisplayEmpty(e.value)},this)),this.chShowEmpty=new Common.UI.CheckBox({el:$("#spark-dlg-check-show-data"),labelText:this.textShowData}),this.chShowEmpty.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setDisplayHidden("checked"==t.getValue())},this)),this.chShowAxis=new Common.UI.CheckBox({el:$("#spark-dlg-check-show"),labelText:this.textShowSparkAxis}),this.chShowAxis.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setDisplayXAxis("checked"==t.getValue())},this)),this.chReverse=new Common.UI.CheckBox({el:$("#spark-dlg-check-reverse"),labelText:this.textReverseOrder}),this.chReverse.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setRightToLeft("checked"==t.getValue())},this)),this.cmbSparkMinType=new Common.UI.ComboBox({el:$("#spark-dlg-combo-mintype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAutoEach,value:Asc.c_oAscSparklineAxisMinMax.Individual},{displayValue:this.textSameAll,value:Asc.c_oAscSparklineAxisMinMax.Group},{displayValue:this.textFixed,value:Asc.c_oAscSparklineAxisMinMax.Custom}]}).on("selected",_.bind(function(t,e){this.spnSparkMinValue.setDisabled(e.value!==Asc.c_oAscSparklineAxisMinMax.Custom),this._changedProps&&this._changedProps.asc_setMinAxisType(e.value),e.value==Asc.c_oAscSparklineAxisMinMax.Custom&&_.isEmpty(this.spnSparkMinValue.getValue())&&this.spnSparkMinValue.setValue(0)},this)),this.spnSparkMinValue=new Common.UI.MetricSpinner({el:$("#spark-dlg-input-min-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""}).on("change",_.bind(function(t,e,i){this._changedProps&&this._changedProps.asc_setManualMin(t.getNumberValue())},this)),this.cmbSparkMaxType=new Common.UI.ComboBox({el:$("#spark-dlg-combo-maxtype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAutoEach,value:Asc.c_oAscSparklineAxisMinMax.Individual},{displayValue:this.textSameAll,value:Asc.c_oAscSparklineAxisMinMax.Group},{displayValue:this.textFixed,value:Asc.c_oAscSparklineAxisMinMax.Custom}]}).on("selected",_.bind(function(t,e){this.spnSparkMaxValue.setDisabled(e.value!==Asc.c_oAscSparklineAxisMinMax.Custom),this._changedProps&&this._changedProps.asc_setMaxAxisType(e.value),e.value==Asc.c_oAscSparklineAxisMinMax.Custom&&_.isEmpty(this.spnSparkMaxValue.getValue())&&this.spnSparkMaxValue.setValue(0)},this)),this.spnSparkMaxValue=new Common.UI.MetricSpinner({el:$("#spark-dlg-input-max-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""}).on("change",_.bind(function(t,e,i){this._changedProps&&this._changedProps.asc_setManualMax(t.getNumberValue())},this)),this.inputAltTitle=new Common.UI.InputField({el:$("#chart-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this.chartSettings),this.setTitle(this.isChart?this.textTitle:this.textTitleSparkline),this.isChart?(this.btnsCategory[4].setVisible(!1),this.btnsCategory[5].setVisible(!1)):(this.btnsCategory[0].setVisible(!1),this.btnsCategory[1].setVisible(!1),this.btnsCategory[2].setVisible(!1),this.btnsCategory[3].setVisible(!1),this.btnsCategory[6].setVisible(!1)),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0),t=this.getActiveCategory(),2==t?this.onVCategoryClick():3==t&&this.onHCategoryClick()}},onSelectType:function(t,e,i,n){if(!this._noApply){var o={};if(_.isFunction(n.toJSON)){if(!n.get("selected"))return;o=n.toJSON()}else o=n;this.btnChartType.setIconCls("item-chartlist "+o.iconCls),this.chartSettings.changeType(o.type),this.updateAxisProps(o.type,!0),this.vertAxisProps=this.chartSettings.getVertAxisProps(),this.horAxisProps=this.chartSettings.getHorAxisProps(),this.updateDataLabels(o.type,this.cmbDataLabels.getValue()),this.currentChartType=o.type}},updateAxisProps:function(t,e){var i=t==Asc.c_oAscChartTypeSettings.lineNormal||t==Asc.c_oAscChartTypeSettings.lineStacked||t==Asc.c_oAscChartTypeSettings.lineStackedPer||t==Asc.c_oAscChartTypeSettings.scatter;this.chMarkers.setVisible(i),this.cmbLines.setVisible(i),this.lblLines.toggleClass("hidden",!i),i&&(this.chMarkers.setValue(this.chartSettings.getShowMarker(),!0),this.cmbLines.setValue(this.chartSettings.getLine()?this.chartSettings.getSmooth()?2:1:0)),i=t==Asc.c_oAscChartTypeSettings.pie||t==Asc.c_oAscChartTypeSettings.doughnut||t==Asc.c_oAscChartTypeSettings.pie3d,this.btnsCategory[2].setDisabled(i),this.btnsCategory[3].setDisabled(i),this.cmbHorShow.setDisabled(i),this.cmbVertShow.setDisabled(i),this.cmbHorTitle.setDisabled(i),this.cmbVertTitle.setDisabled(i),this.cmbHorGrid.setDisabled(i),this.cmbVertGrid.setDisabled(i),this.cmbHorShow.setValue(this.chartSettings.getShowHorAxis()),this.cmbVertShow.setValue(this.chartSettings.getShowVerAxis()),this.cmbHorTitle.setValue(this.chartSettings.getHorAxisLabel()),this.cmbVertTitle.setValue(this.chartSettings.getVertAxisLabel()),this.cmbHorGrid.setValue(this.chartSettings.getHorGridLines()),this.cmbVertGrid.setValue(this.chartSettings.getVertGridLines()),i=t==Asc.c_oAscChartTypeSettings.barNormal3d||t==Asc.c_oAscChartTypeSettings.barStacked3d||t==Asc.c_oAscChartTypeSettings.barStackedPer3d||t==Asc.c_oAscChartTypeSettings.hBarNormal3d||t==Asc.c_oAscChartTypeSettings.hBarStacked3d||t==Asc.c_oAscChartTypeSettings.hBarStackedPer3d||t==Asc.c_oAscChartTypeSettings.barNormal3dPerspective,this.cmbAxisPos.setDisabled(i),i=t==Asc.c_oAscChartTypeSettings.hBarNormal||t==Asc.c_oAscChartTypeSettings.hBarStacked||t==Asc.c_oAscChartTypeSettings.hBarStackedPer||t==Asc.c_oAscChartTypeSettings.hBarNormal3d||t==Asc.c_oAscChartTypeSettings.hBarStacked3d||t==Asc.c_oAscChartTypeSettings.hBarStackedPer3d,this.btnsCategory[2].options.contentTarget=i?"id-chart-settings-dlg-hor":"id-chart-settings-dlg-vert",this.btnsCategory[3].options.contentTarget=i||t==Asc.c_oAscChartTypeSettings.scatter?"id-chart-settings-dlg-vert":"id-chart-settings-dlg-hor"},updateDataLabels:function(t,e){if(t!==this.currentChartType){var i=[{value:Asc.c_oAscChartDataLabelsPos.none,displayValue:this.textNone},{value:Asc.c_oAscChartDataLabelsPos.ctr,displayValue:this.textCenter}];t==Asc.c_oAscChartTypeSettings.barNormal||t==Asc.c_oAscChartTypeSettings.hBarNormal?i.push({value:Asc.c_oAscChartDataLabelsPos.inBase,displayValue:this.textInnerBottom},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop},{value:Asc.c_oAscChartDataLabelsPos.outEnd,displayValue:this.textOuterTop}):t==Asc.c_oAscChartTypeSettings.barStacked||t==Asc.c_oAscChartTypeSettings.barStackedPer||t==Asc.c_oAscChartTypeSettings.hBarStacked||t==Asc.c_oAscChartTypeSettings.hBarStackedPer?i.push({value:Asc.c_oAscChartDataLabelsPos.inBase,displayValue:this.textInnerBottom},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop}):t==Asc.c_oAscChartTypeSettings.lineNormal||t==Asc.c_oAscChartTypeSettings.lineStacked||t==Asc.c_oAscChartTypeSettings.lineStackedPer||t==Asc.c_oAscChartTypeSettings.stock||t==Asc.c_oAscChartTypeSettings.scatter?i.push({value:Asc.c_oAscChartDataLabelsPos.l,displayValue:this.textLeft},{value:Asc.c_oAscChartDataLabelsPos.r,displayValue:this.textRight},{value:Asc.c_oAscChartDataLabelsPos.t,displayValue:this.textTop},{value:Asc.c_oAscChartDataLabelsPos.b,displayValue:this.textBottom}):t!=Asc.c_oAscChartTypeSettings.pie&&t!=Asc.c_oAscChartTypeSettings.pie3d||i.push({
|
|
|
value:Asc.c_oAscChartDataLabelsPos.bestFit,displayValue:this.textFit},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop},{value:Asc.c_oAscChartDataLabelsPos.outEnd,displayValue:this.textOuterTop}),this.cmbDataLabels.setData(i)}if(void 0!==e){this.cmbDataLabels.store.findWhere({value:e})||(e=Asc.c_oAscChartDataLabelsPos.ctr)}else e=Asc.c_oAscChartDataLabelsPos.none;this.cmbDataLabels.setValue(e),this.onSelectDataLabels(this.cmbDataLabels,{value:e})},onVCategoryClick:function(){this.vertAxisProps.getAxisType()==Asc.c_oAscAxisType.val?this.fillVProps(this.vertAxisProps):this.fillHProps(this.vertAxisProps)},onHCategoryClick:function(){this.horAxisProps.getAxisType()==Asc.c_oAscAxisType.val?this.fillVProps(this.horAxisProps):this.fillHProps(this.horAxisProps)},fillVProps:function(t){if(t.getAxisType()===Asc.c_oAscAxisType.val){void 0==this._originalAxisVValues&&(this._originalAxisVValues={minAuto:null==t.getMinVal()?0:t.getMinVal(),maxAuto:null==t.getMaxVal()?10:t.getMaxVal(),crossesAuto:null==t.getCrosses()?0:t.getCrosses()}),this.cmbMinType.setValue(t.getMinValRule());var e=t.getMinValRule()==Asc.c_oAscValAxisRule.auto?this._originalAxisVValues.minAuto:t.getMinVal();switch(this.spnMinValue.setValue(null==e?"":e,!0),this.cmbMaxType.setValue(t.getMaxValRule()),e=t.getMaxValRule()==Asc.c_oAscValAxisRule.auto?this._originalAxisVValues.maxAuto:t.getMaxVal(),this.spnMaxValue.setValue(null==e?"":e,!0),e=t.getCrossesRule(),this.cmbVCrossType.setValue(e),e){case Asc.c_oAscCrossesRule.minValue:e=this.spnMinValue.getNumberValue();break;case Asc.c_oAscCrossesRule.maxValue:e=this.spnMaxValue.getNumberValue();break;case Asc.c_oAscCrossesRule.auto:e=this._originalAxisVValues.crossesAuto;break;default:e=t.getCrosses()}this.spnVAxisCrosses.setValue(null==e?"":e,!0),this.cmbUnits.setValue(t.getDispUnitsRule()),this.chVReverse.setValue(t.getInvertValOrder(),!0),this.cmbVMajorType.setValue(t.getMajorTickMark()),this.cmbVMinorType.setValue(t.getMinorTickMark()),this.cmbVLabelPos.setValue(t.getTickLabelsPos()),this.currentAxisProps=t}},fillHProps:function(t){if(t.getAxisType()===Asc.c_oAscAxisType.cat){void 0==this._originalAxisHValues&&(this._originalAxisHValues={minAuto:null==t.getCrossMinVal()?0:t.getCrossMinVal(),maxAuto:null==t.getCrossMaxVal()?10:t.getCrossMaxVal(),crossesAuto:null==t.getCrosses()?0:t.getCrosses()});var e=t.getCrossesRule();switch(this.cmbHCrossType.setValue(e),e){case Asc.c_oAscCrossesRule.minValue:e=this._originalAxisHValues.minAuto;break;case Asc.c_oAscCrossesRule.maxValue:e=this._originalAxisHValues.maxAuto;break;case Asc.c_oAscCrossesRule.auto:e=this._originalAxisHValues.crossesAuto;break;default:e=t.getCrosses()}this.spnHAxisCrosses.setValue(null==e?"":e,!0),this.cmbAxisPos.setValue(t.getLabelsPosition()),this.chHReverse.setValue(t.getInvertCatOrder(),!0),this.cmbHMajorType.setValue(t.getMajorTickMark()),this.cmbHMinorType.setValue(t.getMinorTickMark()),this.spnMarksInterval.setValue(t.getIntervalBetweenTick(),!0),this.cmbHLabelPos.setValue(t.getTickLabelsPos()),this.spnLabelDist.setValue(t.getLabelsAxisDistance(),!0),e=t.getIntervalBetweenLabelsRule(),this.cmbLabelInterval.setValue(e),this.spnLabelInterval.setValue(e===Asc.c_oAscBetweenLabelsRule.manual?t.getIntervalBetweenLabels():1,!0),this.currentAxisProps=t}},updateSparkStyles:function(t){if(t&&t.length>1){var e=this.cmbSparkStyle.menuPicker,i=e.store;if(i.length==t.length-1)for(var n=i.models,o=0;o<t.length-1;o++)n[o].set("imageUrl",t[o]);else{for(var s=[],a=t[t.length-1],o=0;o<t.length-1;o++)s.push({imageUrl:t[o],data:o});i.reset(s,{silent:!1}),this.cmbSparkStyle.fillComboView(i.at(a<0?0:a),a>-1)}}},onSelectSparkType:function(t,e,i,n){if(!this._noApply){var o={};if(_.isFunction(n.toJSON)){if(!n.get("selected"))return;o=n.toJSON()}else o=n;this.btnSparkType.setIconCls("item-chartlist "+o.iconCls),this._changedProps&&this._changedProps.asc_setType(o.type),this._state.SparkType=o.type;var s=!1,a=this.cmbEmptyCells.getValue();o.type!==Asc.c_oAscSparklineType.Line&&this._arrEmptyCells.length>2?(this._arrEmptyCells.pop(),s=!0):o.type==Asc.c_oAscSparklineType.Line&&this._arrEmptyCells.length<3&&(this._arrEmptyCells.push({value:Asc.c_oAscEDispBlanksAs.Span,displayValue:this.textEmptyLine}),s=!0),s&&(this.cmbEmptyCells.setData(this._arrEmptyCells),this.cmbEmptyCells.setValue(o.type!==Asc.c_oAscSparklineType.Line&&a==Asc.c_oAscEDispBlanksAs.Span?this.textEmptyLine:a)),this.updateSparkStyles(this.chartSettings.asc_getStyles(o.type))}},onSelectSparkStyle:function(t,e){this._noApply||this._changedProps&&this._changedProps.asc_setStyle(e.get("data"))},_setDefaults:function(t){var e=this;if(t)if(this.chartSettings=t,this.isChart){this._state.ChartType=t.getType(),this._noApply=!0;var i=this.mnuChartTypePicker.store.findWhere({type:this._state.ChartType});this.mnuChartTypePicker.selectRecord(i,!0),i?this.btnChartType.setIconCls("item-chartlist "+i.get("iconCls")):this.btnChartType.setIconCls(""),this._noApply=!1;var n=t.getRange();this.txtDataRange.setValue(n||""),this.dataRangeValid=n,this.txtDataRange.validation=function(t){return _.isEmpty(t)?(e.cmbDataDirect.isDisabled()||e.cmbDataDirect.setDisabled(!0),!0):(e.cmbDataDirect.isDisabled()&&e.cmbDataDirect.setDisabled(!1),e.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,t,!1)!=Asc.c_oAscError.ID.DataRangeError||e.textInvalidRange)},this.cmbDataDirect.setDisabled(null===n),this.cmbDataDirect.setValue(t.getInColumns()?1:0),this.cmbChartTitle.setValue(t.getTitle()),this.cmbLegendPos.setValue(t.getLegendPos()),this.updateDataLabels(this._state.ChartType,t.getDataLabelsPos()),this.chSeriesName.setValue(this.chartSettings.getShowSerName(),!0),this.chCategoryName.setValue(this.chartSettings.getShowCatName(),!0),this.chValue.setValue(this.chartSettings.getShowVal(),!0),n=t.getSeparator(),this.txtSeparator.setValue(n||""),this.vertAxisProps=t.getVertAxisProps(),this.horAxisProps=t.getHorAxisProps(),this.updateAxisProps(this._state.ChartType),this.currentChartType=this._state.ChartType,this.imageSettings&&(n=this.imageSettings.asc_getTitle(),this.inputAltTitle.setValue(n||""),n=this.imageSettings.asc_getDescription(),this.textareaAltDescription.val(n||""))}else{this._state.SparkType=t.asc_getType();var i=this.mnuSparkTypePicker.store.findWhere({type:this._state.SparkType});this.mnuSparkTypePicker.selectRecord(i,!0),i?this.btnSparkType.setIconCls("item-chartlist "+i.get("iconCls")):this.btnSparkType.setIconCls(""),this.updateSparkStyles(this.sparklineStyles?this.sparklineStyles:t.asc_getStyles()),this._state.SparkType!==Asc.c_oAscSparklineType.Line&&this._arrEmptyCells.pop(),this.cmbEmptyCells.setData(this._arrEmptyCells);var n=t.asc_getDisplayEmpty();this.cmbEmptyCells.setValue(this._state.SparkType!==Asc.c_oAscSparklineType.Line&&n==Asc.c_oAscEDispBlanksAs.Span?this.textEmptyLine:n),this.chShowEmpty.setValue(t.asc_getDisplayHidden(),!0),this.chShowAxis.setValue(t.asc_getDisplayXAxis(),!0),this.chReverse.setValue(t.asc_getRightToLeft(),!0),this.cmbSparkMinType.setValue(t.asc_getMinAxisType(),!0),this.cmbSparkMaxType.setValue(t.asc_getMaxAxisType(),!0),this.spnSparkMinValue.setDisabled(t.asc_getMinAxisType()!==Asc.c_oAscSparklineAxisMinMax.Custom),this.spnSparkMaxValue.setDisabled(t.asc_getMaxAxisType()!==Asc.c_oAscSparklineAxisMinMax.Custom),this.spnSparkMinValue.setValue(null!==t.asc_getManualMin()?t.asc_getManualMin():"",!0),this.spnSparkMaxValue.setValue(null!==t.asc_getManualMax()?t.asc_getManualMax():"",!0),this._changedProps=new Asc.sparklineGroup,this._noApply=!1}},getSettings:function(){var t;if(this.isChart){var e=this.mnuChartTypePicker.getSelectedRec(),i=e?e.get("type"):this.currentChartType;this.chartSettings.putType(i),this.chartSettings.putInColumns(1==this.cmbDataDirect.getValue()),this.chartSettings.putRange(this.txtDataRange.getValue()),this.chartSettings.putTitle(this.cmbChartTitle.getValue()),this.chartSettings.putLegendPos(this.cmbLegendPos.getValue()),this.chartSettings.putShowHorAxis(this.cmbHorShow.getValue()),this.chartSettings.putShowVerAxis(this.cmbVertShow.getValue()),this.chartSettings.putHorAxisLabel(this.cmbHorTitle.getValue()),this.chartSettings.putVertAxisLabel(this.cmbVertTitle.getValue()),this.chartSettings.putHorGridLines(this.cmbHorGrid.getValue()),this.chartSettings.putVertGridLines(this.cmbVertGrid.getValue()),this.chartSettings.putDataLabelsPos(this.cmbDataLabels.getValue()),this.chartSettings.putShowSerName("checked"==this.chSeriesName.getValue()),this.chartSettings.putShowCatName("checked"==this.chCategoryName.getValue()),this.chartSettings.putShowVal("checked"==this.chValue.getValue()),this.chartSettings.putSeparator(_.isEmpty(this.txtSeparator.getValue())?" ":this.txtSeparator.getValue()),this.chartSettings.putShowMarker("checked"==this.chMarkers.getValue()),t=i==Asc.c_oAscChartTypeSettings.lineNormal||i==Asc.c_oAscChartTypeSettings.lineStacked||i==Asc.c_oAscChartTypeSettings.lineStackedPer||i==Asc.c_oAscChartTypeSettings.scatter,t&&(t=this.cmbLines.getValue(),this.chartSettings.putLine(0!==t),t>0&&this.chartSettings.putSmooth(2==t)),this.chartSettings.putVertAxisProps(this.vertAxisProps),this.chartSettings.putHorAxisProps(this.horAxisProps);var n=this.isAltTitleChanged||this.isAltDescChanged?new Asc.asc_CImgProperty:null;return this.isAltTitleChanged&&n.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&n.asc_putDescription(this.textareaAltDescription.val()),{chartSettings:this.chartSettings,imageSettings:n}}return{chartSettings:this._changedProps}},isRangeValid:function(){if(this.isChart){var t;if(_.isEmpty(this.txtDataRange.getValue()))return!0;var e=this.mnuChartTypePicker.getSelectedRec(),i=e?e.get("type"):this.currentChartType;return(t=this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,this.txtDataRange.getValue(),!0,0==this.cmbDataDirect.getValue(),i))==Asc.c_oAscError.ID.No||(this.setActiveCategory(0),t==Asc.c_oAscError.ID.StockChartError?Common.UI.warning({msg:this.errorStockChart}):t==Asc.c_oAscError.ID.MaxDataSeriesError?Common.UI.warning({msg:this.errorMaxRows}):t==Asc.c_oAscError.ID.MaxDataPointsError?Common.UI.warning({msg:this.errorMaxPoints}):this.txtDataRange.cmpEl.find("input").focus(),!1)}return!0},onSelectData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.dataRangeValid=e.getSettings(),t.txtDataRange.setValue(t.dataRangeValid),t.txtDataRange.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+160,n.top+125),i.setSettings({api:t.api,isRows:0==t.cmbDataDirect.getValue(),range:_.isEmpty(t.txtDataRange.getValue())||1!=t.txtDataRange.checkValidate()?t.dataRangeValid:t.txtDataRange.getValue(),type:Asc.c_oAscSelectionDialogType.Chart})}},onSelectDataLabels:function(t,e,i){var n=e.value==Asc.c_oAscChartDataLabelsPos.none;this.chSeriesName.setDisabled(n),this.chCategoryName.setDisabled(n),this.chValue.setDisabled(n),this.txtSeparator.setDisabled(n),n||"checked"===this.chSeriesName.getValue()||"checked"===this.chCategoryName.getValue()||"checked"===this.chValue.getValue()||this.chValue.setValue("checked",!0)},onSelectSparkData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.sparkDataRangeValid=e.getSettings(),t.txtSparkDataRange.setValue(t.sparkDataRangeValid),t.txtSparkDataRange.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+160,n.top+125),i.setSettings({api:t.api,range:_.isEmpty(t.txtSparkDataRange.getValue())||1!=t.txtSparkDataRange.checkValidate()?t.sparkDataRangeValid:t.txtSparkDataRange.getValue(),type:Asc.c_oAscSelectionDialogType.Chart})}},onSelectLocationData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.dataLocationRangeValid=e.getSettings(),t.txtSparkDataLocation.setValue(t.dataLocationRangeValid),t.txtSparkDataLocation.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+160,n.top+125),i.setSettings({api:t.api,range:_.isEmpty(t.txtSparkDataLocation.getValue())||1!=t.txtSparkDataLocation.checkValidate()?t.dataLocationRangeValid:t.txtSparkDataLocation.getValue(),type:Asc.c_oAscSelectionDialogType.FormatTable})}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.txtDataRange.cmpEl.find("input").focus()},50)},close:function(){this.api.asc_onCloseChartFrame(),Common.Views.AdvancedSettingsWindow.prototype.close.apply(this,arguments)},textTitle:"Chart - Advanced Settings",textShowValues:"Display chart values",textShowBorders:"Display chart borders",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textDataRows:"in rows",textDataColumns:"in columns",textDisplayLegend:"Display Legend",textLegendBottom:"Bottom",textLegendTop:"Top",textLegendRight:"Right",textLegendLeft:"Left",textShowAxis:"Display Axis",textShowGrid:"Grid Lines",textDataRange:"Data Range",textChartTitle:"Chart Title",textXAxisTitle:"X Axis Title",textYAxisTitle:"Y Axis Title",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",cancelButtonText:"Cancel",textTypeStyle:"Chart Type, Style &<br/>Data Range",textChartElementsLegend:"Chart Elements &<br/>Chart Legend",textLayout:"Layout",textLegendPos:"Legend",textHorTitle:"Horizontal Axis Title",textVertTitle:"Vertical Axis Title",textDataLabels:"Data Labels",textSeparator:"Data Labels Separator",textSeriesName:"Series Name",textCategoryName:"Category Name",textValue:"Value",textAxisOptions:"Axis Options",textMinValue:"Minimum Value",textMaxValue:"Maximum Value",textAxisCrosses:"Axis Crosses",textUnits:"Display Units",textTickOptions:"Tick Options",textMajorType:"Major Type",textMinorType:"Minor Type",textLabelOptions:"Label Options",textLabelPos:"Label Position",textReverse:"Values in reverse order",textVertAxis:"Vertical Axis",textHorAxis:"Horizontal Axis",textMarksInterval:"Interval between Marks",textLabelDist:"Axis Label Distance",textLabelInterval:"Interval between Labels",textAxisPos:"Axis Position",textLeftOverlay:"Left Overlay",textRightOverlay:"Right Overlay",textOverlay:"Overlay",textNoOverlay:"No Overlay",textRotated:"Rotated",textHorizontal:"Horizontal",textInnerBottom:"Inner Bottom",textInnerTop:"Inner Top",textOuterTop:"Outer Top",textNone:"None",textCenter:"Center",textFixed:"Fixed",textAuto:"Auto",textCross:"Cross",textIn:"In",textOut:"Out",textLow:"Low",textHigh:"High",textNextToAxis:"Next to axis",textHundreds:"Hundreds",textThousands:"Thousands",textTenThousands:"10 000",textHundredThousands:"100 000",textMillions:"Millions",textTenMillions:"10 000 000",textHundredMil:"100 000 000",textBillions:"Billions",textTrillions:"Trillions",textCustom:"Custom",textManual:"Manual",textBetweenTickMarks:"Between Tick Marks",textOnTickMarks:"On Tick Marks",textHorGrid:"Horizontal Gridlines",textVertGrid:"Vertical Gridlines",textLines:"Lines",textMarkers:"Markers",textMajor:"Major",textMinor:"Minor",textMajorMinor:"Major and Minor",textStraight:"Straight",textSmooth:"Smooth",textType:"Type",textTypeData:"Type & Data",textStyle:"Style",textSelectData:"Select Data",textDataSeries:"Data series",errorMaxRows:"ERROR! The maximum number of data series per chart is 255.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",textAxisSettings:"Axis Settings",textGridLines:"Gridlines",textShow:"Show",textHide:"Hide",textLeft:"Left",textRight:"Right",textTop:"Top",textBottom:"Bottom",textFit:"Fit Width",textSparkRanges:"Sparkline Ranges",textLocationRange:"Location Range",textEmptyCells:"Hidden and Empty cells",textShowEmptyCells:"Show empty cells as",textShowData:"Show data in hidden rows and columns",textGroup:"Group Sparkline",textSingle:"Single Sparkline",textGaps:"Gaps",textZero:"Zero",textEmptyLine:"Connect data points with line",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",textShowSparkAxis:"Show Axis",textReverseOrder:"Reverse order",textAutoEach:"Auto for Each",textSameAll:"Same for All",textTitleSparkline:"Sparkline - Advanced Settings",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.",textSurface:"Surface",errorMaxPoints:"ERROR! The maximum number of points in series per chart is 4096."},SSE.Views.ChartSettingsDlg||{}))}),define("spreadsheeteditor/main/app/view/ChartSettings",["text!spreadsheeteditor/main/app/template/ChartSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/ComboDataView","spreadsheeteditor/main/app/view/ChartSettingsDlg"],function(t,e,i,n){"use strict";SSE.Views.ChartSettings=n.View.extend(i.extend({el:"#id-chart-settings",template:i.template(t),events:{},options:{alias:"ChartSettings"},initialize:function(){this._initSettings=!0,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Width:0,Height:0,ChartStyle:1,ChartType:-1,SeveralCharts:!1,DisabledControls:!1,keepRatio:!1,SparkType:-1,SparkStyle:1,LineWeight:1,MarkersPoint:!1,HighPoint:!1,LowPoint:!1,FirstPoint:!1,LastPoint:!1,NegativePoint:!1,SparkColor:"000000",MarkersColor:this.defColor,HighColor:this.defColor,LowColor:this.defColor,FirstColor:this.defColor,LastColor:this.defColor,NegativeColor:this.defColor,SparkId:void 0},this._nRatio=1,this.spinners=[],this.chPoints=[],this.lockedControls=[],this._locked=!1,this.defColor={color:"4f81bd",effectId:24},this.isChart=!0,this._noApply=!1,this._originalProps=null,this.render(),this.ChartSizeContainer=e("#chart-panel-size"),this.ChartTypesContainer=e("#chart-panel-types"),this.SparkTypesContainer=e("#spark-panel-types"),this.SparkPointsContainer=e("#spark-panel-points")},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateChartStyles",i.bind(this._onUpdateChartStyles,this)),this},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.ShowHideElem(!!(t&&t.asc_getChartProperties&&t.asc_getChartProperties())),this.disableControls(this._locked),this.api&&t)if(t.asc_getChartProperties&&t.asc_getChartProperties()){this._originalProps=new Asc.asc_CImgProperty(t),this.isChart=!0,this._noApply=!0,this.chartProps=t.asc_getChartProperties();var e=t.asc_getSeveralCharts()||this._locked;if(this._state.SeveralCharts!==e&&(this.linkAdvanced.toggleClass("disabled",e),this._state.SeveralCharts=e),e=t.asc_getSeveralChartTypes(),this._state.SeveralCharts&&e)this.btnChartType.setIconCls(""),this._state.ChartType=null;else{var n=this.chartProps.getType();if(this._state.ChartType!==n){var o=this.mnuChartTypePicker.store.findWhere({type:n});this.mnuChartTypePicker.selectRecord(o,!0),o?this.btnChartType.setIconCls("item-chartlist "+o.get("iconCls")):this.btnChartType.setIconCls(""),this.updateChartStyles(this.api.asc_getChartPreviews(n)),this._state.ChartType=n}}if(e=t.asc_getSeveralChartStyles(),this._state.SeveralCharts&&e)this.cmbChartStyle.fieldPicker.deselectAll(),this.cmbChartStyle.menuPicker.deselectAll(),this._state.ChartStyle=null;else if(e=this.chartProps.getStyle(),this._state.ChartStyle!==e||this._isChartStylesChanged){this.cmbChartStyle.suspendEvents();var s=this.cmbChartStyle.menuPicker.store.findWhere({data:e});this.cmbChartStyle.menuPicker.selectRecord(s),this.cmbChartStyle.resumeEvents(),this._isChartStylesChanged&&(s?this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),!0):this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0),!0)),this._state.ChartStyle=e}this._isChartStylesChanged=!1,this._noApply=!1,e=t.asc_getWidth(),(Math.abs(this._state.Width-e)>.001||(null===this._state.Width||null===e)&&this._state.Width!==e)&&(this.spnWidth.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Width=e),e=t.asc_getHeight(),(Math.abs(this._state.Height-e)>.001||(null===this._state.Height||null===e)&&this._state.Height!==e)&&(this.spnHeight.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Height=e),t.asc_getHeight()>0&&(this._nRatio=t.asc_getWidth()/t.asc_getHeight()),e=t.asc_getLockAspect(),this._state.keepRatio!==e&&(this.btnRatio.toggle(e),this._state.keepRatio=e)}else{this._originalProps=t,this.isChart=!1,this._state.SparkId=t.asc_getId();var n=t.asc_getType(),a=!1;if(this._state.SparkType!==n){var o=this.mnuSparkTypePicker.store.findWhere({type:n});this.mnuSparkTypePicker.selectRecord(o,!0),o?this.btnSparkType.setIconCls("item-chartlist "+o.get("iconCls")):this.btnSparkType.setIconCls(""),this._state.SparkType=n,a=!0}var l=t.asc_getLineWeight(),r=Math.abs(this._state.LineWeight-l)<.001&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.LineWeight-l)>.001||r||(null===this._state.LineWeight||null===l)&&this._state.LineWeight!==l){this._state.LineWeight=l;var c=null===l?l:i.find(this.cmbBorderSize.store.models,function(t){if(l<t.attributes.value+.01&&l>t.attributes.value-.01)return!0});c?this.cmbBorderSize.selectRecord(c):this.cmbBorderSize.setValue(null!==l?parseFloat(l.toFixed(2))+" "+this.txtPt:""),this.BorderSize=l}this.cmbBorderSize.setDisabled(this._locked||this._state.SparkType!==Asc.c_oAscSparklineType.Line);var h=t.asc_getColorSeries();if(h){this.SparkColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.SparkColor,p=typeof this._state.SparkColor;if(d!==p||"object"==d&&(this.SparkColor.effectValue!==this._state.SparkColor.effectValue||this._state.SparkColor.color.indexOf(this.SparkColor.color)<0)||"object"!=d&&(this._state.SparkColor.indexOf(this.SparkColor)<0||"object"==typeof this.btnSparkColor.color)){if(this.btnSparkColor.setColor(this.SparkColor),"object"==typeof this.SparkColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.SparkColor.effectValue){this.colorsSpark.select(this.SparkColor,!0),m=!0;break}m||this.colorsSpark.clearSelection()}else this.colorsSpark.select(this.SparkColor,!0);this._state.SparkColor=this.SparkColor}}var g=t.asc_getMarkersPoint();if(h=t.asc_getColorMarkers(),this._state.MarkersPoint!==g&&(this.chMarkersPoint.setValue(null!==g&&void 0!==g?g:"indeterminate",!0),this._state.MarkersPoint=g,a=!0),this.chMarkersPoint.setDisabled(this._locked||this._state.SparkType!==Asc.c_oAscSparklineType.Line),this.btnMarkersColor.setDisabled(this._locked||this._state.SparkType!==Asc.c_oAscSparklineType.Line),h){this.MarkersColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.MarkersColor,p=typeof this._state.MarkersColor;if(d!==p||"object"==d&&(this.MarkersColor.effectValue!==this._state.MarkersColor.effectValue||this._state.MarkersColor.color.indexOf(this.MarkersColor.color)<0)||"object"!=d&&(this._state.MarkersColor.indexOf(this.MarkersColor)<0||"object"==typeof this.btnMarkersColor.color)){if(this.btnMarkersColor.setColor(this.MarkersColor),"object"==typeof this.MarkersColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.MarkersColor.effectValue){this.colorsMarkers.select(this.MarkersColor,!0),m=!0;break}m||this.colorsMarkers.clearSelection()}else this.colorsMarkers.select(this.MarkersColor,!0);this._state.MarkersColor=this.MarkersColor,a=!0}}if(g=t.asc_getHighPoint(),h=t.asc_getColorHigh(),this._state.HighPoint!==g&&(this.chHighPoint.setValue(null!==g&&void 0!==g?g:"indeterminate",!0),this._state.HighPoint=g,a=!0),h){this.HighColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.HighColor,p=typeof this._state.HighColor;if(d!==p||"object"==d&&(this.HighColor.effectValue!==this._state.HighColor.effectValue||this._state.HighColor.color.indexOf(this.HighColor.color)<0)||"object"!=d&&(this._state.HighColor.indexOf(this.HighColor)<0||"object"==typeof this.btnHighColor.color)){if(this.btnHighColor.setColor(this.HighColor),"object"==typeof this.HighColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.HighColor.effectValue){this.colorsHigh.select(this.HighColor,!0),m=!0;break}m||this.colorsHigh.clearSelection()}else this.colorsHigh.select(this.HighColor,!0);this._state.HighColor=this.HighColor,a=!0}}if(g=t.asc_getLowPoint(),h=t.asc_getColorLow(),this._state.LowPoint!==g&&(this.chLowPoint.setValue(null!==g&&void 0!==g?g:"indeterminate",!0),this._state.LowPoint=g,a=!0),h){this.LowColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.LowColor,p=typeof this._state.LowColor;if(d!==p||"object"==d&&(this.LowColor.effectValue!==this._state.LowColor.effectValue||this._state.LowColor.color.indexOf(this.LowColor.color)<0)||"object"!=d&&(this._state.LowColor.indexOf(this.LowColor)<0||"object"==typeof this.btnLowColor.color)){if(this.btnLowColor.setColor(this.LowColor),"object"==typeof this.LowColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.LowColor.effectValue){this.colorsLow.select(this.LowColor,!0),m=!0;break}m||this.colorsLow.clearSelection()}else this.colorsLow.select(this.LowColor,!0);this._state.LowColor=this.LowColor,a=!0}}if(g=t.asc_getFirstPoint(),h=t.asc_getColorFirst(),this._state.FirstPoint!==g&&(this.chFirstPoint.setValue(null!==g&&void 0!==g?g:"indeterminate",!0),this._state.FirstPoint=g,a=!0),h){this.FirstColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.FirstColor,p=typeof this._state.FirstColor;if(d!==p||"object"==d&&(this.FirstColor.effectValue!==this._state.FirstColor.effectValue||this._state.FirstColor.color.indexOf(this.FirstColor.color)<0)||"object"!=d&&(this._state.FirstColor.indexOf(this.FirstColor)<0||"object"==typeof this.btnFirstColor.color)){if(this.btnFirstColor.setColor(this.FirstColor),"object"==typeof this.FirstColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.FirstColor.effectValue){this.colorsFirst.select(this.FirstColor,!0),m=!0;break}m||this.colorsFirst.clearSelection()}else this.colorsFirst.select(this.FirstColor,!0);this._state.FirstColor=this.FirstColor,a=!0}}if(g=t.asc_getLastPoint(),h=t.asc_getColorLast(),this._state.LastPoint!==g&&(this.chLastPoint.setValue(null!==g&&void 0!==g?g:"indeterminate",!0),this._state.LastPoint=g,a=!0),h){this.LastColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.LastColor,p=typeof this._state.LastColor;if(d!==p||"object"==d&&(this.LastColor.effectValue!==this._state.LastColor.effectValue||this._state.LastColor.color.indexOf(this.LastColor.color)<0)||"object"!=d&&(this._state.LastColor.indexOf(this.LastColor)<0||"object"==typeof this.btnLastColor.color)){if(this.btnLastColor.setColor(this.LastColor),"object"==typeof this.LastColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.LastColor.effectValue){this.colorsLast.select(this.LastColor,!0),m=!0;break}m||this.colorsLast.clearSelection()}else this.colorsLast.select(this.LastColor,!0);this._state.LastColor=this.LastColor,a=!0}}if(g=t.asc_getNegativePoint(),h=t.asc_getColorNegative(),this._state.NegativePoint!==g&&(this.chNegativePoint.setValue(null!==g&&void 0!==g?g:"indeterminate",!0),this._state.NegativePoint=g,a=!0),h){this.NegativeColor=h.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB()),effectValue:h.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(h.asc_getR(),h.asc_getG(),h.asc_getB());var d=typeof this.NegativeColor,p=typeof this._state.NegativeColor;if(d!==p||"object"==d&&(this.NegativeColor.effectValue!==this._state.NegativeColor.effectValue||this._state.NegativeColor.color.indexOf(this.NegativeColor.color)<0)||"object"!=d&&(this._state.NegativeColor.indexOf(this.NegativeColor)<0||"object"==typeof this.btnNegativeColor.color)){if(this.btnNegativeColor.setColor(this.NegativeColor),"object"==typeof this.NegativeColor){for(var m=!1,u=0;u<10;u++)if(Common.Utils.ThemeColor.ThemeValues[u]==this.NegativeColor.effectValue){this.colorsNegative.select(this.NegativeColor,!0),m=!0;break}m||this.colorsNegative.clearSelection()}else this.colorsNegative.select(this.NegativeColor,!0);this._state.NegativeColor=this.NegativeColor,a=!0}}a&&this.updateSparkStyles(t.asc_getStyles())}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},UpdateThemeColors:function(){var t;this.btnSparkColor||(t=this.defColor,this.btnSparkColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnSparkColor.render(e("#spark-color-btn")),this.btnSparkColor.setColor("000000"),this.lockedControls.push(this.btnSparkColor),this.colorsSpark=new Common.UI.ThemeColorPalette({el:e("#spark-color-menu"),value:"000000"}),this.colorsSpark.on("select",i.bind(this.onColorsSparkSelect,this)),this.btnSparkColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsSpark,this.btnSparkColor)),this.btnHighColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-high-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-high-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}).render(e("#spark-high-color-btn")),this.btnHighColor.setColor(this.defColor.color),this.lockedControls.push(this.btnHighColor),this.colorsHigh=new Common.UI.ThemeColorPalette({el:e("#spark-high-color-menu")}),this.colorsHigh.on("select",i.bind(this.onColorsPointSelect,this,0,this.btnHighColor)),this.btnHighColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsHigh,this.btnHighColor)),this.btnLowColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-low-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-low-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}).render(e("#spark-low-color-btn")),this.btnLowColor.setColor(this.defColor.color),
|
|
|
this.lockedControls.push(this.btnLowColor),this.colorsLow=new Common.UI.ThemeColorPalette({el:e("#spark-low-color-menu")}),this.colorsLow.on("select",i.bind(this.onColorsPointSelect,this,1,this.btnLowColor)),this.btnLowColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsLow,this.btnLowColor)),this.btnNegativeColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-negative-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-negative-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}).render(e("#spark-negative-color-btn")),this.btnNegativeColor.setColor(this.defColor.color),this.lockedControls.push(this.btnNegativeColor),this.colorsNegative=new Common.UI.ThemeColorPalette({el:e("#spark-negative-color-menu")}),this.colorsNegative.on("select",i.bind(this.onColorsPointSelect,this,2,this.btnNegativeColor)),this.btnNegativeColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsNegative,this.btnNegativeColor)),this.btnFirstColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-first-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-first-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}).render(e("#spark-first-color-btn")),this.lockedControls.push(this.btnFirstColor),this.colorsFirst=new Common.UI.ThemeColorPalette({el:e("#spark-first-color-menu")}),this.colorsFirst.on("select",i.bind(this.onColorsPointSelect,this,3,this.btnFirstColor)),this.btnFirstColor.setColor(this.defColor.color),this.btnFirstColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsFirst,this.btnFirstColor)),this.btnLastColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-last-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-last-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}).render(e("#spark-last-color-btn")),this.btnLastColor.setColor(this.defColor.color),this.lockedControls.push(this.btnLastColor),this.colorsLast=new Common.UI.ThemeColorPalette({el:e("#spark-last-color-menu")}),this.colorsLast.on("select",i.bind(this.onColorsPointSelect,this,4,this.btnLastColor)),this.btnLastColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsLast,this.btnLastColor)),this.btnMarkersColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="spark-markers-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="spark-markers-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}).render(e("#spark-markers-color-btn")),this.btnMarkersColor.setColor(this.defColor.color),this.lockedControls.push(this.btnMarkersColor),this.colorsMarkers=new Common.UI.ThemeColorPalette({el:e("#spark-markers-color-menu")}),this.colorsMarkers.on("select",i.bind(this.onColorsPointSelect,this,5,this.btnMarkersColor)),this.btnMarkersColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsMarkers,this.btnMarkersColor))),this.colorsSpark.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsHigh.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),t),this.colorsLow.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),t),this.colorsNegative.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),t),this.colorsFirst.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),t),this.colorsLast.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),t),this.colorsMarkers.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),t),this.btnSparkColor.setColor(this.colorsSpark.getColor()),this.btnHighColor.setColor(this.colorsHigh.getColor()),this.btnLowColor.setColor(this.colorsLow.getColor()),this.btnNegativeColor.setColor(this.colorsNegative.getColor()),this.btnFirstColor.setColor(this.colorsFirst.getColor()),this.btnLastColor.setColor(this.colorsLast.getColor()),this.btnMarkersColor.setColor(this.colorsMarkers.getColor())},createDelayedControls:function(){var t=this;this.btnChartType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist bar-normal",menu:new Common.UI.Menu({style:"width: 435px; padding-top: 12px;",items:[{template:i.template('<div id="id-chart-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),this.btnChartType.on("render:after",function(n){t.mnuChartTypePicker=new Common.UI.DataView({el:e("#id-chart-menu-type"),parentMenu:n.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:t.textColumn},{id:"menu-chart-group-line",caption:t.textLine},{id:"menu-chart-group-pie",caption:t.textPie},{id:"menu-chart-group-hbar",caption:t.textBar},{id:"menu-chart-group-area",caption:t.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:t.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:t.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]),itemTemplate:i.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnChartType.render(e("#chart-button-type")),this.mnuChartTypePicker.on("item:click",i.bind(this.onSelectType,this,this.btnChartType)),this.lockedControls.push(this.btnChartType),this.spnWidth=new Common.UI.MetricSpinner({el:e("#chart-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:e("#chart-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.spnWidth.on("change",i.bind(this.onWidthChange,this)),this.spnHeight.on("change",i.bind(this.onHeightChange,this)),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render(e("#chart-button-ratio")),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",i.bind(function(t,e){if(t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this.api){var i=new Asc.asc_CImgProperty;i.asc_putLockAspect(t.pressed),this.api.asc_setGraphicObjectProps(i)}},this)),this.btnSparkType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist spark-column",menu:new Common.UI.Menu({style:"width: 200px; padding-top: 12px;",items:[{template:i.template('<div id="id-spark-menu-type" class="menu-insertchart" style="margin: 5px 5px 0 10px;"></div>')}]})}),this.btnSparkType.on("render:after",function(n){t.mnuSparkTypePicker=new Common.UI.DataView({el:e("#id-spark-menu-type"),parentMenu:n.menu,restoreHeight:120,allowScrollbar:!1,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-sparkcolumn",inline:!0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:t.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:t.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:t.textWinLossSpark}]),itemTemplate:i.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnSparkType.render(e("#spark-button-type")),this.mnuSparkTypePicker.on("item:click",i.bind(this.onSelectSparkType,this,this.btnSparkType)),this.lockedControls.push(this.btnSparkType),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#spark-combo-line-type"),style:"width: 90px;",allowNoBorders:!1}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(1).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.chHighPoint=new Common.UI.CheckBox({el:e("#spark-checkbox-high"),labelText:this.textHighPoint}),this.lockedControls.push(this.chHighPoint),this.chPoints.push(this.chHighPoint),this.chLowPoint=new Common.UI.CheckBox({el:e("#spark-checkbox-low"),labelText:this.textLowPoint}),this.lockedControls.push(this.chLowPoint),this.chPoints.push(this.chLowPoint),this.chNegativePoint=new Common.UI.CheckBox({el:e("#spark-checkbox-negative"),labelText:this.textNegativePoint}),this.lockedControls.push(this.chNegativePoint),this.chPoints.push(this.chNegativePoint),this.chFirstPoint=new Common.UI.CheckBox({el:e("#spark-checkbox-first"),labelText:this.textFirstPoint}),this.lockedControls.push(this.chFirstPoint),this.chPoints.push(this.chFirstPoint),this.chLastPoint=new Common.UI.CheckBox({el:e("#spark-checkbox-last"),labelText:this.textLastPoint}),this.lockedControls.push(this.chLastPoint),this.chPoints.push(this.chLastPoint),this.chMarkersPoint=new Common.UI.CheckBox({el:e("#spark-checkbox-markers"),labelText:this.textMarkers}),this.lockedControls.push(this.chMarkersPoint),this.chPoints.push(this.chMarkersPoint),this.chHighPoint.on("change",i.bind(this.onCheckPointChange,this,0)),this.chLowPoint.on("change",i.bind(this.onCheckPointChange,this,1)),this.chNegativePoint.on("change",i.bind(this.onCheckPointChange,this,2)),this.chFirstPoint.on("change",i.bind(this.onCheckPointChange,this,3)),this.chLastPoint.on("change",i.bind(this.onCheckPointChange,this,4)),this.chMarkersPoint.on("change",i.bind(this.onCheckPointChange,this,5)),this.btnSelectData=new Common.UI.Button({el:e("#chart-btn-select-data")}),this.btnSelectData.on("click",i.bind(this.onSelectData,this)),this.lockedControls.push(this.btnSelectData),this.linkAdvanced=e("#chart-advanced-link"),e(this.el).on("click","#chart-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this.UpdateThemeColors(),this._initSettings=!1},ShowHideElem:function(t){this.ChartSizeContainer.toggleClass("settings-hidden",!t),this.ChartTypesContainer.toggleClass("settings-hidden",!t),this.SparkTypesContainer.toggleClass("settings-hidden",t),this.SparkPointsContainer.toggleClass("settings-hidden",t)},onWidthChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnHeight.getNumberValue();if(this.btnRatio.pressed&&(s=o/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)),this.api){var a=new Asc.asc_CImgProperty;a.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(o)),a.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(s)),this.api.asc_setGraphicObjectProps(a)}Common.NotificationCenter.trigger("edit:complete",this)},onHeightChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnWidth.getNumberValue();if(this.btnRatio.pressed&&(s=o*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this.api){var a=new Asc.asc_CImgProperty;a.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(s)),a.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(o)),this.api.asc_setGraphicObjectProps(a)}Common.NotificationCenter.trigger("edit:complete",this)},openAdvancedSettings:function(){if(!this.linkAdvanced.hasClass("disabled")){var t,e=this;e.api&&(t=e.isChart?e.api.asc_getChartObject():e._originalProps)&&new SSE.Views.ChartSettingsDlg({chartSettings:t,imageSettings:e.isChart?e._originalProps:null,sparklineStyles:e.sparklineStyles,isChart:e.isChart,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.isChart?(e.api.asc_editChartDrawingObject(i.chartSettings),i.imageSettings&&e.api.asc_setGraphicObjectProps(i.imageSettings)):e.api.asc_setSparklineGroup(e._state.SparkId,i.chartSettings)),Common.NotificationCenter.trigger("edit:complete",e)}}).show()}},onSelectData:function(){var t=this;if(t.api){var e=t.api.asc_getChartObject(),n=function(i,n){"ok"==n&&(e.putRange(i.getSettings()),t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),t.api.asc_editChartDrawingObject(e)),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},o=function(n){var o;return i.isEmpty(n)?"":(o=t.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,n,!0,!e.getInColumns(),t._state.ChartType))==Asc.c_oAscError.ID.No||(o==Asc.c_oAscError.ID.StockChartError?this.errorStockChart:o==Asc.c_oAscError.ID.MaxDataSeriesError?this.errorMaxRows:this.txtInvalidRange)},s=new SSE.Views.CellRangeDialog({handler:n}).on("close",function(){t.api.asc_onCloseChartFrame()});s.show(),s.setSettings({api:t.api,range:e.getRange(),validation:o,type:Asc.c_oAscSelectionDialogType.Chart})}},onSelectType:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnChartType.setIconCls("item-chartlist "+s.iconCls),this._state.ChartType=-1,this.api&&!this._noApply&&this.chartProps){var a=new Asc.asc_CImgProperty;this.chartProps.changeType(s.type),a.asc_putChartProperties(this.chartProps),this.api.asc_setGraphicObjectProps(a)}Common.NotificationCenter.trigger("edit:complete",this)}},onSelectStyle:function(t,e){if(!this._noApply){if(this.api&&!this._noApply&&this.chartProps){var i=new Asc.asc_CImgProperty;this.chartProps.putStyle(e.get("data")),i.asc_putChartProperties(this.chartProps),this.api.asc_setGraphicObjectProps(i)}Common.NotificationCenter.trigger("edit:complete",this)}},_onUpdateChartStyles:function(){this.api&&null!==this._state.ChartType&&this._state.ChartType>-1&&this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType))},updateChartStyles:function(t){var n=this;if(this._isChartStylesChanged=!0,this.cmbChartStyle||(this.cmbChartStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:270,enableKeyEvents:!0,cls:"combo-chart-style"}),this.cmbChartStyle.render(e("#chart-combo-style")),this.cmbChartStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbChartStyle.on("click",i.bind(this.onSelectStyle,this)),this.cmbChartStyle.openButton.menu.on("show:after",function(){n.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbChartStyle)),t&&t.length>0){var o=this.cmbChartStyle.menuPicker.store;if(o){var s=o.length;if(s>0&&s==t.length){var a=o.models;i.each(t,function(t,e){a[e].set("imageUrl",t.asc_getImage())})}else{var l=[];i.each(t,function(t,e){l.push({imageUrl:t.asc_getImage(),data:t.asc_getName(),tip:n.textStyle+" "+t.asc_getName()})}),o.reset(l,{silent:!1})}}}else this.cmbChartStyle.menuPicker.store.reset(),this.cmbChartStyle.clearComboView();this.cmbChartStyle.setDisabled(!t||t.length<1||this._locked)},updateSparkStyles:function(t){var n=this;if(this.cmbSparkStyle||(this.cmbSparkStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:272,enableKeyEvents:!0,cls:"combo-spark-style"}),this.cmbSparkStyle.render(e("#spark-combo-style")),this.cmbSparkStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbSparkStyle.on("click",i.bind(this.onSelectSparkStyle,this)),this.cmbSparkStyle.openButton.menu.on("show:after",function(){n.cmbSparkStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbSparkStyle)),t&&t.length>1){var o=this.cmbSparkStyle.menuPicker.store,s=t[t.length-1];if(this.sparklineStyles=t,o.length==t.length-1){for(var a=o.models,l=0;l<t.length-1;l++)a[l].set("imageUrl",t[l]);s<0?(this.cmbSparkStyle.fillComboView(o.at(0),!1),this.cmbSparkStyle.fieldPicker.deselectAll(),this.cmbSparkStyle.menuPicker.deselectAll()):this.cmbSparkStyle.menuPicker.selectRecord(o.at(s))}else{for(var r=[],l=0;l<t.length-1;l++)r.push({imageUrl:t[l],data:l});o.reset(r,{silent:!1}),this.cmbSparkStyle.fillComboView(o.at(s<0?0:s),s>-1)}}},onSelectSparkType:function(t,e,n,o){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnSparkType.setIconCls("item-chartlist "+s.iconCls),this._state.SparkType=-1,this.api&&!this._noApply&&this._originalProps){var a=new Asc.sparklineGroup;a.asc_setType(s.type),this.api.asc_setSparklineGroup(this._state.SparkId,a)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectSparkStyle:function(t,e){if(!this._noApply){if(this.api&&!this._noApply&&this._originalProps){var i=new Asc.sparklineGroup;i.asc_setStyle(e.get("data")),this.api.asc_setSparklineGroup(this._state.SparkId,i)}Common.NotificationCenter.trigger("edit:complete",this)}},applyBorderSize:function(t){if(t=parseFloat(t),t=isNaN(t)?1:Math.max(.01,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply&&this._originalProps){var e=new Asc.sparklineGroup;e.asc_setLineWeight(this.BorderSize),this.api.asc_setSparklineGroup(this._state.SparkId,e),Common.NotificationCenter.trigger("edit:complete",this)}},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<.01||a>1584)&&(this._state.LineWeight=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){Common.NotificationCenter.trigger("edit:complete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onColorsSparkSelect:function(t,e){if(this.btnSparkColor.setColor(e),this.api&&!this._noApply&&this._originalProps){var i=new Asc.sparklineGroup;i.asc_setColorSeries(Common.Utils.ThemeColor.getRgbColor(e)),this.api.asc_setSparklineGroup(this._state.SparkId,i)}Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onCheckPointChange:function(t,e,i,n,o){if(this.api&&!this._noApply&&this._originalProps){var s=new Asc.sparklineGroup;switch(t){case 0:s.asc_setHighPoint("checked"==e.getValue());break;case 1:s.asc_setLowPoint("checked"==e.getValue());break;case 2:s.asc_setNegativePoint("checked"==e.getValue());break;case 3:s.asc_setFirstPoint("checked"==e.getValue());break;case 4:s.asc_setLastPoint("checked"==e.getValue());break;case 5:s.asc_setMarkersPoint("checked"==e.getValue())}this.api.asc_setSparklineGroup(this._state.SparkId,s)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsPointSelect:function(t,e,i,n){if(e.setColor(n),"checked"!==this.chPoints[t].getValue()&&this.chPoints[t].setValue(!0,!0),this.api&&!this._noApply&&this._originalProps){var o=new Asc.sparklineGroup;switch(t){case 0:o.asc_setHighPoint(!0),o.asc_setColorHigh(Common.Utils.ThemeColor.getRgbColor(n));break;case 1:o.asc_setLowPoint(!0),o.asc_setColorLow(Common.Utils.ThemeColor.getRgbColor(n));break;case 2:o.asc_setNegativePoint(!0),o.asc_setColorNegative(Common.Utils.ThemeColor.getRgbColor(n));break;case 3:o.asc_setFirstPoint(!0),o.asc_setColorFirst(Common.Utils.ThemeColor.getRgbColor(n));break;case 4:o.asc_setLastPoint(!0),o.asc_setColorLast(Common.Utils.ThemeColor.getRgbColor(n));break;case 5:o.asc_setMarkersPoint(!0),o.asc_setColorMarkers(Common.Utils.ThemeColor.getRgbColor(n))}this.api.asc_setSparklineGroup(this._state.SparkId,o)}Common.NotificationCenter.trigger("edit:complete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textEditData:"Edit Data and Location",textChartType:"Change Chart Type",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textStyle:"Style",textAdvanced:"Show advanced settings",strSparkColor:"Color",strLineWeight:"Line Weight",textMarkers:"Markers",textNewColor:"Add New Custom Color",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",textHighPoint:"High Point",textLowPoint:"Low Point",textNegativePoint:"Negative Point",textFirstPoint:"First Point",textLastPoint:"Last Point",strTemplate:"Template",textShow:"Show",textType:"Type",textSelectData:"Select Data",textRanges:"Data Range",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",textSurface:"Surface"},SSE.Views.ChartSettings||{}))}),define("text!spreadsheeteditor/main/app/template/ShapeSettings.template",[],function(){
|
|
|
return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strFill %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="shape-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="shape-panel-color-fill" class="padding-small" style="width: 100%;">\r\n <div id="shape-back-color-btn" style=""></div>\r\n </div>\r\n <div id="shape-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="shape-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="shape-button-from-url" style="width:90px;float:right;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: top">\r\n <div id="shape-combo-fill-type" style="width: 90px;"></div>\r\n </td>\r\n <td rowspan="2">\r\n <div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;float:right;">\r\n <div id="shape-texture-img" style="width: 50px;height: 50px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom">\r\n <label class="input-label" style=""><%= scope.textTexture %></label>\r\n <div id="shape-combo-fill-texture" style="width: 90px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div id="shape-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>\r\n <div id="shape-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>\r\n <div id="shape-foreground-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>\r\n <div id="shape-background-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </div>\r\n <div id="shape-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div style="height:80px;">\r\n <div style="display: inline-block;">\r\n <label class="input-label" style=""><%= scope.textStyle %></label>\r\n <div id="shape-combo-grad-type" style="width: 90px;"></div>\r\n </div>\r\n <div style="display: inline-block;float: right;">\r\n <label class="input-label" style=""><%= scope.textDirection %></label>\r\n <div id="shape-button-direction" style=""></div>\r\n </div>\r\n </div>\r\n <label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <div id="shape-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="shape-gradient-color-btn" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div class="padding-small" id="shape-panel-transparent-fill" style="width: 100%;">\r\n <label class="header" style="display:block;"><%= scope.strTransparency %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <label id="shape-lbl-transparency-start">0</label>\r\n <div id="shape-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>\r\n <label id="shape-lbl-transparency-end">100</label>\r\n </div>\r\n <div id="shape-spin-transparency" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strStroke %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strSize %></label>\r\n <div id="shape-combo-border-size" style="width: 93px;"></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strColor %></label>\r\n <div id="shape-border-color-btn" style=""></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strType %></label>\r\n <div id="shape-combo-border-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textRotation %></label>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td>\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textRotate90 %></label>\r\n <div>\r\n <div id="shape-button-270" style="display: inline-block;margin-right: 4px;"></div>\r\n <div id="shape-button-90" style="display: inline-block;"></div>\r\n </div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textFlip %></label>\r\n <div>\r\n <div id="shape-button-fliph" style="display: inline-block;margin-right: 4px;"></div>\r\n <div id="shape-button-flipv" style="display: inline-block;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr class="change-type">\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr class="change-type">\r\n <td class="padding-small">\r\n <label class="header" style="margin-top: 3px;"><%= scope.strChange %></label>\r\n <div id="shape-btn-change" style="display: inline-block; float:right;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="shape-checkbox-shadow"></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td align="center">\r\n <label class="link" id="shape-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboBorderSize",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.BordersModel=Backbone.Model.extend({defaults:function(){return{value:null,displayValue:null,pxValue:null,id:Common.UI.getId(),offsety:void 0}}}),Common.UI.BordersStore=Backbone.Collection.extend({model:Common.UI.BordersModel}),Common.UI.ComboBorderSize=Common.UI.ComboBox.extend(_.extend({template:_.template(['<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">','<div class="form-control" style="padding-top:2px; <%= style %>"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',"<span><%= item.displayValue %></span>","<% if (item.offsety!==undefined) { %>",'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="right" style="background-position: 0 -<%= item.offsety %>px;">',"<% } %>","</a></li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(t){var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),i=[{displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+e,value:6,pxValue:6,offsety:120}];!1!==t.allowNoBorders&&i.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!1,store:new Common.UI.BordersStore,data:i,menuStyle:"min-width: 160px;"},t))},render:function(t){return Common.UI.ComboBox.prototype.render.call(this,t),this},itemClicked:function(t){var e=$(t.currentTarget).parent();this._selectedItem=this.store.findWhere({id:e.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),e.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault())},updateFormControl:function(t){var e=$(this.el).find(".form-control");t.get("value")>0?(e[0].innerHTML="",e.removeClass("text").addClass("image"),e.css("background-position","0 -"+t.get("offsety")+"px")):(e[0].innerHTML=this.txtNoBorders,e.removeClass("image").addClass("text"))},setValue:function(t){if(this._selectedItem=null===t||void 0===t?void 0:_.find(this.store.models,function(e){if(t<e.attributes.value+.01&&t>e.attributes.value-.01)return!0}),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var e=$(this.el).find(".form-control");e[0].innerHTML="",e.removeClass("image").addClass("text")}},txtNoBorders:"No Borders"},Common.UI.ComboBorderSize||{})),Common.UI.ComboBorderSizeEditable=Common.UI.ComboBox.extend(_.extend({template:_.template(['<span class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control text">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',"<span><%= item.displayValue %></span>","<% if (item.offsety!==undefined) { %>",'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="right" style="background-position: 0 -<%= item.offsety %>px;">',"<% } %>","</a></li>","<% }); %>","</ul>","</span>"].join("")),initialize:function(t){this.txtNoBorders=t.txtNoBorders||this.txtNoBorders;var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),i=[{displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+e,value:6,pxValue:6,offsety:120}];!1!==t.allowNoBorders&&i.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!0,store:new Common.UI.BordersStore,data:i,menuStyle:"min-width: 160px;"},t))},render:function(t){return Common.UI.ComboBox.prototype.render.call(this,t),this},txtNoBorders:"No Borders"},Common.UI.ComboBorderSizeEditable||{})),Common.UI.ComboBorderType=Common.UI.ComboBorderSize.extend(_.extend({template:_.template(['<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">','<div class="form-control" style="<%= style %>"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem" style="padding: 2px 0;">','<span style="margin-top: 0;"></span>',"<% if (item.offsety!==undefined) { %>",'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="left" style="background-position: 0 -<%= item.offsety %>px;">',"<% } %>","</a></li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(t){Common.UI.ComboBorderSize.prototype.initialize.call(this,_.extend({store:new Common.UI.BordersStore,data:[{value:Asc.c_oDashType.solid,offsety:140},{value:Asc.c_oDashType.sysDot,offsety:160},{value:Asc.c_oDashType.sysDash,offsety:180},{value:Asc.c_oDashType.dash,offsety:200},{value:Asc.c_oDashType.dashDot,offsety:220},{value:Asc.c_oDashType.lgDash,offsety:240},{value:Asc.c_oDashType.lgDashDot,offsety:260},{value:Asc.c_oDashType.lgDashDotDot,offsety:280}]},t))},render:function(t){return Common.UI.ComboBorderSize.prototype.render.call(this,t),this},updateFormControl:function(t){var e=$(this.el).find(".form-control");e[0].innerHTML="",e.removeClass("text").addClass("image"),e.css("background-position","0 -"+t.get("offsety")+"px")}},Common.UI.ComboBorderType||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/ColorButton",["common/main/lib/component/Button"],function(){"use strict";Common.UI.ColorButton=Common.UI.Button.extend({options:{hint:!1,enableToggle:!1,visible:!0},template:_.template(['<div class="btn-group" id="<%= id %>">','<button type="button" class="btn btn-color dropdown-toggle <%= cls %>" data-toggle="dropdown" style="<%= style %>">',"<span> </span>","</button>","</div>"].join("")),setColor:function(t){var e,i,n=$(this.cmpEl).find("button span");this.color=t,"transparent"==t?(e="#BEBEBE",i=t,n.addClass("color-transparent")):(e="transparent",i="object"==typeof t?"#"+t.color:"#"+t,n.removeClass("color-transparent")),n.css({"background-color":i,"border-color":e})}})}),void 0===Common)var Common={};if(define("common/main/lib/component/Slider",["common/main/lib/component/BaseView","underscore"],function(t,e){"use strict";Common.UI.SingleSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,step:1,value:100,enableKeyEvents:!1},disabled:!1,template:e.template(['<div class="slider single-slider" style="">','<div class="track">','<div class="track-left img-commonctrl"></div>','<div class="track-center img-commonctrl"></div>','<div class="track-right img-commonctrl" style=""></div>',"</div>",'<div class="thumb img-commonctrl" style=""></div>',"<% if (this.options.enableKeyEvents) { %>",'<input type="text" style="position: absolute; top:-10px; width: 1px; height: 1px;">',"<% } %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.step=e.options.step,e.options.el&&e.render(),this.setValue(e.options.value)},render:function(t){var i=this;i.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),this.cmpEl.find(".track-center").width(i.options.width-14),this.cmpEl.width(i.options.width),this.thumb=this.cmpEl.find(".thumb");var n,o=function(t){t.preventDefault(),t.stopPropagation();var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,i.thumb.removeClass("active"),$(document).off("mouseup",o),$(document).off("mousemove",s),i._dragstart=void 0,i.trigger("changecomplete",i,i.value,i.lastValue)},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,Math.abs(i.value-i.lastValue)>.001&&i.trigger("change",i,i.value,i.lastValue)}},a=function(t){i.disabled||(i._dragstart=t.pageX*Common.Utils.zoom()-i.thumb.offset().left-7,i.thumb.addClass("active"),$(document).on("mouseup",o),$(document).on("mousemove",s),i.options.enableKeyEvents&&setTimeout(function(){i.input.focus()},10))},l=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,i.trigger("change",i,i.value,i.lastValue),i.trigger("changecomplete",i,i.value,i.lastValue)}},r=function(t){i.lastValue=i.value,i.value=Math.max(i.minValue,Math.min(i.maxValue,i.value+(t?i.step:-i.step))),i.setThumbPosition(Math.round((i.value-i.minValue)*i.delta)),i.trigger("change",i,i.value,i.lastValue)},c=function(t){i.disabled||t.keyCode!=Common.UI.Keys.UP&&t.keyCode!=Common.UI.Keys.DOWN&&t.keyCode!=Common.UI.Keys.LEFT&&t.keyCode!=Common.UI.Keys.RIGHT||(t.preventDefault(),t.stopPropagation(),d.off("keydown","input",c),n=setInterval(e.bind(r,i,t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),100))},h=function(t){i.disabled||(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN||Common.UI.Keys.LEFT||Common.UI.Keys.RIGHT)&&(t.stopPropagation(),t.preventDefault(),clearInterval(n),r(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),d.on("keydown","input",c),i.trigger("changecomplete",i,i.value,i.lastValue))};if(!i.rendered){var d=i.cmpEl;d.on("mousedown",".thumb",a),d.on("mousedown",".track",l),this.options.enableKeyEvents&&(d.on("keydown","input",c),d.on("keyup","input",h))}return i.rendered=!0,this},setThumbPosition:function(t){this.thumb.css({left:t+"%"})},setValue:function(t){this.lastValue=this.value,this.value=Math.max(this.minValue,Math.min(this.maxValue,t)),this.setThumbPosition(Math.round((t-this.minValue)*this.delta))},getValue:function(){return this.value},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t}}),Common.UI.MultiSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],thumbTemplate:'<div class="thumb" style=""></div>'},disabled:!1,template:e.template(['<div class="slider multi-slider">','<div class="track">','<div class="track-left"></div>','<div class="track-center""></div>','<div class="track-right" style=""></div>',"</div>","<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.thumbs=[],e.options.el&&e.render()},render:function(t){var i=this;i.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({items:this.options.values,thumbTemplate:this.options.thumbTemplate})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl));var n=this.cmpEl;n.find(".track-center").width(i.options.width-14),n.width(i.options.width);var o=function(t){t.preventDefault(),t.stopPropagation();var e=t.data.index,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1<i.thumbs.length?i.thumbs[e+1].position:100,a=Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100),l=a<o||a>s,r=Math.max(0,Math.min(100,a)),c=r/i.delta+i.minValue;i.setThumbPosition(e,r),i.thumbs[e].value=c,l&&i.sortThumbs(),$(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),i._dragstart=void 0,i.trigger("changecomplete",i,c,n)},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=t.data.index,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1<i.thumbs.length?i.thumbs[e+1].position:100,a=Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100),l=a<o||a>s,r=Math.max(0,Math.min(100,a)),c=r/i.delta+i.minValue;i.setThumbPosition(e,r),i.thumbs[e].value=c,l&&i.sortThumbs(),Math.abs(c-n)>.001&&i.trigger("change",i,c,n)}},a=function(t){if(!i.disabled){var n=t.data.index,o=i.thumbs[n].thumb;i._dragstart=t.pageX*Common.Utils.zoom()-o.offset().left-o.width()/2,i.setActiveThumb(n),e.each(i.thumbs,function(t,e){n==e?t.thumb.css("z-index",500):t.thumb.css("z-index","")}),$(document).on("mouseup",null,t.data,i.binding.onMouseUp),$(document).on("mousemove",null,t.data,i.binding.onMouseMove)}},l=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100))),n=r(e),o=i.thumbs[n].value,s=e/i.delta+i.minValue;i.setThumbPosition(n,e),i.thumbs[n].value=s,i.trigger("change",i,s,o),i.trigger("changecomplete",i,s,o)}},r=function(t){for(var e,n=100,o=0,s=i.thumbs.length,a=0;a<s;a++)if(e=Math.abs(i.thumbs[a].position-t),Math.abs(e<=n)){var l=i.thumbs[a+1],r=i.thumbs[a-1];if(void 0!==r&&t<r.position)continue;if(void 0!==l&&t>l.position)continue;o=a,n=e}return o};return this.binding={onMouseUp:e.bind(o,this),onMouseMove:e.bind(s,this),onMouseDown:e.bind(a,this)},this.$thumbs=n.find(".thumb"),e.each(this.$thumbs,function(t,e){var n=$(t);i.thumbs.push({thumb:n,index:e}),i.setValue(e,i.options.values[e]),n.on("mousedown",null,i.thumbs[e],i.binding.onMouseDown)}),i.setActiveThumb(0,!0),i.rendered||n.on("mousedown",".track",l),i.rendered=!0,this},setActiveThumb:function(t,e){this.currentThumb=t,this.$thumbs.removeClass("active"),this.thumbs[t].thumb.addClass("active"),!0!==e&&this.trigger("thumbclick",this,t)},setThumbPosition:function(t,e){this.thumbs[t].position=e,this.thumbs[t].thumb.css({left:e+"%"})},setValue:function(t,e){this.thumbs[t].value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(t,Math.round((e-this.minValue)*this.delta))},getValue:function(t){return this.thumbs[t].value},getValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.value)}),t},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t},sortThumbs:function(){this.thumbs.sort(function(t,e){return t.position-e.position});var t=[];return e.each(this.thumbs,function(e,i){t.push(e.index),e.index=i}),t},setThumbs:function(t){var e=this.thumbs.length;if(e!=t)for(var i=0;i<Math.abs(t-e);i++)e<t?this.addThumb():this.removeThumb()},addThumb:function(){var t=this.cmpEl,e=$(this.options.thumbTemplate),i=this.thumbs.length;t.append(e),this.thumbs.push({thumb:e,index:i}),i>0&&this.setValue(i,this.getValue(i-1)),e.on("mousedown",null,this.thumbs[i],this.binding.onMouseDown)},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),t>0&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1))}})}),void 0===Common)var Common={};define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(t,e){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0,thumbTemplate:'<div class="thumb img-commonctrl" style=""><div class="thumb-top"></div><div class="thumb-bottom"></div></div>'},disabled:!1,template:e.template(['<div class="slider multi-slider-gradient">','<div class="track"></div>',"<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","</div>"].join("")),initialize:function(t){this.styleStr={},Common.UI.MultiSlider.prototype.initialize.call(this,t)},render:function(t){Common.UI.MultiSlider.prototype.render.call(this,t);var i=this;i.trackEl=i.cmpEl.find(".track");for(var n=0;n<i.thumbs.length;n++)i.thumbs[n].thumb.on("dblclick",null,function(){i.trigger("thumbdblclick",i)}),i.thumbs[n].thumbcolor=i.thumbs[n].thumb.find("> div"),i.setColorValue(i.options.colorValues[n],n);i.changeSliderStyle(),i.changeGradientStyle(),i.on("change",e.bind(i.changeGradientStyle,i))},setColorValue:function(t,e){var i=void 0!==e?e:this.currentThumb;this.thumbs[i].colorValue=t,this.thumbs[i].thumbcolor.css("background-color",t),this.changeGradientStyle()},getColorValue:function(t){var e=void 0!==t?t:this.currentThumb;return this.thumbs[e].colorValue},setValue:function(t,e){Common.UI.MultiSlider.prototype.setValue.call(this,t,e),this.changeGradientStyle()},getColorValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.colorValue)}),t},changeGradientStyle:function(){if(this.rendered){var t;this.styleStr.specific&&(t=Common.Utils.String.format(this.styleStr.specific,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t)),Common.Utils.isIE&&(t=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.getColorValue(0),this.getColorValue(this.thumbs.length-1)),this.trackEl.css("filter",t)),this.styleStr.common&&(t=Common.Utils.String.format(this.styleStr.common,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t))}},sortThumbs:function(){var t=Common.UI.MultiSlider.prototype.sortThumbs.call(this);return this.trigger("sortthumbs",this,t),t},addThumb:function(){Common.UI.MultiSlider.prototype.addThumb.call(this);var t=this,e=t.thumbs.length-1;t.thumbs[e].thumb.on("dblclick",null,function(){t.trigger("thumbdblclick",t)}),t.thumbs[e].thumbcolor=t.thumbs[e].thumb.find("> div"),e>0&&this.setColorValue(this.getColorValue(e-1),e),t.changeSliderStyle()},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),t>0&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1),this.changeSliderStyle())},changeSliderStyle:function(){this.styleStr={specific:"",common:"linear-gradient(to right"},Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr.specific="-webkit-gradient(linear, left top, right top":Common.Utils.isChrome||Common.Utils.isSafari?this.styleStr.specific="-webkit-linear-gradient(left":Common.Utils.isGecko?this.styleStr.specific="-moz-linear-gradient(left":Common.Utils.isOpera&&Common.Utils.operaVersion>11?this.styleStr.specific="-o-linear-gradient(left":Common.Utils.isIE&&(this.styleStr.specific="-ms-linear-gradient(left");for(var t=0;t<this.thumbs.length;t++)this.styleStr.common+=", {"+t+"} {"+(this.thumbs.length+t)+"}%",Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr.specific+=", color-stop({"+(this.thumbs.length+t)+"}%,{"+t+"})":this.styleStr.specific+=", {"+t+"} {"+(this.thumbs.length+t)+"}%";this.styleStr.specific+=")",this.styleStr.common+=")"}})}),define("text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template",[],function(){
|
|
|
return'<div id="id-adv-shape-width" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td width="108px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="shape-advanced-spin-width"></div>\r\n </td>\r\n <td width="28px" style="vertical-align: bottom;">\r\n <div id="shape-advanced-button-ratio"></div>\r\n </td>\r\n <td width="108px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="shape-advanced-spin-height"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-rotate" class="settings-panel active">\r\n <div class="inner-content padding-large">\r\n <div style="width: 100%;">\r\n <label class="input-label"><%= scope.textAngle %></label>\r\n <div id="shape-advanced-spin-angle" style="display: inline-block; margin-left: 5px;"></div>\r\n </div>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content padding-large">\r\n <table cols="2">\r\n <tr>\r\n <td rowspan="2" class="padding-small" style="vertical-align: top;">\r\n <label class="input-label" style="margin-right: 15px;vertical-align: top;"><%= scope.textFlipped %></label>\r\n </td>\r\n <td class="padding-small">\r\n <div id="shape-advanced-checkbox-hor"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="shape-advanced-checkbox-vert"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-shape" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textLineStyle %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="125px">\r\n <label class="input-label"><%= scope.textCapType %></label>\r\n <div id="shape-advanced-cap-type" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textJoinType %></label>\r\n <div id="shape-advanced-join-type" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textArrows %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textBeginStyle %></label>\r\n <div id="shape-advanced-begin-style" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textEndStyle %></label>\r\n <div id="shape-advanced-end-style" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBeginSize %></label>\r\n <div id="shape-advanced-begin-size" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textEndSize %></label>\r\n <div id="shape-advanced-end-size" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-margins" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="shape-margin-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="shape-margin-left"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBottom %></label>\r\n <div id="shape-margin-bottom"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="shape-margin-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-columns" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textColNumber %></label>\r\n <div id="shape-columns-number"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textSpacing %></label>\r\n <div id="shape-columns-spacing"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-alttext" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="1" width="100%">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textAltTitle %></label>\r\n <div id="shape-advanced-alt-title"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textAltDescription %></label>\r\n <textarea id="shape-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("spreadsheeteditor/main/app/view/ShapeSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t){"use strict";SSE.Views.ShapeSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"shape-adv-settings-group",sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},properties:null,storageName:"sse-shape-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-shape-width",panelCaption:this.textSize},{panelId:"id-adv-shape-rotate",panelCaption:this.textRotation},{panelId:"id-adv-shape-shape",panelCaption:this.textWeightArrows},{panelId:"id-adv-shape-margins",panelCaption:this.strMargins},{panelId:"id-adv-shape-columns",panelCaption:this.strColumns},{panelId:"id-adv-shape-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this.Margins=void 0,this._nRatio=1,this._originalProps=this.options.shapeProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnWidth.on("change",_.bind(function(t,e,i,n){if(this.btnRatio.pressed){var o=t.getNumberValue(),s=o/this._nRatio;s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-height"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;this.btnRatio.pressed&&(s=o*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.spinners.push(this.spnHeight),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render($("#shape-advanced-button-ratio")),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect(t.pressed)},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#shape-margin-top"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginTop.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getPaddings()&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putTop(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#shape-margin-bottom"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginBottom.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getPaddings()&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putBottom(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#shape-margin-left"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getPaddings()&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putLeft(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#shape-margin-right"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getPaddings()&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putRight(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginRight),this.spnAngle=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-angle"),step:1,width:80,defaultUnit:"°",value:"0 °",maxValue:3600,minValue:-3600}),this.chFlipHor=new Common.UI.CheckBox({el:$("#shape-advanced-checkbox-hor"),labelText:this.textHorizontally}),this.chFlipVert=new Common.UI.CheckBox({el:$("#shape-advanced-checkbox-vert"),labelText:this.textVertically}),this._arrCapType=[{displayValue:this.textFlat,value:Asc.c_oAscLineCapType.Flat},{displayValue:this.textRound,value:Asc.c_oAscLineCapType.Round},{displayValue:this.textSquare,value:Asc.c_oAscLineCapType.Square}],this.cmbCapType=new Common.UI.ComboBox({el:$("#shape-advanced-cap-type"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:this._arrCapType}),this.cmbCapType.setValue(Asc.c_oAscLineCapType.Flat),this.cmbCapType.on("selected",_.bind(function(t,e){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getStroke()&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinecap(e.value))},this)),this._arrJoinType=[{displayValue:this.textRound,value:Asc.c_oAscLineJoinType.Round},{displayValue:this.textBevel,value:Asc.c_oAscLineJoinType.Bevel},{displayValue:this.textMiter,value:Asc.c_oAscLineJoinType.Miter}],this.cmbJoinType=new Common.UI.ComboBox({el:$("#shape-advanced-join-type"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:this._arrJoinType}),this.cmbJoinType.setValue(Asc.c_oAscLineJoinType.Round),this.cmbJoinType.on("selected",_.bind(function(t,e){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getStroke()&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinejoin(e.value))},this));for(var e=[],i=[],n=0;n<6;n++)e.push({value:n,offsetx:80*n+10,offsety:0});for(e[0].type=Asc.c_oAscLineBeginType.None,e[1].type=Asc.c_oAscLineBeginType.Triangle,e[2].type=Asc.c_oAscLineBeginType.Arrow,e[3].type=Asc.c_oAscLineBeginType.Stealth,e[4].type=Asc.c_oAscLineBeginType.Diamond,e[5].type=Asc.c_oAscLineBeginType.Oval,n=0;n<9;n++)i.push({value:n,offsetx:90,offsety:20*(n+1)});for(i[0].type=Asc.c_oAscLineBeginSize.small_small,i[1].type=Asc.c_oAscLineBeginSize.small_mid,i[2].type=Asc.c_oAscLineBeginSize.small_large,i[3].type=Asc.c_oAscLineBeginSize.mid_small,i[4].type=Asc.c_oAscLineBeginSize.mid_mid,i[5].type=Asc.c_oAscLineBeginSize.mid_large,i[6].type=Asc.c_oAscLineBeginSize.large_small,i[7].type=Asc.c_oAscLineBeginSize.large_mid,i[8].type=Asc.c_oAscLineBeginSize.large_large,this.btnBeginStyle=new Common.UI.ComboBox({el:$("#shape-advanced-begin-style"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnBeginStyleMenu=new Common.UI.Menu({style:"min-width: 105px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('<div id="shape-advanced-menu-begin-style" style="width: 105px; margin: 0 5px;"></div>')}]}).render($("#shape-advanced-begin-style")),this.mnuBeginStylePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-begin-style"),parentMenu:this.btnBeginStyleMenu,store:new Common.UI.DataViewStore(e),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuBeginStylePicker.on("item:click",_.bind(this.onSelectBeginStyle,this)),this._selectStyleItem(this.btnBeginStyle,null),this.btnBeginSize=new Common.UI.ComboBox({el:$("#shape-advanced-begin-size"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnBeginSizeMenu=new Common.UI.Menu({style:"min-width: 160px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('<div id="shape-advanced-menu-begin-size" style="width: 160px; margin: 0 5px;"></div>')}]}).render($("#shape-advanced-begin-size")),this.mnuBeginSizePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-begin-size"),parentMenu:this.btnBeginSizeMenu,store:new Common.UI.DataViewStore(i),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuBeginSizePicker.on("item:click",_.bind(this.onSelectBeginSize,this)),this._selectStyleItem(this.btnBeginSize,null),n=0;n<e.length;n++)e[n].offsety+=200;for(n=0;n<i.length;n++)i[n].offsety+=200;this.btnEndStyle=new Common.UI.ComboBox({el:$("#shape-advanced-end-style"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnEndStyleMenu=new Common.UI.Menu({style:"min-width: 105px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('<div id="shape-advanced-menu-end-style" style="width: 105px; margin: 0 5px;"></div>')}]}).render($("#shape-advanced-end-style")),this.mnuEndStylePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-end-style"),parentMenu:this.btnEndStyleMenu,store:new Common.UI.DataViewStore(e),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndStylePicker.on("item:click",_.bind(this.onSelectEndStyle,this)),this._selectStyleItem(this.btnEndStyle,null),this.btnEndSize=new Common.UI.ComboBox({el:$("#shape-advanced-end-size"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnEndSizeMenu=new Common.UI.Menu({style:"min-width: 160px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('<div id="shape-advanced-menu-end-size" style="width: 160px; margin: 0 5px;"></div>')}]}).render($("#shape-advanced-end-size")),this.mnuEndSizePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-end-size"),parentMenu:this.btnEndSizeMenu,store:new Common.UI.DataViewStore(i),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndSizePicker.on("item:click",_.bind(this.onSelectEndSize,this)),this._selectStyleItem(this.btnEndSize,null),this.on("show",function(t){t.getChild(".footer .primary").focus()}),this.spnColumns=new Common.UI.MetricSpinner({el:$("#shape-columns-number"),step:1,allowDecimal:!1,width:100,defaultUnit:"",value:"1",maxValue:16,minValue:1}),this.spnColumns.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_putColumnNumber(t.getNumberValue()))},this)),this.spnSpacing=new Common.UI.MetricSpinner({el:$("#shape-columns-spacing"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:40.64,minValue:0}),this.spnSpacing.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_putColumnSpace(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnSpacing),this.inputAltTitle=new Common.UI.InputField({el:$("#shape-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t&&t.asc_getShapeProperties()){var e=t.asc_getShapeProperties();this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(t.asc_getWidth()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.asc_getHeight()).toFixed(2),!0),t.asc_getHeight()>0&&(this._nRatio=t.asc_getWidth()/t.asc_getHeight());var i=t.asc_getLockAspect();this.btnRatio.toggle(i),this._setShapeDefaults(e);var n=e.asc_getPaddings();if(n){var o=n.asc_getLeft();this.spnMarginLeft.setValue(null!==o&&void 0!==o?Common.Utils.Metric.fnRecalcFromMM(o):"",!0),o=n.asc_getTop(),this.spnMarginTop.setValue(null!==o&&void 0!==o?Common.Utils.Metric.fnRecalcFromMM(o):"",!0),o=n.asc_getRight(),this.spnMarginRight.setValue(null!==o&&void 0!==o?Common.Utils.Metric.fnRecalcFromMM(o):"",!0),o=n.asc_getBottom(),this.spnMarginBottom.setValue(null!==o&&void 0!==o?Common.Utils.Metric.fnRecalcFromMM(o):"",!0)}this.btnsCategory[3].setDisabled(null===n);var s=e.asc_getType();this.btnsCategory[4].setDisabled("line"==s||"bentConnector2"==s||"bentConnector3"==s||"bentConnector4"==s||"bentConnector5"==s||"curvedConnector2"==s||"curvedConnector3"==s||"curvedConnector4"==s||"curvedConnector5"==s||"straightConnector1"==s),i=e.asc_getColumnNumber(),this.spnColumns.setValue(null!==i&&void 0!==i?i:"",!0),i=e.asc_getColumnSpace(),this.spnSpacing.setValue(null!==i&&void 0!==i?Common.Utils.Metric.fnRecalcFromMM(i):"",!0),i=t.asc_getTitle(),this.inputAltTitle.setValue(i||""),i=t.asc_getDescription(),this.textareaAltDescription.val(i||""),i=t.asc_getRot(),this.spnAngle.setValue(void 0==i||null===i?"":Math.floor(180*i/3.14159265358979+.5),!0),this.chFlipHor.setValue(t.asc_getFlipH()),this.chFlipVert.setValue(t.asc_getFlipV()),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()),this._changedProps.asc_putRot(3.14159265358979*this.spnAngle.getNumberValue()/180),this._changedProps.asc_putFlipH("checked"==this.chFlipHor.getValue()),this._changedProps.asc_putFlipV("checked"==this.chFlipVert.getValue()),{shapeProps:this._changedProps}},_setShapeDefaults:function(t){if(t){var e=t.asc_getStroke();if(e){this.btnsCategory[2].setDisabled(e.asc_getType()==Asc.c_oAscStrokeType.STROKE_NONE);for(var i=e.asc_getLinejoin(),n=0;n<this._arrJoinType.length;n++)if(i==this._arrJoinType[n].value){this.cmbJoinType.setValue(i);break}for(i=e.asc_getLinecap(),n=0;n<this._arrCapType.length;n++)if(i==this._arrCapType[n].value){this.cmbCapType.setValue(i);break}var o=e.asc_getCanChangeArrows();if(this.btnBeginStyle.setDisabled(!o),this.btnEndStyle.setDisabled(!o),this.btnBeginSize.setDisabled(!o),this.btnEndSize.setDisabled(!o),o){i=e.asc_getLinebeginsize();var s=this.mnuBeginSizePicker.store.findWhere({type:i});s?this._beginSizeIdx=s.get("value"):(this._beginSizeIdx=null,this._selectStyleItem(this.btnBeginSize,null)),i=e.asc_getLinebeginstyle(),s=this.mnuBeginStylePicker.store.findWhere({type:i}),s?(this.mnuBeginStylePicker.selectRecord(s,!0),this._updateSizeArr(this.btnBeginSize,this.mnuBeginSizePicker,s,this._beginSizeIdx),this._selectStyleItem(this.btnBeginStyle,s)):this._selectStyleItem(this.btnBeginStyle,null),i=e.asc_getLineendsize(),s=this.mnuEndSizePicker.store.findWhere({type:i}),s?this._endSizeIdx=s.get("value"):(this._endSizeIdx=null,this._selectStyleItem(this.btnEndSize,null)),i=e.asc_getLineendstyle(),s=this.mnuEndStylePicker.store.findWhere({type:i}),s?(this.mnuEndStylePicker.selectRecord(s,!0),this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,s,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,s)):this._selectStyleItem(this.btnEndStyle,null)}else this._selectStyleItem(this.btnBeginStyle),this._selectStyleItem(this.btnEndStyle),this._selectStyleItem(this.btnBeginSize),this._selectStyleItem(this.btnEndSize)}}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01)}this.sizeMax={width:Common.Utils.Metric.fnRecalcFromMM(10*this.options.sizeMax.width),height:Common.Utils.Metric.fnRecalcFromMM(10*this.options.sizeMax.height)},this.options.sizeOriginal&&(this.sizeOriginal={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.width),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.height)})},_updateSizeArr:function(t,e,i,n){i.get("value")>0?(e.store.each(function(t){t.set({offsetx:80*i.get("value")+10})},this),t.setDisabled(!1),null!==n?(e.selectByIndex(n,!0),this._selectStyleItem(t,e.store.at(n))):this._selectStyleItem(t,null)):(this._selectStyleItem(t,null),t.setDisabled(!0))},_selectStyleItem:function(t,e){$(t.el).find(".form-control").css("background-position",(e?20-e.get("offsetx")+"px":"0")+" "+(e?"-"+e.get("offsety")+"px":"-30px"))},onSelectBeginStyle:function(t,e,i){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getStroke()&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinebeginstyle(i.get("type"))),null!==this._beginSizeIdx&&void 0!==this._beginSizeIdx||(this._beginSizeIdx=4),this._updateSizeArr(this.btnBeginSize,this.mnuBeginSizePicker,i,this._beginSizeIdx),this._selectStyleItem(this.btnBeginStyle,i)},onSelectBeginSize:function(t,e,i){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getStroke()&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinebeginsize(i.get("type"))),this._beginSizeIdx=i.get("value"),this._selectStyleItem(this.btnBeginSize,i)},onSelectEndStyle:function(t,e,i){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getStroke()&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLineendstyle(i.get("type"))),null!==this._endSizeIdx&&void 0!==this._endSizeIdx||(this._endSizeIdx=4),this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,i,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,i)},onSelectEndSize:function(t,e,i){this._changedProps&&(null!==this._changedProps.asc_getShapeProperties()&&void 0!==this._changedProps.asc_getShapeProperties()||this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),null===this._changedProps.asc_getShapeProperties().asc_getStroke()&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLineendsize(i.get("type"))),this._endSizeIdx=i.get("value"),this._selectStyleItem(this.btnEndSize,i)},textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",textSize:"Size",textWidth:"Width",textHeight:"Height",textKeepRatio:"Constant Proportions",cancelButtonText:"Cancel",okButtonText:"Ok",textTitle:"Shape - Advanced Settings",strMargins:"Text Padding",textRound:"Round",textMiter:"Miter",textSquare:"Square",textFlat:"Flat",textBevel:"Bevel",textArrows:"Arrows",textLineStyle:"Line Style",textCapType:"Cap Type",textJoinType:"Join Type",textBeginStyle:"Begin Style",textBeginSize:"Begin Size",textEndStyle:"End Style",textEndSize:"End Size",textWeightArrows:"Weights & Arrows",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.",strColumns:"Columns",textSpacing:"Spacing between columns",textColNumber:"Number of columns",textRotation:"Rotation",textAngle:"Angle",textFlipped:"Flipped",textHorizontally:"Horizontally",textVertically:"Vertically"},SSE.Views.ShapeSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/ShapeSettings",["text!spreadsheeteditor/main/app/template/ShapeSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog","spreadsheeteditor/main/app/view/ShapeSettingsAdvanced"],function(t,e,i,n){"use strict";SSE.Views.ShapeSettings=n.View.extend(i.extend({el:"#id-shape-settings",template:i.template(t),events:{},options:{alias:"ShapeSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,
|
|
|
this._noApply=!0,this.imgprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,DisabledFillPanels:!1,DisabledControls:!1,HideShapeOnlySettings:!1,HideChangeTypeSettings:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.fillControls=[],this.render(),this.FillColorContainer=e("#shape-panel-color-fill"),this.FillImageContainer=e("#shape-panel-image-fill"),this.FillPatternContainer=e("#shape-panel-pattern-fill"),this.FillGradientContainer=e("#shape-panel-gradient-fill"),this.TransparencyContainer=e("#shape-panel-transparent-fill"),this.ShapeOnlySettings=e(".shape-only"),this.CanChangeType=e(".change-type")},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.asc_setInterfaceDrawImagePlaceShape("shape-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),n.asc_putFill(new Asc.asc_CFillSolid),n.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor("transparent"==this.ShapeColor.Color?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;if(n.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),n.asc_putFill(new Asc.asc_CFillGrad),n.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),n.asc_getFill().asc_putLinearScale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.asc_getFill().asc_putPositions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),n.asc_getFill().asc_putPatternType(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(a)),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.asc_putFill(null),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBackSelect:function(t,e){if(this.btnBackColor.setColor(e),this.ShapeColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;"transparent"==this.ShapeColor.Color?(n.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.asc_putFill(null)):(n.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),n.asc_putFill(new Asc.asc_CFillSolid),n.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),n.asc_getFill().asc_putPatternType(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsFGSelect:function(t,e){if(this.btnFGColor.setColor(e),this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.asc_getFill().asc_putPatternType(this.PatternFillType),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBGSelect:function(t,e){if(this.btnBGColor.setColor(e),this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.asc_getFill().asc_putPatternType(this.PatternFillType),n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),n.asc_putFill(new Asc.asc_CFillBlip),n.asc_getFill().asc_putType(this.BlipFillType),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onNumTransparencyChange:function(t,e,i,n){if(this.sldrTransparency.setValue(t.getNumberValue(),!0),this.api){var o=t.getNumberValue(),s=new Asc.asc_CShapeProperty,a=new Asc.asc_CShapeFill;a.asc_putTransparent(2.55*o),s.asc_putFill(a),this.imgprops.asc_putShapeProperties(s),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onTransparencyChange:function(t,e,n){this._sliderChanged=e,this.numTransparency.setValue(e,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=e,this._sendUndoPoint||(this.api.setEndPointHistory(),this._transparencyApplyFunc()),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(void 0!==this._sliderChanged){var t=new Asc.asc_CShapeProperty,e=new Asc.asc_CShapeFill;e.asc_putTransparent(2.55*this._sliderChanged),t.asc_putFill(e),this.imgprops.asc_putShapeProperties(t),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=void 0}},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls("")}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""));if(this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),n.asc_putFill(new Asc.asc_CFillGrad),n.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),n.asc_getFill().asc_putLinearScale(!0)),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var a=new Asc.asc_CShapeProperty,l=new Asc.asc_CShapeFill;l.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),l.asc_putFill(new Asc.asc_CFillGrad),l.asc_getFill().asc_putGradType(this.GradFillType),l.asc_getFill().asc_putLinearAngle(6e4*s.type),l.asc_getFill().asc_putLinearScale(!0),a.asc_putFill(l),this.imgprops.asc_putShapeProperties(a),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)}},onColorsGradientSelect:function(t,e){if(this.btnGradColor.setColor(e),this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),n.asc_putFill(new Asc.asc_CFillGrad),n.asc_getFill().asc_putGradType(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.asc_getFill().asc_putColors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),n.asc_getFill().asc_putLinearScale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.asc_getFill().asc_putPositions(o)),i.asc_putFill(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_CShapeProperty,e=new Asc.asc_CShapeFill;e.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),e.asc_putFill(new Asc.asc_CFillGrad),e.asc_getFill().asc_putGradType(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.asc_getFill().asc_putPositions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),e.asc_getFill().asc_putLinearScale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.asc_getFill().asc_putColors(i)),t.asc_putFill(e),this.imgprops.asc_putShapeProperties(t),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_CShapeProperty,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.asc_putColor(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.asc_putColor(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.asc_putWidth(this._pt2mm(this.BorderSize))),e.asc_putStroke(i),this.imgprops.asc_putShapeProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),Common.NotificationCenter.trigger("edit:complete",this)}},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){Common.NotificationCenter.trigger("edit:complete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBorderSelect:function(t,e){if(this.btnBorderColor.setColor(e),this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE):(n.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),n.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.asc_putWidth(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putStroke(n),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)&&null!==t.BlipFillType){var s=new Asc.asc_CShapeProperty,a=new Asc.asc_CShapeFill;a.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),a.asc_putFill(new Asc.asc_CFillBlip),a.asc_getFill().asc_putType(t.BlipFillType),a.asc_getFill().asc_putUrl(o),s.asc_putFill(a),t.imgprops.asc_putShapeProperties(s),t.api.asc_setGraphicObjectProps(t.imgprops)}}Common.NotificationCenter.trigger("edit:complete",t)}}).show()},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.asc_getGraphicObjectProps();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].asc_getObjectType(),Asc.c_oAscTypeSelectElement.Image==n){o=i[s].asc_getObjectValue(),new SSE.Views.ShapeSettingsAdvanced({shapeProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.asc_setGraphicObjectProps(i.shapeProps),Common.NotificationCenter.trigger("edit:complete",e)}}).show();break}}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),null==this.imgprops&&(this.imgprops=new Asc.asc_CImgProperty),t&&t.asc_getShapeProperties()){var n=t.asc_getShapeProperties(),o=n.asc_getType();this._originalProps=n,this._noApply=!0,this.disableControls(this._locked,!n.asc_getCanFill()),this.hideShapeOnlySettings(n.asc_getFromChart()||n.asc_getFromImage());var s=n.get_FromChart()||"line"==o||"bentConnector2"==o||"bentConnector3"==o||"bentConnector4"==o||"bentConnector5"==o||"curvedConnector2"==o||"curvedConnector3"==o||"curvedConnector4"==o||"curvedConnector5"==o||"straightConnector1"==o;this.hideChangeTypeSettings(s),s||(this.btnChangeShape.menu.items[0].setVisible(n.get_FromImage()),this.btnChangeShape.menu.items[1].setVisible(!n.get_FromImage()));var a=null,l=n.asc_getFill(),r=l.asc_getType(),c=null,h=l.asc_getTransparent();if((Math.abs(this._state.Transparency-h)>.001||Math.abs(this.numTransparency.getNumberValue()-h)>.001||(null===this._state.Transparency||null===h)&&(this._state.Transparency!==h||this.numTransparency.getNumberValue()!==h))&&(void 0!==h&&(this.sldrTransparency.setValue(null===h?100:h/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=h),null===l||null===r)this.OriginalFillType=null;else if(r==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(r==Asc.c_oAscFill.FILL_TYPE_SOLID)l=l.asc_getFill(),c=l.asc_getColor(),c?c.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB()),effectValue:c.asc_getValue()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(r==Asc.c_oAscFill.FILL_TYPE_BLIP)l=l.asc_getFill(),this.BlipFillType=l.asc_getType(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(r==Asc.c_oAscFill.FILL_TYPE_PATT){if(l=l.asc_getFill(),this.PatternFillType=l.asc_getPatternType(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var a=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(a),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}c=l.asc_getColorFg(),c?c.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB()),effectValue:c.asc_getValue()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB())}:this.FGColor={Value:1,Color:"000000"},c=l.asc_getColorBg(),c?c.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB()),effectValue:c.asc_getValue()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(r==Asc.c_oAscFill.FILL_TYPE_GRAD){l=l.asc_getFill();var d=l.asc_getGradType();if(this._state.GradFillType===d&&this.GradFillType===d||(this.GradFillType=d,a=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),a=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,a.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var p=Math.floor(l.asc_getLinearAngle()/6e4);if(Math.abs(this.GradLinearDirectionType-p)>.001){this.GradLinearDirectionType=p;var m=this.mnuDirectionPicker.store.findWhere({type:p});this.mnuDirectionPicker.selectRecord(m,!0),m?this.btnDirection.setIconCls("item-gradient "+m.get("iconcls")):this.btnDirection.setIconCls("")}}var u=this,g=l.asc_getColors(),b=l.asc_getPositions(),f=g.length;this.sldrGradient.setThumbs(f),this.GradColor.colors.length>f&&(this.GradColor.colors.splice(f,this.GradColor.colors.length-f),this.GradColor.values.splice(f,this.GradColor.colors.length-f),this.GradColor.currentIdx=0),g&&g.forEach(function(t,e){t?t.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(u.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.asc_getR(),t.asc_getG(),t.asc_getB()),effectValue:t.asc_getValue()},Common.Utils.ThemeColor.colorValue2EffectId(u.GradColor.colors[e])):u.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.asc_getR(),t.asc_getG(),t.asc_getB()):u.GradColor.colors[e]="000000";var i=b[e];null!==i&&(i/=1e3,u.GradColor.values[e]=i)});for(var C=0;C<f;C++)u.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof u.GradColor.colors[C]?u.GradColor.colors[C].color:u.GradColor.colors[C]),C),u.sldrGradient.setValue(C,u.GradColor.values[C]);this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var v=typeof this.ShapeColor.Color,_=typeof this._state.ShapeColor;if(v!==_||"object"==v&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=v&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var y=!1,x=0;x<10;x++)if(Common.Utils.ThemeColor.ThemeValues[x]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),y=!0;break}y||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var w,S=n.asc_getStroke(),A=S.asc_getType(),k="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(S?(A==Asc.c_oAscStrokeType.STROKE_COLOR?(c=S.asc_getColor(),c?c.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB()),effectValue:c.asc_getValue()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(c.asc_getR(),c.asc_getG(),c.asc_getB())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},w=S.asc_getPrstDash()):(A=null,this.BorderColor={Value:0,Color:"transparent"}),v=typeof this.BorderColor.Color,_=typeof this._state.StrokeColor,k||v!==_||"object"==v&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=v&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var y=!1,x=0;x<10;x++)if(Common.Utils.ThemeColor.ThemeValues[x]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),y=!0;break}y||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==A||A==Asc.c_oAscStrokeType.STROKE_COLOR){if(A==Asc.c_oAscStrokeType.STROKE_COLOR){var T=S.asc_getWidth(),I=Math.abs(this._state.StrokeWidth-T)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-T)>1e-5||I||(null===this._state.StrokeWidth||null===T)&&this._state.StrokeWidth!==T){this._state.StrokeWidth=T,null!==T&&(T=this._mm2pt(T));var E=null===T?T:i.find(this.cmbBorderSize.store.models,function(t){if(T<t.attributes.value+1e-5&&T>t.attributes.value-1e-5)return!0});E?this.cmbBorderSize.selectRecord(E):this.cmbBorderSize.setValue(null!==T?parseFloat(T.toFixed(2))+" "+this.txtPt:""),this.BorderSize=T}}else A==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=A}if(this._state.StrokeBorderType!==w&&(this.BorderType=this._state.StrokeBorderType=w,this.cmbBorderType.setValue(w)),v=typeof this.FGColor.Color,_=typeof this._state.FGColor,v!==_||"object"==v&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=v&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var y=!1,x=0;x<10;x++)if(Common.Utils.ThemeColor.ThemeValues[x]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),y=!0;break}y||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(v=typeof this.BGColor.Color,_=typeof this._state.BGColor,v!==_||"object"==v&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=v&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var y=!1,x=0;x<10;x++)if(Common.Utils.ThemeColor.ThemeValues[x]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),y=!0;break}y||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(c=this.GradColor.colors[this.GradColor.currentIdx],v=typeof c,_=typeof this._state.GradColor,v!==_||"object"==v&&(c.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(c.color)<0)||"object"!=v&&this._state.GradColor.indexOf(c)<0){if(this.btnGradColor.setColor(c),"object"==typeof c){for(var y=!1,x=0;x<10;x++)if(Common.Utils.ThemeColor.ThemeValues[x]==c.effectValue){this.colorsGrad.select(c,!0),y=!0;break}y||this.colorsGrad.clearSelection()}else this.colorsGrad.select(c,!0);this._state.GradColor=c}this.chShadow.setValue(!!n.asc_getShadow(),!0),this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#shape-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.fillControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['<div class="style" id="<%= id %>">','<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ','width="'+this.cmbPattern.itemWidth+'" height="'+this.cmbPattern.itemHeight+'" ','style="background-position: -<%= offsetx %>px -<%= offsety %>px;"/>',"</div>"].join("")),this.cmbPattern.render(e("#shape-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.fillControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:e("#shape-button-from-file")}),this.fillControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:e("#shape-button-from-url")}),this.fillControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",i.bind(function(t){this.api&&this.api.asc_changeShapeImageFromFile(this.BlipFillType),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this._arrFillType=[{
|
|
|
displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#shape-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.fillControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#shape-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.fillControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#shape-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.fillControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#shape-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#shape-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#shape-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.fillControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('<div id="id-shape-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-shape-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(e("#shape-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.fillControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#shape-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.fillControls.push(this.sldrGradient),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#shape-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#shape-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnChangeShape=new Common.UI.Button({cls:"btn-icon-default",iconCls:"btn-change-shape",menu:new Common.UI.Menu({menuAlign:"tr-br",cls:"menu-shapes",items:[]})}),this.btnChangeShape.render(e("#shape-btn-change")),this.lockedControls.push(this.btnChangeShape),this.btnRotate270=new Common.UI.Button({cls:"btn-toolbar",iconCls:"rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.render(e("#shape-button-270",t.$el)),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({cls:"btn-toolbar",iconCls:"rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.render(e("#shape-button-90",t.$el)),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({cls:"btn-toolbar",iconCls:"flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.render(e("#shape-button-flipv",t.$el)),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({cls:"btn-toolbar",iconCls:"flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.render(e("#shape-button-fliph",t.$el)),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),this.chShadow=new Common.UI.CheckBox({el:e("#shape-checkbox-shadow"),labelText:this.strShadow}),this.chShadow.on("change",i.bind(this.onCheckShadow,this)),this.lockedControls.push(this.chShadow),e(this.el).on("click","#shape-advanced-link",i.bind(this.openAdvancedSettings,this)),this.linkAdvanced=e("#shape-advanced-link")},createDelayedElements:function(){this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e<this.patternViewData.length;e++)this.patternViewData[e].id=Common.UI.getId();this.cmbPattern.menuPicker.store.add(this.patternViewData),this.cmbPattern.menuPicker.store.length>0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.fillAutoShapes(),this.UpdateThemeColors(),this._initSettings=!1},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0){this.btnTexture||(this.btnTexture=new Common.UI.ComboBox({el:e("#shape-combo-fill-texture"),template:i.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle" tabindex="0" data-toggle="dropdown">','<div class="form-control text" style="width: 90px;">'+this.textSelectTexture+"</div>",'<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('<div id="id-shape-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(e("#shape-combo-fill-texture")),this.fillControls.push(this.btnTexture));var o=[];i.each(t,function(t){o.push({imageUrl:t.asc_getImage(),name:n.textureNames[t.asc_getId()],type:t.asc_getId(),selected:!1})});new Common.UI.DataView({el:e("#id-shape-menu-texture"),restoreHeight:174,parentMenu:n.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(o),itemTemplate:i.template('<div class="item-texture"><img src="<%= imageUrl %>" id="<%= id %>"></div>')}).on("item:click",i.bind(this.onSelectTexture,this))}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),s.asc_putFill(new Asc.asc_CFillBlip),s.asc_getFill().asc_putType(Asc.c_oAscFillBlipType.TILE),s.asc_getFill().asc_putTextureId(n.get("type")),o.asc_putFill(s),this.imgprops.asc_putShapeProperties(o),this.api.asc_setGraphicObjectProps(this.imgprops)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},fillAutoShapes:function(){for(var t=this,n=this.application.getCollection("ShapeGroups"),o=n.length,s=-1;s<o-1&&o>0;s++){var a=n.at(s>-1?s:s+1),l=new Common.UI.MenuItem({caption:a.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tr-tl",items:[{template:i.template('<div id="id-shape-menu-shapegroup'+(s+1)+'" class="menu-shape" style="width: '+(a.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});t.btnChangeShape.menu.addItem(l);var r=a.get("groupStore");s<0&&(r=r.clone(),r.shift());new Common.UI.DataView({el:e("#id-shape-menu-shapegroup"+(s+1)),store:r,parentMenu:l.menu,showLast:!1,itemTemplate:i.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class="icon"><use xlink:href="#svg-icon-<%= data.shapeType %>"></use></svg></div>')}).on("item:click",function(e,i,n,o){t.api&&(t.api.asc_changeShapeType(n.get("data").shapeType),Common.NotificationCenter.trigger("edit:complete",t)),"click"!==o.type&&t.btnChangeShape.menu.hide()})}},onBtnRotateClick:function(t){var e=new Asc.asc_CShapeProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.imgprops.asc_putShapeProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),Common.NotificationCenter.trigger("edit:complete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CShapeProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.imgprops.asc_putShapeProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),Common.NotificationCenter.trigger("edit:complete",this)},onCheckShadow:function(t,e,i,n){if(this.api){var o=new Asc.asc_CShapeProperty;o.asc_putShadow("checked"==t.getValue()?new Asc.asc_CShadowProperty:null),this.imgprops.asc_putShapeProperties(o),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="shape-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="shape-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(e("#shape-back-color-btn")),this.btnBackColor.setColor("transparent"),this.fillControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:e("#shape-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",i.bind(this.onColorsBackSelect,this)),this.btnBackColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="shape-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="shape-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(e("#shape-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:e("#shape-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",i.bind(this.onColorsBorderSelect,this)),this.btnBorderColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="shape-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="shape-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(e("#shape-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.fillControls.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:e("#shape-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",i.bind(this.onColorsFGSelect,this)),this.btnFGColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="shape-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="shape-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(e("#shape-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.fillControls.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:e("#shape-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",i.bind(this.onColorsBGSelect,this)),this.btnBGColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="shape-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="shape-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(e("#shape-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.fillControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:e("#shape-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",i.bind(this.onColorsGradientSelect,this)),this.btnGradColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},disableFillPanels:function(t){this._state.DisabledFillPanels!==t&&(this._state.DisabledFillPanels=t,i.each(this.fillControls,function(e){e.setDisabled(t)}),this.lblTransparencyStart.toggleClass("disabled",t),this.lblTransparencyEnd.toggleClass("disabled",t))},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t,e){this._initSettings||(this.disableFillPanels(t||e),this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)))},hideShapeOnlySettings:function(t){this._state.HideShapeOnlySettings!==t&&(this._state.HideShapeOnlySettings=t,this.ShapeOnlySettings.toggleClass("hidden",1==t))},hideChangeTypeSettings:function(t){this._state.HideChangeTypeSettings!==t&&(this._state.HideChangeTypeSettings=t,this.CanChangeType.toggleClass("hidden",1==t))},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strChange:"Change Autoshape",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textNewColor:"Add New Custom Color",textAdvanced:"Show advanced settings",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",strType:"Type",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",strShadow:"Show shadow"},SSE.Views.ShapeSettings||{}))}),define("text!spreadsheeteditor/main/app/template/TextArtSettings.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTemplate %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-template" style="width: 100%; height: 64px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strFill %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="textart-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="textart-panel-color-fill" class="padding-small" style="width: 100%;">\r\n <div id="textart-back-color-btn" style=""></div>\r\n </div>\r\n <div id="textart-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="textart-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="textart-button-from-url" style="width:90px;float:right;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: top">\r\n <div id="textart-combo-fill-type" style="width: 90px;"></div>\r\n </td>\r\n <td rowspan="2">\r\n <div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;float:right;">\r\n <div id="textart-texture-img" style="width: 50px;height: 50px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom">\r\n <label class="input-label" style=""><%= scope.textTexture %></label>\r\n <div id="textart-combo-fill-texture" style="width: 90px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div id="textart-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>\r\n <div id="textart-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>\r\n <div id="textart-foreground-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>\r\n <div id="textart-background-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </div>\r\n <div id="textart-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div style="height:80px;">\r\n <div style="display: inline-block;">\r\n <label class="input-label" style=""><%= scope.textStyle %></label>\r\n <div id="textart-combo-grad-type" style="width: 90px;"></div>\r\n </div>\r\n <div style="display: inline-block;float: right;">\r\n <label class="input-label" style=""><%= scope.textDirection %></label>\r\n <div id="textart-button-direction" style=""></div>\r\n </div>\r\n </div>\r\n <label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <div id="textart-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="textart-gradient-color-btn" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div class="padding-small" id="textart-panel-transparent-fill" style="width: 100%;">\r\n <label class="header" style="display:block;"><%= scope.strTransparency %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <label id="textart-lbl-transparency-start">0</label>\r\n <div id="textart-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>\r\n <label id="textart-lbl-transparency-end">100</label>\r\n </div>\r\n <div id="textart-spin-transparency" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strStroke %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strSize %></label>\r\n <div id="textart-combo-border-size" style="width: 93px;"></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strColor %></label>\r\n <div id="textart-border-color-btn" style=""></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strType %></label>\r\n <div id="textart-combo-border-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTransform %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-transform" style="width: 100%; height: 42px;"></div>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("spreadsheeteditor/main/app/view/TextArtSettings",["text!spreadsheeteditor/main/app/template/TextArtSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(t,e,i,n){"use strict";SSE.Views.TextArtSettings=n.View.extend(i.extend({el:"#id-textart-settings",template:i.template(t),events:{},options:{alias:"TextArtSettings"},initialize:function(){this._initSettings=!0,this._noApply=!0,this.imgprops=null,this.shapeprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,FormId:null,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this.FillColorContainer=e("#textart-panel-color-fill"),this.FillImageContainer=e("#textart-panel-image-fill"),this.FillPatternContainer=e("#textart-panel-pattern-fill"),this.FillGradientContainer=e("#textart-panel-gradient-fill"),this.TransparencyContainer=e("#textart-panel-transparent-fill")},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.asc_setInterfaceDrawImagePlaceTextArt("textart-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),n.asc_putFill(new Asc.asc_CFillSolid),n.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor("transparent"==this.ShapeColor.Color?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;if(n.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),n.asc_putFill(new Asc.asc_CFillGrad),n.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),n.asc_getFill().asc_putLinearScale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.asc_getFill().asc_putPositions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),n.asc_getFill().asc_putPatternType(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(a)),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.asc_putFill(null),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBackSelect:function(t,e){if(this.btnBackColor.setColor(e),this.ShapeColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;"transparent"==this.ShapeColor.Color?(n.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.asc_putFill(null)):(n.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),n.asc_putFill(new Asc.asc_CFillSolid),
|
|
|
n.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),n.asc_getFill().asc_putPatternType(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsFGSelect:function(t,e){if(this.btnFGColor.setColor(e),this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.asc_getFill().asc_putPatternType(this.PatternFillType),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBGSelect:function(t,e){if(this.btnBGColor.setColor(e),this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),n.asc_putFill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.asc_getFill().asc_putPatternType(this.PatternFillType),n.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),n.asc_putFill(new Asc.asc_CFillBlip),n.asc_getFill().asc_putType(this.BlipFillType),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onNumTransparencyChange:function(t,e,i,n){if(this.sldrTransparency.setValue(t.getNumberValue(),!0),this.api){var o=t.getNumberValue(),s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.asc_putTransparent(2.55*o),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onTransparencyChange:function(t,e,n){this._sliderChanged=e,this.numTransparency.setValue(e,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=e,this._sendUndoPoint||(this.api.setEndPointHistory(),this._transparencyApplyFunc()),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(void 0!==this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.asc_putTransparent(2.55*this._sliderChanged),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=void 0}},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls("")}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""));if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),n.asc_putFill(new Asc.asc_CFillGrad),n.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),n.asc_getFill().asc_putLinearScale(!0)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var a=new Asc.asc_TextArtProperties,l=new Asc.asc_CShapeFill;l.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),l.asc_putFill(new Asc.asc_CFillGrad),l.asc_getFill().asc_putGradType(this.GradFillType),l.asc_getFill().asc_putLinearAngle(6e4*s.type),l.asc_getFill().asc_putLinearScale(!0),a.asc_putFill(l),this.shapeprops.put_TextArtProperties(a),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)}},onColorsGradientSelect:function(t,e){if(this.btnGradColor.setColor(e),this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),n.asc_putFill(new Asc.asc_CFillGrad),n.asc_getFill().asc_putGradType(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.asc_getFill().asc_putColors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),n.asc_getFill().asc_putLinearScale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.asc_getFill().asc_putPositions(o)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),e.asc_putFill(new Asc.asc_CFillGrad),e.asc_getFill().asc_putGradType(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.asc_getFill().asc_putPositions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.asc_getFill().asc_putLinearAngle(6e4*this.GradLinearDirectionType),e.asc_getFill().asc_putLinearScale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.asc_getFill().asc_putColors(i)),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_TextArtProperties,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.asc_putColor(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.asc_putColor(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.asc_putWidth(this._pt2mm(this.BorderSize))),e.asc_putLine(i),this.shapeprops.put_TextArtProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){Common.NotificationCenter.trigger("edit:complete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBorderSelect:function(t,e){if(this.btnBorderColor.setColor(e),this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE):(n.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),n.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.asc_putWidth(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)&&null!==t.BlipFillType){var s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),a.asc_putFill(new Asc.asc_CFillBlip),a.asc_getFill().asc_putType(t.BlipFillType),a.asc_getFill().asc_putUrl(o),s.asc_putFill(a),t.shapeprops.put_TextArtProperties(s),t.api.asc_setGraphicObjectProps(t.imgprops)}}Common.NotificationCenter.trigger("edit:complete",t)}}).show()},ChangeSettings:function(t){if(null==this.imgprops&&(this.imgprops=new Asc.asc_CImgProperty,this.imgprops.asc_putShapeProperties(new Asc.asc_CShapeProperty),this.shapeprops=this.imgprops.asc_getShapeProperties()),this._initSettings&&this.createDelayedElements(),t&&t.asc_getShapeProperties()&&t.asc_getShapeProperties().get_TextArtProperties()){var n=t.asc_getShapeProperties().get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var o=null,s=n.asc_getFill(),a=s?s.asc_getType():null,l=null;if(s){var r=s.asc_getTransparent();(Math.abs(this._state.Transparency-r)>.001||Math.abs(this.numTransparency.getNumberValue()-r)>.001||(null===this._state.Transparency||null===r)&&(this._state.Transparency!==r||this.numTransparency.getNumberValue()!==r))&&(void 0!==r&&(this.sldrTransparency.setValue(null===r?100:r/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=r)}if(null===s||void 0===s||null===a)this.OriginalFillType=null;else if(a==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(a==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.asc_getFill(),l=s.asc_getColor(),l?l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(a==Asc.c_oAscFill.FILL_TYPE_BLIP)s=s.asc_getFill(),this.BlipFillType=s.asc_getType(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(a==Asc.c_oAscFill.FILL_TYPE_PATT){if(s=s.asc_getFill(),this.PatternFillType=s.asc_getPatternType(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var o=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(o),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}l=s.asc_getColorFg(),l?l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB())}:this.FGColor={Value:1,Color:"000000"},l=s.asc_getColorBg(),l?l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(a==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.asc_getFill();var c=s.asc_getGradType();if(this._state.GradFillType===c&&this.GradFillType===c||(this.GradFillType=c,o=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),o=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,o.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var h=Math.floor(s.asc_getLinearAngle()/6e4);if(Math.abs(this.GradLinearDirectionType-h)>.001){this.GradLinearDirectionType=h;var d=this.mnuDirectionPicker.store.findWhere({type:h});this.mnuDirectionPicker.selectRecord(d,!0),d?this.btnDirection.setIconCls("item-gradient "+d.get("iconcls")):this.btnDirection.setIconCls("")}}var p=this,m=s.asc_getColors(),u=s.asc_getPositions(),g=m.length;this.sldrGradient.setThumbs(g),this.GradColor.colors.length>g&&(this.GradColor.colors.splice(g,this.GradColor.colors.length-g),this.GradColor.values.splice(g,this.GradColor.colors.length-g),this.GradColor.currentIdx=0),m&&m.forEach(function(t,e){t?t.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(p.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.asc_getR(),t.asc_getG(),t.asc_getB()),effectValue:t.asc_getValue()},Common.Utils.ThemeColor.colorValue2EffectId(p.GradColor.colors[e])):p.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.asc_getR(),t.asc_getG(),t.asc_getB()):p.GradColor.colors[e]="000000";var i=u[e];null!==i&&(i/=1e3,p.GradColor.values[e]=i)});for(var b=0;b<g;b++)p.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof p.GradColor.colors[b]?p.GradColor.colors[b].color:p.GradColor.colors[b]),b),p.sldrGradient.setValue(b,p.GradColor.values[b]);this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var f=typeof this.ShapeColor.Color,C=typeof this._state.ShapeColor;if(f!==C||"object"==f&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=f&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),v=!0;break}v||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var y,x=n.asc_getLine(),w=x?x.asc_getType():null,S="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(x?(w==Asc.c_oAscStrokeType.STROKE_COLOR?(l=x.asc_getColor(),l?l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},y=x.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},f=typeof this.BorderColor.Color,C=typeof this._state.StrokeColor,S||f!==C||"object"==f&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=f&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),v=!0;break}v||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==w||w==Asc.c_oAscStrokeType.STROKE_COLOR){if(w==Asc.c_oAscStrokeType.STROKE_COLOR){var A=x.asc_getWidth(),k=Math.abs(this._state.StrokeWidth-A)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-A)>1e-5||k||(null===this._state.StrokeWidth||null===A)&&this._state.StrokeWidth!==A){this._state.StrokeWidth=A,null!==A&&(A=this._mm2pt(A));var T=null===A?A:i.find(this.cmbBorderSize.store.models,function(t){if(A<t.attributes.value+1e-5&&A>t.attributes.value-1e-5)return!0});T?this.cmbBorderSize.selectRecord(T):this.cmbBorderSize.setValue(null!==A?parseFloat(A.toFixed(2))+" "+this.txtPt:""),this.BorderSize=A}}else w==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=w}if(this._state.StrokeBorderType!==y&&(this.BorderType=this._state.StrokeBorderType=y,this.cmbBorderType.setValue(y)),f=typeof this.FGColor.Color,C=typeof this._state.FGColor,f!==C||"object"==f&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=f&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),v=!0;break}v||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(f=typeof this.BGColor.Color,C=typeof this._state.BGColor,f!==C||"object"==f&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=f&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),v=!0;break}v||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(l=this.GradColor.colors[this.GradColor.currentIdx],f=typeof l,C=typeof this._state.GradColor,f!==C||"object"==f&&(l.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(l.color)<0)||"object"!=f&&this._state.GradColor.indexOf(l)<0){if(this.btnGradColor.setColor(l),"object"==typeof l){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==l.effectValue){this.colorsGrad.select(l,!0),v=!0;break}v||this.colorsGrad.clearSelection()}else this.colorsGrad.select(l,!0);this._state.GradColor=l}var I=n.asc_getForm();if(this._state.FormId!==I){this.cmbTransform.suspendEvents();var o=this.cmbTransform.menuPicker.store.findWhere({type:I});this.cmbTransform.menuPicker.selectRecord(o),this.cmbTransform.resumeEvents(),this._state.FormId=I}this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#textart-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.lockedControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['<div class="style" id="<%= id %>">','<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ','width="'+this.cmbPattern.itemWidth+'" height="'+this.cmbPattern.itemHeight+'" ','style="background-position: -<%= offsetx %>px -<%= offsety %>px;"/>',"</div>"].join("")),this.cmbPattern.render(e("#textart-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:e("#textart-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:e("#textart-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",i.bind(function(t){this.api&&this.api.asc_changeArtImageFromFile(this.BlipFillType),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#textart-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.lockedControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#textart-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.lockedControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#textart-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.lockedControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#textart-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#textart-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#textart-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.lockedControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('<div id="id-textart-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-textart-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(e("#textart-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.lockedControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#textart-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.lockedControls.push(this.sldrGradient),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#textart-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#textart-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.cmbTransform=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-textart"}),this.cmbTransform.render(e("#textart-combo-transform")),this.cmbTransform.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTransform.on("click",i.bind(this.onTransformSelect,this)),this.cmbTransform.openButton.menu.on("show:after",function(){t.cmbTransform.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTransform)},createDelayedElements:function(){this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e<this.patternViewData.length;e++)this.patternViewData[e].id=Common.UI.getId();this.cmbPattern.menuPicker.store.add(this.patternViewData),this.cmbPattern.menuPicker.store.length>0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),
|
|
|
this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this.fillTransform(this.api.asc_getPropertyEditorTextArts()),this._initSettings=!1},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0){this.btnTexture=new Common.UI.ComboBox({el:e("#textart-combo-fill-texture"),template:i.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle" tabindex="0" data-toggle="dropdown">','<div class="form-control text" style="width: 90px;">'+this.textSelectTexture+"</div>",'<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('<div id="id-textart-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(e("#textart-combo-fill-texture")),this.lockedControls.push(this.btnTexture);var o=[];i.each(t,function(t){o.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})});new Common.UI.DataView({el:e("#id-textart-menu-texture"),restoreHeight:174,parentMenu:n.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(o),itemTemplate:i.template('<div><img src="<%= imageUrl %>" id="<%= id %>"></div>')}).on("item:click",i.bind(this.onSelectTexture,this))}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),s.asc_putFill(new Asc.asc_CFillBlip),s.asc_getFill().asc_putType(Asc.c_oAscFillBlipType.TILE),s.asc_getFill().asc_putTextureId(n.get("type")),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.asc_setGraphicObjectProps(this.imgprops)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},fillTextArt:function(){var t=this;this.cmbTextArt||(this.cmbTextArt=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,showLast:!1,cls:"combo-textart"}),this.cmbTextArt.render(e("#textart-combo-template")),this.cmbTextArt.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTextArt.on("click",i.bind(this.onTextArtSelect,this)),this.cmbTextArt.openButton.menu.on("show:after",function(){t.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTextArt));var n=this.application.getCollection("Common.Collections.TextArt").models,o=this.cmbTextArt.menuPicker.store.length;if(o>0&&o==n.length){var s=this.cmbTextArt.menuPicker.store.models;i.each(n,function(t,e){s[e].set("imageUrl",t.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(n),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))},onTextArtSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putStyle(e.get("data")),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},fillTransform:function(t){if(t&&t.length>1&&t[1]){for(var e=[],n=t[1],o=0;o<n.length;o++){var s=n[o];s&&s.length>0&&i.each(s,function(t){e.push({imageUrl:t.Image,type:t.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(e),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putForm(e.get("type")),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(e("#textart-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:e("#textart-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",i.bind(this.onColorsBorderSelect,this)),this.btnBorderColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(e("#textart-back-color-btn")),this.btnBackColor.setColor("transparent"),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:e("#textart-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",i.bind(this.onColorsBackSelect,this)),this.btnBackColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(e("#textart-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.lockedControls.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:e("#textart-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",i.bind(this.onColorsFGSelect,this)),this.btnFGColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(e("#textart-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.lockedControls.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:e("#textart-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",i.bind(this.onColorsBGSelect,this)),this.btnBGColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(e("#textart-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.lockedControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:e("#textart-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",i.bind(this.onColorsGradientSelect,this)),this.btnGradColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}))},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textNewColor:"Add New Custom Color",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",textTransform:"Transform",textTemplate:"Template",strType:"Type"},SSE.Views.TextArtSettings||{}))}),define("text!spreadsheeteditor/main/app/template/TableSettings.template",[],function(){return'<table cols="2">\n <tr>\n <td width="50%">\n <label class="header"><%= scope.textRows %></label>\n </td>\n <td width="50%">\n <label class="header"><%= scope.textColumns %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="table-checkbox-header"></div>\n </td>\n <td class="padding-small">\n <div id="table-checkbox-first"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="table-checkbox-total"></div>\n </td>\n <td class="padding-small">\n <div id="table-checkbox-last"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="table-checkbox-banded"></div>\n </td>\n <td class="padding-small">\n <div id="table-checkbox-col-banded"></div>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <div id="table-checkbox-filter"></div>\n </td>\n </tr>\n <tr>\n <td colspan=2>\n <label class="header"><%= scope.textTemplate %></label>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <div class="" id="table-combo-template" style="width: 100%; height: 60px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr class="hidden">\n <td colspan=2>\n <label class="header"><%= scope.textTableName %></label>\n </td>\n </tr>\n <tr class="hidden">\n <td colspan=2 class="padding-small">\n <div id="table-txt-name" class="input-row" style="width: 100%;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-large" colspan=2>\n <label class="header" style="margin-top: 3px;"><%= scope.textResize %></label>\n <button type="button" class="btn btn-text-default" id="table-btn-select-data" style="display: inline-block; float:right; min-width: 100px;width: auto;"><%= scope.textSelectData %></button>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <label class="header" style="margin-top: 3px;"><%= scope.textEdit %></label>\n <div id="table-btn-edit" style="display: inline-block; float:right;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <button type="button" class="btn btn-text-default" id="table-btn-convert-range" style="width:100%;"><%= scope.textConvertRange %></button>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td align="center" colspan=2>\n <label class="link" id="table-advanced-link"><%= scope.textAdvanced %></label>\n </td>\n </tr>\n <tr class="finish-cell"></tr>\n</table>'}),define("text!spreadsheeteditor/main/app/template/TableSettingsAdvanced.template",[],function(){return'<div id="id-adv-table-alttext" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" width="100%">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.textAltTitle %></label>\n <div id="table-advanced-alt-title"></div>\n </td>\n </tr>\n <tr>\n <td>\n <label class="header"><%= scope.textAltDescription %></label>\n <textarea id="table-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\n </td>\n </tr>\n <tr>\n <td>\n <label><%= scope.textAltTip %></label>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),define("spreadsheeteditor/main/app/view/TableSettingsAdvanced",["text!spreadsheeteditor/main/app/template/TableSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(t){"use strict";SSE.Views.TableSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"table-adv-settings-group",properties:null,storageName:"sse-table-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-table-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.tableProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.inputAltTitle=new Common.UI.InputField({el:$("#table-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){var e=t.asc_getTitle();this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||"")}},getSettings:function(){if(this.isAltTitleChanged||this.isAltDescChanged){var t=new Asc.AdvancedTableInfoSettings;return t.asc_setTitle(this.inputAltTitle.getValue()),t.asc_setDescription(this.textareaAltDescription.val()),t}},textTitle:"Table - 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.TableSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/TableSettings",["text!spreadsheeteditor/main/app/template/TableSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ComboDataView","spreadsheeteditor/main/app/view/TableOptionsDialog","spreadsheeteditor/main/app/view/TableSettingsAdvanced"],function(t,e,i,n){"use strict";SSE.Views.TableSettings=n.View.extend(i.extend({el:"#id-table-settings",template:i.template(t),events:{},options:{alias:"TableSettings"},initialize:function(){this._initSettings=!0,this._state={TableName:"",TemplateName:"",Range:"",CheckHeader:!1,CheckTotal:!1,CheckBanded:!1,CheckFirst:!1,CheckLast:!1,CheckColBanded:!1,CheckFilter:!1,DisabledControls:!1,TableNameError:!1},this.lockedControls=[],this._locked=!1,this.isEditCell=!1,this._originalProps=null,this._noApply=!1,this.render()},onCheckTemplateChange:function(t,e,i,n,o,s){this._state[e]=void 0,this.api&&this.api.asc_changeFormatTableInfo(this._state.TableName,t,"checked"==n),Common.NotificationCenter.trigger("edit:complete",this)},onTableTemplateSelect:function(t,e){this.api&&!this._noApply&&this.api.asc_changeAutoFilter(this._state.TableName,Asc.c_oAscChangeFilterOptions.style,e.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},onEditClick:function(t,e,i){this.api&&(e.options.idx>=0&&e.options.idx<4?this.api.asc_changeSelectionFormatTable(this._state.TableName,e.value):e.options.idx>=4&&e.options.idx<8?this.api.asc_insertCellsInTable(this._state.TableName,e.value):this.api.asc_deleteCellsInTable(this._state.TableName,e.value)),Common.NotificationCenter.trigger("edit:complete",this)},onTableNameChanged:function(t,e,i){var n=this._state.TableName;if(this._state.TableName="",n.toLowerCase()==e.toLowerCase())return void Common.NotificationCenter.trigger("edit:complete",this);var o=this,s=this.api.asc_checkDefinedName(e,null);if(!0===s.asc_getStatus())s=!0;else switch(s.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:s=this.textIsLocked;break;case Asc.c_oAscDefinedNameReason.Existed:s=this.textExistName;break;case Asc.c_oAscDefinedNameReason.NameReserved:s=this.textReservedName;break;default:s=this.textInvalidName}!0===s?(this.api.asc_changeDisplayNameTable(n,e),Common.NotificationCenter.trigger("edit:complete",this)):this._state.TableNameError||(this._state.TableNameError=!0,Common.UI.alert({msg:s,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(t){Common.NotificationCenter.trigger("edit:complete",this),o._state.TableNameError=!1}}))},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#table-advanced-link")},setApi:function(t){return this.api=t,t&&(this.api.asc_registerCallback("asc_onSendThemeColors",i.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onEditCell",this.onApiEditCell.bind(this))),this},createDelayedControls:function(){this.chHeader=new Common.UI.CheckBox({el:e("#table-checkbox-header"),labelText:this.textHeader}),this.lockedControls.push(this.chHeader),this.chTotal=new Common.UI.CheckBox({el:e("#table-checkbox-total"),labelText:this.textTotal}),this.lockedControls.push(this.chTotal),this.chBanded=new Common.UI.CheckBox({el:e("#table-checkbox-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chBanded),this.chFirst=new Common.UI.CheckBox({el:e("#table-checkbox-first"),labelText:this.textFirst}),this.lockedControls.push(this.chFirst),this.chLast=new Common.UI.CheckBox({el:e("#table-checkbox-last"),labelText:this.textLast}),this.lockedControls.push(this.chLast),this.chColBanded=new Common.UI.CheckBox({el:e("#table-checkbox-col-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chColBanded),this.chFilter=new Common.UI.CheckBox({el:e("#table-checkbox-filter"),labelText:this.textFilter}),this.lockedControls.push(this.chFilter),this.chHeader.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.rowHeader,"CheckHeader")),this.chTotal.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.rowTotal,"CheckTotal")),this.chBanded.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.rowBanded,"CheckBanded")),this.chFirst.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.columnFirst,"CheckFirst")),this.chLast.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.columnLast,"CheckLast")),this.chColBanded.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.columnBanded,"CheckColBanded")),this.chFilter.on("change",i.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.filterButton,"CheckFilter")),this.txtTableName=new Common.UI.InputField({el:e("#table-txt-name"),name:"tablename",style:"width: 100%;",validateOnBlur:!1}),this.txtTableName.on("changed:after",i.bind(this.onTableNameChanged,this)),this.lockedControls.push(this.txtTableName),this.btnSelectData=new Common.UI.Button({el:e("#table-btn-select-data")}),this.btnSelectData.on("click",i.bind(this.onSelectData,this)),this.lockedControls.push(this.btnSelectData),this.btnEdit=new Common.UI.Button({cls:"btn-icon-default",iconCls:"btn-edit-table",menu:new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.selectRowText,value:Asc.c_oAscChangeSelectionFormatTable.row,idx:0},{caption:this.selectColumnText,value:Asc.c_oAscChangeSelectionFormatTable.column,idx:1},{caption:this.selectDataText,value:Asc.c_oAscChangeSelectionFormatTable.data,idx:2},{caption:this.selectTableText,value:Asc.c_oAscChangeSelectionFormatTable.all,idx:3},{caption:"--"},{caption:this.insertRowAboveText,value:Asc.c_oAscInsertOptions.InsertTableRowAbove,idx:4},{caption:this.insertRowBelowText,value:Asc.c_oAscInsertOptions.InsertTableRowBelow,idx:5},{caption:this.insertColumnLeftText,value:Asc.c_oAscInsertOptions.InsertTableColLeft,idx:6},{caption:this.insertColumnRightText,value:Asc.c_oAscInsertOptions.InsertTableColRight,idx:7},{caption:"--"},{caption:this.deleteRowText,value:Asc.c_oAscDeleteOptions.DeleteRows,idx:8},{caption:this.deleteColumnText,value:Asc.c_oAscDeleteOptions.DeleteColumns,idx:9},{caption:this.deleteTableText,value:Asc.c_oAscDeleteOptions.DeleteTable,idx:10}]})}),this.btnEdit.render(e("#table-btn-edit")),this.btnEdit.menu.on("show:after",i.bind(function(t){this.api&&(t.items[5].setDisabled(!this._originalProps.asc_getIsInsertRowAbove()),t.items[6].setDisabled(!this._originalProps.asc_getIsInsertRowBelow()),t.items[7].setDisabled(!this._originalProps.asc_getIsInsertColumnLeft()),t.items[8].setDisabled(!this._originalProps.asc_getIsInsertColumnRight()),t.items[10].setDisabled(!this._originalProps.asc_getIsDeleteRow()),t.items[11].setDisabled(!this._originalProps.asc_getIsDeleteColumn()),t.items[12].setDisabled(!this._originalProps.asc_getIsDeleteTable()))},this)),this.btnEdit.menu.on("item:click",i.bind(this.onEditClick,this)),this.lockedControls.push(this.btnEdit),this.btnConvertRange=new Common.UI.Button({el:e("#table-btn-convert-range")}),this.btnConvertRange.on("click",i.bind(function(t){this.api&&this.api.asc_convertTableToRange(this._state.TableName),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.lockedControls.push(this.btnConvertRange),e(this.el).on("click","#table-advanced-link",i.bind(this.openAdvancedSettings,this)),this._initSettings=!1},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;e.api&&!this._locked&&new SSE.Views.TableSettingsAdvanced({tableProps:e._originalProps,api:e.api,handler:function(t,i){"ok"==t&&e.api&&i&&e.api.asc_changeFormatTableInfo(e._state.TableName,Asc.c_oAscChangeTableStyleInfo.advancedSettings,i),Common.NotificationCenter.trigger("edit:complete",e)}}).show()}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedControls(),this.disableControls(this._locked),t){this._originalProps=t;var e=t.asc_getTableName();this._state.TableName!==e&&(this.txtTableName.setValue(e),this._state.TableName=e),this._state.Range=t.asc_getTableRange();var i=!1;if(e=t.asc_getFirstRow(),this._state.CheckHeader!==e&&(this.chHeader.setValue(e,!0),this._state.CheckHeader=e,i=!0),e=t.asc_getLastRow(),this._state.CheckTotal!==e&&(this.chTotal.setValue(e,!0),this._state.CheckTotal=e,i=!0),e=t.asc_getBandHor(),this._state.CheckBanded!==e&&(this.chBanded.setValue(e,!0),this._state.CheckBanded=e,i=!0),e=t.asc_getFirstCol(),this._state.CheckFirst!==e&&(this.chFirst.setValue(e,!0),this._state.CheckFirst=e,i=!0),e=t.asc_getLastCol(),this._state.CheckLast!==e&&(this.chLast.setValue(e,!0),this._state.CheckLast=e,i=!0),e=t.asc_getBandVer(),this._state.CheckColBanded!==e&&(this.chColBanded.setValue(e,!0),this._state.CheckColBanded=e,i=!0),e=t.asc_getFilterButton(),this._state.CheckFilter!==e&&(this.chFilter.setValue(e,!0),this._state.CheckFilter=e),this.chFilter.isDisabled()!==(!this._state.CheckHeader||this._locked||null===e)&&this.chFilter.setDisabled(!this._state.CheckHeader||this._locked||null===e),i&&this.onApiInitTableTemplates(this.api.asc_getTablePictures(t)),e=t.asc_getTableStyleName(),this._state.TemplateName!==e||this._isTemplatesChanged){this.cmbTableTemplate.suspendEvents();var n=this.cmbTableTemplate.menuPicker.store.findWhere({name:e});this.cmbTableTemplate.menuPicker.selectRecord(n),this.cmbTableTemplate.resumeEvents(),this._isTemplatesChanged&&(n?this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),!0):this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0),!0)),this._state.TemplateName=e}this._isTemplatesChanged=!1}},onSendThemeColors:function(){this.cmbTableTemplate&&(this.onApiInitTableTemplates(this.api.asc_getTablePictures(this._originalProps)),this.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY:!0}))},onApiInitTableTemplates:function(t){var n=this;this._isTemplatesChanged=!0,this.cmbTableTemplate||(this.cmbTableTemplate=new Common.UI.ComboDataView({itemWidth:61,itemHeight:46,menuMaxHeight:300,enableKeyEvents:!0}),this.cmbTableTemplate.render(e("#table-combo-template")),this.cmbTableTemplate.openButton.menu.cmpEl.css({"min-width":175,"max-width":175}),this.cmbTableTemplate.on("click",i.bind(this.onTableTemplateSelect,this)),this.cmbTableTemplate.openButton.menu.on("show:after",function(){n.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTableTemplate),this._locked&&this.cmbTableTemplate.setDisabled(this._locked));var o=n.cmbTableTemplate.menuPicker.store.length;if(o>0&&o==t.length){var s=n.cmbTableTemplate.menuPicker.store.models;i.each(t,function(t,e){s[e].set("imageUrl",t.asc_getImage())})}else{n.cmbTableTemplate.menuPicker.store.reset([]);var a=[];i.each(t,function(t){a.push({id:Common.UI.getId(),name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),n.cmbTableTemplate.menuPicker.store.add(a)}},onSelectData:function(){var t=this;if(t.api){var e=function(e,i){if("ok"==i){t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None);var n=e.getSettings();n.selectionType==Asc.c_oAscSelectionType.RangeMax||n.selectionType==Asc.c_oAscSelectionType.RangeRow||n.selectionType==Asc.c_oAscSelectionType.RangeCol?Common.UI.warning({title:t.textLongOperation,msg:t.warnLongOperation,buttons:["ok","cancel"],callback:function(e){"ok"==e&&setTimeout(function(){t.api.asc_changeTableRange(t._state.TableName,n.range)},1),Common.NotificationCenter.trigger("edit:complete",t)}}):t.api.asc_changeTableRange(t._state.TableName,n.range)}Common.NotificationCenter.trigger("edit:complete",t)},i=new SSE.Views.TableOptionsDialog({handler:e});i.show(),i.setSettings({api:t.api,range:t._state.Range,title:t.textResize})}},onApiEditCell:function(t){this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd,t!=Asc.c_oAscCellEditorState.editStart&&t!=Asc.c_oAscCellEditorState.editEnd||this.disableControls(this._locked)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||(t=t||this.isEditCell,this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)))},textEdit:"Rows & Columns",selectRowText:"Select Row",selectColumnText:"Select Entire Column",selectDataText:"Select Column Data",selectTableText:"Select Table",insertRowAboveText:"Insert Row Above",insertRowBelowText:"Insert Row Below",insertColumnLeftText:"Insert Column Left",insertColumnRightText:"Insert Column Right",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",textOK:"OK",textCancel:"Cancel",textTemplate:"Select From Template",textRows:"Rows",textColumns:"Columns",textHeader:"Header",textTotal:"Total",textBanded:"Banded",textFirst:"First",textLast:"Last",textEmptyTemplate:"No templates",textFilter:"Filter button",textTableName:"Table Name",textResize:"Resize table",textSelectData:"Select Data",textInvalidName:"ERROR! Invalid table name",textExistName:"ERROR! Range with such a name already exists",textIsLocked:"This element is being edited by another user.",notcriticalErrorTitle:"Warning",textReservedName:"The name you are trying to use is already referenced in cell formulas. Please use some other name.",textAdvanced:"Show advanced settings",textConvertRange:"Convert to range",textLongOperation:"Long operation",warnLongOperation:"The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?"},SSE.Views.TableSettings||{}))}),define("text!spreadsheeteditor/main/app/template/PivotSettings.template",[],function(){
|
|
|
return'<table cols="2">\n <tr>\n <td colspan=2>\n <label class="header"><%= scope.textFields %></label>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-large">\n <div id="pivot-list-fields" class="pivot-check-listview"></div>\n </td>\n </tr>\n <tr>\n <td width="50%">\n <label class="header"><%= scope.textFilters %></label>\n </td>\n <td width="50%">\n <label class="header"><%= scope.textColumns %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="pivot-list-filters" class="pivot-listview"></div>\n </td>\n <td class="padding-small">\n <div id="pivot-list-columns" class="pivot-listview" style="margin-left: 3px;"></div>\n </td>\n </tr>\n <tr>\n <td width="50%">\n <label class="header"><%= scope.textRows %></label>\n </td>\n <td width="50%">\n <label class="header"><%= scope.textValues %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <div id="pivot-list-rows" class="pivot-listview"></div>\n </td>\n <td class="padding-large">\n <div id="pivot-list-values" class="pivot-listview" style="margin-left: 3px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td align="center" colspan=2>\n <label class="link" id="pivot-advanced-link"><%= scope.textAdvanced %></label>\n </td>\n </tr>\n <tr class="finish-cell"></tr>\n</table>'}),define("text!spreadsheeteditor/main/app/template/FieldSettingsDialog.template",[],function(){return'<div id="id-pivot-field-settings-layout" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" style="width: 100%;">\n <tr>\n <td class="padding-small" style="white-space: nowrap;">\n <label class="header" style="vertical-align: middle; margin-right: 4px;"><%= scope.txtSourceName %></label>\n <label id="field-settings-source" style="vertical-align: middle; max-width: 220px; overflow: hidden; text-overflow: ellipsis;"></label>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.txtCustomName %></label>\n <div id="field-settings-custom" style="width:264px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <label class="header"><%= scope.textReport %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-radio-tab"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-radio-outline"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <div id="field-settings-chk-compact" style="margin-left: 20px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-repeat"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-blank"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-subtotals"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-radio-top" style="margin-left: 20px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <div id="field-settings-radio-bottom" style="margin-left: 20px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-empty"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>\n<div id="id-pivot-field-settings-subtotals" class="settings-panel">\n <div class="inner-content">\n <table cols="1" style="width: 100%;">\n <tr>\n <td class="padding-small">\n <label class="header"><%= scope.txtSummarize %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-sum"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-count"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-ave"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-max"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-min"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-product"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-num"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-dev"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-devp"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-var"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="field-settings-chk-varp"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>\n'}),define("spreadsheeteditor/main/app/view/FieldSettingsDialog",["text!spreadsheeteditor/main/app/template/FieldSettingsDialog.template","common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/ComboBox","common/main/lib/component/CheckBox","common/main/lib/view/AdvancedSettingsWindow"],function(t){"use strict";SSE.Views.FieldSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:284,height:440,toggleGroup:"pivot-field-settings-group",storageName:"sse-pivot-field-settings-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-pivot-field-settings-layout",panelCaption:this.strLayout},{panelId:"id-pivot-field-settings-subtotals",panelCaption:this.strSubtotals}],contentTemplate:_.template(t)({scope:this})},e),this.api=e.api,this.handler=e.handler,this.props=e.props,this.fieldIndex=e.fieldIndex||0,this.names=e.names||[],this.type=e.type||0,Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.inputCustomName=new Common.UI.InputField({el:$("#field-settings-custom"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}),this.lblSourceName=this.$window.find("#field-settings-source"),this.radioTabular=new Common.UI.RadioBox({el:$("#field-settings-radio-tab"),labelText:this.txtTabular,name:"asc-radio-report-form"}),this.radioOutline=new Common.UI.RadioBox({el:$("#field-settings-radio-outline"),labelText:this.txtOutline,name:"asc-radio-report-form",checked:!0}),this.chCompact=new Common.UI.CheckBox({el:$("#field-settings-chk-compact"),labelText:this.txtCompact}),this.chRepeat=new Common.UI.CheckBox({el:$("#field-settings-chk-repeat"),labelText:this.txtRepeat}),this.chBlank=new Common.UI.CheckBox({el:$("#field-settings-chk-blank"),labelText:this.txtBlank}),this.chSubtotals=new Common.UI.CheckBox({el:$("#field-settings-chk-subtotals"),labelText:this.txtShowSubtotals}),this.radioTop=new Common.UI.RadioBox({el:$("#field-settings-radio-top"),labelText:this.txtTop,name:"asc-radio-show-subtotals"}),this.radioBottom=new Common.UI.RadioBox({el:$("#field-settings-radio-bottom"),labelText:this.txtBottom,name:"asc-radio-show-subtotals",checked:!0}),this.chEmpty=new Common.UI.CheckBox({el:$("#field-settings-chk-empty"),labelText:this.txtEmpty}),this.chSum=new Common.UI.CheckBox({el:$("#field-settings-chk-sum"),labelText:this.txtSum}),this.chCount=new Common.UI.CheckBox({el:$("#field-settings-chk-count"),labelText:this.txtCount}),this.chAve=new Common.UI.CheckBox({el:$("#field-settings-chk-ave"),labelText:this.txtAverage}),this.chMax=new Common.UI.CheckBox({el:$("#field-settings-chk-max"),labelText:this.txtMax}),this.chMin=new Common.UI.CheckBox({el:$("#field-settings-chk-min"),labelText:this.txtMin}),this.chProduct=new Common.UI.CheckBox({el:$("#field-settings-chk-product"),labelText:this.txtProduct}),this.chNum=new Common.UI.CheckBox({el:$("#field-settings-chk-num"),labelText:this.txtCountNums}),this.chDev=new Common.UI.CheckBox({el:$("#field-settings-chk-dev"),labelText:this.txtStdDev}),this.chDevp=new Common.UI.CheckBox({el:$("#field-settings-chk-devp"),labelText:this.txtStdDevp}),this.chVar=new Common.UI.CheckBox({el:$("#field-settings-chk-var"),labelText:this.txtVar}),this.chVarp=new Common.UI.CheckBox({el:$("#field-settings-chk-varp"),labelText:this.txtVarp}),this.afterRender()},afterRender:function(){if(this._setDefaults(this.props),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(t){if(t){var e=this,i=t.asc_getCacheFields(),n=t.asc_getPivotFields()[this.fieldIndex];this.lblSourceName.html(Common.Utils.String.htmlEncode(i[this.fieldIndex].asc_getName())),this.inputCustomName.setValue(Common.Utils.String.htmlEncode((n||i[this.fieldIndex]).asc_getName())),n.asc_getSubtotalTop()?this.radioTop.setValue(!0):this.radioBottom.setValue(!0);var o=n.asc_getSubtotals();o&&_.each(o,function(t){switch(t){case Asc.c_oAscItemType.Sum:e.chSum.setValue(!0);break;case Asc.c_oAscItemType.Count:e.chCount.setValue(!0);break;case Asc.c_oAscItemType.Avg:e.chAve.setValue(!0);break;case Asc.c_oAscItemType.Max:e.chMax.setValue(!0);break;case Asc.c_oAscItemType.Min:e.chMin.setValue(!0);break;case Asc.c_oAscItemType.Product:e.chProduct.setValue(!0);break;case Asc.c_oAscItemType.CountA:e.chNum.setValue(!0);break;case Asc.c_oAscItemType.StdDev:e.chDev.setValue(!0);break;case Asc.c_oAscItemType.StdDevP:e.chDevp.setValue(!0);break;case Asc.c_oAscItemType.Var:e.chVar.setValue(!0);break;case Asc.c_oAscItemType.VarP:e.chVarp.setValue(!0)}})}},getSettings:function(){return{}},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},textTitle:"Field Settings",textCancel:"Cancel",textOk:"OK",strSubtotals:"Subtotals",strLayout:"Layout",txtSourceName:"Source name: ",txtCustomName:"Custom name",textReport:"Report Form",txtTabular:"Tabular",txtOutline:"Outline",txtCompact:"Compact",txtRepeat:"Repeat items labels at each row",txtBlank:"Insert blank rows after each item",txtShowSubtotals:"Show subtotals",txtTop:"Show at top of group",txtBottom:"Show at bottom of group",txtEmpty:"Show items with no data",txtSummarize:"Functions for Subtotals",txtAverage:"Average",txtCount:"Count",txtCountNums:"Count Numbers",txtMax:"Max",txtMin:"Min",txtProduct:"Product",txtStdDev:"StdDev",txtStdDevp:"StdDevp",txtSum:"Sum",txtVar:"Var",txtVarp:"Varp"},SSE.Views.FieldSettingsDialog||{}))}),define("spreadsheeteditor/main/app/view/ValueFieldSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/ComboBox","common/main/lib/view/AdvancedSettingsWindow"],function(){"use strict";SSE.Views.ValueFieldSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:284,height:340},initialize:function(t){var e=this;_.extend(this.options,{title:this.textTitle,template:['<div class="box" style="height:'+(e.options.height-85)+'px;">','<div class="content-panel" style="padding: 0 10px;"><div class="inner-content">','<div class="settings-panel active">','<table cols="2" style="width: 100%;">',"<tr>",'<td colspan="2" class="padding-small" style="white-space: nowrap;">','<label class="header" style="vertical-align: middle; margin-right: 4px;">'+e.txtSourceName+"</label>",'<label id="value-field-settings-source" style="vertical-align: middle; max-width: 220px; overflow: hidden; text-overflow: ellipsis;"></label>',"</td>","</tr>","<tr>",'<td colspan="2" class="padding-large">','<label class="header">',e.txtCustomName,"</label>",'<div id="value-field-settings-custom" style="width:264px;"></div>',"</td>","</tr>","<tr>",'<td colspan="2" class="padding-small">',"</td>","</tr>","<tr>",'<td colspan="2" class="padding-large">','<label class="header">',e.txtSummarize,"</label>",'<div id="value-field-settings-summarize" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>","<tr>",'<td colspan="2" class="padding-small">',"</td>","</tr>","<tr>",'<td colspan="2" class="padding-large">','<label class="header">',e.txtShowAs,"</label>",'<div id="value-field-settings-showas" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-code">',"<td>",'<label class="header">',e.txtBaseField,"</label>",'<div id="value-field-settings-field" class="input-group-nr" style="width:125px;"></div>',"</td>","<td>",'<label class="header">',e.txtBaseItem,"</label>",'<div id="value-field-settings-item" class="input-group-nr" style="width:125px;"></div>',"</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+e.textOk+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+e.textCancel+"</button>","</div>"].join("")},t),this.api=t.api,this.handler=t.handler,this.props=t.props,this.field=t.field||0,this.names=t.names||[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.inputCustomName=new Common.UI.InputField({el:$("#value-field-settings-custom"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}),this.cmbSummarize=new Common.UI.ComboBox({el:$("#value-field-settings-summarize"),cls:"input-group-nr",menuStyle:"min-width: 264px;",editable:!1,data:[{value:Asc.c_oAscDataConsolidateFunction.Sum,displayValue:this.txtSum},{value:Asc.c_oAscDataConsolidateFunction.Count,displayValue:this.txtCount},{value:Asc.c_oAscDataConsolidateFunction.Average,displayValue:this.txtAverage},{value:Asc.c_oAscDataConsolidateFunction.Max,displayValue:this.txtMax},{value:Asc.c_oAscDataConsolidateFunction.Min,displayValue:this.txtMin},{value:Asc.c_oAscDataConsolidateFunction.Product,displayValue:this.txtProduct},{value:Asc.c_oAscDataConsolidateFunction.CountNums,displayValue:this.txtCountNums},{value:Asc.c_oAscDataConsolidateFunction.StdDev,displayValue:this.txtStdDev},{value:Asc.c_oAscDataConsolidateFunction.StdDevp,displayValue:this.txtStdDevp},{value:Asc.c_oAscDataConsolidateFunction.Var,displayValue:this.txtVar},{value:Asc.c_oAscDataConsolidateFunction.Varp,displayValue:this.txtVarp}]}),this.cmbSummarize.setValue(Asc.c_oAscDataConsolidateFunction.Sum),this.cmbSummarize.on("selected",_.bind(this.onSummarizeSelect,this)),this.cmbShowAs=new Common.UI.ComboBox({el:$("#value-field-settings-showas"),cls:"input-group-nr",menuStyle:"min-width: 264px;",editable:!1,data:[{value:Asc.c_oAscShowDataAs.Normal,displayValue:this.txtNormal},{value:Asc.c_oAscShowDataAs.PercentOfRow,displayValue:this.txtPercentOfRow},{value:Asc.c_oAscShowDataAs.PercentOfCol,displayValue:this.txtPercentOfCol},{value:Asc.c_oAscShowDataAs.PercentOfTotal,displayValue:this.txtPercentOfTotal},{value:Asc.c_oAscShowDataAs.Percent,displayValue:this.txtPercent},{value:Asc.c_oAscShowDataAs.Difference,displayValue:this.txtDifference},{value:Asc.c_oAscShowDataAs.PercentDiff,displayValue:this.txtPercentDiff},{value:Asc.c_oAscShowDataAs.RunTotal,displayValue:this.txtRunTotal},{value:Asc.c_oAscShowDataAs.Index,displayValue:this.txtIndex}]}),this.cmbShowAs.setValue(Asc.c_oAscDataConsolidateFunction.Normal),this.cmbShowAs.on("selected",_.bind(this.onShowAsSelect,this)),this.cmbBaseField=new Common.UI.ComboBox({el:$("#value-field-settings-field"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbBaseField.on("selected",_.bind(this.onBaseFieldSelect,this)),this.cmbBaseItem=new Common.UI.ComboBox({el:$("#value-field-settings-item"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbBaseItem.on("selected",_.bind(this.onBaseItemSelect,this)),this.lblSourceName=this.$window.find("#value-field-settings-source"),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(t){if(t){var e=this.field,i=t.asc_getCacheFields(),n=e.asc_getShowDataAs();this.lblSourceName.html(Common.Utils.String.htmlEncode(i[e.asc_getIndex()].asc_getName())),this.inputCustomName.setValue(Common.Utils.String.htmlEncode(e.asc_getName())),this.cmbSummarize.setValue(e.asc_getSubtotal()),this.cmbShowAs.setValue(n);var o=[];this.names.forEach(function(t){o.push({value:t,displayValue:t})}),this.cmbBaseField.setData(o),this.cmbBaseField.setValue(this.names[0]),this.cmbBaseField.setDisabled(n!=c_oAscShowDataAs.Difference&&n!=c_oAscShowDataAs.Percent&&n!=c_oAscShowDataAs.PercentDiff&&n!=c_oAscShowDataAs.RunTotal),this.cmbBaseItem.setDisabled(n!=c_oAscShowDataAs.Difference&&n!=c_oAscShowDataAs.Percent&&n!=c_oAscShowDataAs.PercentDiff)}},getSettings:function(){var t=new Asc.CT_DataField;return t.asc_setName(this.inputCustomName.getValue()),t.asc_setSubtotal(this.cmbSummarize.getValue()),t},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onSummarizeSelect:function(t,e){this.inputCustomName.setValue(e.displayValue+" "+this.txtByField+" "+this.lblSourceName.text())},onShowAsSelect:function(t,e){},onBaseFieldSelect:function(t,e){},onBaseItemSelect:function(t,e){},textTitle:"Value Field Settings",textCancel:"Cancel",textOk:"OK",txtSourceName:"Source name: ",txtCustomName:"Custom name",txtSummarize:"Summarize value field by",txtShowAs:"Show values as",txtBaseField:"Base field",txtBaseItem:"Base item",txtAverage:"Average",txtCount:"Count",txtCountNums:"Count Numbers",txtMax:"Max",txtMin:"Min",txtProduct:"Product",txtStdDev:"StdDev",txtStdDevp:"StdDevp",txtSum:"Sum",txtVar:"Var",txtVarp:"Varp",txtNormal:"No Calculation",txtDifference:"The Difference From",txtPercent:"Percent of",txtPercentDiff:"Percent Difference From",txtRunTotal:"Running Total In",txtPercentOfRow:"Percent of Total",txtPercentOfCol:"Percent of Column",txtPercentOfTotal:"Percent of Row",txtIndex:"Index",txtByField:"by field"},SSE.Views.ValueFieldSettingsDialog||{}))}),define("text!spreadsheeteditor/main/app/template/PivotSettingsAdvanced.template",[],function(){return'<div id="id-adv-pivot-layout" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" style="width: 100%;">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.txtName %></label>\n <div id="pivot-adv-name"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <label class="header"><%= scope.textGrandTotals %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="pivot-adv-chk-show-rows"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <div id="pivot-adv-chk-show-columns"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <label class="header"><%= scope.textDisplayFields %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="pivot-adv-radio-down"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="pivot-adv-radio-over"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <label id="pivot-adv-label-wrap" class="input-label" style="margin-top: 4px;"></label>\n <div id="pivot-adv-spin-wrap" style="float: right; width: 85px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <label class="header"><%= scope.textHeaders %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="pivot-adv-chk-show-headers"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>\n<div id="id-adv-pivot-data" class="settings-panel">\n <div class="inner-content">\n <table cols="2" style="width: 100%;">\n <tr>\n <td colspan=2 >\n <label class="header"><%= scope.textDataRange %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small" width="220">\n <div id="pivot-adv-txt-range" class="input-row" style="margin-right: 10px;"></div>\n </td>\n <td class="padding-small" style="text-align: right;">\n <button type="button" class="btn btn-text-default" id="pivot-adv-btn-data" style="min-width: 100px;width: auto;"><%= scope.textSelectData %></button>\n </td>\n </tr>\n </table>\n </div>\n</div>\n<div id="id-adv-pivot-alttext" class="settings-panel">\n <div class="inner-content">\n <table cols="1" width="100%">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.textAltTitle %></label>\n <div id="pivot-advanced-alt-title"></div>\n </td>\n </tr>\n <tr>\n <td>\n <label class="header"><%= scope.textAltDescription %></label>\n <textarea id="pivot-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\n </td>\n </tr>\n <tr>\n <td>\n <label><%= scope.textAltTip %></label>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),define("spreadsheeteditor/main/app/view/PivotSettingsAdvanced",["text!spreadsheeteditor/main/app/template/PivotSettingsAdvanced.template","common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/ComboBox","common/main/lib/component/CheckBox","common/main/lib/component/MetricSpinner","common/main/lib/view/AdvancedSettingsWindow"],function(t){"use strict";SSE.Views.PivotSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:395,toggleGroup:"pivot-adv-settings-group",storageName:"sse-pivot-adv-settings-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-pivot-layout",panelCaption:this.strLayout},{panelId:"id-adv-pivot-data",panelCaption:this.textDataSource},{panelId:"id-adv-pivot-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),this.api=e.api,this.handler=e.handler,this.props=e.props,Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.inputName=new Common.UI.InputField({el:$("#pivot-adv-name"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}),this.radioDown=new Common.UI.RadioBox({el:$("#pivot-adv-radio-down"),labelText:this.textDown,name:"asc-radio-display-field",checked:!0}),this.radioDown.on("change",_.bind(function(t,e,i){e&&this.lblPageWrap.html(this.textWrapCol)},this)),this.radioOver=new Common.UI.RadioBox({el:$("#pivot-adv-radio-over"),labelText:this.textOver,name:"asc-radio-display-field"}),this.radioOver.on("change",_.bind(function(t,e,i){e&&this.lblPageWrap.html(this.textWrapRow)},this)),this.chRows=new Common.UI.CheckBox({el:$("#pivot-adv-chk-show-rows"),labelText:this.textShowRows}),this.chCols=new Common.UI.CheckBox({el:$("#pivot-adv-chk-show-columns"),labelText:this.textShowCols}),this.numWrap=new Common.UI.MetricSpinner({el:$("#pivot-adv-spin-wrap"),step:1,width:85,allowDecimal:!1,defaultUnit:"",value:"0",maxValue:255,minValue:0}),this.lblPageWrap=this.$window.find("#pivot-adv-label-wrap"),this.chHeaders=new Common.UI.CheckBox({el:$("#pivot-adv-chk-show-headers"),labelText:this.textShowHeaders}),this.txtDataRange=new Common.UI.InputField({el:$("#pivot-adv-txt-range"),name:"range",style:"width: 100%;",allowBlank:!0,blankError:this.txtEmpty,validateOnChange:!0}),this.btnSelectData=new Common.UI.Button({el:$("#pivot-adv-btn-data")}),this.btnSelectData.on("click",_.bind(this.onSelectData,this)),this.inputAltTitle=new Common.UI.InputField({el:$("#pivot-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this.props),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(t){if(t){this.inputName.setValue(Common.Utils.String.htmlEncode(t.asc_getName())),this.chCols.setValue(t.asc_getRowGrandTotals(),!0),this.chRows.setValue(t.asc_getColGrandTotals(),!0),t.asc_getPageOverThenDown()?this.radioOver.setValue(!0):this.radioDown.setValue(!0),this.lblPageWrap.html(t.asc_getPageOverThenDown()?this.textWrapRow:this.textWrapCol),this.numWrap.setValue(t.asc_getPageWrap()),this.chHeaders.setValue(t.asc_getShowHeaders(),!0),this.txtDataRange.validation=function(t){return!0}}},getSettings:function(){var t=new Asc.CT_pivotTableDefinition;return t.asc_setRowGrandTotals("checked"==this.chCols.getValue()),t.asc_setColGrandTotals("checked"==this.chRows.getValue()),t},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.isRangeValid()&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},isRangeValid:function(){if(this.isChart){if(_.isEmpty(this.txtDataRange.getValue()))this.txtDataRange.showError([this.txtEmpty]);else if(this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Pivot,this.txtDataRange.getValue())==Asc.c_oAscError.ID.No)return!0;return this.setActiveCategory(1),this.txtDataRange.cmpEl.find("input").focus(),!1}return!0},onSelectData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.dataRangeValid=e.getSettings(),t.txtDataRange.setValue(t.dataRangeValid),t.txtDataRange.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+160,n.top+125),i.setSettings({api:t.api,range:_.isEmpty(t.txtDataRange.getValue())||1!=t.txtDataRange.checkValidate()?t.dataRangeValid:t.txtDataRange.getValue(),type:Asc.c_oAscSelectionDialogType.Pivot})}},textTitle:"Pivot Table - Advanced Settings",textCancel:"Cancel",textOk:"OK",strLayout:"Name and Layout",txtName:"Name",textGrandTotals:"Grand Totals",textShowRows:"Show for rows",textShowCols:"Show for columns",textDataSource:"Data Source",textDataRange:"Data Range",textSelectData:"Select Data",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.",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",textDisplayFields:"Display fields in report filter area",textDown:"Down, then over",textOver:"Over, then down",textWrapCol:"Report filter fields per column",textWrapRow:"Report filter fields per row",textHeaders:"Field Headers",textShowHeaders:"Show field headers for rows and columns"},SSE.Views.PivotSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/PivotSettings",["text!spreadsheeteditor/main/app/template/PivotSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/ListView","spreadsheeteditor/main/app/view/FieldSettingsDialog","spreadsheeteditor/main/app/view/ValueFieldSettingsDialog","spreadsheeteditor/main/app/view/PivotSettingsAdvanced"],function(t,e,i,n,o){"use strict";SSE.Views.PivotSettings=n.View.extend(i.extend({el:"#id-pivot-settings",template:i.template(t),events:{},options:{alias:"PivotSettings"},initialize:function(){this._initSettings=!0,this._state={names:[],DisabledControls:!1,field:{}},this.lockedControls=[],this._locked=!1,this._originalProps=null,this._noApply=!1,this.render()},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#pivot-advanced-link")},setApi:function(t){return this.api=t,this},createDelayedControls:function(){this.fieldsList=new Common.UI.ListView({el:e("#pivot-list-fields"),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:i.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:i.template(["<div>",'<label class="checkbox-indeterminate" style="position:absolute;">',"<% if (check) { %>",'<input type="button" class="checked img-commonctrl"/>',"<% } else { %>",'<input type="button" class="img-commonctrl"/>',"<% } %>","</label>",'<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= Common.Utils.String.htmlEncode(value) %></div>','<div class="listitem-icon img-commonctrl"></div>',"</div>"].join(""))}),this.fieldsList.on("item:click",i.bind(this.onFieldsCheck,this)),this.lockedControls.push(this.fieldsList)
|
|
|
;var t=i.template(['<div id="<%= id %>" class="list-item" style="display:inline-block;">','<div style=""><%= Common.Utils.String.htmlEncode(value) %></div>','<div class="listitem-icon img-commonctrl"></div>',"</div>"].join(""));this.columnsList=new Common.UI.ListView({el:e("#pivot-list-columns"),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:i.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:t}),this.columnsList.on("item:click",i.bind(this.onColumnsSelect,this,0)),this.lockedControls.push(this.columnsList),this.rowsList=new Common.UI.ListView({el:e("#pivot-list-rows"),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:i.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:t}),this.rowsList.on("item:click",i.bind(this.onColumnsSelect,this,1)),this.lockedControls.push(this.rowsList),this.valuesList=new Common.UI.ListView({el:e("#pivot-list-values"),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:i.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:t}),this.valuesList.on("item:click",i.bind(this.onColumnsSelect,this,2)),this.lockedControls.push(this.valuesList),this.filtersList=new Common.UI.ListView({el:e("#pivot-list-filters"),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:i.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:t}),this.filtersList.on("item:click",i.bind(this.onColumnsSelect,this,3)),this.lockedControls.push(this.filtersList),e(this.el).on("click","#pivot-advanced-link",i.bind(this.openAdvancedSettings,this)),this._initSettings=!1},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;e.api&&!this._locked&&new SSE.Views.PivotSettingsAdvanced({props:e._originalProps,api:e.api,handler:function(t,i){"ok"==t&&e.api&&i&&e._originalProps.asc_set(e.api,i),Common.NotificationCenter.trigger("edit:complete",e)}}).show()}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedControls(),this.disableControls(this._locked),t){this._originalProps=t,this._state.TableName=t.asc_getName();var e=this,i=t.asc_getCacheFields(),n=t.asc_getPivotFields();this._state.names=[],n.forEach(function(t,n){e._state.names[n]=t.asc_getName()||i[n].asc_getName()});var o=[],s=[],a=t.asc_getColumnFields();a&&a.forEach(function(t,i){var n=t.asc_getIndex();if(n>-1||-2==n){var a=n>-1?e._state.names[n]:e.textValues;o.push(new Common.UI.DataViewModel({selected:!1,allowSelected:!1,pivotIndex:n,index:i,value:a,tip:a.length>10?a:""})),s[a]=!0}}),this.columnsList.store.reset(o),this.columnsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),o=[],a=t.asc_getRowFields(),a&&a.forEach(function(t,i){var n=t.asc_getIndex();if(n>-1||-2==n){var a=n>-1?e._state.names[n]:e.textValues;o.push(new Common.UI.DataViewModel({selected:!1,allowSelected:!1,pivotIndex:n,index:i,value:a,tip:a.length>10?a:""})),s[a]=!0}}),this.rowsList.store.reset(o),this.rowsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),o=[],a=t.asc_getDataFields(),a&&a.forEach(function(t,i){var n=t.asc_getIndex();if(n>-1){var a=t.asc_getName();o.push(new Common.UI.DataViewModel({selected:!1,allowSelected:!1,pivotIndex:n,index:i,value:a,tip:a.length>10?a:""})),s[e._state.names[n]]=!0}}),this.valuesList.store.reset(o),this.valuesList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),o=[],a=t.asc_getPageFields(),a&&a.forEach(function(t,i){var n=t.asc_getIndex();if(n>-1){var a=e._state.names[n];o.push(new Common.UI.DataViewModel({selected:!1,allowSelected:!1,pivotIndex:n,index:i,value:a,tip:a.length>10?a:""})),s[a]=!0}}),this.filtersList.store.reset(o),this.filtersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),o=[],e._state.names.forEach(function(t,e){o.push(new Common.UI.DataViewModel({selected:!1,allowSelected:!1,value:t,index:e,tip:t.length>25?t:"",check:s[t]}))}),this.fieldsList.store.reset(o),this.fieldsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onFieldsCheck:function(t,n,o){if(!this.checkCellTrigerBlock){var s="",a="",l=!1,r=null,c=window.event?window.event:window._event;if(c){var h=e(c.target);if(h&&h.hasClass("listitem-icon")){if(this._state.field={record:o},this.pivotFieldsMenu){if(this.pivotFieldsMenu.isVisible())return void this.pivotFieldsMenu.hide()}else this.miAddFilter=new Common.UI.MenuItem({caption:this.txtAddFilter,checkable:!1}),this.miAddFilter.on("click",i.bind(this.onAddFilter,this)),this.miAddRow=new Common.UI.MenuItem({caption:this.txtAddRow,checkable:!1}),this.miAddColumn=new Common.UI.MenuItem({caption:this.txtAddColumn,checkable:!1}),this.miAddValues=new Common.UI.MenuItem({caption:this.txtAddValues,checkable:!1}),this.pivotFieldsMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[this.miAddFilter,this.miAddRow,this.miAddColumn,this.miAddValues]});var d=(void 0!=o&&o.get("index"),this.pivotFieldsMenu),p=e(c.currentTarget),m=e(this.el),u=p.offset(),g=m.offset();[u.left-g.left+p.width(),u.top-g.top+p.height()/2];var b=m.find("#menu-pivot-fields-container");return d.rendered||(b.length<1&&(b=e('<div id="menu-pivot-fields-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',d.id),m.append(b)),d.render(b),d.cmpEl.attr({tabindex:"-1"}),d.on("show:after",function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)}).on("hide:after",function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)})),d.menuAlignEl=p,d.setOffset(-20,-p.height()/2-3),d.show(),i.delay(function(){d.cmpEl.focus()},10),c.stopPropagation(),void c.preventDefault()}if(a=c.target.type,s=e(c.currentTarget).find(".list-item"),s.length){r=s.get(0).getBoundingClientRect();var f=c.clientX*Common.Utils.zoom(),C=c.clientY*Common.Utils.zoom();r.left<f&&f<r.right&&r.top<C&&C<r.bottom&&(l=!0)}("button"===a||l)&&(this.updateFieldCheck(t,o),i.delay(function(){t.$el.find(".listview").focus()},100,this))}}},updateFieldCheck:function(t,e){e&&t&&(t.isSuspendEvents=!0,e.set("check",!e.get("check")),t.isSuspendEvents=!1,t.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}))},onColumnsSelect:function(t,n,o,s,a){var l=e(a.target);if(l&&l.hasClass("listitem-icon")){if(this._state.field={record:s,type:t},this.fieldsMenu){if(this.fieldsMenu.isVisible())return void this.fieldsMenu.hide()}else this.miMoveUp=new Common.UI.MenuItem({caption:this.txtMoveUp,checkable:!1}),this.miMoveDown=new Common.UI.MenuItem({caption:this.txtMoveDown,checkable:!1}),this.miMoveBegin=new Common.UI.MenuItem({caption:this.txtMoveBegin,checkable:!1}),this.miMoveEnd=new Common.UI.MenuItem({caption:this.txtMoveEnd,checkable:!1}),this.miMoveFilter=new Common.UI.MenuItem({caption:this.txtMoveFilter,checkable:!1}),this.miMoveRow=new Common.UI.MenuItem({caption:this.txtMoveRow,checkable:!1}),this.miMoveColumn=new Common.UI.MenuItem({caption:this.txtMoveColumn,checkable:!1}),this.miMoveValues=new Common.UI.MenuItem({caption:this.txtMoveValues,checkable:!1}),this.miRemove=new Common.UI.MenuItem({caption:this.txtRemove,checkable:!1}),this.miRemove.on("click",i.bind(this.onRemove,this)),this.miFieldSettings=new Common.UI.MenuItem({caption:this.txtFieldSettings,checkable:!1}),this.miFieldSettings.on("click",i.bind(this.onFieldSettings,this)),this.fieldsMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[this.miMoveUp,this.miMoveDown,this.miMoveBegin,this.miMoveEnd,{caption:"--"},this.miMoveFilter,this.miMoveRow,this.miMoveColumn,this.miMoveValues,{caption:"--"},this.miRemove,{caption:"--"},this.miFieldSettings]});this.miMoveFilter.setDisabled(3==t),this.miMoveRow.setDisabled(1==t),this.miMoveColumn.setDisabled(0==t),this.miMoveValues.setDisabled(2==t);var r=void 0!=s?s.get("index"):-1,c=n.store.length;this.miMoveUp.setDisabled(r<1),this.miMoveDown.setDisabled(r>c-2||r<0),this.miMoveBegin.setDisabled(r<1),this.miMoveEnd.setDisabled(r>c-2||r<0),this.miFieldSettings.setDisabled(-2==s.get("pivotIndex"));var h=this.fieldsMenu,d=e(a.currentTarget),p=e(this.el),m=d.offset(),u=p.offset();[m.left-u.left+d.width(),m.top-u.top+d.height()/2];var g=p.find("#menu-pivot-container");h.rendered||(g.length<1&&(g=e('<div id="menu-pivot-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',h.id),p.append(g)),h.render(g),h.cmpEl.attr({tabindex:"-1"}),h.on("show:after",function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)}).on("hide:after",function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)})),h.menuAlignEl=d,h.setOffset(-20,-d.height()/2-3),h.show(),i.delay(function(){h.cmpEl.focus()},10),a.stopPropagation(),a.preventDefault()}},setLocked:function(t){this._locked=t},onFieldSettings:function(t,e,i){var n=this;if(n.api&&!this._locked&&n._state.field)if(2==n._state.field.type){var o=n._originalProps.asc_getDataFields()[n._state.field.record.get("index")];new SSE.Views.ValueFieldSettingsDialog({props:n._originalProps,field:o,names:n._state.names,api:n.api,handler:function(t,e){"ok"==t&&n.api&&e&&o.asc_set(n.api,n._originalProps,e),Common.NotificationCenter.trigger("edit:complete",n)}}).show()}else new SSE.Views.FieldSettingsDialog({props:n._originalProps,fieldIndex:n._state.field.record.get("pivotIndex"),names:n._state.names,api:n.api,type:n._state.field.type,handler:function(t,e){"ok"==t&&n.api,Common.NotificationCenter.trigger("edit:complete",n)}}).show()},onAddFilter:function(){this.api&&!this._locked&&this._state.field&&this._originalProps.asc_addPageField(this.api,this._state.field.record.get("index"))},onRemove:function(){this.api&&!this._locked&&this._state.field&&this._originalProps.asc_removeField(this.api,this._state.field.record.get("pivotIndex"))},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textFields:"Select Fields",textOK:"OK",textCancel:"Cancel",textValues:"Values",textRows:"Rows",textColumns:"Columns",textFilters:"Filters",notcriticalErrorTitle:"Warning",textAdvanced:"Show advanced settings",txtMoveUp:"Move Up",txtMoveDown:"Move Down",txtMoveBegin:"Move to Beginning",txtMoveEnd:"Move to End",txtMoveFilter:"Move to Filters",txtMoveRow:"Move to Rows",txtMoveColumn:"Move to Columns",txtMoveValues:"Move to Values",txtRemove:"Remove Field",txtFieldSettings:"Field Settings",txtAddFilter:"Add to Filters",txtAddRow:"Add to Rows",txtAddColumn:"Add to Columns",txtAddValues:"Add to Values"},SSE.Views.PivotSettings||{}))}),define("text!spreadsheeteditor/main/app/template/SignatureSettings.template",[],function(){return'<table cols="2">\n <tr>\n <td class="padding-large">\n <label style="font-size: 18px;"><%= scope.strSignature %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-large">\n <div id="signature-invisible-sign" style="width:100%;"></div>\n </td>\n </tr>\n <tr class="requested">\n <td class="padding-small">\n <label class="header"><%= scope.strRequested %></label>\n </td>\n </tr>\n <tr class="requested">\n <td class="padding-large">\n <div id="signature-requested-sign"></div>\n </td>\n </tr>\n <tr class="valid">\n <td class="padding-small">\n <label class="header"><%= scope.strValid %></label>\n </td>\n </tr>\n <tr class="valid">\n <td class="padding-large">\n <div id="signature-valid-sign"></div>\n </td>\n </tr>\n <tr class="invalid">\n <td class="padding-small">\n <label class="header" style="color:#bb3d3d;"><%= scope.strInvalid %></label>\n </td>\n </tr>\n <tr class="invalid">\n <td><div id="signature-invalid-sign"></div></td>\n </tr>\n <tr class="finish-cell"></tr>\n</table>'}),define("spreadsheeteditor/main/app/view/SignatureSettings",["text!spreadsheeteditor/main/app/template/SignatureSettings.template","jquery","underscore","backbone","common/main/lib/component/Button"],function(t,e,i,n){"use strict";SSE.Views.SignatureSettings=n.View.extend(i.extend({el:"#id-signature-settings",template:i.template(t),events:{},options:{alias:"SignatureSettings"},initialize:function(){this._state={DisabledEditing:!1,ready:!1,hasValid:!1,hasInvalid:!1,hasRequested:!1,tip:void 0},this._locked=!1,this.render()},render:function(){this.$el.html(this.template({scope:this}));var t=SSE.getController("Common.Controllers.Protection").getView();this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#signature-invisible-sign")),this.viewRequestedList=new Common.UI.DataView({el:e("#signature-requested-sign"),enableKeyEvents:!1,itemTemplate:i.template(['<div id="<%= id %>" class="signature-item requested">','<div class="caret img-commonctrl nomargin"></div>','<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',"</div>"].join(""))}),this.viewValidList=new Common.UI.DataView({el:e("#signature-valid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['<div id="<%= id %>" class="signature-item">','<div class="caret img-commonctrl <% if (name == "" || date == "") { %>nomargin<% } %>"></div>','<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>','<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',"</div>"].join(""))}),this.viewInvalidList=new Common.UI.DataView({el:e("#signature-invalid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['<div id="<%= id %>" class="signature-item">','<div class="caret img-commonctrl <% if (name == "" || date == "") { %>nomargin<% } %>"></div>','<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>','<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',"</div>"].join(""))}),this.viewRequestedList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewValidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewInvalidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewRequestedList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.viewValidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.viewInvalidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.signatureMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.strSign,value:0},{caption:this.strDetails,value:1},{caption:this.strSetup,value:2},{caption:this.strDelete,value:3}]}),this.signatureMenu.on("item:click",i.bind(this.onMenuSignatureClick,this))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateSignatures",i.bind(this.onApiUpdateSignatures,this)),Common.NotificationCenter.on("document:ready",i.bind(this.onDocumentReady,this)),this},ChangeSettings:function(t){this._state.hasRequested||this._state.hasValid||this._state.hasInvalid||this.updateSignatures(this.api.asc_getSignatures(),this.api.asc_getRequestSignatures())},setLocked:function(t){this._locked=t},setMode:function(t){this.mode=t},onApiUpdateSignatures:function(t,e){this._state.ready&&(this.updateSignatures(t,e),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid))},updateSignatures:function(t,e){var n=this,o=[],s=[],a=[],l=1;i.each(e,function(t,e){var i=t.asc_getSigner1();o.push({name:""!==i?i:n.strSigner+" "+l++,guid:t.asc_getGuid(),requested:!0})}),i.each(t,function(t,e){var n=t.asc_getDate(),o={name:t.asc_getSigner1(),certificateId:t.asc_getId(),guid:t.asc_getGuid(),date:i.isEmpty(n)?"":new Date(n).toLocaleString(),invisible:!t.asc_getVisible()};0==t.asc_getValid()?s.push(o):a.push(o)}),n._state.hasValid=s.length>0,n._state.hasInvalid=a.length>0,n._state.hasRequested=o.length>0,this.viewRequestedList.store.reset(o),this.viewValidList.store.reset(s),this.viewInvalidList.store.reset(a),this.$el.find(".requested").toggleClass("hidden",!n._state.hasRequested),this.$el.find(".valid").toggleClass("hidden",!n._state.hasValid),this.$el.find(".invalid").toggleClass("hidden",!n._state.hasInvalid),n.disableEditing(n._state.hasValid||n._state.hasInvalid)},onItemContextMenu:function(t,n,o,s){var a=this.signatureMenu;a.isVisible()&&a.hide();var l=e(this.el).offset(),r=[s.clientX*Common.Utils.zoom()-l.left+5,s.clientY*Common.Utils.zoom()-l.top+5];this.showSignatureMenu(o,r),a.menuAlign="tl-bl",a.menuAlignEl=null,a.setOffset(15,5),a.show(),i.delay(function(){a.cmpEl.focus()},10)},onSelectSignature:function(t,n,o,s){if(o){var a=e(s.target);if(a&&a.hasClass("caret")){var l=this.signatureMenu;if(l.isVisible())return void l.hide();var r=e(s.currentTarget),c=r.offset(),h=e(this.el).offset(),d=[c.left-h.left+r.width(),c.top-h.top+r.height()/2];this.showSignatureMenu(o,d),l.menuAlign="tr-br",l.menuAlignEl=r,l.setOffset(-20,-r.height()/2+3),l.show(),i.delay(function(){l.cmpEl.focus()},10),s.stopPropagation(),s.preventDefault()}else this.api.asc_gotoSignature(o.get("guid"))}},showSignatureMenu:function(t,i){var n=this.signatureMenu,o=e(this.el),s=o.find("#menu-signature-container");n.rendered||(s.length<1&&(s=e('<div id="menu-signature-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',n.id),o.append(s)),n.render(s),n.cmpEl.attr({tabindex:"-1"}),n.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}}));var a=t.get("requested"),l=this._state.hasValid||this._state.hasInvalid;n.items[0].setVisible(a),n.items[1].setVisible(!a),n.items[2].setVisible(a||!t.get("invisible")),n.items[3].setVisible(!a),n.items[0].setDisabled(this._locked),n.items[3].setDisabled(this._locked),n.items[1].cmpEl.attr("data-value",t.get("certificateId")),n.items[2].cmpEl.attr("data-value",l?1:0),n.cmpEl.attr("data-value",t.get("guid")),s.css({left:i[0],top:i[1]})},onMenuSignatureClick:function(t,e){var i=t.cmpEl.attr("data-value");switch(e.value){case 0:Common.NotificationCenter.trigger("protect:sign",i);break;case 1:this.api.asc_ViewCertificate(e.cmpEl.attr("data-value"));break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",!!parseInt(e.cmpEl.attr("data-value")),i);break;case 3:this.api.asc_RemoveSignature(i)}},onDocumentReady:function(){this._state.ready=!0,this.updateSignatures(this.api.asc_getSignatures(),this.api.asc_getRequestSignatures()),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid,this._state.hasRequested)},showSignatureTooltip:function(t,e,i){var n=this,o=n._state.tip;if(!t&&!e&&!i)return void(o&&o.isVisible()&&(o.close(),n._state.tip=void 0));var s=t||e,a=e?n.txtSignedInvalid:t?n.txtSigned:"";i&&(a=n.txtRequestedSignatures+"<br><br>"+a),o&&o.isVisible()&&(a!==o.text||s!==o.showLink)&&(o.close(),n._state.tip=void 0),n._state.tip||(o=new Common.UI.SynchronizeTip({target:SSE.getController("RightMenu").getView("RightMenu").btnSignature.btnEl,text:a,showLink:s,textLink:this.txtContinueEditing,placement:"left"}),o.on({dontshowclick:function(){Common.UI.warning({title:n.notcriticalErrorTitle,msg:n.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(t){"ok"==t&&(o.close(),n._state.tip=void 0,n.api.asc_RemoveAllSignatures())}})},closeclick:function(){o.close(),n._state.tip=void 0}}),n._state.tip=o,o.show())},disableEditing:function(t){if(this._state.DisabledEditing!=t){this._state.DisabledEditing=t;var e=SSE.getController("RightMenu");t&&"id-signature-settings"!==e.rightmenu.GetActivePane()&&e.rightmenu.clearSelection(),e.SetDisabled(t,!0),SSE.getController("Toolbar").DisableToolbar(t,t),SSE.getController("Statusbar").SetDisabled(t),SSE.getController("Common.Controllers.ReviewChanges").SetDisabled(t),SSE.getController("DocumentHolder").SetDisabled(t,!0),SSE.getController("LeftMenu").setPreviewMode(t);var i=SSE.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t)}},strSignature:"Signature",strRequested:"Requested signatures",strValid:"Valid signatures",strInvalid:"Invalid signatures",strSign:"Sign",strDetails:"Signature Details",strSetup:"Signature Setup",txtSigned:"Valid signatures has been added to the workbook. The workbook is protected from editing.",txtSignedInvalid:"Some of the digital signatures in workbook are invalid or could not be verified. The workbook is protected from editing.",txtRequestedSignatures:"This workbook needs to be signed.",txtContinueEditing:"Edit anyway",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the workbook.<br>Are you sure you want to continue?",strDelete:"Remove Signature",strSigner:"Signer"},SSE.Views.SignatureSettings||{}))}),define("text!spreadsheeteditor/main/app/template/CellSettings.template",[],function(){return'<table cols="2">\n <tr>\n <td colspan=2 class="padding-small">\n <label class="header"><%= scope.textBorders %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div id="cell-combo-border-type" style="display: inline-block; vertical-align: middle; width: 93px;"></div>\n <div style="display: inline-block; float:right;vertical-align: middle;">\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBorderColor %></label>\n <div id="cell-border-color-btn" style="display: inline-block;"></div>\n </div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <label class="input-label"><%= scope.textSelectBorders %></label>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <div id="cell-button-border-all" style="display: inline-block;"></div>\n <div id="cell-button-border-none" style="display: inline-block;"></div>\n <div id="cell-button-border-inner" style="display: inline-block;"></div>\n <div id="cell-button-border-outer" style="display: inline-block;"></div>\n <div id="cell-button-border-diagu" style="display: inline-block;"></div>\n <div id="cell-button-border-diagd" style="display: inline-block;"></div>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <div id="cell-button-border-left" style="display: inline-block;"></div>\n <div id="cell-button-border-inner-vert" style="display: inline-block;"></div>\n <div id="cell-button-border-right" style="display: inline-block;"></div>\n <div id="cell-button-border-top" style="display: inline-block;"></div>\n <div id="cell-button-border-inner-hor" style="display: inline-block;"></div>\n <div id="cell-button-border-bottom" style="display: inline-block;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2 align="right">\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>\n <div id="cell-back-color-btn" style="display: inline-block;text-align:left;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <label class="header"><%= scope.textOrientation %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <label class="input-label"><%= scope.textAngle %></label>\n <div id="cell-spin-angle" style="display: inline-block;margin-left:5px;"></div>\n </td>\n </tr>\n <tr class="finish-cell"></tr>\n</table>'}),define("spreadsheeteditor/main/app/view/CellSettings",["text!spreadsheeteditor/main/app/template/CellSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboBorderSize","common/main/lib/view/OpenDialog"],function(t,e,i,n){"use strict";SSE.Views.CellSettings=n.View.extend(i.extend({el:"#id-cell-settings",template:i.template(t),events:{},options:{alias:"CellSettings"},initialize:function(){this._initSettings=!0,this._state={BackColor:void 0,DisabledControls:!0,CellAngle:void 0},this.lockedControls=[],this._locked=!0,this.isEditCell=!1,this.BorderType=1,this.render(),this.createDelayedControls()},onColorsBackSelect:function(t,e){this.btnBackColor.setColor(e),this.api&&this.api.asc_setCellBackgroundColor("transparent"==e?null:Common.Utils.ThemeColor.getRgbColor(e)),Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onColorsBorderSelect:function(t,e){this.btnBorderColor.setColor(e)},onBtnBordersClick:function(t,e){if(this.api){var i=[],n=this.BorderType,o=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);"inner"==t.options.borderId?(i[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(n,o)):"all"==t.options.borderId?(i[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(n,o)):"outer"==t.options.borderId?(i[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(n,o),i[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(n,o)):"none"!=t.options.borderId&&(i[t.options.borderId]=new Asc.asc_CBorder(n,o)),this.api.asc_setCellBorders(i)}Common.NotificationCenter.trigger("edit:complete",this)},onBorderTypeSelect:function(t,e){this.BorderType=e.value},onAngleChange:function(t,e,i,n){this.api&&this.api.asc_setCellAngle(t.getNumberValue())},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,t&&this.api.asc_registerCallback("asc_onEditCell",this.onApiEditCell.bind(this)),this},createDelayedControls:function(){var t=[[Asc.c_oAscBorderOptions.Left,"btn-borders-small btn-position-left","cell-button-border-left",this.tipLeft],[Asc.c_oAscBorderOptions.InnerV,"btn-borders-small btn-position-inner-vert","cell-button-border-inner-vert",this.tipInnerVert],[Asc.c_oAscBorderOptions.Right,"btn-borders-small btn-position-right","cell-button-border-right",this.tipRight],[Asc.c_oAscBorderOptions.Top,"btn-borders-small btn-position-top","cell-button-border-top",this.tipTop],[Asc.c_oAscBorderOptions.InnerH,"btn-borders-small btn-position-inner-hor","cell-button-border-inner-hor",this.tipInnerHor],[Asc.c_oAscBorderOptions.Bottom,"btn-borders-small btn-position-bottom","cell-button-border-bottom",this.tipBottom],[Asc.c_oAscBorderOptions.DiagU,"btn-borders-small btn-position-diagu","cell-button-border-diagu",this.tipDiagU],[Asc.c_oAscBorderOptions.DiagD,"btn-borders-small btn-position-diagd","cell-button-border-diagd",this.tipDiagD],["inner","btn-borders-small btn-position-inner","cell-button-border-inner",this.tipInner],["outer","btn-borders-small btn-position-outer","cell-button-border-outer",this.tipOuter],["all","btn-borders-small btn-position-all","cell-button-border-all",this.tipAll],["none","btn-borders-small btn-position-none","cell-button-border-none",this.tipNone]];i.each(t,function(t,n,o){var s=new Common.UI.Button({cls:"btn-toolbar",iconCls:t[1],borderId:t[0],hint:t[3],disabled:this._locked});s.render(e("#"+t[2])),s.on("click",i.bind(this.onBtnBordersClick,this)),this.lockedControls.push(s)},this),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#cell-combo-border-type"),cls:"cell-border-type",style:"width: 93px;",menuStyle:"min-width: 93px;",disabled:this._locked,data:[{value:Asc.c_oAscBorderStyles.Thin,offsety:0},{value:Asc.c_oAscBorderStyles.Hair,offsety:20},{value:Asc.c_oAscBorderStyles.Dotted,offsety:40},{value:Asc.c_oAscBorderStyles.Dashed,offsety:60},{value:Asc.c_oAscBorderStyles.DashDot,offsety:80},{value:Asc.c_oAscBorderStyles.DashDotDot,offsety:100},{value:Asc.c_oAscBorderStyles.Medium,offsety:120},{value:Asc.c_oAscBorderStyles.MediumDashed,offsety:140},{value:Asc.c_oAscBorderStyles.MediumDashDot,offsety:160},{value:Asc.c_oAscBorderStyles.MediumDashDotDot,offsety:180},{value:Asc.c_oAscBorderStyles.Thick,offsety:200}]}).on("selected",i.bind(this.onBorderTypeSelect,this)),this.BorderType=Asc.c_oAscBorderStyles.Thin,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",disabled:this._locked,menu:!0}),this.btnBorderColor.render(e("#cell-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",disabled:this._locked,menu:!0}),this.btnBackColor.render(e("#cell-back-color-btn")),this.btnBackColor.setColor("transparent"),this.lockedControls.push(this.btnBackColor),this.spnAngle=new Common.UI.MetricSpinner({el:e("#cell-spin-angle"),step:1,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!1,maxValue:90,minValue:-90,disabled:this._locked}),this.lockedControls.push(this.spnAngle),this.spnAngle.on("change",i.bind(this.onAngleChange,this))},createDelayedElements:function(){this.UpdateThemeColors(),this._initSettings=!1},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){var e,n=t.asc_getFill().asc_getColor();e=n?n.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()),effectValue:n.get_value()}:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()):"transparent";var o=typeof e;if(o!==typeof this._state.BackColor||"object"==o&&(e.effectValue!==this._state.BackColor.effectValue||this._state.BackColor.color.indexOf(e.color)<0)||"object"!=o&&void 0!==this._state.BackColor&&this._state.BackColor.indexOf(e)<0){if(this.btnBackColor.setColor(e),i.isObject(e)){for(var s=!1,a=0;a<10;a++)if(Common.Utils.ThemeColor.ThemeValues[a]==e.effectValue){this.colorsBack.select(e,!0),s=!0;break}s||this.colorsBack.clearSelection()}else this.colorsBack.select(e,!0);this._state.BackColor=e}var l=t.asc_getAngle();(Math.abs(this._state.CellAngle-l)>.1||void 0===this._state.CellAngle&&this._state.CellAngle!==l)&&(this.spnAngle.setValue(null!==l?l:"",!0),this._state.CellAngle=l)}},UpdateThemeColors:function(){this.borderColor||(this.btnBorderColor.setMenu(new Common.UI.Menu({items:[{template:i.template('<div id="cell-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="cell-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})),this.borderColor=new Common.UI.ThemeColorPalette({el:e("#cell-border-color-menu")}),this.borderColor.on("select",i.bind(this.onColorsBorderSelect,this)),this.btnBorderColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.borderColor,this.btnBorderColor)),this.btnBackColor.setMenu(new Common.UI.Menu({items:[{template:i.template('<div id="cell-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="cell-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})),this.colorsBack=new Common.UI.ThemeColorPalette({el:e("#cell-back-color-menu"),transparent:!0}),this.colorsBack.on("select",i.bind(this.onColorsBackSelect,this)),this.btnBackColor.menu.items[1].on("click",i.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor))),
|
|
|
this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.btnBorderColor.setColor(this.borderColor.getColor())},onApiEditCell:function(t){this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd,t!=Asc.c_oAscCellEditorState.editStart&&t!=Asc.c_oAscCellEditorState.editEnd||this.disableControls(this._locked)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||(t=t||this.isEditCell,this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)})))},textBorders:"Border's Style",textBorderColor:"Color",textBackColor:"Background color",textSelectBorders:"Select borders that you want to change",textNewColor:"Add New Custom Color",tipTop:"Set Outer Top Border Only",tipLeft:"Set Outer Left Border Only",tipBottom:"Set Outer Bottom Border Only",tipRight:"Set Outer Right Border Only",tipAll:"Set Outer Border and All Inner Lines",tipNone:"Set No Borders",tipInner:"Set Inner Lines Only",tipInnerVert:"Set Vertical Inner Lines Only",tipInnerHor:"Set Horizontal Inner Lines Only",tipOuter:"Set Outer Border Only",tipDiagU:"Set Diagonal Up Border",tipDiagD:"Set Diagonal Down Border",textOrientation:"Text Orientation",textAngle:"Angle"},SSE.Views.CellSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;if(define("spreadsheeteditor/main/app/view/RightMenu",["text!spreadsheeteditor/main/app/template/RightMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","spreadsheeteditor/main/app/view/ParagraphSettings","spreadsheeteditor/main/app/view/ImageSettings","spreadsheeteditor/main/app/view/ChartSettings","spreadsheeteditor/main/app/view/ShapeSettings","spreadsheeteditor/main/app/view/TextArtSettings","spreadsheeteditor/main/app/view/TableSettings","spreadsheeteditor/main/app/view/PivotSettings","spreadsheeteditor/main/app/view/SignatureSettings","spreadsheeteditor/main/app/view/CellSettings","common/main/lib/component/Scroller"],function(t,e,i,n){"use strict";SSE.Views.RightMenu=n.View.extend(i.extend({el:"#right-menu",template:i.template(t),events:{},initialize:function(){return this.minimizedMode=!0,this.btnText=new Common.UI.Button({hint:this.txtParagraphSettings,asctype:Common.Utils.documentSettingsType.Paragraph,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnImage=new Common.UI.Button({hint:this.txtImageSettings,asctype:Common.Utils.documentSettingsType.Image,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnChart=new Common.UI.Button({hint:this.txtChartSettings,asctype:Common.Utils.documentSettingsType.Chart,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnShape=new Common.UI.Button({hint:this.txtShapeSettings,asctype:Common.Utils.documentSettingsType.Shape,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTextArt=new Common.UI.Button({hint:this.txtTextArtSettings,asctype:Common.Utils.documentSettingsType.TextArt,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTable=new Common.UI.Button({hint:this.txtTableSettings,asctype:Common.Utils.documentSettingsType.Table,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnPivot=new Common.UI.Button({hint:this.txtPivotSettings,asctype:Common.Utils.documentSettingsType.Pivot,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnCell=new Common.UI.Button({hint:this.txtCellSettings,asctype:Common.Utils.documentSettingsType.Cell,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panel:"id-paragraph-settings",btn:this.btnText},this._settings[Common.Utils.documentSettingsType.Image]={panel:"id-image-settings",btn:this.btnImage},this._settings[Common.Utils.documentSettingsType.Shape]={panel:"id-shape-settings",btn:this.btnShape},this._settings[Common.Utils.documentSettingsType.Chart]={panel:"id-chart-settings",btn:this.btnChart},this._settings[Common.Utils.documentSettingsType.TextArt]={panel:"id-textart-settings",btn:this.btnTextArt},this._settings[Common.Utils.documentSettingsType.Table]={panel:"id-table-settings",btn:this.btnTable},this._settings[Common.Utils.documentSettingsType.Pivot]={panel:"id-pivot-settings",btn:this.btnPivot},this._settings[Common.Utils.documentSettingsType.Cell]={panel:"id-cell-settings",btn:this.btnCell},this},render:function(t){var n=e(this.el);this.trigger("render:before",this),this.defaultHideRightMenu=t.customization&&!!t.customization.hideRightMenu;var o=!Common.localStorage.getBool("sse-hide-right-settings",this.defaultHideRightMenu);return n.css("width",(o?MENU_SCALE_PART:SCALE_MIN)+"px"),n.css("z-index",101),n.show(),n.html(this.template({})),this.btnText.setElement(e("#id-right-menu-text"),!1),this.btnText.render(),this.btnImage.setElement(e("#id-right-menu-image"),!1),this.btnImage.render(),this.btnChart.setElement(e("#id-right-menu-chart"),!1),this.btnChart.render(),this.btnShape.setElement(e("#id-right-menu-shape"),!1),this.btnShape.render(),this.btnTextArt.setElement(e("#id-right-menu-textart"),!1),this.btnTextArt.render(),this.btnTable.setElement(e("#id-right-menu-table"),!1),this.btnTable.render(),this.btnPivot.setElement(e("#id-right-menu-pivot"),!1),this.btnPivot.render(),this.btnCell.setElement(e("#id-right-menu-cell"),!1),this.btnCell.render(),this.btnText.on("click",i.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",i.bind(this.onBtnMenuClick,this)),this.btnChart.on("click",i.bind(this.onBtnMenuClick,this)),this.btnShape.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTextArt.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",i.bind(this.onBtnMenuClick,this)),this.btnPivot.on("click",i.bind(this.onBtnMenuClick,this)),this.btnCell.on("click",i.bind(this.onBtnMenuClick,this)),this.paragraphSettings=new SSE.Views.ParagraphSettings,this.imageSettings=new SSE.Views.ImageSettings,this.chartSettings=new SSE.Views.ChartSettings,this.shapeSettings=new SSE.Views.ShapeSettings,this.textartSettings=new SSE.Views.TextArtSettings,this.tableSettings=new SSE.Views.TableSettings,this.pivotSettings=new SSE.Views.PivotSettings,this.cellSettings=new SSE.Views.CellSettings,t&&t.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({hint:this.txtSignatureSettings,asctype:Common.Utils.documentSettingsType.Signature,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings[Common.Utils.documentSettingsType.Signature]={panel:"id-signature-settings",btn:this.btnSignature},this.btnSignature.el=e("#id-right-menu-signature"),this.btnSignature.render().setVisible(!0),this.btnSignature.on("click",i.bind(this.onBtnMenuClick,this)),this.signatureSettings=new SSE.Views.SignatureSettings),i.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),o&&(e("#id-cell-settings").parent().css("display","inline-block"),e("#id-cell-settings").addClass("active")),this.trigger("render:after",this),this},setApi:function(t){return this.api=t,this.paragraphSettings.setApi(t),this.imageSettings.setApi(t),this.chartSettings.setApi(t),this.shapeSettings.setApi(t),this.textartSettings.setApi(t),this.tableSettings.setApi(t),this.pivotSettings.setApi(t),this.cellSettings.setApi(t),this.signatureSettings&&this.signatureSettings.setApi(t),this},setMode:function(t){return this.mode=t,this},onBtnMenuClick:function(t,i){var n=e("#"+this._settings[t.options.asctype].panel),o=n.parent();t.pressed?(this.minimizedMode&&(e(this.el).width(MENU_SCALE_PART),o.css("display","inline-block"),this.minimizedMode=!1,Common.localStorage.setItem("sse-hide-right-settings",0)),o.find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&this.scroller.scrollTop(0)):(o.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.localStorage.setItem("sse-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,t.options.asctype,this.minimizedMode])},SetActivePane:function(t,i){if(!(this.minimizedMode&&!0!==i||void 0===this._settings[t]))if(this.minimizedMode)this._settings[t].btn.toggle(!0,!1),this._settings[t].btn.trigger("click",this._settings[t].btn);else{var n=e("#"+this._settings[t].panel);n.hasClass("active")||(n.parent().find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&(this.scroller.update(),this.scroller.scrollTop(0))),this._settings[t].btn.isActive()||this._settings[t].btn.toggle(!0,!1)}},GetActivePane:function(){return this.minimizedMode?null:this.$el.find(".settings-panel.active")[0].id},clearSelection:function(){var t=e(".right-panel");t.find("> .active").removeClass("active"),this._settings.forEach(function(t){t.btn.isActive()&&t.btn.toggle(!1,!0)}),t.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.NotificationCenter.trigger("layout:changed","rightmenu")},txtParagraphSettings:"Paragraph Settings",txtImageSettings:"Image Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtChartSettings:"Chart Settings",txtSparklineSettings:"Sparkline Settings",txtTableSettings:"Table Settings",txtPivotSettings:"Pivot Table Settings",txtSignatureSettings:"Signature Settings",txtCellSettings:"Cell Settings"},SSE.Views.RightMenu||{}))}),define("spreadsheeteditor/main/app/controller/RightMenu",["core","spreadsheeteditor/main/app/view/RightMenu"],function(){"use strict";SSE.Controllers.RightMenu=Backbone.Controller.extend({models:[],collections:[],views:["RightMenu"],initialize:function(){this.editMode=!0,this._state={},this.addListeners({Toolbar:{insertimage:this.onInsertImage.bind(this),insertshape:this.onInsertShape.bind(this),insertchart:this.onInsertChart.bind(this),inserttextart:this.onInsertTextArt.bind(this),inserttable:this.onInsertTable.bind(this)},RightMenu:{rightmenuclick:this.onRightMenuClick}})},onLaunch:function(){this.rightmenu=this.createView("RightMenu"),this.rightmenu.on("render:after",_.bind(this.onRightMenuAfterRender,this))},onRightMenuAfterRender:function(t){t.shapeSettings.application=t.textartSettings.application=this.getApplication(),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panelId:"id-paragraph-settings",panel:t.paragraphSettings,btn:t.btnText,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Image]={panelId:"id-image-settings",panel:t.imageSettings,btn:t.btnImage,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Shape]={panelId:"id-shape-settings",panel:t.shapeSettings,btn:t.btnShape,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.TextArt]={panelId:"id-textart-settings",panel:t.textartSettings,btn:t.btnTextArt,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Chart]={panelId:"id-chart-settings",panel:t.chartSettings,btn:t.btnChart,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Table]={panelId:"id-table-settings",panel:t.tableSettings,btn:t.btnTable,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Pivot]={panelId:"id-pivot-settings",panel:t.pivotSettings,btn:t.btnPivot,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Signature]={panelId:"id-signature-settings",panel:t.signatureSettings,btn:t.btnSignature,hidden:1,props:{},locked:!1},this._settings[Common.Utils.documentSettingsType.Cell]={panelId:"id-cell-settings",panel:t.cellSettings,btn:t.btnCell,hidden:1,locked:!1}},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},setMode:function(t){this.editMode=t.isEdit},onRightMenuClick:function(t,e,i){if(!i&&this.editMode){var n=this._settings[e].panel,o=this._settings[e].props;o&&n&&n.ChangeSettings.call(n,e==Common.Utils.documentSettingsType.Signature?void 0:o)}Common.NotificationCenter.trigger("layout:changed","rightmenu")},onSelectionChanged:function(t){if(!this.rangeSelectionMode){var e=[],i=t.asc_getFlags().asc_getSelectionType(),n=t.asc_getFormatTableInfo(),o=t.asc_getSparklineInfo(),s=t;i!=Asc.c_oAscSelectionType.RangeImage&&i!=Asc.c_oAscSelectionType.RangeShape&&i!=Asc.c_oAscSelectionType.RangeChart&&i!=Asc.c_oAscSelectionType.RangeChartText&&i!=Asc.c_oAscSelectionType.RangeShapeText||(e=this.api.asc_getGraphicObjectProps()),!(e.length<=0)||s||n||o||this.rightmenu.minimizedMode||"id-signature-settings"===this.rightmenu.GetActivePane()||(this.rightmenu.clearSelection(),this._openRightMenu=!0),this.onFocusObject(e,s,n,o,null)}},onFocusObject:function(t,e,i,n,o){if(this.editMode){for(var s=e.asc_getLocked(),a=!0===e.asc_getLockedTable()||!this.rightmenu.mode.canModifyFilter,l=!0===e.asc_getLockedSparkline(),r=(e.asc_getLockedPivotTable(),0);r<this._settings.length;++r)r!=Common.Utils.documentSettingsType.Signature&&this._settings[r]&&(this._settings[r].hidden=1,this._settings[r].locked=!1);for(this._settings[Common.Utils.documentSettingsType.Signature].locked=!1,r=0;r<t.length;++r){var c=t[r].asc_getObjectType(),h=this.getDocumentSettingsType(c);if(!(void 0===h||h>=this._settings.length||void 0===this._settings[h])){var d=t[r].asc_getObjectValue();h==Common.Utils.documentSettingsType.Image&&(null!==d.asc_getChartProperties()?(h=Common.Utils.documentSettingsType.Chart,this._settings[h].btn.updateHint(this.rightmenu.txtChartSettings)):null!==d.asc_getShapeProperties()&&(h=Common.Utils.documentSettingsType.Shape,d.asc_getShapeProperties().asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=d,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=d.asc_getLocked()))),this._settings[h].props=d,this._settings[h].hidden=0,this._settings[h].locked=d.asc_getLocked(),this._settings[Common.Utils.documentSettingsType.Signature].locked||(this._settings[Common.Utils.documentSettingsType.Signature].locked=d.asc_getLocked())}}i&&(h=Common.Utils.documentSettingsType.Table,this._settings[h].props=i,this._settings[h].locked=a,this._settings[h].hidden=0),n&&(h=Common.Utils.documentSettingsType.Chart,this._settings[h].props=n,this._settings[h].locked=l,this._settings[h].hidden=0,this._settings[h].btn.updateHint(this.rightmenu.txtSparklineSettings)),t.length<=0&&(h=Common.Utils.documentSettingsType.Cell,this._settings[h].props=e,this._settings[h].locked=s,this._settings[h].hidden=0);var p,m=-1,u=-1,g=this.rightmenu.GetActivePane();for(r=0;r<this._settings.length;++r){var b=this._settings[r];void 0!==b&&void 0!==b.btn&&void 0!==b.panel&&(b.hidden?(b.btn.isDisabled()||b.btn.setDisabled(!0),g==b.panelId&&(p=-1)):(b.btn.isDisabled()&&b.btn.setDisabled(!1),r!=Common.Utils.documentSettingsType.Signature&&(m=r),b.needShow?(b.needShow=!1,u=r):g==b.panelId&&(p=r),b.panel.setLocked(b.locked)))}if(!this.rightmenu.minimizedMode||this._openRightMenu){var f;u>-1?f=u:m>=0&&p<0?f=m:p>=0&&(f=p),void 0==f&&this._openRightMenu&&m>=0&&(f=m),void 0!==f&&(this.rightmenu.SetActivePane(f,this._openRightMenu),f!=Common.Utils.documentSettingsType.Signature?this._settings[f].panel.ChangeSettings.call(this._settings[f].panel,this._settings[f].props):this._settings[f].panel.ChangeSettings.call(this._settings[f].panel),this._openRightMenu=!1)}this._settings[Common.Utils.documentSettingsType.Image].needShow=!1,this._settings[Common.Utils.documentSettingsType.Chart].needShow=!1,this._settings[Common.Utils.documentSettingsType.Table].needShow=!1}},onCoAuthoringDisconnect:function(){this.SetDisabled(!0),this.setMode({isEdit:!1})},onInsertImage:function(){this._settings[Common.Utils.documentSettingsType.Image].needShow=!0},onInsertChart:function(){this._settings[Common.Utils.documentSettingsType.Chart].needShow=!0},onInsertShape:function(){this._settings[Common.Utils.documentSettingsType.Shape].needShow=!0},onInsertTextArt:function(){this._settings[Common.Utils.documentSettingsType.TextArt].needShow=!0},onInsertTable:function(){this._settings[Common.Utils.documentSettingsType.Table].needShow=!0},UpdateThemeColors:function(){this.rightmenu.shapeSettings.UpdateThemeColors(),this.rightmenu.textartSettings.UpdateThemeColors(),this.rightmenu.chartSettings.UpdateThemeColors(),this.rightmenu.cellSettings.UpdateThemeColors()},updateMetricUnit:function(){this.rightmenu.paragraphSettings.updateMetricUnit(),this.rightmenu.chartSettings.updateMetricUnit(),this.rightmenu.imageSettings.updateMetricUnit()},fillTextArt:function(){this.rightmenu.textartSettings.fillTextArt()},createDelayedElements:function(){this.api&&(this._openRightMenu=!Common.localStorage.getBool("sse-hide-right-settings",this.rightmenu.defaultHideRightMenu),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this)),this.rightmenu.shapeSettings.createDelayedElements(),this.onSelectionChanged(this.api.asc_getCellInfo()))},onDoubleClickOnObject:function(t){if(this.editMode){var e=t.asc_getObjectType(),i=this.getDocumentSettingsType(e);if(!(void 0===i||i>=this._settings.length||void 0===this._settings[i])){var n=t.asc_getObjectValue();i==Common.Utils.documentSettingsType.Image&&(null!==n.asc_getChartProperties()?i=Common.Utils.documentSettingsType.Chart:null!==n.asc_getShapeProperties()&&(i=Common.Utils.documentSettingsType.Shape)),i!==Common.Utils.documentSettingsType.Paragraph&&(this.rightmenu.SetActivePane(i,!0),this._settings[i].panel.ChangeSettings.call(this._settings[i].panel,this._settings[i].props))}}},getDocumentSettingsType:function(t){switch(t){case Asc.c_oAscTypeSelectElement.Paragraph:return Common.Utils.documentSettingsType.Paragraph;case Asc.c_oAscTypeSelectElement.Image:return Common.Utils.documentSettingsType.Image}},onApiUpdateSignatures:function(t,e){if(this.rightmenu.signatureSettings){var i=(!t||t.length<1)&&(!e||e.length<1),n=Common.Utils.documentSettingsType.Signature;this._settings[n].hidden=i?1:0,this._settings[n].btn.setDisabled(i),this._settings[n].panel.setLocked(this._settings[n].locked)}},SetDisabled:function(t,e){this.setMode({isEdit:!t}),this.rightmenu&&(this.rightmenu.paragraphSettings.disableControls(t),this.rightmenu.shapeSettings.disableControls(t),this.rightmenu.imageSettings.disableControls(t),this.rightmenu.chartSettings.disableControls(t),this.rightmenu.tableSettings.disableControls(t),this.rightmenu.pivotSettings.disableControls(t),this.rightmenu.cellSettings.disableControls(t),!e&&this.rightmenu.signatureSettings&&this.rightmenu.btnSignature.setDisabled(t),!e&&this.rightmenu.signatureSettings&&this.rightmenu.btnSignature.setDisabled(t),t?(this.rightmenu.btnText.setDisabled(t),this.rightmenu.btnTable.setDisabled(t),this.rightmenu.btnImage.setDisabled(t),this.rightmenu.btnShape.setDisabled(t),this.rightmenu.btnTextArt.setDisabled(t),this.rightmenu.btnChart.setDisabled(t),this.rightmenu.btnPivot.setDisabled(t),this.rightmenu.btnCell.setDisabled(t)):this.onSelectionChanged(this.api.asc_getCellInfo()))},onCellsRange:function(t){this.rangeSelectionMode=t!=Asc.c_oAscSelectionDialogType.None}})}),define("common/main/lib/view/SaveAsDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SaveAsDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:420,height:681,header:!0},t),this.template=['<div id="id-saveas-folder-placeholder"></div>'].join(""),e.tpl=_.template(this.template)(e),this.saveFolderUrl=t.saveFolderUrl||"",this.saveFileUrl=t.saveFileUrl||"",this.defFileName=t.defFileName||"",this.saveFolderUrl=this.saveFolderUrl.replace("{title}",encodeURIComponent(this.defFileName)).replace("{fileuri}",encodeURIComponent(this.saveFileUrl)),Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=645,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-saveas-folder-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-saveas-folder-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.saveFolderUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(_.isEmpty(t.error)||this.trigger("saveaserror",this,t.error),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Folder for save",textLoading:"Loading"},Common.Views.SaveAsDlg||{}))}),define("text!spreadsheeteditor/main/app/template/LeftMenu.template",[],function(){return'<div id="view-left-menu" class="tool-menu left">\r\n <div class="tool-menu-btns">\r\n <button id="left-btn-search" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-search"> </i></button>\r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n <button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><i class="icon img-toolbarmenu btn-menu-comments"> </i></button>\r\n <button id="left-btn-chat" class="btn btn-category" content-target="left-panel-chat"><i class="icon img-toolbarmenu btn-menu-chat"> </i></button>\r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n <button id="left-btn-plugins" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-plugin"> </i></button>\r\n <button id="left-btn-spellcheck" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-ic-docspell"> </i></button>\r\n <button id="left-btn-support" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-support"> </i></button>\r\n <button id="left-btn-about" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-about"> </i></button>\r\n </div>\r\n <div class="left-panel" style="">\r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n <div id="left-panel-comments" class="" style="display: none;" />\r\n <div id="left-panel-chat" class="" style="display: none;" />\r\n <div id="left-panel-spellcheck" class="" style="display: none; height: 100%;" />\r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n <div id="left-panel-plugins" class="" style="display: none; height: 100%; position: relative;" />\r\n </div>\r\n</div>'}),define("common/main/lib/view/About",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.Views.About=Common.UI.BaseView.extend(_.extend({menu:void 0,options:{alias:"Common.Views.About"},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.txtVersionNum="0.0.0",this.template=_.template(['<table id="id-about-licensor-logo" cols="1" style="width: 100%; margin-top: 20px;">',"<tr>",'<td align="center"><div class="asc-about-office"></div></td>',"</tr>","<tr>",'<td align="center"><label class="asc-about-version">'+t.appName.toUpperCase()+"</label></td>","</tr>","<tr>",'<td align="center"><label class="asc-about-version" id="id-about-licensor-version-name">'+this.txtVersion+this.txtVersionNum+"</label></td>","</tr>","</table>",'<table id="id-about-licensor-info" cols="3" style="width: 100%;" class="margin-bottom">',"<tr>",'<td colspan="3" align="center" style="padding: 20px 0 10px 0;"><label class="asc-about-companyname"><%= publishername %></label></td>',"</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtAddress+"</label>",'<label class="asc-about-desc"><%= publisheraddr %></label>',"</td>","</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtMail+"</label>",'<a href="mailto:<%= supportemail %>"><%= supportemail %></a>',"</td>","</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtTel+"</label>",'<label class="asc-about-desc"><%= phonenum %></label>',"</td>","</tr>","<tr>",'<td colspan="3" align="center">','<a href="<%= publisherurl %>" target="_blank"><% print(publisherurl.replace(/https?:\\/{2}/, "").replace(/\\/$/,"")) %></a>',"</td>","</tr>","</table>",'<table id="id-about-licensee-info" cols="1" style="width: 100%; margin-top: 20px;" class="hidden margin-bottom"><tbody>',"<tr>",'<td align="center" class="padding-small"><div id="id-about-company-logo"/></td>',"</tr>","<tr>",'<td align="center"><label class="asc-about-version">'+t.appName.toUpperCase()+"</label></td>","</tr>","<tr>",'<td align="center"><label style="padding-bottom: 29px;" class="asc-about-version" id="id-about-licensee-version-name">'+this.txtVersion+this.txtVersionNum+"</label></td>","</tr>","<tr>",'<td align="center" class="padding-small">','<label class="asc-about-companyname" id="id-about-company-name"></label>',"</td>","</tr>","<tr>",'<td align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtAddress+"</label>",'<label class="asc-about-desc" id="id-about-company-address"></label>',"</td>","</tr>","<tr>",'<td align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtMail+"</label>",'<a href="mailto:" id="id-about-company-mail"></a>',"</td>","</tr>","<tr>",'<td align="center" class="padding-small">','<a href="" target="_blank" id="id-about-company-url"></a>',"</td>","</tr>","<tr>",'<td align="center">','<label class="asc-about-lic" id="id-about-company-lic"></label>',"</td>","</tr>","</table>",'<table id="id-about-licensor-short" cols="1" style="width: 100%; margin-top: 31px;" class="hidden"><tbody>',"<tr>",'<td style="width:50%;"><div class="separator horizontal short left"/></td>','<td align="center"><label class="asc-about-header">'+this.txtPoweredBy+"</label></td>",'<td style="width:50%;"><div class="separator horizontal short"/></td>',"</tr>","<tr>",'<td colspan="3" align="center" style="padding: 9px 0 10px;"><label class="asc-about-companyname"><%= publishername %></label></td>',"</tr>","<tr>",'<td colspan="3" align="center">','<label class="asc-about-desc"><% print(publisherurl.replace(/https?:\\/{2}/, "").replace(/\\/$/,"")) %></label>',"</td>","</tr>","</table>"].join("")),this.menu=t.menu},render:function(){var t=$(this.el);return t.html(this.template({publishername:"Ascensio System SIA",publisheraddr:"20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050",publisherurl:"https://www.onlyoffice.com/",supportemail:"support@onlyoffice.com",phonenum:"+371 660-16425",scope:this})),t.addClass("about-dlg"),this.cntLicenseeInfo=$("#id-about-licensee-info"),this.cntLicensorInfo=$("#id-about-licensor-info"),this.divCompanyLogo=$("#id-about-company-logo"),this.lblCompanyName=$("#id-about-company-name"),this.lblCompanyAddress=$("#id-about-company-address"),this.lblCompanyMail=$("#id-about-company-mail"),this.lblCompanyUrl=$("#id-about-company-url"),this.lblCompanyLic=$("#id-about-company-lic"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},setLicInfo:function(t){if(t&&"object"==typeof t&&"object"==typeof t.customer){var e=t.customer;$("#id-about-licensor-logo").addClass("hidden"),$("#id-about-licensor-short").removeClass("hidden"),this.cntLicensorInfo.addClass("hidden"),this.cntLicenseeInfo.removeClass("hidden"),this.cntLicensorInfo.removeClass("margin-bottom");var i=e.name;if(i&&i.length?this.lblCompanyName.text(i):this.lblCompanyName.parents("tr").addClass("hidden"),i=e.address,i&&i.length?this.lblCompanyAddress.text(i):this.lblCompanyAddress.parents("tr").addClass("hidden"),(i=e.mail)&&i.length?this.lblCompanyMail.attr("href","mailto:"+i).text(i):this.lblCompanyMail.parents("tr").addClass("hidden"),(i=e.www)&&i.length){var n=/^https?:\/{2}/i.test(i)?"":"http://";this.lblCompanyUrl.attr("href",n+i).text(i)}else this.lblCompanyUrl.parents("tr").addClass("hidden");(i=e.info)&&i.length?this.lblCompanyLic.text(i):this.lblCompanyLic.parents("tr").addClass("hidden"),(i=e.logo)&&i.length?this.divCompanyLogo.html('<img src="'+i+'" style="max-width:216px; max-height: 35px;" />'):this.divCompanyLogo.parents("tr").addClass("hidden")}else this.cntLicenseeInfo.addClass("hidden"),this.cntLicensorInfo.addClass("margin-bottom")},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.fireEvent("show",this)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},setMode:function(t){t.isLightVersion&&($("#id-about-licensor-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum),$("#id-about-licensee-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum))},txtPoweredBy:"Powered by",txtVersion:"Version ",txtLicensor:"LICENSOR",txtLicensee:"LICENSEE",txtAddress:"address: ",txtMail:"email: ",txtTel:"tel.: ",txtEdition:"Integration Edition "},Common.Views.About||{}))}),define("text!common/main/lib/template/Comments.template",[],function(){
|
|
|
return'<% if (!hide) { %>\r\n <div id="<%= id %>" class="user-comment-item">\r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n <div class="user-name">\r\n <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>\r\n </div>\r\n <div class="user-date"><%=date%></div>\r\n <% if (quote!==null && quote!==\'\') { %>\r\n <div class="user-quote"><%=scope.getFixedQuote(quote)%></div>\r\n <% } %>\r\n <% if (!editText || scope.viewmode) { %>\r\n <div class="user-message" data-can-copy="true"><%=scope.pickLink(comment)%></div>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>\r\n <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change">textEdit</button>\r\n <button class="btn normal dlg-btn btn-inner-close">textCancel</button>\r\n </div>\r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n <div class="reply-arrow img-commonctrl"></div>\r\n <% _.each(replys, function (item, index) { %>\r\n <div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;>\r\n <div class="user-name">\r\n <div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>\r\n </div>\r\n <div class="user-date"><%=item.get("date")%></div>\r\n <% if (!item.get("editText")) { %>\r\n <div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>\r\n <% if (!scope.viewmode) { %>\r\n <div class="btns-reply-ct">\r\n <% if (item.get("editable")) { %>\r\n <div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n <% } %>\r\n </div>\r\n <%}%>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength"><%=item.get("reply")%></textarea>\r\n <button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change">textEdit</button>\r\n <button class="btn normal dlg-btn btn-inner-close">textClose</button>\r\n </div>\r\n <% } %>\r\n </div>\r\n <% }); %>\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReply && !scope.viewmode) { %>\r\n <% if (replys.length) { %>\r\n <label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } else { %>\r\n <label class="user-reply" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editText && !lock && !scope.viewmode) { %>\r\n <div class="edit-ct">\r\n <% if (editable) { %>\r\n <div class="btn-edit img-commonctrl"></div>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% } %>\r\n <% if (resolved) { %>\r\n <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>\r\n <% } else { %>\r\n <div class="btn-resolve img-commonctrl" data-toggle="tooltip"></div>\r\n <% } %>\r\n </div>\r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReply) { %>\r\n <div class="reply-ct">\r\n <textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength"></textarea>\r\n <button class="btn normal dlg-btn primary btn-reply" id="id-comments-change">textReply</button>\r\n <button class="btn normal dlg-btn btn-close">textClose</button>\r\n </div>\r\n <% } %>\r\n <% if (lock) { %>\r\n <div class="lock-area"></div>\r\n <div class="lock-author"><%=lockuserid%></div>\r\n <% } %>\r\n <% if (!last) { %>\r\n <div class="separator-cmt"></div>\r\n <% } %>\r\n </div>\r\n<% } %>\r\n'}),define("text!common/main/lib/template/CommentsPanel.template",[],function(){return'<div id="comments-box" class="layout-ct vbox">\r\n <div class="layout-item messages-ct"/>\r\n <div class="layout-item add-link-ct">\r\n <label class="btn new"><%=textAddCommentToDoc%></label>\r\n </div>\r\n <div style="display: none;" class="layout-item new-comment-ct">\r\n <div class="inner-ct">\r\n <textarea id="comment-msg-new" class="user-select" placeholder="<%=textEnterCommentHint%>" maxlength="<%=maxCommLength%>"/>\r\n </div>\r\n <button class="btn add normal dlg-btn primary"><%=textAddComment%></button>\r\n <button class="btn cancel normal dlg-btn"><%=textCancel%></button>\r\n </div>\r\n</div>\r\n'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Comments",["text!common/main/lib/template/Comments.template","text!common/main/lib/template/CommentsPanel.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o}Common.Views.Comments=Common.UI.BaseView.extend(_.extend({el:"#left-panel-comments",template:_.template(e),addCommentHeight:45,newCommentHeight:110,textBoxAutoSizeLocked:void 0,viewmode:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.store=this.options.store},render:function(){var e=this;this.rendered||(this.$el.html(this.template({textAddCommentToDoc:e.textAddCommentToDoc,textAddComment:e.textAddComment,textCancel:e.textCancel,textEnterCommentHint:e.textEnterCommentHint,maxCommLength:Asc.c_oAscMaxCellOrCommentLength})),this.buttonAddCommentToDoc=new Common.UI.Button({el:$(".btn.new",this.$el),enableToggle:!1}),this.buttonAdd=new Common.UI.Button({action:"add",el:$(".btn.add",this.$el),enableToggle:!1}),this.buttonCancel=new Common.UI.Button({el:$(".btn.cancel",this.$el),enableToggle:!1}),this.buttonAddCommentToDoc.on("click",_.bind(this.onClickShowBoxDocumentComment,this)),this.buttonAdd.on("click",_.bind(this.onClickAddDocumentComment,this)),this.buttonCancel.on("click",_.bind(this.onClickCancelDocumentComment,this)),this.txtComment=$("#comment-msg-new",this.el),this.txtComment.keydown(function(t){if(!t.ctrlKey&&!t.metaKey||t.altKey||t.keyCode!=Common.UI.Keys.RETURN){if(t.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,t.stopImmediatePropagation(),t.preventDefault()}}else e.onClickAddDocumentComment(),t.stopImmediatePropagation()}));var n=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,listenStoreEvents:!1,template:_.template('<div class="dataview-ct inner"></div>')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(){var t=$(this.el).find("textarea");if(t&&t.length){var e=t.val();t.focus(),t.val(""),t.val(e)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function t(){n.scrollHeight>n.clientHeight?i.css({height:n.scrollHeight+s+"px"}):(a=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(l=Math.max(n.scrollHeight+s,o),i.css({height:l+"px"}))),e.autoScrollToEditButtons()}var e=this,i=$(this.el).find("textarea"),n=null,o=50,s=0,a=0,l=0;i&&i.length&&(n=i.get(0))&&(s=.25*parseInt(i.css("lineHeight"),10),t(),i.bind("input propertychange",t)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)},autoScrollToEditButtons:function(){var t=$("#id-comments-change"),e=null,i=this.el.getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)}}}());if(n)if(this.commentsView)this.commentsView.onResetItems();else{this.commentsView=new n({el:$(".messages-ct",e.el),store:e.store,itemTemplate:_.template(i(t,{textAddReply:e.textAddReply,textAdd:e.textAdd,textCancel:e.textCancel,textEdit:e.textEdit,textReply:e.textReply,textClose:e.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var o=function(t,i,n){i.tipsArray&&i.tipsArray.forEach(function(t){t.remove()});var o=[],s=$(i.el).find(".btn-resolve");s.tooltip({title:e.textResolve,placement:"cursor"}),s.each(function(t,e){o.push($(e).data("bs.tooltip").tip())}),s=$(i.el).find(".btn-resolve-check"),s.tooltip({title:e.textOpenAgain,placement:"cursor"}),s.each(function(t,e){o.push($(e).data("bs.tooltip").tip())}),i.tipsArray=o};this.commentsView.on("item:add",o),this.commentsView.on("item:remove",o),this.commentsView.on("item:change",o),this.commentsView.on("item:click",function(t,i,n,o){function s(){e.update()}var a,l,r,c,h;if(a=$(o.target))if(l=n.get("editText"),r=n.get("showReply"),c=n.get("uid"),h=a.attr("data-value"),a.hasClass("btn-edit"))_.isUndefined(h)?l||(e.fireEvent("comment:closeEditing"),n.set("editText",!0),this.autoHeightTextBox(),s(),this.setFocusToTextBox(),e.hookTextBox()):(e.fireEvent("comment:closeEditing",[c]),e.fireEvent("comment:editReply",[c,h]),e.commentsView.reply=h,this.autoHeightTextBox(),s(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(a.hasClass("btn-delete"))_.isUndefined(h)?(e.fireEvent("comment:remove",[c]),Common.NotificationCenter.trigger("edit:complete",e)):e.fireEvent("comment:removeReply",[c,h]),e.fireEvent("comment:closeEditing"),s();else if(a.hasClass("user-reply"))e.fireEvent("comment:closeEditing"),n.set("showReply",!0),s(),this.autoHeightTextBox(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox();else if(a.hasClass("btn-reply",!1))r&&(e.fireEvent("comment:addReply",[c,this.getActiveTextBoxVal()]),e.fireEvent("comment:closeEditing"),s());else if(a.hasClass("btn-close",!1))e.fireEvent("comment:closeEditing",[c]);else if(a.hasClass("btn-inner-edit",!1))_.isUndefined(e.commentsView.reply)?l&&e.fireEvent("comment:change",[c,this.getActiveTextBoxVal()]):(e.fireEvent("comment:changeReply",[c,e.commentsView.reply,this.getActiveTextBoxVal()]),e.commentsView.reply=void 0),e.fireEvent("comment:closeEditing"),s();else if(a.hasClass("btn-inner-close",!1))e.fireEvent("comment:closeEditing"),e.commentsView.reply=void 0,s();else if(a.hasClass("btn-resolve",!1)){var d=a.data("bs.tooltip");d&&(d.dontShow=!0),e.fireEvent("comment:resolve",[c]),s()}else if(a.hasClass("btn-resolve-check",!1)){var d=a.data("bs.tooltip");d&&(d.dontShow=!0),e.fireEvent("comment:resolve",[c]),s()}else a.hasClass("msg-reply")||a.hasClass("btn-resolve-check")||a.hasClass("btn-resolve")||e.fireEvent("comment:show",[c,!1])})}return this.rendered||this.setupLayout(),this.update(),this.rendered=!0,this},update:function(){this.updateLayout(),this.updateScrolls()},updateScrolls:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},showEditContainer:function(t){var e=$(".add-link-ct",this.el),i=$(".new-comment-ct",this.el);$(".messages-ct",this.el),$("#comments-box",this.el);this.layout.freezePanels(!t),t?(e.css({display:"none"}),i.css({display:"table-row"}),this.txtComment.val(""),this.txtComment.focus(),this.textBoxAutoSizeLocked=void 0):(e.css({display:"table-row"}),i.css({display:"none"})),this.updateLayout(),this.updateScrolls()},onClickShowBoxDocumentComment:function(){this.fireEvent("comment:closeEditing"),this.showEditContainer(!0)},onClickAddDocumentComment:function(){this.fireEvent("comment:add",[this,this.txtComment.val().trim(),void 0,!1,!0]),this.txtComment.val("")},onClickCancelDocumentComment:function(){this.showEditContainer(!1)},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},hookTextBox:function(){var t=this.commentsView.getTextBox();t&&t.keydown(function(t){if(!t.ctrlKey&&!t.metaKey||t.altKey||t.keyCode!=Common.UI.Keys.RETURN){if(t.keyCode===Common.UI.Keys.TAB){var e,i,n;n=this.selectionStart,i=this.selectionEnd,e=$(this),e.val(e.val().substring(0,n)+"\t"+e.val().substring(i)),this.selectionStart=this.selectionEnd=n+1,t.stopImmediatePropagation(),t.preventDefault()}}else{var o=$("#id-comments-change");o&&o.length&&o.click(),t.stopImmediatePropagation()}})},setupLayout:function(){var t=this,e=$(t.el),i=$(".new-comment-ct",t.el),n=($(".add-link-ct",t.el),$("#comments-box",t.el)),o=n.find(" > .layout-item");t.layout=new Common.UI.VBoxLayout({box:n,freeze:!0,items:[{el:o[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var e=n.height();return"none"!==i.css("display")&&.5*e<t.newCommentHeight?e-t.newCommentHeight:.5*e},fmax:function(){return"none"!==i.css("display")?n.height()-t.newCommentHeight:n.height()-t.addCommentHeight}}},{el:o[1],stretch:!0},{el:o[2],stretch:!0}]}),t.layout.on("layout:resizedrag",function(){t.updateScrolls(),t.textBoxAutoSizeLocked=!0},this),$(window).on("resize",function(){if("none"!==e.css("display")){var i=$("#comments-box",t.el).height(),n=$(".new-comment-ct",t.el),o=$(".add-link-ct",t.el);"none"!==n.css("display")?t.layout.setResizeValue(0,Math.max(-t.newCommentHeight,Math.min(i-(n.height()+4),i-t.newCommentHeight))):t.layout.setResizeValue(0,Math.max(-t.addCommentHeight,Math.min(i-o.height(),i-t.addCommentHeight))),t.updateScrolls()}}),this.autoHeightTextBox()},changeLayout:function(t){var e=this,i=$(".new-comment-ct",this.el),n=$(".add-link-ct",this.el),o=$(".messages-ct",this.el);if(o.toggleClass("stretch",!t.canComments),t.canComments){var s=$("#comments-box",this.el),a=s.find(" > .layout-item");n.show(),this.layout.changeLayout([{el:a[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var t=s.height();return"none"!==i.css("display")&&.5*t<e.newCommentHeight?t-e.newCommentHeight:.5*t},fmax:function(){return"none"!==i.css("display")?s.height()-e.newCommentHeight:s.height()-e.addCommentHeight}}},{el:a[1],stretch:!0},{el:a[2],stretch:!0}])}else i.hide(),n.hide(),this.layout.changeLayout([{el:o[0],rely:!1,stretch:!0}])},updateLayout:function(){var t=$("#comments-box",this.el);"none"!==$(".new-comment-ct",this.el).css("display")?this.layout.setResizeValue(0,t.height()-this.newCommentHeight):this.layout.setResizeValue(0,t.height()-this.addCommentHeight)},autoHeightTextBox:function(){function t(){var t,o,s;if(t=$("#comment-msg-new",e.el),s=$("#comments-box",e.el).height(),0==t.val().length)return e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,s-e.newCommentHeight)),void(e.textBoxAutoSizeLocked=void 0);_.isUndefined(e.textBoxAutoSizeLocked)&&(t.height(),o=t.get(0).scrollHeight,t.css({height:n+"px"}),t.height(),o=Math.max(t.get(0).scrollHeight+i,48),t.css({height:"100%"}),s=$("#comments-box",e.el).height(),e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,Math.min(s-o-48,s-e.newCommentHeight))))}var e=this,i=0,n=44,o=$("#comment-msg-new",this.el);o.length<1||(i=.25*parseInt(o.css("lineHeight"),10),t(),o.bind("input propertychange",t),this.textBox=o)},getFixedQuote:function(t){return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(t),120,!0)},getUserName:function(t){return Common.Utils.String.htmlEncode(t)},pickLink:function(t){var e,i,n=[];t=Common.Utils.String.htmlEncode(t),t.replace(Common.Utils.ipStrongRe,function(t){return e=arguments[arguments.length-2],n.push({start:e,end:t.length+e,str:'<a href="'+t+'" target="_blank" data-can-copy="true">'+t+"</a>"}),""}),(t.length<1e3||t.search(/\S{255,}/)<0)&&t.replace(Common.Utils.hostnameStrongRe,function(t){var o=/(((^https?)|(^ftp)):\/\/)/i.test(t)?t:"http://"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&e<t.end||e<=t.start&&e+i>t.start})||n.push({start:e,end:i+e,str:'<a href="'+o+'" target="_blank" data-can-copy="true">'+t+"</a>"}),""}),t.replace(Common.Utils.emailStrongRe,function(t){var o=/((^mailto:)\/\/)/i.test(t)?t:"mailto:"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&e<t.end||e<=t.start&&e+i>t.start})||n.push({start:e,end:i+e,str:'<a href="'+o+'">'+t+"</a>"}),""}),n=_.sortBy(n,function(t){return t.start});for(var o=n.length>0?t.substring(0,n[0].start)+n[0].str:t,s=1;s<n.length;s++)o+=t.substring(n[s-1].end,n[s].start)+n[s].str;return n.length>0&&(o+=t.substring(n[s-1].end,t.length)),o},pickEMail:function(t,e){var i=Common.Utils.String.htmlEncode(e).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._]+\.[A-Z]+\b/gi);i=_.map(i,function(t){return t.slice(1,t.length)}),i.length>0&&Common.Gateway.requestSendNotify({emails:i,actionId:t,actionLink:{action:{type:"comment",data:t}},message:e})},textComments:"Comments",textAnonym:"Guest",textAddCommentToDoc:"Add Comment to Document",textAddComment:"Add Comment",textCancel:"Cancel",textAddReply:"Add Reply",textReply:"Reply",textClose:"Close",textResolved:"Resolved",textResolve:"Resolve",textEnterCommentHint:"Enter your comment here",textEdit:"Edit",textAdd:"Add",textOpenAgain:"Open Again",textHintAddComment:"Add Comment"},Common.Views.Comments||{}))}),define("text!common/main/lib/template/Chat.template",[],function(){return'<div id="chat-box" class="layout-ct vbox">\r\n <div id="chat-users" class="layout-item area">\r\n <div id="chat-user-ct"></div>\r\n </div>\r\n <div id="chat-messages" class="layout-item area">\r\n <div id="chat-message-ct"></div>\r\n </div>\r\n <div id="chat-options" class="layout-item">\r\n <div id="chat-options-ct">\r\n <textarea id="chat-msg-text" class="user-select" maxlength="<%=maxMsgLength%>"></textarea>\r\n <button id="chat-msg-btn-add" class="btn normal dlg-btn primary"><%=scope.textSend%></button>\r\n </div>\r\n </div>\r\n</div>'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Chat",["text!common/main/lib/template/Chat.template","common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(t){"use strict";Common.Views.Chat=Common.UI.BaseView.extend(_.extend({el:"#left-panel-chat",template:_.template(t),storeUsers:void 0,storeMessages:void 0,tplUser:['<li id="<%= user.get("iid") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>','<div class="name"><div class="color" style="background-color: <%= user.get("color") %>;" ></div><%= scope.getUserName(user.get("username")) %>',"</div>","</li>"].join(""),templateUserList:_.template("<ul><% for (originalId in users) { %><%= _.template(usertpl)({user: users[originalId][0], scope: scope}) %><% } %></ul>"),tplMsg:["<li>",'<% if (msg.get("type")==1) { %>','<div class="message service" data-can-copy="true"><%= msg.get("message") %></div>',"<% } else { %>",'<div class="user-name" data-can-copy="true">','<div class="color" style="display: inline-block; background-color: <% if (msg.get("usercolor")!==null) { %><%=msg.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(msg.get("username")) %>',"</div>",'<label class="message user-select" data-can-copy="true"><%= msg.get("message") %></label>',"<% } %>","</li>"].join(""),templateMsgList:_.template("<ul><% _.each(messages, function(item) { %><%= _.template(msgtpl)({msg: item, scope: scope}) %><% }); %></ul>"),events:{},usersBoxHeight:72,messageBoxHeight:70,addMessageBoxHeight:110,initialize:function(t){_.extend(this,t),Common.UI.BaseView.prototype.initialize.call(this,arguments),this.storeUsers.bind({add:_.bind(this._onResetUsers,this),change:_.bind(this._onResetUsers,this),reset:_.bind(this._onResetUsers,this)}),this.storeMessages.bind({add:_.bind(this._onAddMessage,this),reset:_.bind(this._onResetMessages,this)})},render:function(t){return t=t||this.el,$(t).html(this.template({scope:this,maxMsgLength:Asc.c_oAscMaxCellOrCommentLength})),this.panelBox=$("#chat-box",this.el),this.panelUsers=$("#chat-users",this.el),this.panelMessages=$("#chat-messages",this.el),this.txtMessage=$("#chat-msg-text",this.el),this.panelOptions=$("#chat-options",this.el),this.panelUsers.scroller=new Common.UI.Scroller({el:$("#chat-users"),useKeyboard:!0,minScrollbarLength:25}),this.panelMessages.scroller=new Common.UI.Scroller({el:$("#chat-messages"),includePadding:!0,useKeyboard:!0,minScrollbarLength:40}),$("#chat-msg-btn-add",this.el).on("click",_.bind(this._onBtnAddMessage,this)),this.txtMessage.on("keydown",_.bind(this._onKeyDown,this)),this.setupLayout(),this},focus:function(){var t=this;_.defer(function(){t.txtMessage.focus()},100),this.updateLayout(!0),this.setupAutoSizingTextBox()},_onKeyDown:function(t){t.keyCode==Common.UI.Keys.RETURN?!t.ctrlKey&&!t.metaKey||t.altKey||this._onBtnAddMessage(t):t.keyCode==Common.UI.Keys.ESC&&this.hide()},_onResetUsers:function(t,e){this.panelUsers&&(this.panelUsers.html(this.templateUserList({users:this.storeUsers.chain().filter(function(t){return t.get("online")}).groupBy(function(t){return t.get("idOriginal")}).value(),usertpl:this.tplUser,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onAddMessage:function(t,e,i){if(this.panelMessages){var n=this.panelMessages.find("ul");n&&n.length&&(this._prepareMessage(t),n.append(_.template(this.tplMsg)({msg:t,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.panelMessages.scroller.scrollTop(n.get(0).getBoundingClientRect().height))}},_onResetMessages:function(t,e){if(this.panelMessages){t.each(function(t){this._prepareMessage(t)},this),this.panelMessages.html(this.templateMsgList({messages:t.models,msgtpl:this.tplMsg,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},_onBtnAddMessage:function(t){this.txtMessage&&(this.fireEvent("message:add",[this,this.txtMessage.val().trim()]),this.txtMessage.val(""),this.focus())},_prepareMessage:function(t){var e=this.storeUsers.findOriginalUser(t.get("userid"));t.set({usercolor:e?e.get("color"):null,message:this._pickLink(Common.Utils.String.htmlEncode(t.get("message")))},{silent:!0})},_pickLink:function(t){var e,i,n=[];t.replace(Common.Utils.ipStrongRe,function(t){return e=arguments[arguments.length-2],n.push({start:e,end:t.length+e,str:'<a href="'+t+'" target="_blank" data-can-copy="true">'+t+"</a>"}),""}),(t.length<1e3||t.search(/\S{255,}/)<0)&&t.replace(Common.Utils.hostnameStrongRe,function(t){var o=/(((^https?)|(^ftp)):\/\/)/i.test(t)?t:"http://"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&e<t.end||e<=t.start&&e+i>t.start})||n.push({start:e,end:i+e,str:'<a href="'+o+'" target="_blank" data-can-copy="true">'+t+"</a>"}),""}),t.replace(Common.Utils.emailStrongRe,function(t){var o=/((^mailto:)\/\/)/i.test(t)?t:"mailto:"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&e<t.end||e<=t.start&&e+i>t.start})||n.push({start:e,end:i+e,str:'<a href="'+o+'">'+t+"</a>"}),""}),n=_.sortBy(n,function(t){return t.start});for(var o=n.length>0?t.substring(0,n[0].start)+n[0].str:t,s=1;s<n.length;s++)o+=t.substring(n[s-1].end,n[s].start)+n[s].str;return n.length>0&&(o+=t.substring(n[s-1].end,t.length)),o},getUserName:function(t){return Common.Utils.String.htmlEncode(t)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this),this.textBoxAutoSizeLocked=void 0},setupLayout:function(){var t=this,e=$(t.el),i=this.panelBox.find(" > .layout-item");t.layout=new Common.UI.VBoxLayout({box:this.panelBox,items:[{el:i[0],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return t.usersBoxHeight},fmax:function(){return.5*t.panelBox.height()-t.messageBoxHeight}}},{el:i[1],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return Math.max(t.messageBoxHeight+t.usersBoxHeight,.5*t.panelBox.height())},fmax:function(){return t.panelBox.height()-t.addMessageBoxHeight}}},{el:i[2],stretch:!0}]}),t.layout.on("layout:resizedrag",function(e){t.updateScrolls(),t.usersCachedHeigt=t.panelUsers.height()+8+1,e.index||(t.textBoxAutoSizeLocked=!0)},this),$(window).on("resize",function(){"none"!==e.css("display")&&t.updateLayout()}),this.updateLayout();var n=this.panelBox.height();this.layout.setResizeValue(0,this.usersBoxHeight),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.max(.5*n,n-t.panelOptions.height()-4))),this.setupAutoSizingTextBox(),this.txtMessage.bind("input propertychange",_.bind(this.updateHeightTextBox,this))},updateLayout:function(t){var e=this,i=this.panelBox.height();if(e.layout.setResizeValue(1,Math.max(e.addMessageBoxHeight,Math.max(.5*i,i-e.panelOptions.height()-4))),t){this.panelUsers.css("height");this.panelUsers.css("height","1px");var n=this.panelUsers.get(0).scrollHeight;e.layout.setResizeValue(0,Math.max(e.usersBoxHeight,Math.min(n+2,Math.floor(.5*i)-e.messageBoxHeight)))}else e.layout.setResizeValue(0,Math.max(e.usersBoxHeight,Math.min(e.usersCachedHeigt+2,Math.floor(.5*i)-e.messageBoxHeight)));e.updateScrolls(),e.updateHeightTextBox(null)},setupAutoSizingTextBox:function(){this.lineHeight=0,this.minHeight=44,this.lineHeight=1.25*parseInt(this.txtMessage.css("lineHeight"),10),this.updateHeightTextBox(!0)},updateHeightTextBox:function(t){var e,i,n=this.txtMessage;if(i=this.panelBox.height(),t&&0==n.val().length)return this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,i-this.addMessageBoxHeight)),this.textBoxAutoSizeLocked=void 0,void this.updateScrolls();_.isUndefined(this.textBoxAutoSizeLocked)&&(n.height(),e=n.get(0).scrollHeight,n.css({height:this.minHeight+"px"}),n.height(),e=Math.max(n.get(0).scrollHeight+this.lineHeight,1),n.css({height:"100%"}),i=this.panelBox.height(),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.min(i-e-40,i-this.addMessageBoxHeight)))&&this.updateScrolls())},updateScrolls:function(){this.panelUsers&&this.panelUsers.scroller&&this.panelMessages&&this.panelMessages.scroller&&(this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},textSend:"Send"},Common.Views.Chat||{}))}),define("common/main/lib/view/SearchDialog",["common/main/lib/component/Window"],function(){"use strict";Common.UI.SearchDialog=Common.UI.Window.extend(_.extend({options:{width:550,title:"Search & Replace",modal:!1,cls:"search",toolclose:"hide",alias:"SearchDialog"},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div class="box">','<div class="input-row">','<span class="btn-placeholder" id="search-placeholder-btn-options"></span>','<input type="text" id="sd-text-search" class="form-control" maxlength="255" placeholder="'+this.textSearchStart+'">',"</div>",'<div class="input-row">','<input type="text" id="sd-text-replace" class="form-control" maxlength="255" placeholder="'+this.textReplaceDef+'">',"</div>",'<div class="input-row">','<label class="link" id="search-label-replace" result="replaceshow">'+this.txtBtnReplace+"</label>","</div>","</div>",'<div class="separator horizontal"/>','<div class="footer right">','<button class="btn normal dlg-btn" result="replace" style="margin-right: 6px;">'+this.txtBtnReplace+"</button>",'<button class="btn normal dlg-btn" result="replaceall" style="margin-right: 10px;">'+this.txtBtnReplaceAll+"</button>",'<button class="btn normal dlg-btn iconic" result="back" style="margin-right: 6px;"><span class="icon img-commonctrl back" /></button>','<button class="btn normal dlg-btn iconic" result="next"><span class="icon img-commonctrl next" /></button>',"</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){return Common.UI.Window.prototype.render.call(this),this.miMatchCase=new Common.UI.MenuItem({caption:this.textMatchCase,checkable:!0}),this.miMatchWord=new Common.UI.MenuItem({caption:this.options.matchwordstr||this.textWholeWords,checkable:!0}),this.miHighlight=new Common.UI.MenuItem({caption:this.textHighlight,checkable:!0}),this.btnOptions=new Common.UI.Button({id:"search-btn-options",cls:"btn-toolbar",iconCls:"btn-settings",menu:new Common.UI.Menu({items:[this.miMatchCase,this.miMatchWord,this.miHighlight]})}),this.options.extraoptions&&(this.btnOptions.menu.addItem({caption:"--"}),this.options.extraoptions.forEach(function(t){this.btnOptions.menu.addItem(t)},this)),this.btnOptions.render(this.$window.find("#search-placeholder-btn-options")),this.options.matchcase||this.miMatchCase.hide(),this.options.matchword||this.miMatchWord.hide(),this.options.markresult?this.options.markresult.applied&&this.miHighlight.setChecked(!0,!0):this.miHighlight.hide(),"search"===this.options.mode&&$(this.$window.find(".input-row").get(2)).hide(),this.txtSearch=this.$window.find("#sd-text-search"),this.txtReplace=this.$window.find("#sd-text-replace"),this.lblReplace=this.$window.find("#search-label-replace"),this.miHighlight.on("toggle",_.bind(this.onHighlight,this)),this.$window.find(".btn[result=back]").on("click",_.bind(this.onBtnClick,this,"back")),this.$window.find(".btn[result=next]").on("click",_.bind(this.onBtnClick,this,"next")),this.$window.find(".btn[result=replace]").on("click",_.bind(this.onBtnClick,this,"replace")),this.$window.find(".btn[result=replaceall]").on("click",_.bind(this.onBtnClick,this,"replaceall")),this.$window.find("label[result=replaceshow]").on("click",_.bind(this.onShowReplace,this)),this.txtSearch.on("keydown",null,"search",_.bind(this.onKeyPress,this)),this.txtReplace.on("keydown",null,"replace",_.bind(this.onKeyPress,this)),this.on("animate:before",_.bind(this.focus,this)),this},show:function(t,e){Common.UI.Window.prototype.show.call(this),!this.mode&&!t&&(t="search"),t&&this.mode!=t&&this.setMode(t),e&&this.setSearchText(e),this.options.markresult&&this.miHighlight.checked&&this.fireEvent("search:highlight",[this,!0]),this.focus()},focus:function(){var t=this;setTimeout(function(){t.txtSearch.focus(),t.txtSearch.select()},10)},onKeyPress:function(t){this.isLocked()||(t.keyCode==Common.UI.Keys.RETURN?("search"==t.data?this.onBtnClick("next",t):"replace"==t.data&&"replace"==this.mode&&this.onBtnClick("replace",t),t.preventDefault(),t.stopPropagation()):t.keyCode==Common.UI.Keys.ESC&&$(".asc-loadmask").length<1&&(this.hide(),t.preventDefault(),t.stopPropagation()))},onBtnClick:function(t,e){if(!$(".asc-loadmask").length){var i={
|
|
|
textsearch:this.txtSearch.val(),textreplace:this.txtReplace.val(),matchcase:this.miMatchCase.checked,matchword:this.miMatchWord.checked,highlight:this.miHighlight.checked};this.fireEvent("search:"+t,[this,i])}},setMode:function(t){this.mode=t;var e=this.$window.find(".input-row");"no-replace"===t?(this.setTitle(this.textTitle2),e.eq(1).hide(),e.eq(2).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.options.matchcase||this.options.matchword||this.options.markresult||(this.txtSearch.addClass("clear"),this.btnOptions.hide()),this.menuLookin&&this.menuLookin.menu.items[1].setDisabled(!1),this.setHeight(170)):(this.txtSearch.removeClass("clear"),this.setTitle(this.textTitle),"search"===t?(e.eq(2).show(),this.lblReplace.text(this.txtBtnReplace),e.eq(1).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.menuLookin&&this.menuLookin.menu.items[1].setDisabled(!1),this.setHeight(200)):(e.eq(2).show(),this.lblReplace.text(this.txtBtnHideReplace),e.eq(1).show(),this.$window.find(".btn[result=replace]").show(),this.$window.find(".btn[result=replaceall]").show(),this.menuLookin&&(this.menuLookin.menu.items[0].setChecked(!0),this.menuLookin.menu.items[1].setDisabled(!0)),this.setHeight(230)))},setSearchText:function(t){this.txtSearch&&this.txtSearch.val(t)},onShowReplace:function(t){this.setMode("replace"==this.mode?"search":"replace");var e=this;_.defer(function(){"replace"==e.mode?e.txtReplace.focus():e.txtSearch.focus()},300)},onHighlight:function(t,e){this.fireEvent("search:highlight",[this,e])},getSettings:function(){return{textsearch:this.txtSearch.val(),matchcase:this.miMatchCase.checked,matchword:this.miMatchWord.checked}},textTitle:"Search & Replace",textTitle2:"Search",txtBtnReplace:"Replace",txtBtnReplaceAll:"Replace All",textMatchCase:"Case sensitive",textWholeWords:"Whole words only",textHighlight:"Highlight results",textReplaceDef:"Enter the replacement text",textSearchStart:"Enter text for search",txtBtnHideReplace:"Hide Replace"},Common.UI.SearchDialog||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Plugins",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Plugins=Common.UI.BaseView.extend(_.extend({el:"#left-panel-plugins",storePlugins:void 0,template:_.template(['<div id="plugins-box" class="layout-ct vbox">','<label id="plugins-header"><%= scope.strPlugins %></label>','<div id="plugins-list" class="">',"</div>","</div>",'<div id="current-plugin-box" class="layout-ct vbox hidden">','<div id="current-plugin-header">',"<label></label>",'<div id="id-plugin-close" class="plugin-close img-commonctrl"></div>',"</div>",'<div id="current-plugin-frame" class="">',"</div>","</div>",'<div id="plugins-mask" style="display: none;">'].join("")),initialize:function(t){_.extend(this,t),this._locked=!1,this._state={DisabledControls:!1},this.lockedControls=[],Common.UI.BaseView.prototype.initialize.call(this,arguments),Common.NotificationCenter.on("app:ready",function(t){Common.Utils.asyncCall(this._onAppReady,this,t)}.bind(this))},render:function(t){return t&&(this.$el=$(t)),this.$el.html(this.template({scope:this})),this.viewPluginsList=new Common.UI.DataView({el:$("#plugins-list"),store:this.storePlugins,enableKeyEvents:!1,itemTemplate:_.template(['<div id="<%= id %>" class="item-plugins" style="display: <% if (visible) {%> block; <%} else {%> none; <% } %>">','<div class="plugin-icon" style="background-image: url(<%= baseUrl %><%= variations[currentVariation].get("icons")[((window.devicePixelRatio > 1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);"></div>',"<% if (variations.length>1) { %>",'<div class="plugin-caret img-commonctrl"></div>',"<% } %>","<%= name %>","</div>"].join(""))}),this.lockedControls.push(this.viewPluginsList),this.viewPluginsList.cmpEl.off("click"),this.pluginName=$("#current-plugin-header label"),this.pluginsPanel=$("#plugins-box"),this.pluginsMask=$("#plugins-mask",this.$el),this.currentPluginPanel=$("#current-plugin-box"),this.currentPluginFrame=$("#current-plugin-frame"),this.pluginMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[]}),this.trigger("render:after",this),this},getPanel:function(){var t=$('<section id="plugins-panel" class="panel" data-tab="plugins"></section>'),e=$('<div class="group"></div>');return this.storePlugins.isEmpty()||this.storePlugins.each(function(t){}),e.appendTo(t),t},renderTo:function(t){if(!this.storePlugins.isEmpty()){var e=this,i=$('<div class="group"></div>');this.storePlugins.each(function(t){if(t.get("visible")){var n=t.get("variations"),o=t.get("guid"),s=n[t.get("currentVariation")].get("icons"),a=t.get("baseUrl")+s[(window.devicePixelRatio>1?1:0)+(s.length>2?2:0)],l=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconImg:a,caption:t.get("name"),menu:n&&n.length>1,split:n&&n.length>1,value:o,hint:t.get("name")}),r=$('<span class="slot"></span>').appendTo(i);l.render(r),t.set("button",l),e.lockedControls.push(l)}}),t.html(i),$('<div class="separator long"></div>').prependTo(t)}},setLocked:function(t){this._locked=t},ChangeSettings:function(t){this.disableControls(this._locked)},disableControls:function(t){this._state.DisabledControls!==t&&(this._state.DisabledControls=t,_.each(this.lockedControls,function(e){e.setDisabled(t)}),this.pluginsMask&&this.pluginsMask.css("display",t?"block":"none"))},openInsideMode:function(t,e,i){return!!this.pluginsPanel&&(this.pluginsPanel.toggleClass("hidden",!0),this.currentPluginPanel.toggleClass("hidden",!1),this.pluginName.text(t),this.iframePlugin||(this.iframePlugin=document.createElement("iframe"),this.iframePlugin.id=void 0===i?"plugin_iframe":i,this.iframePlugin.name="pluginFrameEditor",this.iframePlugin.width="100%",this.iframePlugin.height="100%",this.iframePlugin.align="top",this.iframePlugin.frameBorder=0,this.iframePlugin.scrolling="no",this.iframePlugin.onload=_.bind(this._onLoad,this),this.currentPluginFrame.append(this.iframePlugin),this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:this.currentPluginFrame})),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),this.iframePlugin.src=e),this.fireEvent("plugin:open",[this,"onboard","open"]),!0)},closeInsideMode:function(){this.pluginsPanel&&(this.iframePlugin&&(this.currentPluginFrame.empty(),this.iframePlugin=null),this.currentPluginPanel.toggleClass("hidden",!0),this.fireEvent("plugin:open",[this,"onboard","close"]))},openedPluginMode:function(t){var e=this.storePlugins.findWhere({guid:t});if(e){var i=e.get("button");i&&(i.toggle(!0),i.menu&&i.menu.items.length>0&&i.menu.items[0].setCaption(this.textStop))}},closedPluginMode:function(t){var e=this.storePlugins.findWhere({guid:t});if(e){var i=e.get("button");i&&(i.toggle(!1),i.menu&&i.menu.items.length>0&&i.menu.items[0].setCaption(this.textStart))}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},_onAppReady:function(t){},createPluginButton:function(t){if(!t.get("visible"))return null;var e=this,i=t.get("variations"),n=t.get("guid"),o=i[t.get("currentVariation")].get("icons"),s=t.get("baseUrl")+o[(window.devicePixelRatio>1?1:0)+(o.length>2?2:0)],a=[];_.each(t.get("variations"),function(t,i){t.get("visible")&&a.push({caption:i>0?t.get("description"):e.textStart,value:parseInt(t.get("index"))})});var l=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconImg:s,caption:t.get("name"),menu:a.length>1,split:a.length>1,value:n,hint:t.get("name")});return l.split&&(l.setMenu(new Common.UI.Menu({items:a,pluginGuid:t.get("guid")})),l.menu.on("item:click",function(t,i,n){e.fireEvent("plugin:select",[t.options.pluginGuid,i.value])})),l.on("click",function(t,i){e.fireEvent("plugin:select",[t.options.value,0])}),t.set("button",l),e.lockedControls.push(l),l},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},strPlugins:"Plugins",textLoading:"Loading",textStart:"Start",textStop:"Stop",groupCaption:"Plugins"},Common.Views.Plugins||{})),Common.Views.PluginDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{header:!0,enableKeyEvents:!1},t);var i=e.buttons&&_.size(e.buttons)>0?85:34;e.header||(i-=34),this.bordersOffset=40,e.width=Common.Utils.innerWidth()-2*this.bordersOffset-e.width<0?Common.Utils.innerWidth()-2*this.bordersOffset:e.width,e.height+=i,e.height=Common.Utils.innerHeight()-2*this.bordersOffset-e.height<0?Common.Utils.innerHeight()-2*this.bordersOffset:e.height,e.cls+=" advanced-settings-dlg",this.template=['<div id="id-plugin-container" class="box" style="height:'+(e.height-i)+'px;">','<div id="id-plugin-placeholder" style="width: 100%;height: 100%;"></div>',"</div>",'<% if ((typeof buttons !== "undefined") && _.size(buttons) > 0) { %>','<div class="separator horizontal"/>','<div class="footer" style="text-align: center;">',"<% for(var bt in buttons) { %>",'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" style="margin-right: 10px;"><%= buttons[bt].text %></button>',"<% } %>","</div>","<% } %>"].join(""),e.tpl=_.template(this.template)(e),this.url=t.url||"",this.frameId=t.frameId||"plugin_iframe",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"}),this.boxEl=this.$window.find(".body > .box"),this._headerFooterHeight=this.options.buttons&&_.size(this.options.buttons)>0?85:34,this.options.header||(this._headerFooterHeight-=34),this._headerFooterHeight+=parseInt(this.$window.css("border-top-width"))+parseInt(this.$window.css("border-bottom-width"));var t=document.createElement("iframe");t.id=this.frameId,t.name="pluginFrameEditor",t.width="100%",t.height="100%",t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this);var e=this;setTimeout(function(){e.isLoaded||(e.loadMask=new Common.UI.LoadMask({owner:$("#id-plugin-placeholder")}),e.loadMask.setTitle(e.textLoading),e.loadMask.show(),e.isLoaded&&e.loadMask.hide())},500),t.src=this.url,$("#id-plugin-placeholder").append(t),this.on("resizing",function(t){e.boxEl.css("height",parseInt(e.$window.css("height"))-e._headerFooterHeight)});var i=function(){e.onWindowResize()};$(window).on("resize",i),this.on("close",function(){$(window).off("resize",i)})},_onLoad:function(){this.isLoaded=!0,this.loadMask&&this.loadMask.hide()},setInnerSize:function(t,e){var i=Common.Utils.innerHeight(),n=Common.Utils.innerWidth(),o=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width")),s=2*this.bordersOffset;i-s<e+this._headerFooterHeight&&(e=i-s-this._headerFooterHeight),n-s<t+o&&(t=n-s-o),this.boxEl.css("height",e),Common.UI.Window.prototype.setHeight.call(this,e+this._headerFooterHeight),Common.UI.Window.prototype.setWidth.call(this,t+o),this.$window.css("left",(n-t-o)/2),this.$window.css("top",(i-e-this._headerFooterHeight)/2)},onWindowResize:function(){var t=Common.Utils.innerWidth(),e=Common.Utils.innerHeight(),i=this.getWidth(),n=this.getHeight(),o=this.resizable?0:this.bordersOffset;if(n<e-2*o+.1&&i<t-2*o+.1){var s=this.getLeft(),a=this.getTop();a<o?this.$window.css("top",o):a+n>e-o&&this.$window.css("top",e-o-n),s<o?this.$window.css("left",o):s+i>t-o&&this.$window.css("left",t-o-i)}else n>e-2*o&&(this.setHeight(Math.max(e-2*o,this.initConfig.minheight)),this.boxEl.css("height",Math.max(e-2*o,this.initConfig.minheight)-this._headerFooterHeight),this.$window.css("top",o)),i>t-2*o&&(this.setWidth(Math.max(t-2*o,this.initConfig.minwidth)),this.$window.css("left",o))},textLoading:"Loading"},Common.Views.PluginDlg||{}))}),define("text!spreadsheeteditor/main/app/template/FileMenu.template",[],function(){return'<div class="panel-menu">\r\n <li class="fm-first-item"/>\r\n <li id="fm-btn-return" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-save" class="fm-btn" />\r\n <li id="fm-btn-edit" class="fm-btn" />\r\n <li id="fm-btn-download" class="fm-btn" />\r\n <li id="fm-btn-save-copy" class="fm-btn" />\r\n <li id="fm-btn-save-desktop" class="fm-btn" />\r\n <li id="fm-btn-print" class="fm-btn" />\r\n <li id="fm-btn-rename" class="fm-btn" />\r\n <li id="fm-btn-protect" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-recent" class="fm-btn" />\r\n <li id="fm-btn-create" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-info" class="fm-btn" />\r\n <li id="fm-btn-rights" class="fm-btn" />\r\n <li class="devider" class="fm-btn" />\r\n <li id="fm-btn-settings" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-help" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-back" class="fm-btn" />\r\n</div>\r\n<div class="panel-context">\r\n <div id="panel-saveas" class="content-box" />\r\n <div id="panel-savecopy" class="content-box" />\r\n <div id="panel-recentfiles" class="content-box" />\r\n <div id="panel-createnew" class="content-box" />\r\n <div id="panel-info" class="content-box" />\r\n <div id="panel-rights" class="content-box" />\r\n <div id="panel-settings" class="content-box" />\r\n <div id="panel-help" class="content-box" />\r\n <div id="panel-protect" class="content-box" />\r\n</div>'}),define("spreadsheeteditor/main/app/view/FileMenu",["text!spreadsheeteditor/main/app/template/FileMenu.template","underscore","common/main/lib/component/BaseView"],function(t,e){"use strict";SSE.Views.FileMenu=Common.UI.BaseView.extend(e.extend({el:"#file-menu-panel",options:{alias:"FileMenu"},template:e.template(t),events:function(){return{"click .fm-btn":e.bind(function(t){var i=$(t.currentTarget);i.hasClass("active")||($(".fm-btn",this.el).removeClass("active"),i.addClass("active"));var n=e.findWhere(this.items,{el:t.currentTarget});if(n){var o=this.panels[n.options.action];this.fireEvent("item:click",[this,n.options.action,!!o]),o&&(this.$el.find(".content-box:visible").hide(),this.active=n.options.action,o.show())}},this)}},initialize:function(){},render:function(){this.$el=$(this.el),this.$el.html(this.template()),this.miSave=new Common.UI.MenuItem({el:$("#fm-btn-save",this.el),action:"save",caption:this.btnSaveCaption,canFocused:!1,disabled:!0}),this.miEdit=new Common.UI.MenuItem({el:$("#fm-btn-edit",this.el),action:"edit",caption:this.btnToEditCaption,canFocused:!1}),this.miDownload=new Common.UI.MenuItem({el:$("#fm-btn-download",this.el),action:"saveas",caption:this.btnDownloadCaption,canFocused:!1}),this.miSaveCopyAs=new Common.UI.MenuItem({el:$("#fm-btn-save-copy",this.el),action:"save-copy",caption:this.btnSaveCopyAsCaption,canFocused:!1}),this.miSaveAs=new Common.UI.MenuItem({el:$("#fm-btn-save-desktop",this.el),action:"save-desktop",caption:this.btnSaveAsCaption,canFocused:!1}),this.miPrint=new Common.UI.MenuItem({el:$("#fm-btn-print",this.el),action:"print",caption:this.btnPrintCaption,canFocused:!1}),this.miRename=new Common.UI.MenuItem({el:$("#fm-btn-rename",this.el),action:"rename",caption:this.btnRenameCaption,canFocused:!1}),this.miProtect=new Common.UI.MenuItem({el:$("#fm-btn-protect",this.el),action:"protect",caption:this.btnProtectCaption,canFocused:!1}),this.miRecent=new Common.UI.MenuItem({el:$("#fm-btn-recent",this.el),action:"recent",caption:this.btnRecentFilesCaption,canFocused:!1}),this.miNew=new Common.UI.MenuItem({el:$("#fm-btn-create",this.el),action:"new",caption:this.btnCreateNewCaption,canFocused:!1}),this.miAccess=new Common.UI.MenuItem({el:$("#fm-btn-rights",this.el),action:"rights",caption:this.btnRightsCaption,canFocused:!1}),this.miSettings=new Common.UI.MenuItem({el:$("#fm-btn-settings",this.el),action:"opts",caption:this.btnSettingsCaption,canFocused:!1}),this.miHelp=new Common.UI.MenuItem({el:$("#fm-btn-help",this.el),action:"help",caption:this.btnHelpCaption,canFocused:!1}),this.items=[],this.items.push(new Common.UI.MenuItem({el:$("#fm-btn-return",this.el),action:"back",caption:this.btnCloseMenuCaption,canFocused:!1}),this.miSave,this.miEdit,this.miDownload,this.miSaveCopyAs,this.miSaveAs,this.miPrint,this.miRename,this.miProtect,this.miRecent,this.miNew,new Common.UI.MenuItem({el:$("#fm-btn-info",this.el),action:"info",caption:this.btnInfoCaption,canFocused:!1}),this.miAccess,this.miSettings,this.miHelp,new Common.UI.MenuItem({el:$("#fm-btn-back",this.el),action:"exit",caption:this.btnBackCaption,canFocused:!1}));var t=this;return t.panels={opts:new SSE.Views.FileMenuPanels.Settings({menu:t}).render(),info:new SSE.Views.FileMenuPanels.DocumentInfo({menu:t}).render(),rights:new SSE.Views.FileMenuPanels.DocumentRights({menu:t}).render()},t.$el.find(".content-box").hide(),this},show:function(t){if((!this.isVisible()||void 0!==t)&&this.mode){var e=!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline?"info":"saveas";t||(t=this.active||e),this.$el.show(),this.selectMenu(t,e),this.api.asc_enableKeyEvents(!1),this.fireEvent("menu:show",[this])}},hide:function(){this.$el.hide(),this.api&&this.api.asc_enableKeyEvents(!0),this.fireEvent("menu:hide",[this])},applyMode:function(){this.miDownload[!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline?"hide":"show"]();var t=!!window.AscDesktopEditor&&window.AscDesktopEditor.isBlockchainSupport();this.miSaveCopyAs[!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline||!this.mode.canRequestSaveAs&&!this.mode.saveAsUrl||t?"hide":"show"](),this.miSaveAs[this.mode.canDownload&&this.mode.isDesktopApp&&this.mode.isOffline?"show":"hide"](),this.miSave[this.mode.isEdit?"show":"hide"](),this.miEdit[!this.mode.isEdit&&this.mode.canEdit&&this.mode.canRequestEditRights?"show":"hide"](),this.miPrint[this.mode.canPrint?"show":"hide"](),this.miRename[this.mode.canRename&&!this.mode.isDesktopApp?"show":"hide"](),this.miProtect[this.mode.canProtect?"show":"hide"]();var e=this.mode.canDownload||this.mode.isEdit||this.mode.canPrint||this.mode.canProtect||!this.mode.isEdit&&this.mode.canEdit&&this.mode.canRequestEditRights||this.mode.canRename&&!this.mode.isDesktopApp;this.miProtect.$el.find("+.devider")[e&&!this.mode.isDisconnected?"show":"hide"](),this.miRecent[this.mode.canOpenRecent?"show":"hide"](),this.miNew[this.mode.canCreateNew?"show":"hide"](),this.miNew.$el.find("+.devider")[this.mode.canCreateNew?"show":"hide"](),this.miAccess[!this.mode.isOffline&&this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0||this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length)?"show":"hide"](),this.mode.canBack?this.$el.find("#fm-btn-back").show().prev().show():this.$el.find("#fm-btn-back").hide().prev().hide(),this.miHelp[this.mode.canHelp?"show":"hide"](),this.miHelp.$el.prev()[this.mode.canHelp?"show":"hide"](),this.panels.opts.setMode(this.mode),this.panels.info.setMode(this.mode),!this.mode.isDisconnected&&this.panels.info.updateInfo(this.document),this.panels.rights.setMode(this.mode),!this.mode.isDisconnected&&this.panels.rights.updateInfo(this.document),this.mode.canCreateNew&&this.mode.templates&&this.mode.templates.length&&($("a",this.miNew.$el).text(this.btnCreateNewCaption+"..."),this.panels.new=new SSE.Views.FileMenuPanels.CreateNew({menu:this,docs:this.mode.templates}).render()),this.mode.canOpenRecent&&this.mode.recent&&(this.panels.recent=new SSE.Views.FileMenuPanels.RecentFiles({menu:this,recent:this.mode.recent}).render()),this.mode.canProtect&&(this.panels.protect=new SSE.Views.FileMenuPanels.ProtectDoc({menu:this}).render(),this.panels.protect.setMode(this.mode)),this.mode.canDownload&&(this.panels.saveas=new SSE.Views.FileMenuPanels.ViewSaveAs({menu:this}).render()),this.mode.canDownload&&(this.mode.canRequestSaveAs||this.mode.saveAsUrl)&&(this.panels["save-copy"]=new SSE.Views.FileMenuPanels.ViewSaveCopy({menu:this}).render()),this.mode.canHelp&&(this.panels.help=new SSE.Views.FileMenuPanels.Help({menu:this}).render(),this.panels.help.setLangConfig(this.mode.lang))},setMode:function(t,e){t.isDisconnected?(this.mode.canEdit=this.mode.isEdit=!1,this.mode.canOpenRecent=this.mode.canCreateNew=!1,this.mode.isDisconnected=t.isDisconnected,this.mode.canRename=!1,t.enableDownload||(this.mode.canPrint=this.mode.canDownload=!1)):this.mode=t,e||this.applyMode()},setApi:function(t){this.api=t,this.panels.info.setApi(t),this.panels.opts&&this.panels.opts.setApi(t),this.panels.protect&&this.panels.protect.setApi(t),this.api.asc_registerCallback("asc_onDocumentName",e.bind(this.onDocumentName,this))},loadDocument:function(t){this.document=t.doc},selectMenu:function(t,e){if(t){var i=this._getMenuItem(t),n=this.panels[t];!i.isDisabled()&&i.isVisible()||(i=this._getMenuItem(e),n=this.panels[e]),i&&n&&($(".fm-btn",this.el).removeClass("active"),i.$el.addClass("active"),this.$el.find(".content-box:visible").hide(),n.show(),this.active=t)}},_getMenuItem:function(t){return e.find(this.items,function(e){return e.options.action==t})},onDocumentName:function(t){this.document.title=t,this.panels.info.updateInfo(this.document)},isVisible:function(){return!this.$el.is(":hidden")},getButton:function(t){if("save"==t)return this.miSave},btnSaveCaption:"Save",btnDownloadCaption:"Download as...",btnInfoCaption:"Document Info...",btnRightsCaption:"Access Rights...",btnCreateNewCaption:"Create New",btnRecentFilesCaption:"Open Recent...",btnPrintCaption:"Print",btnHelpCaption:"Help...",btnReturnCaption:"Back to Document",btnToEditCaption:"Edit Document",btnBackCaption:"Go to Documents",btnSettingsCaption:"Advanced Settings...",btnSaveAsCaption:"Save as",btnRenameCaption:"Rename...",btnCloseMenuCaption:"Close Menu",btnProtectCaption:"Protect",btnSaveCopyAsCaption:"Save Copy as..."},SSE.Views.FileMenu||{}))}),define("spreadsheeteditor/main/app/view/LeftMenu",["text!spreadsheeteditor/main/app/template/LeftMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/view/About","common/main/lib/view/Comments","common/main/lib/view/Chat","common/main/lib/view/SearchDialog","common/main/lib/view/Plugins","spreadsheeteditor/main/app/view/FileMenu"],function(t,e,i,n){"use strict";SSE.Views.LeftMenu=n.View.extend(i.extend({el:"#left-menu",template:i.template(t),events:function(){return{"click #left-btn-comments":i.bind(this.onCoauthOptions,this),"click #left-btn-chat":i.bind(this.onCoauthOptions,this),"click #left-btn-plugins":i.bind(this.onCoauthOptions,this),"click #left-btn-spellcheck":i.bind(this.onCoauthOptions,this),"click #left-btn-support":function(){var t=this.mode.customization;t&&t.feedback&&t.feedback.url?window.open(t.feedback.url):window.open("https://support.onlyoffice.com")}}},initialize:function(){this.minimizedMode=!0,this._state={}},render:function(){return e(this.el).html(this.template({})),this.btnSearch=new Common.UI.Button({action:"search",el:e("#left-btn-search",this.el),hint:this.tipSearch+Common.Utils.String.platformKey("Ctrl+F"),disabled:!0,enableToggle:!0}),this.btnAbout=new Common.UI.Button({action:"about",el:e("#left-btn-about",this.el),hint:this.tipAbout,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSupport=new Common.UI.Button({action:"support",el:e("#left-btn-support",this.el),hint:this.tipSupport,disabled:!0}),this.btnComments=new Common.UI.Button({el:e("#left-btn-comments",this.el),hint:this.tipComments+Common.Utils.String.platformKey("Ctrl+Shift+H"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnChat=new Common.UI.Button({el:e("#left-btn-chat",this.el),hint:this.tipChat+Common.Utils.String.platformKey("Alt+Q"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnComments.hide(),this.btnChat.hide(),this.btnComments.on("click",i.bind(this.onBtnMenuClick,this)),this.btnComments.on("toggle",i.bind(this.onBtnCommentsToggle,this)),this.btnChat.on("click",i.bind(this.onBtnMenuClick,this)),this.btnPlugins=new Common.UI.Button({el:e("#left-btn-plugins"),hint:this.tipPlugins,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnPlugins.hide(),this.btnPlugins.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSpellcheck=new Common.UI.Button({el:e("#left-btn-spellcheck"),hint:this.tipSpellcheck,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSpellcheck.hide(),this.btnSpellcheck.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSearch.on("click",i.bind(this.onBtnMenuClick,this)),this.btnAbout.on("toggle",i.bind(this.onBtnMenuToggle,this)),this.menuFile=new SSE.Views.FileMenu({}),this.menuFile.render(),this.btnAbout.panel=new Common.Views.About({el:e("#about-menu-panel"),appName:"Spreadsheet Editor"}).render(),this},onBtnMenuToggle:function(t,e){e?(t.panel.show(),this._state.pluginIsRunning||this.$el.width(40),this.btnSearch.isActive()&&this.btnSearch.toggle(!1)):t.panel.hide(),SSE.getController("Toolbar").DisableToolbar(1==e),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onBtnCommentsToggle:function(t,e){e||this.fireEvent("comments:hide",this)},onBtnMenuClick:function(t,e){this.btnAbout.toggle(!1),"search"==t.options.action||(t.pressed?this.$el.width()>40||this.$el.width(Common.localStorage.getItem("sse-mainmenu-width")||300):this._state.pluginIsRunning||(Common.localStorage.setItem("sse-mainmenu-width",this.$el.width()),this.$el.width(40))),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onCoauthOptions:function(t){this.mode.canCoAuthoring&&(this.mode.canViewComments&&(this.btnComments.pressed&&this.btnComments.$el.hasClass("notify")&&this.btnComments.$el.removeClass("notify"),this.panelComments[this.btnComments.pressed?"show":"hide"](),this.fireEvent(this.btnComments.pressed?"comments:show":"comments:hide",this)),this.mode.canChat&&(this.btnChat.pressed?(this.btnChat.$el.hasClass("notify")&&this.btnChat.$el.removeClass("notify"),this.panelChat.show(),this.panelChat.focus()):this.panelChat.hide())),this.panelSpellcheck&&(this.btnSpellcheck.pressed?this.panelSpellcheck.show():this.panelSpellcheck.hide())},setOptionsPanel:function(t,e){"chat"==t?this.panelChat=e.render("#left-panel-chat"):"comment"==t?this.panelComments=e:"plugins"!=t||this.panelPlugins?"spellcheck"!=t||this.panelSpellcheck||(this.panelSpellcheck=e.render("#left-panel-spellcheck")):this.panelPlugins=e.render("#left-panel-plugins")},markCoauthOptions:function(t,e){"chat"!=t||!this.btnChat.isVisible()||this.btnChat.isDisabled()||this.btnChat.pressed||this.btnChat.$el.addClass("notify"),"comments"!=t||!this.btnComments.isVisible()||this.btnComments.pressed||this.btnComments.isDisabled()&&!e||this.btnComments.$el.addClass("notify")},close:function(t){this.btnAbout.toggle(!1),this._state.pluginIsRunning||this.$el.width(40),this.mode.canCoAuthoring&&(this.mode.canViewComments&&(this.panelComments.hide(),this.btnComments.pressed&&this.fireEvent("comments:hide",this),this.btnComments.toggle(!1,!0)),this.mode.canChat&&(this.panelChat.hide(),this.btnChat.toggle(!1))),this.mode.canPlugins&&this.panelPlugins&&!this._state.pluginIsRunning&&(this.panelPlugins.hide(),this.btnPlugins.toggle(!1,!0)),this.panelSpellcheck&&(this.panelSpellcheck.hide(),this.btnSpellcheck.toggle(!1,!0))},isOpened:function(){var t=this.btnSearch.pressed;return!t&&(t=this.btnComments.pressed||this.btnChat.pressed),t},disableMenu:function(t,e){this.btnAbout.setDisabled(!1),this.btnSupport.setDisabled(!1),this.btnSearch.setDisabled(!1),this.btnComments.setDisabled(!1),this.btnChat.setDisabled(!1),this.btnPlugins.setDisabled(!1),this.btnSpellcheck.setDisabled(!1)},showMenu:function(t){var e=/^(\w+):?(\w*)$/.exec(t);"file"==e[1]?this.menuFile.show(e[2].length?e[2]:void 0):"chat"==t?!this.btnChat.isVisible()||this.btnChat.isDisabled()||this.btnChat.pressed||(this.btnChat.toggle(!0),this.onBtnMenuClick(this.btnChat),this.onCoauthOptions(),this.panelChat.focus()):"comments"==t&&(!this.btnComments.isVisible()||this.btnComments.isDisabled()||this.btnComments.pressed||(this.btnComments.toggle(!0),this.onBtnMenuClick(this.btnComments),this.onCoauthOptions(),this.btnComments.$el.focus()))},getMenu:function(t){switch(t){case"file":return this.menuFile;case"about":return this.btnAbout.panel;default:return null}},setMode:function(t){return this.mode=t,this.btnAbout.panel.setMode(t),this},setDeveloperMode:function(t){if(this.$el.is(":visible")){this.developerHint||(this.developerHint=e('<div id="developer-hint">'+(t==Asc.c_oLicenseMode.Trial?this.txtTrial:this.txtDeveloper)+"</div>").appendTo(this.$el),this.devHeight=this.developerHint.outerHeight(),e(window).on("resize",i.bind(this.onWindowResize,this))),this.developerHint.toggleClass("hidden",!t);var n=this.$el.find("button.btn-category:visible"),o=n.length>0?e(n[n.length-1]):null;this.minDevPosition=o?o.offset().top-o.offsetParent().offset().top+o.height()+20:20,this.onWindowResize()}},onWindowResize:function(){this.developerHint.css("top",Math.max((this.$el.height()-this.devHeight)/2,this.minDevPosition))},tipComments:"Comments",tipChat:"Chat",tipAbout:"About",tipSupport:"Feedback & Support",tipFile:"File",tipSearch:"Search",tipPlugins:"Plugins",txtDeveloper:"DEVELOPER MODE",txtTrial:"TRIAL MODE",tipSpellcheck:"Spell checking"},SSE.Views.LeftMenu||{}))}),define("spreadsheeteditor/main/app/controller/LeftMenu",["core","common/main/lib/util/Shortcuts","common/main/lib/view/SaveAsDlg","spreadsheeteditor/main/app/view/LeftMenu","spreadsheeteditor/main/app/view/FileMenu"],function(){"use strict";SSE.Controllers.LeftMenu=Backbone.Controller.extend(_.extend({views:["LeftMenu","FileMenu"],initialize:function(){this.addListeners({"Common.Views.Chat":{hide:_.bind(this.onHideChat,this)},"Common.Views.Plugins":{"plugin:open":_.bind(this.onPluginOpen,this),hide:_.bind(this.onHidePlugins,this)},"Common.Views.Header":{"file:settings":_.bind(this.clickToolbarSettings,this),"click:users":_.bind(this.clickStatusbarUsers,this)},LeftMenu:{"file:show":_.bind(this.fileShowHide,this,!0),"file:hide":_.bind(this.fileShowHide,this,!1),"comments:show":_.bind(this.commentsShowHide,this,!0),"comments:hide":_.bind(this.commentsShowHide,this,!1)},"Common.Views.About":{show:_.bind(this.aboutShowHide,this,!0),hide:_.bind(this.aboutShowHide,this,!1)},FileMenu:{"menu:hide":_.bind(this.menuFilesShowHide,this,"hide"),"menu:show":_.bind(this.menuFilesShowHide,this,"show"),"item:click":_.bind(this.clickMenuFileItem,this),"saveas:format":_.bind(this.clickSaveAsFormat,this),"savecopy:format":_.bind(this.clickSaveCopyAsFormat,this),"settings:apply":_.bind(this.applySettings,this),"create:new":_.bind(this.onCreateNew,this),"recent:open":_.bind(this.onOpenRecent,this)},Toolbar:{"file:settings":_.bind(this.clickToolbarSettings,this),"file:open":this.clickToolbarTab.bind(this,"file"),"file:close":this.clickToolbarTab.bind(this,"other"),"save:disabled":this.changeToolbarSaveState.bind(this)},SearchDialog:{hide:_.bind(this.onSearchDlgHide,this),"search:back":_.bind(this.onQuerySearch,this,"back"),"search:next":_.bind(this.onQuerySearch,this,"next"),"search:replace":_.bind(this.onQueryReplace,this),"search:replaceall":_.bind(this.onQueryReplaceAll,this),"search:highlight":_.bind(this.onSearchHighlight,this)},"Common.Views.ReviewChanges":{"collaboration:chat":_.bind(this.onShowHideChat,this)}}),Common.NotificationCenter.on("app:comment:add",_.bind(this.onAppAddComment,this))},onLaunch:function(){this.leftMenu=this.createView("LeftMenu").render(),this.leftMenu.btnSearch.on("toggle",_.bind(this.onMenuSearch,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+shift+s,ctrl+shift+s":_.bind(this.onShortcut,this,"save"),"command+f,ctrl+f":_.bind(this.onShortcut,this,"search"),"ctrl+h":_.bind(this.onShortcut,this,"replace"),"alt+f":_.bind(this.onShortcut,this,"file"),esc:_.bind(this.onShortcut,this,"escape"),"alt+q":_.bind(this.onShortcut,this,"chat"),"command+shift+h,ctrl+shift+h":_.bind(this.onShortcut,this,"comments"),
|
|
|
f1:_.bind(this.onShortcut,this,"help")}}),Common.util.Shortcuts.suspendEvents();var t=this;this.leftMenu.$el.find("button").each(function(){$(this).on("keydown",function(e){Common.UI.Keys.RETURN!==e.keyCode&&Common.UI.Keys.SPACE!==e.keyCode||(t.leftMenu.btnAbout.toggle(!1),this.blur(),e.preventDefault(),t.api.asc_enableKeyEvents(!0))})})},setApi:function(t){if(this.api=t,this.api.asc_registerCallback("asc_onRenameCellTextEnd",_.bind(this.onRenameText,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiServerDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiServerDisconnect,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),Common.NotificationCenter.on("download:cancel",_.bind(this.onDownloadCancel,this)),this.mode.canCoAuthoring&&(this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onApiChatMessage,this)),this.mode.canComments)){this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this));var e=this.getApplication().getController("Common.Controllers.Comments").groupCollection;for(var i in e)for(var n=e[i],o=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment"),s=0;s<n.length;++s)if(n.at(s).get("userid")!==this.mode.user.id&&(o||!n.at(s).get("resolved"))){this.leftMenu.markCoauthOptions("comments",!0);break}}return this.mode.isEditMailMerge||this.mode.isEditDiagram||this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.leftMenu.getMenu("file").setApi(t),this},setMode:function(t){return this.mode=t,this.leftMenu.setMode(t),this.leftMenu.getMenu("file").setMode(t),t.isEdit||Common.util.Shortcuts.removeShortcuts({shortcuts:{"command+shift+s,ctrl+shift+s":_.bind(this.onShortcut,this,"save"),"alt+f":_.bind(this.onShortcut,this,"file")}}),this},createDelayedElements:function(){return this.mode.canCoAuthoring?(this.leftMenu.btnComments[this.mode.canViewComments&&!this.mode.isLightVersion?"show":"hide"](),this.mode.canViewComments&&this.leftMenu.setOptionsPanel("comment",this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments")),this.leftMenu.btnChat[this.mode.canChat&&!this.mode.isLightVersion?"show":"hide"](),this.mode.canChat&&this.leftMenu.setOptionsPanel("chat",this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"))):(this.leftMenu.btnChat.hide(),this.leftMenu.btnComments.hide()),this.mode.isEdit&&(this.leftMenu.btnSpellcheck.show(),this.leftMenu.setOptionsPanel("spellcheck",this.getApplication().getController("Spellcheck").getView("Spellcheck"))),this.mode.trialMode&&this.leftMenu.setDeveloperMode(this.mode.trialMode),Common.util.Shortcuts.resumeEvents(),this.mode.isEditMailMerge||this.mode.isEditDiagram||Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this},enablePlugins:function(){this.mode.canPlugins?this.leftMenu.setOptionsPanel("plugins",this.getApplication().getController("Common.Controllers.Plugins").getView("Common.Views.Plugins")):this.leftMenu.btnPlugins.hide(),this.mode.trialMode&&this.leftMenu.setDeveloperMode(this.mode.trialMode)},clickMenuFileItem:function(t,e,i){var n=!0;switch(e){case"back":break;case"save":this.api.asc_Save();break;case"save-desktop":this.api.asc_DownloadAs();break;case"print":Common.NotificationCenter.trigger("print",this.leftMenu);break;case"exit":Common.NotificationCenter.trigger("goback");break;case"edit":Common.Gateway.requestEditRights();break;case"new":i?n=!1:this.onCreateNew(void 0,"blank");break;case"rename":var o=this,s=o.api.asc_getDocumentName();new Common.Views.RenameDialog({filename:s,handler:function(t,e){"ok"!=t||_.isEmpty(e.trim())||s===e.trim()||Common.Gateway.requestRename(e),Common.NotificationCenter.trigger("edit:complete",o)}}).show();break;default:n=!1}n&&t.hide()},clickSaveAsFormat:function(t,e){e==Asc.c_oAscFileType.CSV?Common.UI.warning({title:this.textWarning,msg:this.warnDownloadAs,buttons:["ok","cancel"],callback:_.bind(function(i){"ok"==i&&(Common.NotificationCenter.trigger("download:advanced",Asc.c_oAscAdvancedOptionsID.CSV,this.api.asc_getAdvancedOptions(),2,new Asc.asc_CDownloadOptions(e)),t.hide())},this)}):e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?(t.hide(),Common.NotificationCenter.trigger("download:settings",this.leftMenu,e)):(this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e)),t.hide())},clickSaveCopyAsFormat:function(t,e,i){e==Asc.c_oAscFileType.CSV?Common.UI.warning({title:this.textWarning,msg:this.warnDownloadAs,buttons:["ok","cancel"],callback:_.bind(function(n){"ok"==n&&(this.isFromFileDownloadAs=i,Common.NotificationCenter.trigger("download:advanced",Asc.c_oAscAdvancedOptionsID.CSV,this.api.asc_getAdvancedOptions(),2,new Asc.asc_CDownloadOptions(e,!0)),t.hide())},this)}):e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?(this.isFromFileDownloadAs=i,t.hide(),Common.NotificationCenter.trigger("download:settings",this.leftMenu,e,!0)):(this.isFromFileDownloadAs=i,this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e,!0)),t.hide())},onDownloadUrl:function(t){if(this.isFromFileDownloadAs){var e=this,i=this.getApplication().getController("Viewport").getView("Common.Views.Header").getDocumentCaption();if(!i&&(i=e.txtUntitled),"string"==typeof this.isFromFileDownloadAs){var n=i.lastIndexOf(".");n>0&&(i=i.substring(0,n)+this.isFromFileDownloadAs)}e.mode.canRequestSaveAs?Common.Gateway.requestSaveAs(t,i):(e._saveCopyDlg=new Common.Views.SaveAsDlg({saveFolderUrl:e.mode.saveAsUrl,saveFileUrl:t,defFileName:i}),e._saveCopyDlg.on("saveaserror",function(t,i){var n={closable:!1,title:e.textWarning,msg:i,iconCls:"warn",buttons:["ok"],callback:function(t){Common.NotificationCenter.trigger("edit:complete",e)}};Common.UI.alert(n)}).on("close",function(t){e._saveCopyDlg=void 0}),e._saveCopyDlg.show())}this.isFromFileDownloadAs=!1},onDownloadCancel:function(){this.isFromFileDownloadAs=!1},applySettings:function(t){var e=Common.localStorage.getItem("sse-settings-fontrender");Common.Utils.InternalSettings.set("sse-settings-fontrender",e),this.api.asc_setFontRenderingMode(parseInt(e)),e=Common.localStorage.getBool("sse-settings-livecomment",!0),Common.Utils.InternalSettings.set("sse-settings-livecomment",e);var i=Common.localStorage.getBool("sse-settings-resolvedcomment");Common.Utils.InternalSettings.set("sse-settings-resolvedcomment",i),this.mode.canViewComments&&this.leftMenu.panelComments.isVisible()&&(e=i=!0),e?this.api.asc_showComments(i):this.api.asc_hideComments(),e=Common.localStorage.getBool("sse-settings-r1c1"),Common.Utils.InternalSettings.set("sse-settings-r1c1",e),this.api.asc_setR1C1Mode(e),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&(e=Common.localStorage.getBool("sse-settings-coauthmode",!0),Common.Utils.InternalSettings.set("sse-settings-coauthmode",e),this.api.asc_SetFastCollaborative(e)),this.mode.isEdit&&(e=parseInt(Common.localStorage.getItem("sse-settings-autosave")),Common.Utils.InternalSettings.set("sse-settings-autosave",e),this.api.asc_setAutoSaveGap(e)),e=Common.localStorage.getItem("sse-settings-reg-settings"),null!==e&&this.api.asc_setLocale(parseInt(e)),t.hide(),this.leftMenu.fireEvent("settings:apply")},onCreateNew:function(t,e){if(!Common.Controllers.Desktop.process("create:new")){var i=window.open("blank"==e?this.mode.createUrl:e,"_blank");i&&i.focus()}t&&t.hide()},onOpenRecent:function(t,e){t&&t.hide();var i=window.open(e);i&&i.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(t){this.leftMenu.showMenu("file:opts")},clickToolbarTab:function(t,e){"file"==t?this.leftMenu.showMenu("file"):this.leftMenu.menuFile.hide()},changeToolbarSaveState:function(t){var e=this.leftMenu.menuFile.getButton("save");e&&e.setDisabled(t)},clickStatusbarUsers:function(){this.leftMenu.menuFile.panels.rights.changeAccessRights()},onHideChat:function(){$(this.leftMenu.btnChat.el).blur(),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onHidePlugins:function(){Common.NotificationCenter.trigger("layout:changed","leftmenu")},onQuerySearch:function(t,e,i){if(i.textsearch&&i.textsearch.length){var n=this.dlgSearch.findOptions;if(n.asc_setFindWhat(i.textsearch),n.asc_setScanForward("back"!=t),n.asc_setIsMatchCase(i.matchcase),n.asc_setIsWholeCell(i.matchword),n.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),n.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),n.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),!this.api.asc_findText(n)){var o=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){o.dlgSearch.focus()}})}}},onQueryReplace:function(t,e){if(!_.isEmpty(e.textsearch)){this.api.isReplaceAll=!1;var i=this.dlgSearch.findOptions;i.asc_setFindWhat(e.textsearch),i.asc_setReplaceWith(e.textreplace),i.asc_setIsMatchCase(e.matchcase),i.asc_setIsWholeCell(e.matchword),i.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),i.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),i.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),i.asc_setIsReplaceAll(!1),this.api.asc_replaceText(i)}},onQueryReplaceAll:function(t,e){if(!_.isEmpty(e.textsearch)){this.api.isReplaceAll=!0;var i=this.dlgSearch.findOptions;i.asc_setFindWhat(e.textsearch),i.asc_setReplaceWith(e.textreplace),i.asc_setIsMatchCase(e.matchcase),i.asc_setIsWholeCell(e.matchword),i.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),i.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),i.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),i.asc_setIsReplaceAll(!0),this.api.asc_replaceText(i)}},onSearchHighlight:function(t,e){this.api.asc_selectSearchingResults(e)},showSearchDlg:function(t,e){if(!this.dlgSearch){var i=new Common.UI.MenuItem({caption:this.textWithin,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textSheet,toggleGroup:"searchWithih",checkable:!0,checked:!0},{caption:this.textWorkbook,toggleGroup:"searchWithih",checkable:!0,checked:!1}]})}),n=new Common.UI.MenuItem({caption:this.textSearch,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textByRows,toggleGroup:"searchByrows",checkable:!0,checked:!0},{caption:this.textByColumns,toggleGroup:"searchByrows",checkable:!0,checked:!1}]})}),o=new Common.UI.MenuItem({caption:this.textLookin,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textFormulas,toggleGroup:"searchLookin",checkable:!0,checked:!0},{caption:this.textValues,toggleGroup:"searchLookin",checkable:!0,checked:!1}]})});this.dlgSearch=new Common.UI.SearchDialog({matchcase:!0,matchword:!0,matchwordstr:this.textItemEntireCell,markresult:{applied:!0},extraoptions:[i,n,o]}),this.dlgSearch.menuWithin=i,this.dlgSearch.menuSearch=n,this.dlgSearch.menuLookin=o,this.dlgSearch.findOptions=new Asc.asc_CFindOptions}if(t){var s=this.mode.isEdit&&!this.viewmode?e||void 0:"no-replace";this.dlgSearch.isVisible()?(this.dlgSearch.setMode(s),this.dlgSearch.focus()):this.dlgSearch.show(s),this.api.asc_closeCellEditor()}else this.dlgSearch.hide()},onMenuSearch:function(t,e){this.showSearchDlg(e)},onSearchDlgHide:function(){this.leftMenu.btnSearch.toggle(!1,!0),this.api.asc_selectSearchingResults(!1),$(this.leftMenu.btnSearch.el).blur(),this.api.asc_enableKeyEvents(!0)},onRenameText:function(t,e){var i=this;if(this.api.isReplaceAll)Common.UI.info({msg:t?!t-e?Common.Utils.String.format(this.textReplaceSuccess,e):Common.Utils.String.format(this.textReplaceSkipped,t-e):this.textNoTextFound,callback:function(){i.dlgSearch.focus()}});else{var n=this.dlgSearch.getSettings(),o=this.dlgSearch.findOptions;o.asc_setFindWhat(n.textsearch),o.asc_setScanForward(!0),o.asc_setIsMatchCase(n.matchcase),o.asc_setIsWholeCell(n.matchword),o.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),o.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),o.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),i.api.asc_findText(o)||Common.UI.info({msg:this.textNoTextFound,callback:function(){i.dlgSearch.focus()}})}},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,this.dlgSearch&&this.dlgSearch.setMode(this.viewmode?"no-replace":"search"))},onApiServerDisconnect:function(t){this.mode.isEdit=!1,this.leftMenu.close(),this.leftMenu.btnComments.setDisabled(!0),this.leftMenu.btnChat.setDisabled(!0),this.leftMenu.btnPlugins.setDisabled(!0),this.leftMenu.btnSpellcheck.setDisabled(!0),this.leftMenu.getMenu("file").setMode({isDisconnected:!0,enableDownload:!!t}),this.dlgSearch&&(this.leftMenu.btnSearch.toggle(!1,!0),this.dlgSearch.hide())},onApiChatMessage:function(){this.leftMenu.markCoauthOptions("chat")},onApiAddComment:function(t,e){var i=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment");!e||e.asc_getUserId()===this.mode.user.id||!i&&e.asc_getSolved()||this.leftMenu.markCoauthOptions("comments")},onApiAddComments:function(t){for(var e=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment"),i=0;i<t.length;++i)if(t[i].asc_getUserId()!==this.mode.user.id&&(e||!t[i].asc_getSolved())){this.leftMenu.markCoauthOptions("comments");break}},onAppAddComment:function(t,e){if(e){var i=this;new Promise(function(t,e){t()}).then(function(){Common.UI.Menu.Manager.hideAll(),i.leftMenu.showMenu("comments");var t=SSE.getController("Common.Controllers.Comments");t.getView().showEditContainer(!0),t.onAfterShow()})}},commentsShowHide:function(t){if(this.api){var e=Common.Utils.InternalSettings.get("sse-settings-livecomment"),i=Common.Utils.InternalSettings.get("sse-settings-resolvedcomment");e&&i||(t?this.api.asc_showComments(!0):e?this.api.asc_showComments(i):this.api.asc_hideComments()),t&&this.getApplication().getController("Common.Controllers.Comments").onAfterShow(),t||$(this.leftMenu.btnComments.el).blur()}},fileShowHide:function(t){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!t))},aboutShowHide:function(t){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!t),t||$(this.leftMenu.btnAbout.el).blur(),!t&&this.leftMenu._state.pluginIsRunning&&(this.leftMenu.panelPlugins.show(),this.mode.canCoAuthoring&&(this.mode.canViewComments&&this.leftMenu.panelComments.hide(),this.mode.canChat&&this.leftMenu.panelChat.hide())))},menuFilesShowHide:function(t){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!("show"==t))),this.dlgSearch&&("show"==t?this.dlgSearch.suspendKeyEvents():Common.Utils.asyncCall(this.dlgSearch.resumeKeyEvents,this.dlgSearch))},onShortcut:function(t,e){if(this.mode){if(this.mode.isEditDiagram&&"escape"!=t)return!1;if(this.mode.isEditMailMerge&&"escape"!=t&&"search"!=t)return!1;switch(t){case"replace":case"search":return this.leftMenu.btnSearch.isDisabled()||(Common.UI.Menu.Manager.hideAll(),this.showSearchDlg(!0,t),this.leftMenu.btnSearch.toggle(!0,!0),this.leftMenu.btnAbout.toggle(!1),this.leftMenu.menuFile.hide()),!1;case"save":return this.mode.canDownload&&(this.mode.isDesktopApp&&this.mode.isOffline?this.api.asc_DownloadAs():(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file:saveas"))),!1;case"help":return this.mode.isEdit&&this.mode.canHelp&&(Common.UI.Menu.Manager.hideAll(),this.api.asc_closeCellEditor(),this.leftMenu.showMenu("file:help")),!1;case"file":return Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file"),!1;case"escape":if(this.leftMenu.menuFile.isVisible())return this.leftMenu.menuFile.hide(),!1;var i=SSE.getController("Statusbar"),n=i.statusbar.$el.find('.open > [data-toggle="dropdown"]');if(n.length)return $.fn.dropdown.Constructor.prototype.keydown.call(n[0],e),!1;if(this.mode.canPlugins&&this.leftMenu.panelPlugins&&!0!==this.api.isCellEdited&&(n=this.leftMenu.panelPlugins.$el.find('#menu-plugin-container.open > [data-toggle="dropdown"]'),n.length))return $.fn.dropdown.Constructor.prototype.keydown.call(n[0],e),!1;if(this.leftMenu.btnAbout.pressed||($(e.target).parents("#left-menu").length||this.leftMenu.btnPlugins.pressed||this.leftMenu.btnComments.pressed)&&!0!==this.api.isCellEdited)return this.leftMenu.close(),Common.NotificationCenter.trigger("layout:changed","leftmenu"),!1;if((this.mode.isEditDiagram||this.mode.isEditMailMerge)&&(n=$(document.body).find(".open > .dropdown-menu"),!this.api.isCellEdited&&!n.length))return Common.Gateway.internalMessage("shortcut",{key:"escape"}),!1;break;case"chat":return this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")),!1;case"comments":return this.mode.canCoAuthoring&&this.mode.canViewComments&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("comments"),this.getApplication().getController("Common.Controllers.Comments").onAfterShow()),!1}}},onCellsRange:function(t){var e=t!=Asc.c_oAscSelectionDialogType.None;this.leftMenu.btnAbout.setDisabled(e),this.leftMenu.btnSearch.setDisabled(e),this.leftMenu.btnSpellcheck.setDisabled(e),this.mode.canPlugins&&this.leftMenu.panelPlugins&&(this.leftMenu.panelPlugins.setLocked(e),this.leftMenu.panelPlugins.disableControls(e))},onApiEditCell:function(t){var e=t==Asc.c_oAscCellEditorState.editFormula;this.leftMenu.btnAbout.setDisabled(e),this.leftMenu.btnSearch.setDisabled(e),this.leftMenu.btnSpellcheck.setDisabled(e),this.mode.canPlugins&&this.leftMenu.panelPlugins&&(this.leftMenu.panelPlugins.setLocked(e),this.leftMenu.panelPlugins.disableControls(e))},onPluginOpen:function(t,e,i){"onboard"==e&&("open"==i?(this.leftMenu.close(),this.leftMenu.panelPlugins.show(),this.leftMenu.onBtnMenuClick({pressed:!0,options:{action:"plugins"}}),this.leftMenu._state.pluginIsRunning=!0):(this.leftMenu._state.pluginIsRunning=!1,this.leftMenu.close()))},onShowHideChat:function(t){this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(t?(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")):(this.leftMenu.btnChat.toggle(!1,!0),this.leftMenu.onBtnMenuClick(this.leftMenu.btnChat)))},textNoTextFound:"Text not found",newDocumentTitle:"Unnamed document",textItemEntireCell:"Entire cell contents",requestEditRightsText:"Requesting editing rights...",textReplaceSuccess:"Search has been done. {0} occurrences have been replaced",textReplaceSkipped:"The replacement has been made. {0} occurrences were skipped.",warnDownloadAs:"If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",textWarning:"Warning",textSheet:"Sheet",textWorkbook:"Workbook",textByColumns:"By columns",textByRows:"By rows",textFormulas:"Formulas",textValues:"Values",textWithin:"Within",textSearch:"Search",textLookin:"Look in",txtUntitled:"Untitled"},SSE.Controllers.LeftMenu||{}))}),void 0===Common)var Common={};if(Common.IrregularStack=function(t){var e=[],i=function(t,e){return"object"==typeof t&&"object"==typeof e&&window.JSON?window.JSON.stringify(t)===window.JSON.stringify(e):t===e};t=t||{};var n=t.strongCompare||i,o=t.weakCompare||i,s=function(t,i){for(var n=e.length-1;n>=0;n--)if(i(e[n],t))return n;return-1};return{push:function(t){e.push(t)},pop:function(t){var i=s(t,n);if(-1!=i)return e.splice(i,1)[0]},get:function(t){var i=s(t,o);if(-1!=i)return e[i]},exist:function(t){return!(s(t,n)<0)}}},define("irregularstack",function(){}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Fonts",["core","common/main/lib/collection/Fonts"],function(){"use strict";Common.Controllers.Fonts=Backbone.Controller.extend(function(){function t(t,e){for(var i,n=e.get("type")==o,s=-1,a=t.length,l=e.get("name");!n&&++s<a&&(i=t.at(s),i.get("type")==o);)n=i.get("name")==l;return n}function e(e,i){e.showlastused&&t(e.store,i)}function i(t){Common.NotificationCenter.trigger("fonts:change",t)}function n(t,e){var i=[];_.each(t,function(t){var e=t.asc_getFontId();i.push({id:_.isEmpty(e)?Common.UI.getId():e,name:t.asc_getFontName(),imgidx:t.asc_getFontThumbnail(),type:t.asc_getFontType()})});var n=this.getCollection("Common.Collections.Fonts");n&&(n.add(i),n.sort()),Common.NotificationCenter.trigger("fonts:load",n,e)}var o=4;return{models:["Common.Models.Fonts"],collections:["Common.Collections.Fonts"],views:[],initialize:function(){Common.NotificationCenter.on("fonts:select",_.bind(e,this))},onLaunch:function(){},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onInitEditorFonts",_.bind(n,this)),this.api.asc_registerCallback("asc_onFontFamily",_.bind(i,this))}}}())}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/TextArt",["backbone"],function(t){"use strict";Common.Collections.TextArt=t.Collection.extend({model:t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}})})}),void 0===Common)var Common={};if(Common.util=Common.util||{},Common.util.LanguageInfo=new function(){var t={54:["af","Afrikaans"],1078:["af-ZA","Afrikaans (Suid Afrika)","Afrikaans (South Africa)"],28:["sq","Shqipe"],1052:["sq-AL","Shqipe (Shqipëria)","Albanian (Albania)"],132:["gsw","Elsässisch"],1156:["gsw-FR","Elsässisch (Frànkrisch)","Alsatian (France)"],94:["am","አማርኛ"],1118:["am-ET","አማርኛ (ኢትዮጵያ)","Amharic (Ethiopia)"],1:["ar","العربية"],5121:["ar-DZ","العربية (الجزائر)","Arabic (Algeria)"],15361:["ar-BH","العربية (البحرين)","Arabic (Bahrain)"],3073:["ar-EG","العربية (مصر)","Arabic (Egypt)"],2049:["ar-IQ","العربية (العراق)","Arabic (Iraq)"],11265:["ar-JO","العربية (الأردن)","Arabic (Jordan)"],13313:["ar-KW","العربية (الكويت)","Arabic (Kuwait)"],12289:["ar-LB","العربية (لبنان)","Arabic (Lebanon)"],4097:["ar-LY","العربية (ليبيا)","Arabic (Libya)"],6145:["ar-MA","العربية (المملكة المغربية)","Arabic (Morocco)"],8193:["ar-OM","العربية (عمان)","Arabic (Oman)"],16385:["ar-QA","العربية (قطر)","Arabic (Qatar)"],1025:["ar-SA","العربية (المملكة العربية السعودية)","Arabic (Saudi Arabia)"],10241:["ar-SY","العربية (سوريا)","Arabic (Syria)"],7169:["ar-TN","العربية (تونس)","Arabic (Tunisia)"],14337:["ar-AE","العربية (الإمارات العربية المتحدة)","Arabic (U.A.E.)"],9217:["ar-YE","العربية (اليمن)","Arabic (Yemen)"],43:["hy","Հայերեն"],1067:["hy-AM","Հայերեն (Հայաստան)","Armenian (Armenia)"],77:["as","অসমীয়া"],1101:["as-IN","অসমীয়া (ভাৰত)","Assamese (India)"],44:["az","Azərbaycanılı"],29740:["az-Cyrl","Азәрбајҹан дили"],2092:["az-Cyrl-AZ","Азәрбајҹан (Азәрбајҹан)","Azeri (Cyrillic, Azerbaijan)"],30764:["az-Latn","Azərbaycanılı"],1068:["az-Latn-AZ","Azərbaycanılı (Azərbaycan)","Azeri (Latin, Azerbaijan)"],109:["ba","Башҡорт"],1133:["ba-RU","Башҡорт (Россия)","Bashkir (Russia)"],45:["eu","Euskara"],1069:["eu-ES","Euskara (Euskara)","Basque (Basque)"],35:["be","Беларускі"],1059:["be-BY","Беларускі (Беларусь)","Belarusian (Belarus)"],69:["bn","বাংলা"],2117:["bn-BD","বাংলা (বাংলাদেশ)","Bengali (Bangladesh)"],1093:["bn-IN","বাংলা (ভারত)","Bengali (India)"],30746:["bs","bosanski"],25626:["bs-Cyrl","Босански (Ћирилица)"],8218:["bs-Cyrl-BA","Босански (Босна и Херцеговина)","Bosnian (Cyrillic) (Bosnia and Herzegovina)"],26650:["bs-Latn","Bosanski (Latinica)"],5146:["bs-Latn-BA","Bosanski (Bosna i Hercegovina)","Bosnian (Latin) (Bosnia and Herzegovina)"],126:["br","Brezhoneg"],1150:["br-FR","Brezhoneg (Frañs)","Breton (France)"],2:["bg","Български"],1026:["bg-BG","Български (България)","Bulgarian (Bulgaria)"],3:["ca","Català"],1027:["ca-ES","Català (Català)","Catalan (Catalan)"],2051:["ca-ES-valencia","Català (Valencià)","Catalan (Valencia)"],30724:["zh","中文"],4:["zh-Hans","中文(简体)","Chinese (Simplified)"],2052:["zh-CN","中文(中华人民共和国)","Chinese (People's Republic of China)"],4100:["zh-SG","中文(新加坡)","Chinese (Simplified, Singapore)"],31748:["zh-Hant","中文(繁體)","Chinese (Traditional)"],3076:["zh-HK","中文(香港特別行政區)","Chinese (Traditional, Hong Kong S.A.R.)"],5124:["zh-MO","中文(澳門特別行政區)","Chinese (Traditional, Macao S.A.R.)"],1028:["zh-TW","中文(台灣)","Chinese (Traditional, Taiwan)"],131:["co","Corsu"],1155:["co-FR","Corsu (France)","Corsican (France)"],26:["hr","Hrvatski"],1050:["hr-HR","Hrvatski (Hrvatska)","Croatian (Croatia)"],4122:["hr-BA","Hrvatski (Bosna i Hercegovina)","Croatian (Bosnia and Herzegovina)"],5:["cs","Čeština"],1029:["cs-CZ","Čeština (Česká republika)","Czech (Czech Republic)"],6:["da","Dansk"],1030:["da-DK","Dansk (Danmark)","Danish (Denmark)"],140:["prs","درى"],1164:["prs-AF","درى (افغانستان)","Dari (Afghanistan)"],101:["dv","ދިވެހިބަސް"],1125:["dv-MV","ދިވެހިބަސް (ދިވެހި ރާއްޖެ)","Divehi (Maldives)"],19:["nl","Nederlands"],2067:["nl-BE","Nederlands (België)","Dutch (Belgium)"],1043:["nl-NL","Nederlands (Nederland)","Dutch (Netherlands)"],9:["en","English"],3081:["en-AU","English (Australia)","English (Australia)"],10249:["en-BZ","English (Belize)","English (Belize)"],4105:["en-CA","English (Canada)","English (Canada)"],9225:["en-029","English (Caribbean)","English (Caribbean)"],16393:["en-IN","English (India)","English (India)"],6153:["en-IE","English (Ireland)","English (Ireland)"],8201:["en-JM","English (Jamaica)","English (Jamaica)"],17417:["en-MY","English (Malaysia)","English (Malaysia)"],5129:["en-NZ","English (New Zealand)","English (New Zealand)"],13321:["en-PH","English (Philippines)","English (Philippines)"],18441:["en-SG","English (Singapore)","English (Singapore)"],7177:["en-ZA","English (South Africa)","English (South Africa)"],11273:["en-TT","English (Trinidad y Tobago)","English (Trinidad y Tobago)"],2057:["en-GB","English (United Kingdom)","English (United Kingdom)"],1033:["en-US","English (United States)","English (United States)"],12297:["en-ZW","English (Zimbabwe)","English (Zimbabwe)"],15369:["en-HK","English (Hong Kong)","English (Hong Kong)"],14345:["en-ID","English (Indonesia)","English (Indonesia)"],37:["et","Eesti"],1061:["et-EE","Eesti (Eesti)","Estonian (Estonia)"],56:["fo","Føroyskt"],1080:["fo-FO","Føroyskt (Føroyar)","Faroese (Faroe Islands)"],100:["fil","Filipino"],1124:["fil-PH","Filipino (Pilipinas)","Filipino (Philippines)"],11:["fi","Suomi"],1035:["fi-FI","Suomi (Suomi)","Finnish (Finland)"],12:["fr","Français"],2060:["fr-BE","Français (Belgique)","French (Belgium)"],3084:["fr-CA","Français (Canada)","French (Canada)"],1036:["fr-FR","Français (France)","French (France)"],5132:["fr-LU","Français (Luxembourg)","French (Luxembourg)"],6156:["fr-MC","Français (Principauté de Monaco)","French (Principality of Monaco)"],4108:["fr-CH","Français (Suisse)","French (Switzerland)"],15372:["fr-HT","Français (Haïti)","French (Haiti)"],9228:["fr-CG","Français (Congo-Brazzaville)","French (Congo)"],12300:["fr-CI","Français (Côte d’Ivoire)","French (Cote d'Ivoire)"],11276:["fr-CM","Français (Cameroun)","French (Cameroon)"],14348:["fr-MA","Français (Maroc)","French (Morocco)"],13324:["fr-ML","Français (Mali)","French (Mali)"],8204:["fr-RE","Français (La Réunion)","French (Reunion)"],10252:["fr-SN","Français (Sénégal)","French (Senegal)"],7180:["fr-West","French"],98:["fy","Frysk"],1122:["fy-NL","Frysk (Nederlân)","Frisian (Netherlands)"],86:["gl","Galego"],1110:["gl-ES","Galego (Galego)","Galician (Galician)"],55:["ka","ქართული"],1079:["ka-GE","ქართული (საქართველო)","Georgian (Georgia)"],7:["de","Deutsch"],3079:["de-AT","Deutsch (Österreich)","German (Austria)"],1031:["de-DE","Deutsch (Deutschland)","German (Germany)"],5127:["de-LI","Deutsch (Liechtenstein)","German (Liechtenstein)"],4103:["de-LU","Deutsch (Luxemburg)","German (Luxembourg)"],2055:["de-CH","Deutsch (Schweiz)","German (Switzerland)"],8:["el","Ελληνικά"],1032:["el-GR","Ελληνικά (Ελλάδα)","Greek (Greece)"],111:["kl","Kalaallisut"],1135:["kl-GL","Kalaallisut (Kalaallit Nunaat)","Greenlandic (Greenland)"],71:["gu","ગુજરાતી"],1095:["gu-IN","ગુજરાતી (ભારત)","Gujarati (India)"],104:["ha","Hausa"],31848:["ha-Latn","Hausa (Latin)"],1128:["ha-Latn-NG","Hausa (Nigeria)","Hausa (Latin) (Nigeria)"],13:["he","עברית"],1037:["he-IL","עברית (ישראל)","Hebrew (Israel)"],57:["hi","हिंदी"],1081:["hi-IN","हिंदी (भारत)","Hindi (India)"],14:["hu","Magyar"],1038:["hu-HU","Magyar (Magyarország)","Hungarian (Hungary)"],15:["is","Íslenska"],1039:["is-IS","Íslenska (Ísland)","Icelandic (Iceland)"],112:["ig","Igbo"],1136:["ig-NG","Igbo (Nigeria)","Igbo (Nigeria)"],33:["id","Bahasa Indonesia"],1057:["id-ID","Bahasa Indonesia (Indonesia)","Indonesian (Indonesia)"],93:["iu","Inuktitut"],31837:["iu-Latn","Inuktitut (Qaliujaaqpait)"],2141:["iu-Latn-CA","Inuktitut (Kanatami) (kanata)","Inuktitut (Latin) (Canada)"],30813:["iu-Cans","ᐃᓄᒃᑎᑐᑦ (ᖃᓂᐅᔮᖅᐸᐃᑦ)"],1117:["iu-Cans-CA","ᐃᓄᒃᑎᑐᑦ (ᑲᓇᑕᒥ)","Inuktitut (Canada)"],60:["ga","Gaeilge"],2108:["ga-IE","Gaeilge (Éire)","Irish (Ireland)"],52:["xh","isiXhosa"],1076:["xh-ZA","isiXhosa (uMzantsi Afrika)","isiXhosa (South Africa)"],53:["zu","isiZulu"],1077:["zu-ZA","isiZulu (iNingizimu Afrika)","isiZulu (South Africa)"],16:["it","Italiano"],1040:["it-IT","Italiano (Italia)","Italian (Italy)"],2064:["it-CH","Italiano (Svizzera)","Italian (Switzerland)"],17:["ja","日本語"],1041:["ja-JP","日本語 (日本)","Japanese (Japan)"],75:["kn","ಕನ್ನಡ"],1099:["kn-IN","ಕನ್ನಡ (ಭಾರತ)","Kannada (India)"],63:["kk","Қазақ"],1087:["kk-KZ","Қазақ (Қазақстан)","Kazakh (Kazakhstan)"],83:["km","ខ្មែរ"],1107:["km-KH","ខ្មែរ (កម្ពុជា)","Khmer (Cambodia)"],134:["qut","K'iche"],1158:["qut-GT","K'iche (Guatemala)","K'iche (Guatemala)"],135:["rw","Kinyarwanda"],1159:["rw-RW","Kinyarwanda (Rwanda)","Kinyarwanda (Rwanda)"],65:["sw","Kiswahili"],1089:["sw-KE","Kiswahili (Kenya)","Kiswahili (Kenya)"],87:["kok","कोंकणी"],1111:["kok-IN","कोंकणी (भारत)","Konkani (India)"],18:["ko","한국어"],1042:["ko-KR","한국어 (대한민국)","Korean (Korea)"],64:["ky","Кыргыз"],1088:["ky-KG","Кыргыз (Кыргызстан)","Kyrgyz (Kyrgyzstan)"],84:["lo","ລາວ"],1108:["lo-LA","ລາວ (ສ.ປ.ປ. ລາວ)","Lao (Lao P.D.R.)"],38:["lv","Latviešu"],1062:["lv-LV","Latviešu (Latvija)","Latvian (Latvia)"],39:["lt","Lietuvių"],1063:["lt-LT","Lietuvių (Lietuva)","Lithuanian (Lithuania)"],31790:["dsb","Dolnoserbšćina"],2094:["dsb-DE","Dolnoserbšćina (Nimska)","Lower Sorbian (Germany)"],110:["lb","Lëtzebuergesch"],1134:["lb-LU","Lëtzebuergesch (Luxembourg)","Luxembourgish (Luxembourg)"],1071:["mk-MK","Македонски јазик (Македонија)","Macedonian (Former Yugoslav Republic of Macedonia)"],47:["mk","Македонски јазик"],62:["ms","Bahasa Melayu"],2110:["ms-BN","Bahasa Melayu (Brunei Darussalam)","Malay (Brunei Darussalam)"],1086:["ms-MY","Bahasa Melayu (Malaysia)","Malay (Malaysia)"],76:["ml","മലയാളം"],1100:["ml-IN","മലയാളം (ഭാരതം)","Malayalam (India)"],58:["mt","Malti"],1082:["mt-MT","Malti (Malta)","Maltese (Malta)"],129:["mi","Reo Māori"],1153:["mi-NZ","Reo Māori (Aotearoa)","Maori (New Zealand)"],122:["arn","Mapudungun"],1146:["arn-CL","Mapudungun (Chile)","Mapudungun (Chile)"],78:["mr","मराठी"],1102:["mr-IN","मराठी (भारत)","Marathi (India)"],124:["moh","Kanien'kéha"],1148:["moh-CA","Kanien'kéha (Canada)","Mohawk (Canada)"],80:["mn","Монгол хэл"],30800:["mn-Cyrl","Монгол хэл"],1104:["mn-MN","Монгол хэл (Монгол улс)","Mongolian (Cyrillic, Mongolia)"],31824:["mn-Mong","ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ"],2128:["mn-Mong-CN","ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ (ᠪᠦᠭᠦᠳᠡ ᠨᠠᠢᠷᠠᠮᠳᠠᠬᠤ ᠳᠤᠮᠳᠠᠳᠤ ᠠᠷᠠᠳ ᠣᠯᠣᠰ)","Mongolian (Traditional Mongolian) (People's Republic of China)"],97:["ne","नेपाली"],1121:["ne-NP","नेपाली (नेपाल)","Nepali (Nepal)"],2145:["ne-IN","नेपाली (भारत)","Nepali (India)"],20:["no","Norsk"],31764:["nb","Norsk (bokmål)"],1044:["nb-NO","Norsk, bokmål (Norge)","Norwegian, Bokmål (Norway)"],30740:["nn","Norsk (Nynorsk)"],2068:["nn-NO","Norsk, nynorsk (Noreg)","Norwegian, Nynorsk (Norway)"],130:["oc","Occitan"],1154:["oc-FR","Occitan (França)","Occitan (France)"],72:["or","ଓଡ଼ିଆ"],1096:["or-IN","ଓଡ଼ିଆ (ଭାରତ)","Oriya (India)"],
|
|
|
99:["ps","پښتو"],1123:["ps-AF","پښتو (افغانستان)","Pashto (Afghanistan)"],41:["fa","فارسى"],1065:["fa-IR","فارسى (ایران)","Persian (Iran)"],21:["pl","Polski"],1045:["pl-PL","Polski (Polska)","Polish (Poland)"],22:["pt","Português"],1046:["pt-BR","Português (Brasil)","Portuguese (Brazil)"],2070:["pt-PT","Português (Portugal)","Portuguese (Portugal)"],70:["pa","ਪੰਜਾਬੀ"],1094:["pa-IN","ਪੰਜਾਬੀ (ਭਾਰਤ)","Punjabi (India)"],107:["quz","Runasimi"],1131:["quz-BO","Runasimi (Qullasuyu)","Quechua (Bolivia)"],2155:["quz-EC","Runasimi (Ecuador)","Quechua (Ecuador)"],3179:["quz-PE","Runasimi (Piruw)","Quechua (Peru)"],24:["ro","Română"],1048:["ro-RO","Română (România)","Romanian (Romania)"],2072:["ro-MD","Română (Moldova)","Romanian (Republic of Moldova)"],23:["rm","Rumantsch"],1047:["rm-CH","Rumantsch (Svizra)","Romansh (Switzerland)"],25:["ru","Русский"],1049:["ru-RU","Русский (Россия)","Russian (Russia)"],2073:["ru-MD","Русский (Молдавия)","Russian (Republic of Moldova)"],28731:["smn","Sämikielâ"],9275:["smn-FI","Sämikielâ (Suomâ)","Sami (Inari) (Finland)"],31803:["smj","Julevusámegiella"],4155:["smj-NO","Julevusámegiella (Vuodna)","Sami (Lule) (Norway)"],5179:["smj-SE","Julevusámegiella (Svierik)","Sami (Lule) (Sweden)"],59:["se","Davvisámegiella"],3131:["se-FI","Davvisámegiella (Suopma)","Sami (Northern) (Finland)"],1083:["se-NO","Davvisámegiella (Norga)","Sami (Northern) (Norway)"],2107:["se-SE","Davvisámegiella (Ruoŧŧa)","Sami (Northern) (Sweden)"],29755:["sms","Sääm´ǩiõll"],8251:["sms-FI","Sääm´ǩiõll (Lää´ddjânnam)","Sami (Skolt) (Finland)"],30779:["sma","åarjelsaemiengiele"],6203:["sma-NO","åarjelsaemiengiele (Nöörje)","Sami (Southern) (Norway)"],7227:["sma-SE","åarjelsaemiengiele (Sveerje)","Sami (Southern) (Sweden)"],79:["sa","संस्कृत"],1103:["sa-IN","संस्कृत (भारतम्)","Sanskrit (India)"],145:["gd","Gàidhlig"],1169:["gd-GB","Gàidhlig (An Rìoghachd Aonaichte)","Scottish Gaelic (United Kingdom)"],31770:["sr","Srpski"],27674:["sr-Cyrl","Српски (Ћирилица)"],7194:["sr-Cyrl-BA","Српски (Босна и Херцеговина)","Serbian (Cyrillic) (Bosnia and Herzegovina)"],12314:["sr-Cyrl-ME","Српски (Црна Гора)","Serbian (Cyrillic, Montenegro)"],3098:["sr-Cyrl-CS","Српски (Србија и Црна Гора (Претходно))","Serbian (Cyrillic, Serbia and Montenegro (Former))"],10266:["sr-Cyrl-RS","Српски (Србија)","Serbian (Cyrillic, Serbia)"],28698:["sr-Latn","Srpski (Latinica)"],6170:["sr-Latn-BA","Srpski (Bosna i Hercegovina)","Serbian (Latin, Bosnia and Herzegovina)"],11290:["sr-Latn-ME","Srpski (Crna Gora)","Serbian (Latin, Montenegro)"],2074:["sr-Latn-CS","Srpski (Srbija i Crna Gora (Prethodno))","Serbian (Latin, Serbia and Montenegro (Former))"],9242:["sr-Latn-RS","Srpski (Srbija, Latinica)","Serbian (Latin, Serbia)"],108:["nso","Sesotho sa Leboa"],1132:["nso-ZA","Sesotho sa Leboa (Afrika Borwa)","Sesotho sa Leboa (South Africa)"],50:["tn","Setswana"],1074:["tn-ZA","Setswana (Aforika Borwa)","Setswana (South Africa)"],91:["si","සිංහ"],1115:["si-LK","සිංහ (ශ්රී ලංකා)","Sinhala (Sri Lanka)"],27:["sk","Slovenčina"],1051:["sk-SK","Slovenčina (Slovenská republika)","Slovak (Slovakia)"],36:["sl","Slovenski"],1060:["sl-SI","Slovenski (Slovenija)","Slovenian (Slovenia)"],10:["es","Español"],11274:["es-AR","Español (Argentina)","Spanish (Argentina)"],16394:["es-BO","Español (Bolivia)","Spanish (Bolivia)"],13322:["es-CL","Español (Chile)","Spanish (Chile)"],9226:["es-CO","Español (Colombia)","Spanish (Colombia)"],5130:["es-CR","Español (Costa Rica)","Spanish (Costa Rica)"],7178:["es-DO","Español (República Dominicana)","Spanish (Dominican Republic)"],12298:["es-EC","Español (Ecuador)","Spanish (Ecuador)"],17418:["es-SV","Español (El Salvador)","Spanish (El Salvador)"],4106:["es-GT","Español (Guatemala)","Spanish (Guatemala)"],18442:["es-HN","Español (Honduras)","Spanish (Honduras)"],2058:["es-MX","Español (México)","Spanish (Mexico)"],19466:["es-NI","Español (Nicaragua)","Spanish (Nicaragua)"],6154:["es-PA","Español (Panamá)","Spanish (Panama)"],15370:["es-PY","Español (Paraguay)","Spanish (Paraguay)"],10250:["es-PE","Español (Perú)","Spanish (Peru)"],20490:["es-PR","Español (Puerto Rico)","Spanish (Puerto Rico)"],3082:["es-ES","Español (España, alfabetización internacional)","Spanish (Spain)"],21514:["es-US","Español (Estados Unidos)","Spanish (United States)"],14346:["es-UY","Español (Uruguay)","Spanish (Uruguay)"],8202:["es-VE","Español (Republica Bolivariana de Venezuela)","Spanish (Venezuela)"],1034:["es-ES_tradnl","Spanish"],29:["sv","Svenska"],2077:["sv-FI","Svenska (Finland)","Swedish (Finland)"],1053:["sv-SE","Svenska (Sverige)","Swedish (Sweden)"],90:["syr","ܣܘܪܝܝܐ"],1114:["syr-SY","ܣܘܪܝܝܐ (سوريا)","Syriac (Syria)"],40:["tg","Тоҷикӣ"],31784:["tg-Cyrl","Тоҷикӣ"],1064:["tg-Cyrl-TJ","Тоҷикӣ (Тоҷикистон)","Tajik (Cyrillic) (Tajikistan)"],95:["tzm","Tamazight"],31839:["tzm-Latn","Tamazight (Latin)"],2143:["tzm-Latn-DZ","Tamazight (Djazaïr)","Tamazight (Latin) (Algeria)"],73:["ta","தமிழ்"],1097:["ta-IN","தமிழ் (இந்தியா)","Tamil (India)"],68:["tt","Татар"],1092:["tt-RU","Татар (Россия)","Tatar (Russia)"],74:["te","తెలుగు"],1098:["te-IN","తెలుగు (భారత దేశం)","Telugu (India)"],30:["th","ไทย"],1054:["th-TH","ไทย (ไทย)","Thai (Thailand)"],81:["bo","བོད་ཡིག"],1105:["bo-CN","བོད་ཡིག (ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།)","Tibetan (People's Republic of China)"],2129:["bo-BT","Tibetan (Bhutan)","Tibetan (Bhutan)"],31:["tr","Türkçe"],1055:["tr-TR","Türkçe (Türkiye)","Turkish (Turkey)"],66:["tk","Türkmençe"],1090:["tk-TM","Türkmençe (Türkmenistan)","Turkmen (Turkmenistan)"],34:["uk","Українська"],1058:["uk-UA","Українська (Україна)","Ukrainian (Ukraine)"],46:["hsb","Hornjoserbšćina"],1070:["hsb-DE","Hornjoserbšćina (Němska)","Upper Sorbian (Germany)"],32:["ur","اُردو"],1056:["ur-PK","اُردو (پاکستان)","Urdu (Islamic Republic of Pakistan)"],2080:["ur-IN","اُردو (بھارت)","Urdu (India)"],128:["ug","ئۇيغۇر يېزىقى"],1152:["ug-CN","(ئۇيغۇر يېزىقى (جۇڭخۇا خەلق جۇمھۇرىيىتى","Uighur (People's Republic of China)"],30787:["uz-Cyrl","Ўзбек"],2115:["uz-Cyrl-UZ","Ўзбек (Ўзбекистон)","Uzbek (Cyrillic, Uzbekistan)"],67:["uz","U'zbek"],31811:["uz-Latn","U'zbek"],1091:["uz-Latn-UZ","U'zbek (U'zbekiston Respublikasi)","Uzbek (Latin, Uzbekistan)"],42:["vi","Tiếng Việt"],1066:["vi-VN","Tiếng Việt (Việt Nam)","Vietnamese (Vietnam)"],82:["cy","Cymraeg"],1106:["cy-GB","Cymraeg (y Deyrnas Unedig)","Welsh (United Kingdom)"],136:["wo","Wolof"],1160:["wo-SN","Wolof (Sénégal)","Wolof (Senegal)"],133:["sah","Саха"],1157:["sah-RU","Саха (Россия)","Yakut (Russia)"],120:["ii","ꆈꌠꁱꂷ"],1144:["ii-CN","ꆈꌠꁱꂷ (ꍏꉸꏓꂱꇭꉼꇩ)","Yi (People's Republic of China)"],106:["yo","Yoruba"],1130:["yo-NG","Yoruba (Nigeria)","Yoruba (Nigeria)"],1126:["bin-NG","Bini (Nigeria)","Bini (Nigeria)"],1116:["chr-US","ᏣᎳᎩ (ᏌᏊ ᎢᏳᎾᎵᏍᏔᏅ ᏍᎦᏚᎩ)","Cherokee (United States)"],1127:["fuv-NG","Nigerian Fulfulde (Nigeria)","Nigerian Fulfulde (Nigeria)"],1138:["gaz-ET","West Central Oromo (Ethiopia)","West Central Oromo (Ethiopia)"],1140:["gn-PY","Guarani (Paraguay)","Guarani (Paraguay)"],1141:["haw-US","ʻŌlelo Hawaiʻi (ʻAmelika Hui Pū ʻIa)","Hawaiian (United States)"],1129:["ibb-NG","Ibibio (Nigeria)","Ibibio (Nigeria)"],1137:["kr-NG","Kanuri (Nigeria)","Kanuri (Nigeria)"],1112:["mni","Manipuri","Manipuri"],1109:["my-MM","Burmese (Myanmar)","Burmese (Myanmar)"],1145:["pap-AN","Papiamento, Netherlands Antilles","Papiamento, Netherlands Antilles"],2118:["pa-PK","Panjabi (Pakistan)","Panjabi (Pakistan)"],1165:["plt-MG","Plateau Malagasy (Madagascar)","Plateau Malagasy (Madagascar)"],1113:["sd-IN","Sindhi (India)","Sindhi (India)"],2137:["sd-PK","Sindhi (Pakistan)","Sindhi (Pakistan)"],1143:["so-SO","Soomaali (Soomaaliya)","Somali (Somalia)"],1072:["st-ZA","Southern Sotho (South Africa)","Southern Sotho (South Africa)"],1139:["ti-ER","ትግርኛ (ኤርትራ)","Tigrinya (Eritrea)"],2163:["ti-ET","ትግርኛ (ኢትዮጵያ)","Tigrinya (Ethiopia)"],1119:["tmz","Tamanaku"],3167:["tmz-MA","Tamaziɣt n laṭlaṣ (Meṛṛuk)","Tamanaku (Morocco)"],1073:["ts-ZA","Tsonga (South Africa)","Tsonga (South Africa)"],1075:["ven-ZA","South Africa","South Africa"]};return{getLocalLanguageName:function(e){return t[e]||["",e]},getLocalLanguageCode:function(e){if(e)for(var i in t)if(t[i][0].toLowerCase()===e.toLowerCase())return i;return null},getLanguages:function(){return t}}},define("common/main/lib/util/LanguageInfo",function(){}),define("common/main/lib/util/LocalStorage",["gateway"],function(){Common.localStorage=new function(){var t,e,i={},n=function(t){"localstorage"==t.type&&(i=t.keys)};Common.Gateway.on("internalcommand",n);var o=function(){d||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:e})},s=function(){d||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:i})},a=function(t,e,n){if(d)try{localStorage.setItem(t,e)}catch(t){}else i[t]=e,!0===n&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:e}})},l=function(t,e,i){a(t,e?1:0,i)},r=function(t){return d?localStorage.getItem(t):void 0===i[t]?null:i[t]},c=function(t,e){var i=r(t);return e=e||!1,null!==i?0!=parseInt(i):e},h=function(t){return null!==r(t)};try{var d=!!window.localStorage}catch(t){d=!1}return{getId:function(){return t},setId:function(e){t=e},getItem:r,getBool:c,setBool:l,setItem:a,setKeysFilter:function(t){e=t},getKeysFilter:function(){return e},itemExists:h,sync:o,save:s}}}),define("spreadsheeteditor/main/app/model/ShapeGroup",["backbone"],function(t){"use strict";SSE.Models=SSE.Models||{},SSE.Models.ShapeModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),SSE.Models.ShapeGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("spreadsheeteditor/main/app/collection/ShapeGroups",["backbone","spreadsheeteditor/main/app/model/ShapeGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},SSE.Collections.ShapeGroups=t.Collection.extend({model:SSE.Models.ShapeGroup})}),define("spreadsheeteditor/main/app/model/EquationGroup",["backbone"],function(t){"use strict";SSE.Models=SSE.Models||{},SSE.Models.EquationModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),SSE.Models.EquationGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("spreadsheeteditor/main/app/collection/EquationGroups",["backbone","spreadsheeteditor/main/app/model/EquationGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},SSE.Collections.EquationGroups=t.Collection.extend({model:SSE.Models.EquationGroup})}),define("spreadsheeteditor/main/app/model/Formula",["backbone"],function(t){"use strict";SSE.Models=SSE.Models||{},SSE.Models.FormulaModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),index:0,group:null,name:null,origin:null,args:null}}}),SSE.Models.FormulaGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),index:0,name:null,store:null,functions:[]}}})}),define("spreadsheeteditor/main/app/collection/FormulaGroups",["backbone","spreadsheeteditor/main/app/model/Formula"],function(t){"use strict";SSE.Collections=SSE.Collections||{},SSE.Collections.FormulaGroups=t.Collection.extend({model:SSE.Models.FormulaGroup})}),define("spreadsheeteditor/main/app/view/FormulaDialog",["common/main/lib/component/Window","spreadsheeteditor/main/app/collection/FormulaGroups"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.FormulaDialog=Common.UI.Window.extend(_.extend({applyFunction:void 0,initialize:function(t){var e=this,i={};_.extend(i,{width:375,height:490,header:!0,cls:"formula-dlg",contentTemplate:"",title:e.txtTitle,items:[]},t),this.template=t.template||['<div class="box" style="height:'+(i.height-85)+'px;">','<div class="content-panel" >','<label class="header">'+e.textGroupDescription+"</label>",'<div id="formula-dlg-combo-group" class="input-group-nr" style="margin-top: 10px"/>','<label class="header" style="margin-top:10px">'+e.textListDescription+"</label>",'<div id="formula-dlg-combo-functions" class="combo-functions"/>','<label id="formula-dlg-args" style="margin-top: 7px"></label>','<label id="formula-dlg-desc" style="margin-top: 4px; display: block;"></label>',"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+e.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+e.cancelButtonText+"</button>","</div>"].join(""),this.api=t.api,this.formulasGroups=t.formulasGroups,this.handler=t.handler,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.syntaxLabel=$("#formula-dlg-args"),this.descLabel=$("#formula-dlg-desc"),this.fillFormulasGroups()},show:function(t){if(this.$window){var e,i,n,o,s=this.initConfig.height;void 0===window.innerHeight?(e=document.documentElement.offsetWidth,i=document.documentElement.offsetHeight):(e=Common.Utils.innerWidth(),i=Common.Utils.innerHeight()),n=(parseInt(i,10)-parseInt(s,10))/2,o=(parseInt(e,10)-parseInt(this.initConfig.width,10))/2,this.$window.css("left",Math.floor(o)),this.$window.css("top",Math.floor(n))}Common.UI.Window.prototype.show.call(this),this.mask=$(".modals-mask"),this.mask.on("mousedown",_.bind(this.onUpdateFocus,this)),this.$window.on("mousedown",_.bind(this.onUpdateFocus,this)),t&&this.cmbFuncGroup.setValue(t),(t||"Last10"==this.cmbFuncGroup.getValue())&&this.fillFunctions(this.cmbFuncGroup.getValue()),this.cmbListFunctions&&_.delay(function(t){t.cmbListFunctions.$el.find(".listview").focus()},100,this)},hide:function(){this.mask.off("mousedown",_.bind(this.onUpdateFocus,this)),this.$window.off("mousedown",_.bind(this.onUpdateFocus,this)),Common.UI.Window.prototype.hide.call(this)},onBtnClick:function(t){"ok"===t.currentTarget.attributes.result.value&&this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onDblClickFunction:function(){this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onSelectGroup:function(t,e){_.isUndefined(e)||_.isUndefined(e.value)||e.value&&this.fillFunctions(e.value),this.onUpdateFocus()},onSelectFunction:function(t,e,i){this.formulasGroups&&(this.applyFunction={name:i.get("value"),origin:i.get("origin")},this.syntaxLabel.text(this.applyFunction.name+i.get("args")),this.descLabel.text(i.get("desc")))},onPrimary:function(t,e,i){this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onUpdateFocus:function(){_.delay(function(t){t.cmbListFunctions.$el.find(".listview").focus()},100,this)},fillFormulasGroups:function(){if(this.formulasGroups){var t=Common.Utils.InternalSettings.get("sse-settings-func-locale");_.isEmpty(t)&&(t="en");var e,i=[],n=this.formulasGroups.length;for(e=0;e<n;++e){var o=this.formulasGroups.at(e);o.get("functions").length&&i.push({value:o.get("name"),displayValue:o.get("caption")})}this.cmbFuncGroup?this.cmbFuncGroup.setData(i):(this.cmbFuncGroup=new Common.UI.ComboBox({el:$("#formula-dlg-combo-group"),menuStyle:"min-width: 100%;",cls:"input-group-nr",data:i,editable:!1}),this.cmbFuncGroup.on("selected",_.bind(this.onSelectGroup,this))),this.cmbFuncGroup.setValue("Last10"),this.fillFunctions("Last10")}},fillFunctions:function(t){if(this.formulasGroups&&(this.cmbListFunctions||this.functions||(this.functions=new Common.UI.DataViewStore,this.cmbListFunctions=new Common.UI.ListView({el:$("#formula-dlg-combo-functions"),store:this.functions,itemTemplate:_.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= value %></div>')}),this.cmbListFunctions.on("item:select",_.bind(this.onSelectFunction,this)),this.cmbListFunctions.on("item:dblclick",_.bind(this.onDblClickFunction,this)),this.cmbListFunctions.on("entervalue",_.bind(this.onPrimary,this)),this.cmbListFunctions.onKeyDown=_.bind(this.onKeyDown,this.cmbListFunctions),this.cmbListFunctions.$el.find(".listview").focus(),this.cmbListFunctions.scrollToRecord=_.bind(this.onScrollToRecordCustom,this.cmbListFunctions)),this.functions)){this.functions.reset();var e=0,i=0,n=null,o=this.formulasGroups.findWhere({name:t});if(o&&(n=o.get("functions"))&&n.length){for(i=n.length,e=0;e<i;++e)this.functions.push(new Common.UI.DataViewModel({id:n[e].get("index"),selected:e<1,allowSelected:!0,value:n[e].get("name"),args:n[e].get("args"),desc:n[e].get("desc"),origin:n[e].get("origin")}));this.applyFunction={name:n[0].get("name"),origin:n[0].get("origin")},this.syntaxLabel.text(this.applyFunction.name+n[0].get("args")),this.descLabel.text(n[0].get("desc")),this.cmbListFunctions.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}}},onKeyDown:function(t,e){function i(t){s.selectRecord(t),s.scrollToRecord(t),c=$(s.el).find(".inner"),s.scroller.scrollTop(c.scrollTop(),0),e.preventDefault(),e.stopPropagation()}var n=0,o=null,s=this,a="",l="",r=null,c=null,h=!1,d=null;if(!this.disabled){if(_.isUndefined(void 0)&&(e=t),a=t.key,t.keyCode>64&&t.keyCode<91&&a&&a.length){for(a=a.toLocaleLowerCase(),d=this.store.findWhere({selected:!0}),d&&(l=d.get("value"),h=l&&l.length&&l[0].toLocaleLowerCase()===a),n=0;n<this.store.length;++n)if(o=this.store.at(n),l=o.get("value"),l[0].toLocaleLowerCase()===a){if(null===r&&(r=o),h){d===o&&(h=!1);continue}if(o.get("selected"))continue;return void i(o)}if(r)return void i(r)}Common.UI.DataView.prototype.onKeyDown.call(this,t,e)}},onScrollToRecordCustom:function(t){var e=$(this.el).find(".inner"),i=e.offset().top,n=e.find("#"+t.get("id")).parent(),o=n.offset().top;(o<i||o+n.height()>i+e.height())&&(this.scroller?this.scroller.scrollTop(e.scrollTop()+o-i,0):e.scrollTop(e.scrollTop()+o-i))},cancelButtonText:"Cancel",okButtonText:"Ok",textGroupDescription:"Select Function Group",textListDescription:"Select Function",sDescription:"Description",txtTitle:"Insert Function"},SSE.Views.FormulaDialog||{}))}),define("spreadsheeteditor/main/app/view/FormulaTab",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(){"use strict";SSE.Views.FormulaTab=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.btnAutosum.on("click",function(){t.fireEvent("function:apply",[{name:t.api.asc_getFormulaLocaleName("SUM"),origin:"SUM"},!0])}),t.btnAutosum.menu.on("item:click",function(e,i,n){t.fireEvent("function:apply",[{name:i.caption,origin:i.value},!0])}),t.btnFormula.on("click",function(){t.fireEvent("function:apply",[{name:"more",origin:"more"}])})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this),this.toolbar=t.toolbar,this.formulasGroups=t.formulasGroups,this.lockedControls=[];var e=this,i=e.toolbar.$el,n=SSE.enumLock,o=SSE.getController("FormulaDialog");this.btnFinancial=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-finance",caption:o.sCategoryFinancial,hint:o.sCategoryFinancial,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-financial"),this.btnFinancial),this.lockedControls.push(this.btnFinancial),this.btnLogical=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-logic",caption:o.sCategoryLogical,hint:o.sCategoryLogical,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-logical"),this.btnLogical),this.lockedControls.push(this.btnLogical),this.btnTextData=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-func-text",caption:o.sCategoryTextAndData,hint:o.sCategoryTextAndData,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-text"),this.btnTextData),this.lockedControls.push(this.btnTextData),this.btnDateTime=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-datetime",caption:o.sCategoryDateAndTime,hint:o.sCategoryDateAndTime,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-datetime"),this.btnDateTime),this.lockedControls.push(this.btnDateTime),this.btnReference=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-lookup",caption:o.sCategoryLookupAndReference,hint:o.sCategoryLookupAndReference,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-lookup"),this.btnReference),this.lockedControls.push(this.btnReference),this.btnMath=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-func-math",caption:o.sCategoryMathematic,hint:o.sCategoryMathematic,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-math"),this.btnMath),this.lockedControls.push(this.btnMath),this.btnRecent=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-recent",caption:this.txtRecent,hint:this.txtRecent,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-recent"),this.btnRecent),this.lockedControls.push(this.btnRecent),this.btnAutosum=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-autosum",caption:this.txtAutosum,hint:this.txtAutosumTip,split:!0,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth],menu:new Common.UI.Menu({items:[{caption:"SUM",value:"SUM"},{caption:"MIN",value:"MIN"},{caption:"MAX",value:"MAX"},{caption:"COUNT",value:"COUNT"},{caption:"--"},{caption:e.txtAdditional,value:"more"}]})}),Common.Utils.injectComponent(i.find("#slot-btn-autosum"),this.btnAutosum),this.lockedControls.push(this.btnAutosum),this.btnFormula=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ins-formula",caption:this.txtFormula,hint:this.txtFormulaTip,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-additional-formula"),this.btnFormula),this.lockedControls.push(this.btnFormula),this.btnMore=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-more",caption:this.txtMore,hint:this.txtMore,menu:!0,split:!1,disabled:!0,lock:[n.editText,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.selRangeEdit,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-more"),this.btnMore),this.lockedControls.push(this.btnMore),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){t.call(i)})},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButtons:function(t){return this.lockedControls},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},focusInner:function(t,e){e.keyCode==Common.UI.Keys.UP?t.items[t.items.length-1].cmpEl.find("> a").focus():t.items[0].cmpEl.find("> a").focus()},focusOuter:function(t,e){t.items[2].cmpEl.find("> a").focus()},onBeforeKeyDown:function(t,e){if(e.keyCode==Common.UI.Keys.RETURN){e.preventDefault(),e.stopPropagation();var i=$(e.target).closest("li");i.length>0&&i.click(),Common.UI.Menu.Manager.hideAll()}else if("after.bs.dropdown"!==e.namespace&&(e.keyCode==Common.UI.Keys.DOWN||e.keyCode==Common.UI.Keys.UP)){var n=$("> [role=menu] > li:not(.divider):not(.disabled):visible",t.$el).find("> a");if(!n.length)return;var o=n.index(n.filter(":focus")),s=this;(t._outerMenu&&(e.keyCode==Common.UI.Keys.UP&&0==o||e.keyCode==Common.UI.Keys.DOWN&&o==n.length-1)||t._innerMenu&&(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN)&&-1!==o)&&(e.preventDefault(),e.stopPropagation(),_.delay(function(){t._outerMenu?s.focusOuter(t._outerMenu,e):s.focusInner(t._innerMenu,e)},10))}},setButtonMenu:function(t,e){var i=this,n=[],o=i.formulasGroups.findWhere({name:e});if(o){var s=o.get("functions");s&&s.forEach(function(t){n.push(new Common.UI.MenuItem({caption:t.get("name"),value:t.get("origin")}))})}if(n.length)if(t.menu&&t.menu.rendered){var a=t.menu._innerMenu;a&&(a.removeAll(),n.forEach(function(t){a.addItem(t)}))}else{t.setMenu(new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-formula-menu-'+e+'" style="display: flex;" class="open"></div>')},{caption:"--"},{caption:i.txtAdditional,value:"more"}]})),t.menu.items[2].on("click",function(t,n){i.fireEvent("function:apply",[{name:t.caption,origin:t.value},!1,e])}),t.menu.on("show:after",function(t,e){t._innerMenu.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t._innerMenu&&t._innerMenu.cmpEl.focus()},10)}).on("keydown:before",_.bind(i.onBeforeKeyDown,this));var a=new Common.UI.Menu({maxHeight:300,cls:"internal-menu",items:n});a.render(t.menu.items[0].cmpEl.children(":first")),a.cmpEl.css({display:"block",position:"relative",left:0,top:0}),a.cmpEl.attr({tabindex:"-1"}),a.on("item:click",function(t,n,o){i.fireEvent("function:apply",[{name:n.caption,origin:n.value},!1,e])}).on("keydown:before",_.bind(i.onBeforeKeyDown,this)),t.menu._innerMenu=a,a._outerMenu=t.menu}t.setDisabled(n.length<1)},setMenuItemMenu:function(t){var e=this,i=[],n=SSE.getController("FormulaDialog"),o=e.formulasGroups.findWhere({name:t});if(o){var s=o.get("functions");if(s&&s.forEach(function(t){i.push(new Common.UI.MenuItem({caption:t.get("name"),value:t.get("origin")}))}),i.length){var a=new Common.UI.MenuItem({caption:n["sCategory"+t]||t,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-formula-menu-'+t+'" style="display: flex;" class="open"></div>')},{caption:"--"},{caption:e.txtAdditional,value:"more"}]})});a.menu.items[2].on("click",function(i,n){e.fireEvent("function:apply",[{name:i.caption,origin:i.value},!1,t])}),a.menu.on("show:after",function(t,e){t._innerMenu.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t._innerMenu&&t._innerMenu.items[0].cmpEl.find("> a").focus()},10)}).on("keydown:before",_.bind(e.onBeforeKeyDown,this)).on("keydown:before",function(t,e){if(e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.ESC){var i=t.cmpEl.parent();i.hasClass("dropdown-submenu")&&i.hasClass("over")&&(i.removeClass("over"),i.find("> a").focus())}});var l=new Common.UI.Menu({maxHeight:300,cls:"internal-menu",items:i});return l.on("item:click",function(i,n,o){e.fireEvent("function:apply",[{name:n.caption,origin:n.value},!1,t])}).on("keydown:before",_.bind(e.onBeforeKeyDown,this)),a.menu._innerMenu=l,l._outerMenu=a.menu,a}}},fillFunctions:function(){if(this.formulasGroups){this.setButtonMenu(this.btnFinancial,"Financial"),this.setButtonMenu(this.btnLogical,"Logical"),this.setButtonMenu(this.btnTextData,"TextAndData"),this.setButtonMenu(this.btnDateTime,"DateAndTime"),this.setButtonMenu(this.btnReference,"LookupAndReference"),this.setButtonMenu(this.btnMath,"Mathematic"),this.setButtonMenu(this.btnRecent,"Last10");for(var t=this.btnAutosum.menu.items,e=0;e<Math.min(4,t.length);e++)this.api&&t[e].setCaption(this.api.asc_getFormulaLocaleName(t[e].value));var i=this,n=[];["Cube","Database","Engineering","Information","Statistical"].forEach(function(t){var e=i.setMenuItemMenu(t);e&&n.push(e)});var o=this.btnMore;n.length&&(o.menu&&o.menu.rendered?(o.menu.removeAll(),n.forEach(function(t){o.menu.addItem(t)})):o.setMenu(new Common.UI.Menu({items:n})),o.menu.items.forEach(function(t){var e=t.menu.items[0].cmpEl.children(":first"),i=t.menu._innerMenu;i.render(e),i.cmpEl.css({display:"block",position:"relative",left:0,top:0}),i.cmpEl.attr({tabindex:"-1"})})),o.setDisabled(n.length<1)}},updateRecent:function(){this.formulasGroups&&this.setButtonMenu(this.btnRecent,"Last10")},setApi:function(t){this.api=t},txtRecent:"Recently used",txtAutosum:"Autosum",txtAutosumTip:"Summation",txtAdditional:"Additional",txtFormula:"Function",txtFormulaTip:"Insert function",txtMore:"More functions"}}(),SSE.Views.FormulaTab||{}))}),define("spreadsheeteditor/main/app/controller/FormulaDialog",["core","spreadsheeteditor/main/app/collection/FormulaGroups","spreadsheeteditor/main/app/view/FormulaDialog","spreadsheeteditor/main/app/view/FormulaTab"],function(){"use strict";SSE.Controllers=SSE.Controllers||{},SSE.Controllers.FormulaDialog=Backbone.Controller.extend(_.extend({models:[],views:["FormulaDialog","FormulaTab"],collections:["FormulaGroups"],initialize:function(){var t=this;t.langJson={},t.langDescJson={},this.addListeners({FileMenu:{"settings:apply":function(){if(t.mode&&t.mode.isEdit){t.needUpdateFormula=!0;var e=Common.localStorage.getItem("sse-settings-func-locale");Common.Utils.InternalSettings.set("sse-settings-func-locale",e),t.formulasGroups.reset(),t.reloadTranslations(e)}}},FormulaTab:{"function:apply":this.applyFunction},Toolbar:{"function:apply":this.applyFunction,"tab:active":this.onTabActive}})},applyFunction:function(t,e,i){t&&("more"===t.origin?this.showDialog(i):(this.api.asc_insertFormula(t.name,Asc.c_oAscPopUpSelectorType.Func,!!e),!e&&this.updateLast10Formulas(t.origin)))},setConfig:function(t){return this.toolbar=t.toolbar,this.formulaTab=this.createView("FormulaTab",{toolbar:this.toolbar.toolbar,formulasGroups:this.formulasGroups}),this},setApi:function(t){if(this.api=t,this.formulasGroups&&this.api){Common.Utils.InternalSettings.set("sse-settings-func-last",Common.localStorage.getItem("sse-settings-func-last")),this.reloadTranslations(Common.localStorage.getItem("sse-settings-func-locale")||this.appOptions.lang,!0);var e=this;this.formulas=new SSE.Views.FormulaDialog({api:this.api,toolclose:"hide",formulasGroups:this.formulasGroups,handler:_.bind(this.applyFunction,this)}),this.formulas.on({hide:function(){e.api.asc_enableKeyEvents(!0)}})}return this.formulaTab&&this.formulaTab.setApi(this.api),this},setMode:function(t){return this.mode=t,this},onLaunch:function(){this.formulasGroups=this.getApplication().getCollection("FormulaGroups");Common.Gateway.on("init",this.loadConfig.bind(this))},loadConfig:function(t){this.appOptions={},this.appOptions.lang=t.config.lang},reloadTranslations:function(t,e){var i=this;t=(t||"en").split(/[\-_]/)[0].toLowerCase(),Common.Utils.InternalSettings.set("sse-settings-func-locale",t),i.langJson[t]?(i.api.asc_setLocalization(i.langJson[t]),Common.NotificationCenter.trigger("formula:settings",this)):"en"==t?(i.api.asc_setLocalization(void 0),Common.NotificationCenter.trigger("formula:settings",this)):Common.Utils.loadConfig("resources/formula-lang/"+t+".json",function(e){"error"!=e&&(i.langJson[t]=e,i.api.asc_setLocalization(e),Common.NotificationCenter.trigger("formula:settings",this))}),i.langDescJson[t]?i.loadingFormulas(i.langDescJson[t],e):Common.Utils.loadConfig("resources/formula-lang/"+t+"_desc.json",function(n){"error"!=n?(i.langDescJson[t]=n,i.loadingFormulas(n,e)):Common.Utils.loadConfig("resources/formula-lang/en_desc.json",function(n){i.langDescJson[t]="error"!=n?n:null,i.loadingFormulas(i.langDescJson[t],e)})})},getDescription:function(t){return t?(t=t.toLowerCase(),this.langDescJson[t]?this.langDescJson[t]:null):""},showDialog:function(t){this.formulas&&(this.needUpdateFormula&&(this.needUpdateFormula=!1,
|
|
|
this.formulas.$window&&this.formulas.fillFormulasGroups()),this.formulas.show(t))},hideDialog:function(){this.formulas&&this.formulas.isVisible()&&this.formulas.hide()},updateLast10Formulas:function(t){var e=Common.Utils.InternalSettings.get("sse-settings-func-last")||"SUM;AVERAGE;IF;HYPERLINK;COUNT;MAX;SIN;SUMIF;PMT;STDEV";e=e.split(";");var i=_.indexOf(e,t);e.splice(i<0?e.length-1:i,1),e.unshift(t);var n=e.join(";");if(Common.localStorage.setItem("sse-settings-func-last",n),Common.Utils.InternalSettings.set("sse-settings-func-last",n),this.formulasGroups){var o=this.formulasGroups.findWhere({name:"Last10"});o&&o.set("functions",this.loadingLast10Formulas(this.getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")))),this.formulaTab&&this.formulaTab.updateRecent()}},loadingLast10Formulas:function(t){for(var e=(Common.Utils.InternalSettings.get("sse-settings-func-last")||"SUM;AVERAGE;IF;HYPERLINK;COUNT;MAX;SIN;SUMIF;PMT;STDEV").split(";"),i=this.api.asc_getFunctionArgumentSeparator(),n=[],o=0;o<e.length;o++){var s=e[o];n.push(new SSE.Models.FormulaModel({index:o,group:"Last10",name:this.api.asc_getFormulaLocaleName(s),origin:s,args:(t&&t[s]?t[s].a:"").replace(/[,;]/g,i),desc:t&&t[s]?t[s].d:""}))}return n},loadingFormulas:function(t,e){var i,n,o,s=0,a=0,l=this.formulasGroups,r=null,c=0,h=0,d=null,p=[],m=null,u=null,g=this.api.asc_getFunctionArgumentSeparator();if(l&&(i="Last10",u=new SSE.Models.FormulaGroup({name:i,index:c,store:l,caption:this["sCategory"+i]||i}),u&&(u.set("functions",this.loadingLast10Formulas(t)),l.push(u),c+=1),i="All",m=new SSE.Models.FormulaGroup({name:i,index:c,store:l,caption:this["sCategory"+i]||i}),m&&(l.push(m),c+=1),m)){for(d=this.api.asc_getFormulasInfo(),s=0;s<d.length;s+=1){for(i=d[s].asc_getGroupName(),n=d[s].asc_getFormulasArray(),r=new SSE.Models.FormulaGroup({name:i,index:c,store:l,caption:this["sCategory"+i]||i}),c+=1,o=[],a=0;a<n.length;a+=1){var b=n[a].asc_getName(),f=new SSE.Models.FormulaModel({index:h,group:i,name:n[a].asc_getLocaleName(),origin:b,args:(t&&t[b]?t[b].a:"").replace(/[,;]/g,g),desc:t&&t[b]?t[b].d:""});h+=1,o.push(f),p.push(f)}r.set("functions",_.sortBy(o,function(t){return t.get("name")})),l.push(r)}m.set("functions",_.sortBy(p,function(t){return t.get("name")}))}(!e||this._formulasInited)&&this.formulaTab&&this.formulaTab.fillFunctions()},onTabActive:function(t){"formula"==t&&!this._formulasInited&&this.formulaTab&&(this.formulaTab.fillFunctions(),this._formulasInited=!0)},sCategoryAll:"All",sCategoryLast10:"10 last used",sCategoryLogical:"Logical",sCategoryCube:"Cube",sCategoryDatabase:"Database",sCategoryDateAndTime:"Date and time",sCategoryEngineering:"Engineering",sCategoryFinancial:"Financial",sCategoryInformation:"Information",sCategoryLookupAndReference:"Lookup and reference",sCategoryMathematic:"Math and trigonometry",sCategoryStatistical:"Statistical",sCategoryTextAndData:"Text and data"},SSE.Controllers.FormulaDialog||{}))}),define("spreadsheeteditor/main/app/controller/Main",["core","irregularstack","common/main/lib/component/Window","common/main/lib/component/LoadMask","common/main/lib/component/Tooltip","common/main/lib/controller/Fonts","common/main/lib/collection/TextArt","common/main/lib/view/OpenDialog","common/main/lib/util/LanguageInfo","common/main/lib/util/LocalStorage","spreadsheeteditor/main/app/collection/ShapeGroups","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/collection/EquationGroups","spreadsheeteditor/main/app/controller/FormulaDialog"],function(){"use strict";SSE.Controllers.Main=Backbone.Controller.extend(_.extend(function(){var t={about:"button#left-btn-about",feedback:"button#left-btn-support",goback:"#fm-btn-back > a, #header-back > div"},e={toolbar:"#viewport #toolbar",leftMenu:"#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings",rightMenu:"#viewport #right-menu",statusBar:"#statusbar"};return Common.localStorage.setId("table"),Common.localStorage.setKeysFilter("sse-,asc.table"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","EquationGroups","TableTemplates","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)},"Common.Views.ReviewChanges":{"settings:apply":_.bind(this.applySettings,this)}})},onLaunch:function(){var t=this;if(this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseType:!1},this.translationTable=[],this.isModalShowed=0,!Common.Utils.isBrowserSupported())return Common.Utils.showBrowserRestriction(),void Common.Gateway.reportError(void 0,this.unsupportedBrowserErrorText);var e=Common.localStorage.getItem("sse-settings-fontrender");null===e&&(e=window.devicePixelRatio>1?"1":"3"),Common.Utils.InternalSettings.set("sse-settings-fontrender",e);var i=["Normal","Neutral","Bad","Good","Input","Output","Calculation","Check Cell","Explanatory Text","Note","Linked Cell","Warning Text","Heading 1","Heading 2","Heading 3","Heading 4","Title","Total","Currency","Percent","Comma"],n={Series:this.txtSeries,"Diagram Title":this.txtDiagramTitle,"X Axis":this.txtXAxis,"Y Axis":this.txtYAxis,"Your text here":this.txtArt,Table:this.txtTable,Print_Area:this.txtPrintArea,Confidential:this.txtConfidential,"Prepared by ":this.txtPreparedBy+" ",Page:this.txtPage,"Page %1 of %2":this.txtPageOf,Pages:this.txtPages,Date:this.txtDate,Time:this.txtTime,Tab:this.txtTab,File:this.txtFile};i.forEach(function(e){n[e]=t.translationTable[e]=t["txtStyle_"+e.replace(/ /g,"_")]||e}),n["Currency [0]"]=t.translationTable["Currency [0]"]=t.txtStyle_Currency+" [0]",n["Comma [0]"]=t.translationTable["Comma [0]"]=t.txtStyle_Comma+" [0]";for(var o=1;o<7;o++)n["Accent"+o]=t.translationTable["Accent"+o]=t.txtAccent+o,n["20% - Accent"+o]=t.translationTable["20% - Accent"+o]="20% - "+t.txtAccent+o,n["40% - Accent"+o]=t.translationTable["40% - Accent"+o]="40% - "+t.txtAccent+o,n["60% - Accent"+o]=t.translationTable["60% - Accent"+o]="60% - "+t.txtAccent+o;this.api=new Asc.spreadsheet_api({"id-view":"editor_sdk","id-input":"ce-cell-content",translate:n}),this.api.asc_setFontRenderingMode(parseInt(e)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onEndAction",_.bind(this.onLongActionEnd,this)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),this.api.asc_registerCallback("asc_onSpellCheckInit",_.bind(this.loadLanguages,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),Common.NotificationCenter.on("namedrange:locked",_.bind(this.onNamedRangeLocked,this)),Common.NotificationCenter.on("download:cancel",_.bind(this.onDownloadCancel,this)),Common.NotificationCenter.on("download:advanced",_.bind(this.onAdvancedOptions,this)),this.stackLongActions=new Common.IrregularStack({strongCompare:this._compareActionStrong,weakCompare:this._compareActionWeak}),this.stackLongActions.push({id:-254,type:Asc.c_oAscAsyncActionType.BlockInteraction}),this.isShowOpenDialog=!1,this.editorConfig={},Common.Gateway.on("init",_.bind(this.loadConfig,this)),Common.Gateway.on("showmessage",_.bind(this.onExternalMessage,this)),Common.Gateway.on("opendocument",_.bind(this.loadDocument,this)),Common.Gateway.on("internalcommand",_.bind(this.onInternalCommand,this)),Common.Gateway.appReady(),this.getApplication().getController("Viewport").setApi(this.api),$(document.body).on("focus","input, textarea:not(#ce-cell-content)",function(e){!0!==t.isAppDisabled&&e&&e.target&&!/area_id/.test(e.target.id)&&(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/chat-msg-text/.test(e.target.id)?t.dontCloseChat=!0:!t.isModalShowed&&/form-control/.test(e.target.className)&&(t.inFormControl=!0))}),$(document.body).on("blur","input, textarea",function(e){if(!0!==t.isAppDisabled&&!t.isFrameClosed&&!(t.isModalShowed&&!($(".asc-window.enable-key-events:visible").length>0)||t.loadMask&&t.loadMask.isVisible())){if(/form-control/.test(e.target.className)&&(t.inFormControl=!1),t.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file").isVisible())return;if(!e.relatedTarget||!/area_id/.test(e.target.id)&&!("input"==e.target.localName&&$(e.target).parent().find(e.relatedTarget).length>0)&&!("textarea"==e.target.localName&&$(e.target).closest(".asc-window").find(".dropdown-menu").find(e.relatedTarget).length>0)&&("input"!=e.relatedTarget.localName||!/form-control/.test(e.relatedTarget.className))&&("textarea"!=e.relatedTarget.localName||/area_id/.test(e.relatedTarget.id))){if(Common.Utils.isIE&&e.originalEvent&&e.originalEvent.target&&/area_id/.test(e.originalEvent.target.id)&&e.originalEvent.target===e.originalEvent.srcElement)return;t.api.asc_enableKeyEvents(!0),/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!1:/chat-msg-text/.test(e.target.id)&&(t.dontCloseChat=!1)}}}).on("dragover",function(t){var e=t.originalEvent;if(e.target&&$(e.target).closest("#editor_sdk").length<1)return e.preventDefault(),e.dataTransfer.dropEffect="none",!1}).on("dragstart",function(t){var e=t.originalEvent;if(e.target){var i=$(e.target);(i.closest(".combobox").length>0||i.closest(".dropdown-menu").length>0||i.closest(".ribtab").length>0||i.closest(".combo-dataview").length>0)&&e.preventDefault()}}),Common.NotificationCenter.on({"modal:show":function(e){t.isModalShowed++,t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){--t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"modal:hide":function(e){--t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"dataview:focus":function(t){},"dataview:blur":function(e){t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"menu:show":function(t){},"menu:hide":function(e,i){t.isModalShowed||e&&e.cmpEl.hasClass("from-cell-edit")||i||(t.api.asc_InputClearKeyboardElement(),t.api.asc_enableKeyEvents(!0))},"edit:complete":_.bind(this.onEditComplete,this),"settings:unitschanged":_.bind(this.unitsChanged,this)}),this.initNames(),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+s,ctrl+s,command+p,ctrl+p,command+k,ctrl+k,command+d,ctrl+d":_.bind(function(t){t.preventDefault(),t.stopPropagation()},this)}}),t.defaultTitleText="ONLYOFFICE",t.warnNoLicense=t.warnNoLicense.replace("%1","ONLYOFFICE"),t.warnNoLicenseUsers=t.warnNoLicenseUsers.replace("%1","ONLYOFFICE"),t.textNoLicenseTitle=t.textNoLicenseTitle.replace("%1","ONLYOFFICE")},loadConfig:function(t){this.editorConfig=$.extend(this.editorConfig,t.config),this.appOptions={},this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(this.editorConfig.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.isDesktopApp="desktop"==this.editorConfig.targetApp,this.appOptions.canCreateNew=!_.isEmpty(this.editorConfig.createUrl),this.appOptions.canOpenRecent=void 0!==this.editorConfig.recent&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location="string"==typeof this.editorConfig.location?this.editorConfig.location.toLowerCase():"",this.appOptions.region="string"==typeof this.editorConfig.region?this.editorConfig.region.toLowerCase():this.editorConfig.region,this.appOptions.canAutosave=!1,this.appOptions.canAnalytics=!1,this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.saveAsUrl=this.editorConfig.saveAsUrl,this.appOptions.fileChoiceUrl=this.editorConfig.fileChoiceUrl,this.appOptions.isEditDiagram="editdiagram"==this.editorConfig.mode,this.appOptions.isEditMailMerge="editmerge"==this.editorConfig.mode,this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=!1!==this.editorConfig.canBackToFolder&&"object"==typeof this.editorConfig.customization&&"object"==typeof this.editorConfig.customization.goback&&!_.isEmpty(this.editorConfig.customization.goback.url),this.appOptions.canBack=!0===this.appOptions.canBackToFolder,this.appOptions.canPlugins=!1,this.appOptions.canRequestUsers=this.editorConfig.canRequestUsers,this.appOptions.canRequestSendNotify=this.editorConfig.canRequestSendNotify,this.appOptions.canRequestSaveAs=this.editorConfig.canRequestSaveAs,this.appOptions.canRequestInsertImage=this.editorConfig.canRequestInsertImage,this.headerView=this.getApplication().getController("Viewport").getView("Common.Views.Header"),this.headerView.setCanBack(!0===this.appOptions.canBackToFolder,this.appOptions.canBackToFolder?this.editorConfig.customization.goback.text:"").setUserName(this.appOptions.user.fullname);var e=Common.localStorage.getItem("sse-settings-reg-settings");null!==e?this.api.asc_setLocale(parseInt(e)):(e=this.appOptions.region,e=Common.util.LanguageInfo.getLanguages().hasOwnProperty(e)?e:Common.util.LanguageInfo.getLocalLanguageCode(e),e=null!==e?parseInt(e):this.editorConfig.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.editorConfig.lang)):1033,this.api.asc_setLocale(e)),e=Common.localStorage.getBool("sse-settings-r1c1"),Common.Utils.InternalSettings.set("sse-settings-r1c1",e),this.api.asc_setR1C1Mode(e),"us"!=this.appOptions.location&&"ca"!=this.appOptions.location||Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch),this.isFrameClosed=this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge,Common.Controllers.Desktop.init(this.appOptions)},loadDocument:function(t){this.appOptions.spreadsheet=t.doc,this.permissions={};var e={};if(t.doc){this.permissions=_.extend(this.permissions,t.doc.permissions);var i=$.extend({},t.doc.permissions),n=$.extend({},t.doc.options,this.editorConfig.actionLink||{}),o=new Asc.asc_CUserInfo;o.put_Id(this.appOptions.user.id),o.put_FullName(this.appOptions.user.fullname),e=new Asc.asc_CDocInfo,e.put_Id(t.doc.key),e.put_Url(t.doc.url),e.put_Title(t.doc.title),e.put_Format(t.doc.fileType),e.put_VKey(t.doc.vkey),e.put_Options(n),e.put_UserInfo(o),e.put_CallbackUrl(this.editorConfig.callbackUrl),e.put_Token(t.doc.token),e.put_Permissions(i),this.headerView&&this.headerView.setDocumentCaption(t.doc.title)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_registerCallback("asc_onLicenseChanged",_.bind(this.onLicenseChanged,this)),this.api.asc_setDocInfo(e),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId)},onProcessSaveResult:function(t){this.api.asc_OnSaveEnd(t.result),t&&!1===t.result&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(t.message)?this.errorProcessSaveResult:t.message})},onProcessRightsChange:function(t){if(t&&!1===t.enabled){var e=this,i=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("collaboration:sharingdeny"),Common.NotificationCenter.trigger("api:disconnect"),i||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(t.message)?this.warnProcessRightsChange:t.message,callback:function(){e._state.lostEditingRights=!1,e.onEditComplete()}})}},onDownloadAs:function(t){if(!this.appOptions.canDownload)return void Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny,this.errorAccessDeny);this._state.isFromGatewayDownloadAs=!0;var e=t&&"string"==typeof t?Asc.c_oAscFileType[t.toUpperCase()]:null,i=[Asc.c_oAscFileType.XLSX,Asc.c_oAscFileType.ODS,Asc.c_oAscFileType.CSV,Asc.c_oAscFileType.PDF,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.XLTX,Asc.c_oAscFileType.OTS];(!e||i.indexOf(e)<0)&&(e=Asc.c_oAscFileType.XLSX),e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?Common.NotificationCenter.trigger("download:settings",this,e,!0):this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e,!0))},onProcessMouse:function(t){if("mouseup"==t.type){var e=document.getElementById("editor_sdk");if(e){var i=e.getBoundingClientRect(),n=t.event||{};this.api.asc_onMouseUp(n,t.x-i.left,t.y-i.top)}}},goBack:function(t){var e=this;if(!Common.Controllers.Desktop.process("goback")){var i=e.appOptions.customization.goback.url;t||!1===e.appOptions.customization.goback.blank?parent.location.href=i:window.open(i,"_blank")}},onEditComplete:function(t,e){e&&e.restorefocus&&this.api.isCEditorFocused?(this.formulaInput.blur(),this.formulaInput.focus()):(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").focus(),this.api.isCEditorFocused=!1)},onSelectionChanged:function(t){this._isChartDataReady||t.asc_getFlags().asc_getSelectionType()!=Asc.c_oAscSelectionType.RangeChart||(this._isChartDataReady=!0,Common.Gateway.internalMessage("chartDataReady"))},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(t,e){var i={id:e,type:t};this.stackLongActions.pop(i),this.headerView&&this.headerView.setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),t===Asc.c_oAscAsyncActionType.BlockInteraction&&e==Asc.c_oAscAsyncAction.Open&&(Common.Gateway.internalMessage("documentReady",{}),this.onDocumentContentReady()),i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}),i&&this.setLongActionView(i),e==Asc.c_oAscAsyncAction.Save&&this.toolbarView&&this.toolbarView.synchronizeChanges(),i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),i?this.setLongActionView(i):(this.loadMask&&(!this.loadMask.isVisible()||this.dontCloseDummyComment||this.dontCloseChat||this.isModalShowed||this.inFormControl||this.api.asc_enableKeyEvents(!0),this.loadMask.hide()),t!=Asc.c_oAscAsyncActionType.BlockInteraction||(e==Asc.c_oAscAsyncAction.LoadDocumentFonts||e==Asc.c_oAscAsyncAction.ApplyChanges)&&(this.dontCloseDummyComment||this.dontCloseChat||this.isModalShowed||this.inFormControl)||this.onEditComplete(this.loadMask,{restorefocus:!0}))},setLongActionView:function(t){var e="";switch(t.id){case Asc.c_oAscAsyncAction.Open:e=this.openTitleText;break;case Asc.c_oAscAsyncAction.Save:e=this.saveTitleText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:case Asc.c_oAscAsyncAction.ForceSaveButton:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:e=this.loadFontsTitleText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:e=this.loadImagesTitleText;break;case Asc.c_oAscAsyncAction.LoadFont:e=this.loadFontTitleText;break;case Asc.c_oAscAsyncAction.LoadImage:e=this.loadImageTitleText;break;case Asc.c_oAscAsyncAction.DownloadAs:e=this.downloadTitleText;break;case Asc.c_oAscAsyncAction.Print:e=this.printTitleText;break;case Asc.c_oAscAsyncAction.UploadImage:e=this.uploadImageTitleText;break;case Asc.c_oAscAsyncAction.Recalc:e=this.titleRecalcFormulas;break;case Asc.c_oAscAsyncAction.SlowOperation:e=this.textPleaseWait;break;case Asc.c_oAscAsyncAction.PrepareToSave:e=this.savePreparingText;break;case Asc.c_oAscAsyncAction.Waiting:e=this.waitText;break;case-255:e=this.txtEditingMode;break;case-256:e=this.loadingDocumentTitleText;break;default:"string"==typeof t.id&&(e=t.id)}t.type==Asc.c_oAscAsyncActionType.BlockInteraction&&(!this.loadMask&&(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(e),this.isShowOpenDialog||(this.api.asc_enableKeyEvents(!1),this.loadMask.show()))},onApplyEditRights:function(t){t&&!t.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:t.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function t(){if(!window.AscDesktopEditor){var e=[];Common.Utils.isIE9m&&e.push(i.warnBrowserIE9),e.length&&i.showTips(e)}document.removeEventListener("visibilitychange",t)}if(!this._isDocReady){this._state.openDlg&&this._state.openDlg.close();var e,i=this;i._isDocReady=!0,Common.NotificationCenter.trigger("app:ready",this.appOptions),i.hidePreloader(),i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),e=this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram?100:Common.localStorage.getItem("sse-settings-zoom"),Common.Utils.InternalSettings.set("sse-settings-zoom",e);var n=null!==e?parseInt(e)/100:this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom)/100:1;this.api.asc_setZoom(n>0?n:1),this.isLiveCommenting=Common.localStorage.getBool("sse-settings-livecomment",!0),Common.Utils.InternalSettings.set("sse-settings-livecomment",this.isLiveCommenting),e=Common.localStorage.getBool("sse-settings-resolvedcomment"),Common.Utils.InternalSettings.set("sse-settings-resolvedcomment",e),this.isLiveCommenting?this.api.asc_showComments(e):this.api.asc_hideComments(),this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring?(e=Common.localStorage.getItem("sse-settings-coauthmode"),null===e&&null===Common.localStorage.getItem("sse-settings-autosave")&&this.appOptions.customization&&!1===this.appOptions.customization.autosave&&(e=0),this._state.fastCoauth=null===e||1==parseInt(e)):(this._state.fastCoauth=!this.appOptions.isEdit&&this.appOptions.isRestrictedEdit,this._state.fastCoauth&&(this.api.asc_setAutoSaveGap(1),Common.Utils.InternalSettings.set("sse-settings-autosave",1))),this.api.asc_SetFastCollaborative(this._state.fastCoauth),Common.Utils.InternalSettings.set("sse-settings-coauthmode",i._state.fastCoauth),i.api.asc_registerCallback("asc_onStartAction",_.bind(i.onLongActionBegin,i)),i.api.asc_registerCallback("asc_onConfirmAction",_.bind(i.onConfirmAction,i)),i.api.asc_registerCallback("asc_onActiveSheetChanged",_.bind(i.onActiveSheetChanged,i)),i.api.asc_registerCallback("asc_onPrint",_.bind(i.onPrint,i));var o=i.getApplication();i.headerView.setDocumentCaption(i.api.asc_getDocumentName()),i.updateWindowTitle(i.api.asc_isDocumentModified(),!0);var s=o.getController("Toolbar"),a=o.getController("Statusbar"),l=o.getController("DocumentHolder"),r=o.getController("RightMenu"),c=o.getController("LeftMenu"),h=o.getController("CellEditor"),d=a.getView("Statusbar"),p=c.getView("LeftMenu"),m=l.getView("DocumentHolder"),u=o.getController("Common.Controllers.Chat"),g=o.getController("Common.Controllers.Plugins"),b=o.getController("Spellcheck");if(p.getMenu("file").loadDocument({doc:i.appOptions.spreadsheet}),c.setMode(i.appOptions).createDelayedElements().setApi(i.api),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||g.setApi(i.api),p.disableMenu("all",!1),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||!i.appOptions.canBranding||i.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(i.editorConfig.customization),l.setApi(i.api).loadConfig({config:i.editorConfig}),u.setApi(this.api).setMode(this.appOptions),a.createDelayedElements(),a.setApi(i.api),m.setApi(i.api),d.update(),this.formulaInput=h.getView("CellEditor").$el.find("textarea"),i.appOptions.isEdit){b.setApi(i.api).setMode(i.appOptions),i.appOptions.canAutosave?(e=Common.localStorage.getItem("sse-settings-autosave"),null===e&&i.appOptions.customization&&!1===i.appOptions.customization.autosave&&(e=0),e=i._state.fastCoauth||null===e?i.appOptions.canCoAuthoring?1:0:parseInt(e)):e=0,i.api.asc_setAutoSaveGap(e),Common.Utils.InternalSettings.set("sse-settings-autosave",e),i.appOptions.canForcesave&&(i.appOptions.forcesave=Common.localStorage.getBool("sse-settings-forcesave",i.appOptions.canForcesave),Common.Utils.InternalSettings.set("sse-settings-forcesave",i.appOptions.forcesave),i.api.asc_setIsForceSaveOnUserSave(i.appOptions.forcesave)),i.needToUpdateVersion&&(Common.NotificationCenter.trigger("api:disconnect"),s.onApiCoAuthoringDisconnect());var f=setInterval(function(){if(window.styles_loaded||i.appOptions.isEditDiagram||i.appOptions.isEditMailMerge){if(clearInterval(f),Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+i.api.asc_getActiveWorksheetId()]),m.createDelayedElements(),s.createDelayedElements(),i.setLanguages(),!i.appOptions.isEditMailMerge&&!i.appOptions.isEditDiagram){var t=i.api.asc_getPropertyEditorShapes();t&&i.fillAutoShapes(t[0],t[1]),i.fillTextArt(i.api.asc_getTextArtPreviews()),i.updateThemeColors(),s.activateControls()}r.createDelayedElements(),i.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(i.onDocumentCanSaveChanged,i)),i.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(i.onTryUndoInFastCollaborative,i)),i.onDocumentModifiedChanged(i.api.asc_isDocumentModified());var e=o.getController("FormulaDialog");e&&e.setMode(i.appOptions).setApi(i.api),i.needToUpdateVersion&&s.onApiCoAuthoringDisconnect(),Common.NotificationCenter.trigger("document:ready","main"),i.applyLicense()}},50)}else m.createDelayedElementsViewer(),Common.NotificationCenter.trigger("document:ready","main");i.appOptions.canAnalytics,1,Common.Gateway.on("applyeditrights",_.bind(i.onApplyEditRights,i)),Common.Gateway.on("processsaveresult",_.bind(i.onProcessSaveResult,i)),Common.Gateway.on("processrightschange",_.bind(i.onProcessRightsChange,i)),Common.Gateway.on("processmouse",_.bind(i.onProcessMouse,i)),Common.Gateway.on("downloadas",_.bind(i.onDownloadAs,i)),Common.Gateway.sendInfo({mode:i.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(i.onContextMenu,i)),void 0!==document.hidden&&document.hidden?document.addEventListener("visibilitychange",t):t(),Common.Gateway.documentReady()}},onLicenseChanged:function(t){if(!this.appOptions.isEditDiagram&&!this.appOptions.isEditMailMerge){var e=t.asc_getLicenseType();void 0===e||!this.appOptions.canEdit||"view"===this.editorConfig.mode||e!==Asc.c_oLicenseResult.Connections&&e!==Asc.c_oLicenseResult.UsersCount&&e!==Asc.c_oLicenseResult.ConnectionsOS&&e!==Asc.c_oLicenseResult.UsersCountOS||(this._state.licenseType=e),this._isDocReady&&this.applyLicense()}},applyLicense:function(){},disableEditing:function(t){var e=this.getApplication();this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t))},onOpenDocument:function(t){var e=document.getElementById("loadmask-text"),i=(t.asc_getCurrentFont()+t.asc_getCurrentImage())/(t.asc_getFontsCount()+t.asc_getImagesCount());i=this.textLoadingDocument+": "+Math.min(Math.round(100*i),100)+"%",e?e.innerHTML=i:this.loadMask&&this.loadMask.setTitle(i)},onEditorPermissions:function(t){var e=t?t.asc_getLicenseType():Asc.c_oLicenseResult.Error;if(!t||this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)this.appOptions.canModifyFilter=!0;else{if(this.onServerVersion(t.asc_getBuildVersion()))return;t.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.canAutosave=!0,this.appOptions.canAnalytics=t.asc_getIsAnalyticsEnable(),this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.canLicense=e===Asc.c_oLicenseResult.Success||e===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=t.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canComments=this.appOptions.canLicense&&(void 0===this.permissions.comment?!1!==this.permissions.edit:this.permissions.comment)&&"view"!==this.editorConfig.mode,this.appOptions.canComments=this.appOptions.canComments&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canViewComments=this.appOptions.canComments||!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canChat=this.appOptions.canLicense&&!this.appOptions.isOffline&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.chat),this.appOptions.canRename=this.editorConfig.canRename&&!!this.permissions.rename,this.appOptions.trialMode=t.asc_getLicenseMode(),this.appOptions.canModifyFilter=!1!==this.permissions.modifyFilter,this.appOptions.canBranding=t.asc_getCustomization(),this.appOptions.canBranding&&this.headerView.setBranding(this.editorConfig.customization),this.appOptions.canRename&&this.headerView.setCanRename(!0)}this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canRequestClose=this.editorConfig.canRequestClose,this.appOptions.canEdit=!1!==this.permissions.edit&&(this.editorConfig.canRequestEditRights||"view"!==this.editorConfig.mode),this.appOptions.isEdit=(this.appOptions.canLicense||this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)&&!1!==this.permissions.edit&&"view"!==this.editorConfig.mode,this.appOptions.canDownload=!1!==this.permissions.download,this.appOptions.canPrint=!1!==this.permissions.print,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&!(this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)&&"object"==typeof this.editorConfig.customization&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||!("object"==typeof this.editorConfig.customization&&this.editorConfig.customization.commentAuthorOnly),this.appOptions.isSignatureSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isSignaturesSupport()&&!(this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge),this.appOptions.isPasswordSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isProtectionSupport()&&!(this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge),this.appOptions.canProtect=this.appOptions.isSignatureSupport||this.appOptions.isPasswordSupport,this.appOptions.canHelp=!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.help),this.appOptions.isRestrictedEdit=!this.appOptions.isEdit&&this.appOptions.canComments,this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge||(this.appOptions.canBrandingExt=t.asc_getCanBranding()&&("object"==typeof this.editorConfig.customization||this.editorConfig.plugins),this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions)),this.applyModeCommonElements(),this.applyModeEditorElements(),this.appOptions.isEdit||(Common.NotificationCenter.trigger("app:face",this.appOptions),this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),this.api.asc_setViewMode(!this.appOptions.isEdit&&!this.appOptions.isRestrictedEdit),this.appOptions.isRestrictedEdit&&this.appOptions.canComments&&this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments),this.api.asc_LoadDocument()},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var t=this.getApplication(),e=t.getController("Viewport").getView("Viewport"),i=t.getController("Statusbar").getView("Statusbar");if(this.headerView&&this.headerView.setVisible(!this.appOptions.isEditMailMerge&&!this.appOptions.isDesktopApp&&!this.appOptions.isEditDiagram),e&&e.setMode(this.appOptions,!0),i&&i.setMode(this.appOptions),t.getController("Toolbar").setMode(this.appOptions),t.getController("DocumentHolder").setMode(this.appOptions),
|
|
|
(this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram)&&(i.hide(),t.getController("LeftMenu").getView("LeftMenu").hide(),$(window).mouseup(function(t){Common.Gateway.internalMessage("processMouse",{event:"mouse:up"})}).mousemove($.proxy(function(t){this.isDiagramDrag&&Common.Gateway.internalMessage("processMouse",{event:"mouse:move",pagex:t.pageX*Common.Utils.zoom(),pagey:t.pageY*Common.Utils.zoom()})},this))),!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(this.onDocumentModifiedChanged,this));var n=t.getController("Print");n&&this.api&&n.setApi(this.api)}var o=this.getApplication().getController("CellEditor");o&&o.setApi(this.api).setMode(this.appOptions)},applyModeEditorElements:function(t){var e=this.getApplication().getController("Common.Controllers.Comments");if(e&&(e.setMode(this.appOptions),e.setConfig({config:this.editorConfig,sdkviewname:"#ws-canvas-outer",hintmode:!0},this.api)),this.appOptions.isEdit){var i=this,n=this.getApplication(),o=n.getController("Toolbar"),s=n.getController("Statusbar"),a=n.getController("RightMenu"),l=n.getController("Common.Controllers.Fonts"),r=n.getController("Common.Controllers.ReviewChanges");l&&l.setApi(i.api),o&&o.setApi(i.api),a&&a.setApi(i.api),r.setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),i.appOptions.canProtect&&n.getController("Common.Controllers.Protection").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),s&&s.getView("Statusbar").changeViewMode(!0),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram||i.appOptions.isOffline||n.getController("PivotTable").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api);this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode(),a.getView("RightMenu").setMode(i.appOptions).setApi(i.api),this.toolbarView=o.getView("Toolbar");var c=Common.localStorage.getItem("sse-settings-unit");if(c=null!==c?parseInt(c):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(c),Common.Utils.InternalSettings.set("sse-settings-unit",c),i.appOptions.isEditMailMerge||i.appOptions.isEditDiagram)a.getView("RightMenu").hide();else{var h={};JSON.parse(Common.localStorage.getItem("sse-hidden-formula"))&&(h.formula=!0),n.getController("Toolbar").hideElements(h)}i.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.appOptions.isEditDiagram&&i.api.asc_registerCallback("asc_onSelectionChanged",_.bind(i.onSelectionChanged,i)),i.api.asc_setFilteringMode&&i.api.asc_setFilteringMode(i.appOptions.canModifyFilter),i.stackLongActions.exist({id:-255,type:Asc.c_oAscAsyncActionType.BlockInteraction})?i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-255):this._isDocReady||(Common.NotificationCenter.trigger("app:face",this.appOptions),i.hidePreloader(),i.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),window.onbeforeunload=_.bind(i.onBeforeUnload,i),window.onunload=_.bind(i.onUnload,i)}},onExternalMessage:function(t){t&&t.msg&&(t.msg=t.msg.toString(),this.showTips([t.msg.charAt(0).toUpperCase()+t.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error"))},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.LoadingScriptError)return this.showTips([this.scriptLoadError]),void(this.tooltip&&this.tooltip.getBSTip().$tip.css("z-index",1e4));this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256);var n={closable:!0};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.PastInMergeAreaError:n.msg=this.pastInMergeAreaError;break;case Asc.c_oAscError.ID.FrmlWrongCountParentheses:n.msg=this.errorWrongBracketsCount;break;case Asc.c_oAscError.ID.FrmlWrongOperator:n.msg=this.errorWrongOperator;break;case Asc.c_oAscError.ID.FrmlWrongMaxArgument:n.msg=this.errorCountArgExceed;break;case Asc.c_oAscError.ID.FrmlWrongCountArgument:n.msg=this.errorCountArg;break;case Asc.c_oAscError.ID.FrmlWrongFunctionName:n.msg=this.errorFormulaName;break;case Asc.c_oAscError.ID.FrmlAnotherParsingError:n.msg=this.errorFormulaParsing;break;case Asc.c_oAscError.ID.FrmlWrongArgumentRange:n.msg=this.errorArgsRange;break;case Asc.c_oAscError.ID.FrmlOperandExpected:n.msg=this.errorOperandExpected;break;case Asc.c_oAscError.ID.FrmlWrongReferences:n.msg=this.errorFrmlWrongReferences;break;case Asc.c_oAscError.ID.UnexpectedGuid:n.msg=this.errorUnexpectedGuid;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.FileRequest:n.msg=this.errorFileRequest;break;case Asc.c_oAscError.ID.FileVKey:n.msg=this.errorFileVKey;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.MaxDataPointsError:n.msg=this.errorMaxPoints;break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CannotMoveRange:n.msg=this.errorMoveRange;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.AutoFilterDataRangeError:n.msg=this.errorAutoFilterDataRange;break;case Asc.c_oAscError.ID.AutoFilterChangeFormatTableError:n.msg=this.errorAutoFilterChangeFormatTable;break;case Asc.c_oAscError.ID.AutoFilterChangeError:n.msg=this.errorAutoFilterChange;break;case Asc.c_oAscError.ID.AutoFilterMoveToHiddenRangeError:n.msg=this.errorAutoFilterHiddenRange;break;case Asc.c_oAscError.ID.CannotFillRange:n.msg=this.errorFillRange;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop,Common.NotificationCenter.trigger("collaboration:sharingdeny");break;case Asc.c_oAscError.ID.InvalidReferenceOrName:n.msg=this.errorInvalidRef;break;case Asc.c_oAscError.ID.LockCreateDefName:n.msg=this.errorCreateDefName;break;case Asc.c_oAscError.ID.PasteMaxRangeError:n.msg=this.errorPasteMaxRange;break;case Asc.c_oAscError.ID.LockedAllError:n.msg=this.errorLockedAll;break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer.replace("%1","https://api.onlyoffice.com/editors/callback"),n.closable=!1;break;case Asc.c_oAscError.ID.LockedWorksheetRename:n.msg=this.errorLockedWorksheetRename;break;case Asc.c_oAscError.ID.OpenWarning:n.msg=this.errorOpenWarning;break;case Asc.c_oAscError.ID.CopyMultiselectAreaError:n.msg=this.errorCopyMultiselectArea;break;case Asc.c_oAscError.ID.PrintMaxPagesCount:n.msg=this.errorPrintMaxPagesCount;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.LockedCellPivot:n.msg=this.errorLockedCellPivot;break;case Asc.c_oAscError.ID.ForceSaveButton:n.msg=this.errorForceSave;break;case Asc.c_oAscError.ID.ForceSaveTimeout:n.msg=this.errorForceSave,console.warn(n.msg);break;case Asc.c_oAscError.ID.DataEncrypted:n.msg=this.errorDataEncrypted;break;case Asc.c_oAscError.ID.EditingError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.errorEditingSaveas:this.errorEditingDownloadas;break;case Asc.c_oAscError.ID.CannotChangeFormulaArray:n.msg=this.errorChangeArray;break;case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:n.msg=this.errorMultiCellFormula;break;case Asc.c_oAscError.ID.MailToClientMissing:n.msg=this.errorEmailClient;break;case Asc.c_oAscError.ID.NoDataToParse:n.msg=this.errorNoDataToParse;break;case Asc.c_oAscError.ID.CannotUngroupError:n.msg=this.errorCannotUngroup;break;case Asc.c_oAscError.ID.FrmlMaxTextLength:n.msg=this.errorFrmlMaxTextLength;break;case Asc.c_oAscError.ID.DataValidate:var o=i?i.asc_getErrorStyle():void 0;void 0!==o&&(n.iconCls=o==Asc.c_oAscEDataValidationErrorStyle.Stop?"error":o==Asc.c_oAscEDataValidationErrorStyle.Information?"info":"warn"),i&&i.asc_getErrorTitle()&&(n.title=i.asc_getErrorTitle()),n.buttons=["ok","cancel"],n.msg=i&&i.asc_getError()?i.asc_getError():this.errorDataValidate,n.maxwidth=600;break;default:n.msg="string"==typeof t?t:this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",n.closable=!1,this.appOptions.canBackToFolder&&!this.appOptions.isDesktopApp&&"string"!=typeof t&&(n.msg+="<br/><br/>"+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback",!0)}),t==Asc.c_oAscError.ID.DataEncrypted&&(this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect"))):(Common.Gateway.reportWarning(t,n.msg),n.title=n.title||this.notcriticalErrorTitle,n.iconCls=n.iconCls||"warn",n.buttons=n.buttons||["ok"],n.callback=_.bind(function(e){t==Asc.c_oAscError.ID.Warning&&"ok"==e&&this.appOptions.canDownload?(Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas")):t==Asc.c_oAscError.ID.EditingError?(this.disableEditing(!0),Common.NotificationCenter.trigger("api:disconnect",!0)):t==Asc.c_oAscError.ID.DataValidate&&"ok"!==e&&this.api.asc_closeCellEditor(!0),this._state.lostEditingRights=!1,this.onEditComplete()},this)),$(".asc-window.modal.alert:visible").length<1&&t!==Asc.c_oAscError.ID.ForceSaveTimeout&&(Common.UI.alert(n),Common.component.Analytics.trackEvent("Internal Error",t.toString()))},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(t,e){if(this._state.isDocModified!==t||e){if(this.headerView){var i=this.defaultTitleText;if(_.isEmpty(this.headerView.getDocumentCaption())||(i=this.headerView.getDocumentCaption()+" - "+i),t)clearTimeout(this._state.timerCaption),_.isUndefined(i)||(i="* "+i,this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!0));else if(this._state.fastCoauth&&this._state.usersCount>1){var n=this;this._state.timerCaption=setTimeout(function(){n.headerView.setDocumentCaption(n.headerView.getDocumentCaption(),!1)},500)}else this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!1);window.document.title!=i&&(window.document.title=i)}Common.Gateway.setDocumentModified(t),this._state.isDocModified=t}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(t){if(this.updateWindowTitle(t),Common.Gateway.setDocumentModified(t),this.toolbarView&&this.toolbarView.btnCollabChanges&&this.api){var e=this.toolbarView.btnCollabChanges.$icon.hasClass("btn-synch"),i=this.appOptions.forcesave,n=this.api.asc_isDocumentCanSave(),o=!n&&!e&&!i||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!i;this.toolbarView.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){if(this.toolbarView&&this.toolbarView.btnCollabChanges){var e=this.toolbarView.btnCollabChanges.$icon.hasClass("btn-synch"),i=this.appOptions.forcesave,n=!t&&!e&&!i||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!i;this.toolbarView.btnSave.setDisabled(n)}},onBeforeUnload:function(){if(Common.localStorage.save(),!1!==this.permissions.edit&&"view"!==this.editorConfig.mode&&"editdiagram"!==this.editorConfig.mode&&"editmerge"!==this.editorConfig.mode&&this.api.asc_isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var i;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,t),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,e),i=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),this.stackLongActions.pop({id:-254,type:Asc.c_oAscAsyncActionType.BlockInteraction}),Common.NotificationCenter.trigger("layout:changed","main"),(i||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onDownloadCancel:function(){this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},onAdvancedOptions:function(t,e,i,n){if(!this._state.openDlg){var o=this;t==Asc.c_oAscAdvancedOptionsID.CSV?o._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitle.replace("%1","CSV"),closable:2==i,type:Common.Utils.importTextType.CSV,preview:e.asc_getData(),codepages:e.asc_getCodePages(),settings:e.asc_getRecommendedSettings(),api:o.api,handler:function(e,s,a,l){o.isShowOpenDialog=!1,"ok"==e&&o&&o.api&&(2==i?(n&&n.asc_setAdvancedOptions(new Asc.asc_CTextOptions(s,a,l)),o.api.asc_DownloadAs(n)):o.api.asc_setAdvancedOptions(t,new Asc.asc_CTextOptions(s,a,l)),o.loadMask&&o.loadMask.show()),o._state.openDlg=null}}):t==Asc.c_oAscAdvancedOptionsID.DRM&&(o._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:o.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(o.appOptions.isDesktopApp&&o.appOptions.isOffline),validatePwd:!!o._state.isDRM,handler:function(e,i){o.isShowOpenDialog=!1,"ok"==e?o&&o.api&&(o.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(i)),o.loadMask&&o.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),o._state.openDlg=null}}),o._state.isDRM=!0),o._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),o._state.openDlg.show())}},onActiveSheetChanged:function(t){this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram||!window.editor_elements_prepared||(this.application.getController("Statusbar").selectTab(t),this.appOptions.canViewComments&&!this.dontCloseDummyComment&&Common.NotificationCenter.trigger("comments:updatefilter",["doc","sheet"+this.api.asc_getWorksheetId(t)],!1))},onConfirmAction:function(t,e){var i=this;t==Asc.c_oAscConfirm.ConfirmReplaceRange?Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.confirmMoveCellRange,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){e&&e("yes"===t),"yes"==t&&i.onEditComplete(i.application.getController("DocumentHolder").getView("DocumentHolder"))},this)}):t==Asc.c_oAscConfirm.ConfirmPutMergeRange&&Common.UI.warning({closable:!1,title:this.notcriticalErrorTitle,msg:this.confirmPutMergeRange,buttons:["ok"],primary:"ok",callback:_.bind(function(t){e&&e(),i.onEditComplete(i.application.getController("DocumentHolder").getView("DocumentHolder"))},this)})},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines]},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[],o=this.getCollection("ShapeGroups");o.reset();t.length;_.each(t,function(t,o){var s=new Backbone.Collection([],{model:SSE.Models.ShapeModel}),a=e[o].length>18?7:6,l=35*Math.ceil(e[o].length/a)+3,r=30*a;_.each(e[o],function(t,e){s.add({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:r,groupHeight:l})}),o.add(n),setTimeout(function(){i.getApplication().getController("Toolbar").fillAutoShapes()},50)}},fillTextArt:function(t){if(!_.isEmpty(t)){var e=this,i=[],n=this.getCollection("Common.Collections.TextArt");_.each(t,function(t,e){i.push({imageUrl:t,data:e,allowSelected:!0,selected:!1})}),n.reset(i),setTimeout(function(){e.getApplication().getController("Toolbar").fillTextArt()},50),setTimeout(function(){e.getApplication().getController("RightMenu").fillTextArt()},50)}},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Statusbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded&&!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt(i.api.asc_getTextArtPreviews())},1)}},loadLanguages:function(t){this.languages=t,window.styles_loaded&&this.setLanguages()},setLanguages:function(){this.getApplication().getController("Spellcheck").setLanguages(this.languages)},onInternalCommand:function(t){if(t)switch(t.command){case"setChartData":this.setChartData(t.data);break;case"getChartData":this.getChartData();break;case"clearChartData":this.clearChartData();break;case"setMergeData":this.setMergeData(t.data);break;case"getMergeData":this.getMergeData();break;case"setAppDisabled":void 0!==this.isAppDisabled||t.data||(Common.NotificationCenter.trigger("layout:changed","main"),this.loadMask&&this.loadMask.isVisible()&&this.loadMask.updatePosition()),this.isAppDisabled=t.data;break;case"queryClose":0===$("body .asc-window:visible").length?(this.isFrameClosed=!0,this.api.asc_closeCellEditor(),Common.UI.Menu.Manager.hideAll(),Common.Gateway.internalMessage("canClose",{mr:t.data.mr,answer:!0})):Common.Gateway.internalMessage("canClose",{answer:!1});break;case"window:drag":this.isDiagramDrag=t.data;break;case"processmouse":this.onProcessMouse(t.data)}},setChartData:function(t){"object"==typeof t&&this.api&&(this.api.asc_addChartDrawingObject(t),this.isFrameClosed=!1)},getChartData:function(){if(this.api){var t=this.api.asc_getWordChartObject();"object"==typeof t&&Common.Gateway.internalMessage("chartData",{data:t})}},clearChartData:function(){this.api&&this.api.asc_closeCellEditor()},setMergeData:function(t){"object"==typeof t&&this.api&&(this.api.asc_setData(t),this.isFrameClosed=!1)},getMergeData:function(){if(this.api){var t=this.api.asc_getData();"object"==typeof t&&Common.Gateway.internalMessage("mergeData",{data:t})}},unitsChanged:function(t){var e=Common.localStorage.getItem("sse-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("sse-settings-unit",e),this.getApplication().getController("RightMenu").updateMetricUnit(),this.getApplication().getController("Print").getView("MainSettingsPrint").updateMetricUnit(),this.getApplication().getController("Toolbar").getView("Toolbar").updateMetricUnit()},_compareActionStrong:function(t,e){return t.id===e.id&&t.type===e.type},_compareActionWeak:function(t,e){return t.type===e.type},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onNamedRangeLocked:function(){$(".asc-window.modal.alert:visible").length<1&&Common.UI.alert({msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.onEditComplete()},this)})},onTryUndoInFastCollaborative:function(){var t=window.localStorage.getItem("sse-hide-try-undoredo");t&&1==parseInt(t)||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&window.localStorage.setItem("sse-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("sse-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("sse-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=Common.localStorage.getItem("sse-settings-coauthmode"),e=this._state.fastCoauth;this._state.fastCoauth=null===t||1==parseInt(t),this._state.fastCoauth&&!e&&this.toolbarView.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("sse-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("sse-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(t){this.headerView.setDocumentCaption(t),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0)},onMeta:function(t){var e=this.getApplication(),i=e.getController("LeftMenu").getView("LeftMenu").getMenu("file");e.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t.title),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),this.appOptions.spreadsheet.title=t.title,i.loadDocument({doc:this.appOptions.spreadsheet}),i.panels.info.updateInfo(this.appOptions.spreadsheet),Common.Gateway.metaChange(t)},onPrint:function(){this.appOptions.canPrint&&!this.isModalShowed&&Common.NotificationCenter.trigger("print",this)},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(i){var t=new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);t.asc_setAdvancedOptions(e.getApplication().getController("Print").getPrintParams()),e.api.asc_DownloadAs(t)}}}t&&(this.iframePrint.src=t)},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",saveTitleText:"Saving Document",saveTextText:"Saving document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading spreadsheet",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",pastInMergeAreaError:"Cannot change part of a merged cell",titleRecalcFormulas:"Calculating formulas...",textRecalcFormulas:"Calculating formulas...",textPleaseWait:"It's working hard. Please wait...",errorWrongBracketsCount:"Found an error in the formula entered.<br>Wrong cout of brackets.",errorWrongOperator:"An error in the entered formula. Wrong operator is used.<br>Please correct the error or use the Esc button to cancel the formula editing.",errorCountArgExceed:"Found an error in the formula entered.<br>Count of arguments exceeded.",errorCountArg:"Found an error in the formula entered.<br>Invalid number of arguments.",errorFormulaName:"Found an error in the formula entered.<br>Incorrect formula name.",errorFormulaParsing:"Internal error while the formula parsing.",errorArgsRange:"Found an error in the formula entered.<br>Incorrect arguments range.",errorUnexpectedGuid:"External error.<br>Unexpected Guid. Please, contact support.",errorDatabaseConnection:"External error.<br>Database connection error. Please, contact support.",errorFileRequest:"External error.<br>File Request. Please, contact support.",errorFileVKey:"External error.<br>Incorrect securety key. Please, contact support.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorOperandExpected:"The entered function syntax is not correct. Please check if you are missing one of the parentheses - '(' or ')'.",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",errorMoveRange:"Cann't change a part of merged cell",errorBadImageUrl:"Image url is incorrect",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",errorLockedAll:"The operation could not be done as the sheet has been locked by another user.",txtEditingMode:"Set editing mode...",textLoadingDocument:"Loading spreadsheet",textConfirm:"Confirmation",confirmMoveCellRange:"The destination cell's range can contain data. Continue the operation?",textYes:"Yes",textNo:"No",textAnonymous:"Anonymous",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",errorAutoFilterDataRange:"The operation could not be done for the selected range of cells.<br>Select a uniform data range inside or outside the table and try again.",errorAutoFilterChangeFormatTable:"The operation could not be done for the selected cells as you cannot move a part of the table.<br>Select another data range so that the whole table was shifted and try again.",errorAutoFilterHiddenRange:"The operation cannot be performed because the area contains filtered cells.<br>Please unhide the filtered elements and try again.",errorAutoFilterChange:"The operation is not allowed, as it is attempting to shift cells in a table on your worksheet.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorFillRange:"Could not fill the selected range of cells.<br>All the merged cells need to be the same size.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtArt:"Your text here",errorInvalidRef:"Enter a correct name for the selection or a valid reference to go to.",errorCreateDefName:"The existing named ranges cannot be edited and the new ones cannot be created<br>at the moment as some of them are being edited.",errorPasteMaxRange:"The copy and paste area does not match. Please select an area with the same size or click the first cell in a row to paste the copied cells.",errorConnectToServer:' The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the \'OK\' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href="%1" target="_blank">here</a>',errorLockedWorksheetRename:"The sheet cannot be renamed at the moment as it is being renamed by another user",textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.<br>Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",errorOpenWarning:"The length of one of the formulas in the file exceeded<br>the allowed number of characters and it was removed.",errorFrmlWrongReferences:"The function refers to a sheet that does not exist.<br>Please check the data and try again.",textBuyNow:"Visit website",textNoLicenseTitle:"%1 open source version",textContactUs:"Contact sales",
|
|
|
confirmPutMergeRange:"The source data contains merged cells.<br>They will be unmerged before they are pasted into the table.",errorViewerDisconnect:"Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.",warnLicenseExp:"Your license has expired.<br>Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorCopyMultiselectArea:"This command cannot be used with multiple selections.<br>Select a single range and try again.",errorPrintMaxPagesCount:"Unfortunately, it’s not possible to print more than 1500 pages at once in the current version of the program.<br>This restriction will be eliminated in upcoming releases.",errorToken:"The document security token is not correctly formed.<br>Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.<br>Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes.",errorLockedCellPivot:"You cannot change data inside a pivot table.",txtAccent:"Accent",txtStyle_Normal:"Normal",txtStyle_Heading_1:"Heading 1",txtStyle_Heading_2:"Heading 2",txtStyle_Heading_3:"Heading 3",txtStyle_Heading_4:"Heading 4",txtStyle_Title:"Title",txtStyle_Neutral:"Neutral",txtStyle_Bad:"Bad",txtStyle_Good:"Good",txtStyle_Input:"Input",txtStyle_Output:"Output",txtStyle_Calculation:"Calculation",txtStyle_Check_Cell:"Check Cell",txtStyle_Explanatory_Text:"Explanatory Text",txtStyle_Note:"Note",txtStyle_Linked_Cell:"Linked Cell",txtStyle_Warning_Text:"Warning Text",txtStyle_Total:"Total",txtStyle_Currency:"Currency",txtStyle_Percent:"Percent",txtStyle_Comma:"Comma",errorForceSave:"An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",errorMaxPoints:"The maximum number of points in series per chart is 4096.",warnNoLicense:"This version of %1 editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider purchasing a commercial license.",warnNoLicenseUsers:"This version of %1 Editors has certain limitations for concurrent users.<br>If you need more please consider purchasing a commercial license.",warnLicenseExceeded:"The number of concurrent connections to the document server has been exceeded and the document will be opened for viewing only.<br>Please contact your administrator for more information.",warnLicenseUsersExceeded:"The number of concurrent users has been exceeded and the document will be opened for viewing only.<br>Please contact your administrator for more information.",errorDataEncrypted:"Encrypted changes have been received, they cannot be deciphered.",textClose:"Close",textPaidFeature:"Paid feature",scriptLoadError:"The connection is too slow, some of the components could not be loaded. Please reload the page.",errorEditingSaveas:"An error occurred during the work with the document.<br>Use the 'Save as...' option to save the file backup copy to your computer hard drive.",errorEditingDownloadas:"An error occurred during the work with the document.<br>Use the 'Download as...' option to save the file backup copy to your computer hard drive.",txtShape_textRect:"Text Box",txtShape_rect:"Rectangle",txtShape_ellipse:"Ellipse",txtShape_triangle:"Triangle",txtShape_rtTriangle:"Right Triangle",txtShape_parallelogram:"Parallelogram",txtShape_trapezoid:"Trapezoid",txtShape_diamond:"Diamond",txtShape_pentagon:"Pentagon",txtShape_hexagon:"Hexagon",txtShape_heptagon:"Heptagon",txtShape_octagon:"Octagon",txtShape_decagon:"Decagon",txtShape_dodecagon:"Dodecagon",txtShape_pie:"Pie",txtShape_chord:"Chord",txtShape_teardrop:"Teardrop",txtShape_frame:"Frame",txtShape_halfFrame:"Half Frame",txtShape_corner:"Corner",txtShape_diagStripe:"Diagonal Stripe",txtShape_plus:"Plus",txtShape_plaque:"Sign",txtShape_can:"Can",txtShape_cube:"Cube",txtShape_bevel:"Bevel",txtShape_donut:"Donut",txtShape_noSmoking:'"No" Symbol',txtShape_blockArc:"Block Arc",txtShape_foldedCorner:"Folded Corner",txtShape_smileyFace:"Smiley Face",txtShape_heart:"Heart",txtShape_lightningBolt:"Lightning Bolt",txtShape_sun:"Sun",txtShape_moon:"Moon",txtShape_cloud:"Cloud",txtShape_arc:"Arc",txtShape_bracePair:"Double Brace",txtShape_leftBracket:"Left Bracket",txtShape_rightBracket:"Right Bracket",txtShape_leftBrace:"Left Brace",txtShape_rightBrace:"Right Brace",txtShape_rightArrow:"Right Arrow",txtShape_leftArrow:"Left Arrow",txtShape_upArrow:"Up Arrow",txtShape_downArrow:"Down Arrow",txtShape_leftRightArrow:"Left Right Arrow",txtShape_upDownArrow:"Up Down Arrow",txtShape_quadArrow:"Quad Arrow",txtShape_leftRightUpArrow:"Left Right Up Arrow",txtShape_bentArrow:"Bent Arrow",txtShape_uturnArrow:"U-Turn Arrow",txtShape_leftUpArrow:"Left Up Arrow",txtShape_bentUpArrow:"Bent Up Arrow",txtShape_curvedRightArrow:"Curved Right Arrow",txtShape_curvedLeftArrow:"Curved Left Arrow",txtShape_curvedUpArrow:"Curved Up Arrow",txtShape_curvedDownArrow:"Curved Down Arrow",txtShape_stripedRightArrow:"Striped Right Arrow",txtShape_notchedRightArrow:"Notched Right Arrow",txtShape_homePlate:"Pentagon",txtShape_chevron:"Chevron",txtShape_rightArrowCallout:"Right Arrow Callout",txtShape_downArrowCallout:"Down Arrow Callout",txtShape_leftArrowCallout:"Left Arrow Callout",txtShape_upArrowCallout:"Up Arrow Callout",txtShape_leftRightArrowCallout:"Left Right Arrow Callout",txtShape_quadArrowCallout:"Quad Arrow Callout",txtShape_circularArrow:"Circular Arrow",txtShape_mathPlus:"Plus",txtShape_mathMinus:"Minus",txtShape_mathMultiply:"Multiply",txtShape_mathDivide:"Division",txtShape_mathEqual:"Equal",txtShape_mathNotEqual:"Not Equal",txtShape_flowChartProcess:"Flowchart: Process",txtShape_flowChartAlternateProcess:"Flowchart: Alternate Process",txtShape_flowChartDecision:"Flowchart: Decision",txtShape_flowChartInputOutput:"Flowchart: Data",txtShape_flowChartPredefinedProcess:"Flowchart: Predefined Process",txtShape_flowChartInternalStorage:"Flowchart: Internal Storage",txtShape_flowChartDocument:"Flowchart: Document",txtShape_flowChartMultidocument:"Flowchart: Multidocument ",txtShape_flowChartTerminator:"Flowchart: Terminator",txtShape_flowChartPreparation:"Flowchart: Preparation",txtShape_flowChartManualInput:"Flowchart: Manual Input",txtShape_flowChartManualOperation:"Flowchart: Manual Operation",txtShape_flowChartConnector:"Flowchart: Connector",txtShape_flowChartOffpageConnector:"Flowchart: Off-page Connector",txtShape_flowChartPunchedCard:"Flowchart: Card",txtShape_flowChartPunchedTape:"Flowchart: Punched Tape",txtShape_flowChartSummingJunction:"Flowchart: Summing Junction",txtShape_flowChartOr:"Flowchart: Or",txtShape_flowChartCollate:"Flowchart: Collate",txtShape_flowChartSort:"Flowchart: Sort",txtShape_flowChartExtract:"Flowchart: Extract",txtShape_flowChartMerge:"Flowchart: Merge",txtShape_flowChartOnlineStorage:"Flowchart: Stored Data",txtShape_flowChartDelay:"Flowchart: Delay",txtShape_flowChartMagneticTape:"Flowchart: Sequential Access Storage",txtShape_flowChartMagneticDisk:"Flowchart: Magnetic Disk",txtShape_flowChartMagneticDrum:"Flowchart: Direct Access Storage",txtShape_flowChartDisplay:"Flowchart: Display",txtShape_irregularSeal1:"Explosion 1",txtShape_irregularSeal2:"Explosion 2",txtShape_star4:"4-Point Star",txtShape_star5:"5-Point Star",txtShape_star6:"6-Point Star",txtShape_star7:"7-Point Star",txtShape_star8:"8-Point Star",txtShape_star10:"10-Point Star",txtShape_star12:"12-Point Star",txtShape_star16:"16-Point Star",txtShape_star24:"24-Point Star",txtShape_star32:"32-Point Star",txtShape_ribbon2:"Up Ribbon",txtShape_ribbon:"Down Ribbon",txtShape_ellipseRibbon2:"Curved Up Ribbon",txtShape_ellipseRibbon:"Curved Down Ribbon",txtShape_verticalScroll:"Vertical Scroll",txtShape_horizontalScroll:"Horizontal Scroll",txtShape_wave:"Wave",txtShape_doubleWave:"Double Wave",txtShape_wedgeRectCallout:"Rectangular Callout",txtShape_wedgeRoundRectCallout:"Rounded Rectangular Callout",txtShape_wedgeEllipseCallout:"Oval Callout",txtShape_cloudCallout:"Cloud Callout",txtShape_borderCallout1:"Line Callout 1",txtShape_borderCallout2:"Line Callout 2",txtShape_borderCallout3:"Line Callout 3",txtShape_accentCallout1:"Line Callout 1 (Accent Bar)",txtShape_accentCallout2:"Line Callout 2 (Accent Bar)",txtShape_accentCallout3:"Line Callout 3 (Accent Bar)",txtShape_callout1:"Line Callout 1 (No Border)",txtShape_callout2:"Line Callout 2 (No Border)",txtShape_callout3:"Line Callout 3 (No Border)",txtShape_accentBorderCallout1:"Line Callout 1 (Border and Accent Bar)",txtShape_accentBorderCallout2:"Line Callout 2 (Border and Accent Bar)",txtShape_accentBorderCallout3:"Line Callout 3 (Border and Accent Bar)",txtShape_actionButtonBackPrevious:"Back or Previous Button",txtShape_actionButtonForwardNext:"Forward or Next Button",txtShape_actionButtonBeginning:"Beginning Button",txtShape_actionButtonEnd:"End Button",txtShape_actionButtonHome:"Home Button",txtShape_actionButtonInformation:"Information Button",txtShape_actionButtonReturn:"Return Button",txtShape_actionButtonMovie:"Movie Button",txtShape_actionButtonDocument:"Document Button",txtShape_actionButtonSound:"Sound Button",txtShape_actionButtonHelp:"Help Button",txtShape_actionButtonBlank:"Blank Button",txtShape_roundRect:"Round Corner Rectangle",txtShape_snip1Rect:"Snip Single Corner Rectangle",txtShape_snip2SameRect:"Snip Same Side Corner Rectangle",txtShape_snip2DiagRect:"Snip Diagonal Corner Rectangle",txtShape_snipRoundRect:"Snip and Round Single Corner Rectangle",txtShape_round1Rect:"Round Single Corner Rectangle",txtShape_round2SameRect:"Round Same Side Corner Rectangle",txtShape_round2DiagRect:"Round Diagonal Corner Rectangle",txtShape_line:"Line",txtShape_lineWithArrow:"Arrow",txtShape_lineWithTwoArrows:"Double Arrow",txtShape_bentConnector5:"Elbow Connector",txtShape_bentConnector5WithArrow:"Elbow Arrow Connector",txtShape_bentConnector5WithTwoArrows:"Elbow Double-Arrow Connector",txtShape_curvedConnector3:"Curved Connector",txtShape_curvedConnector3WithArrow:"Curved Arrow Connector",txtShape_curvedConnector3WithTwoArrows:"Curved Double-Arrow Connector",txtShape_spline:"Curve",txtShape_polyline1:"Scribble",txtShape_polyline2:"Freeform",errorChangeArray:"You cannot change part of an array.",errorMultiCellFormula:"Multi-cell array formulas are not allowed in tables.",errorEmailClient:"No email client could be found",txtPrintArea:"Print_Area",txtTable:"Table",textCustomLoader:"Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.",errorNoDataToParse:"No data was selected to parse.",errorCannotUngroup:"Cannot ungroup. To start an outline, select the detail rows or columns and group them.",errorFrmlMaxTextLength:"Text values in formulas are limited to 255 characters.<br>Use the CONCATENATE function or concatenation operator (&)",waitText:"Please, wait...",errorDataValidate:"The value you entered is not valid.<br>A user has restricted values that can be entered into this cell.",txtConfidential:"Confidential",txtPreparedBy:"Prepared by",txtPage:"Page",txtPageOf:"Page %1 of %2",txtPages:"Pages",txtDate:"Date",txtTime:"Time",txtTab:"Tab",txtFile:"File"}}(),SSE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:600,height:536,header:!0},t),this.template=['<div id="id-sharing-placeholder"></div>'].join(""),e.tpl=_.template(this.template)(e),this.settingsurl=t.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=500,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.settingsurl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(t.needUpdate&&this.trigger("accessrights",this,t.sharingSettings),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("spreadsheeteditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog"],function(){"use strict";!SSE.Views.FileMenuPanels&&(SSE.Views.FileMenuPanels={}),SSE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:void 0,formats:[[{name:"XLSX",imgCls:"xlsx",type:Asc.c_oAscFileType.XLSX},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"ODS",imgCls:"ods",type:Asc.c_oAscFileType.ODS},{name:"CSV",imgCls:"csv",type:Asc.c_oAscFileType.CSV}],[{name:"XLTX",imgCls:"xltx",type:Asc.c_oAscFileType.XLTX},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA},{name:"OTS",imgCls:"ots",type:Asc.c_oAscFileType.OTS}]],template:_.template(["<table><tbody>","<% _.each(rows, function(row) { %>","<tr>","<% _.each(row, function(item) { %>",'<td><div><svg class="btn-doc-format" format="<%= item.type %>">','<use xlink:href="#svg-format-<%= item.imgCls %>"></use>',"</svg></div></td>","<% }) %>","</tr>","<% }) %>","</tbody></table>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onFormatClick:function(t){var e=t.currentTarget.attributes.format;!_.isUndefined(e)&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,parseInt(e.value)])}}),SSE.Views.FileMenuPanels.ViewSaveCopy=Common.UI.BaseView.extend({el:"#panel-savecopy",menu:void 0,formats:[[{name:"XLSX",imgCls:"xlsx",type:Asc.c_oAscFileType.XLSX,ext:".xlsx"},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF,ext:".pdf"},{name:"ODS",imgCls:"ods",type:Asc.c_oAscFileType.ODS,ext:".ods"},{name:"CSV",imgCls:"csv",type:Asc.c_oAscFileType.CSV,ext:".csv"}],[{name:"XLTX",imgCls:"xltx",type:Asc.c_oAscFileType.XLTX,ext:".xltx"},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA,ext:".pdf"},{name:"OTS",imgCls:"ots",type:Asc.c_oAscFileType.OTS,ext:".ots"}]],template:_.template(["<table><tbody>","<% _.each(rows, function(row) { %>","<tr>","<% _.each(row, function(item) { %>",'<td><div><svg class="btn-doc-format" format="<%= item.type %>", format-ext="<%= item.ext %>">','<use xlink:href="#svg-format-<%= item.imgCls %>"></use>',"</svg></div></td>","<% }) %>","</tr>","<% }) %>","</tbody></table>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onFormatClick:function(t){var e=t.currentTarget.attributes.format,i=t.currentTarget.attributes["format-ext"];_.isUndefined(e)||_.isUndefined(i)||!this.menu||this.menu.fireEvent("savecopy:format",[this.menu,parseInt(e.value),i.value])}}),SSE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:void 0,template:_.template(['<div style="width:100%; height:100%; position: relative;">','<div id="id-settings-menu" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>','<div id="id-settings-content" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding">','<div id="panel-settings-general" style="width:100%; height:100%;" class="no-padding main-settings-panel active"></div>','<div id="panel-settings-print" style="width:100%; height:100%;" class="no-padding main-settings-panel"></div>',"</div>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.generalSettings=new SSE.Views.FileMenuPanels.MainSettingsGeneral({menu:this.menu}),this.generalSettings.options={alias:"MainSettingsGeneral"},this.generalSettings.render(),this.printSettings=SSE.getController("Print").getView("MainSettingsPrint"),this.printSettings.menu=this.menu,this.printSettings.render($("#panel-settings-print")),this.viewSettingsPicker=new Common.UI.DataView({el:$("#id-settings-menu"),store:new Common.UI.DataViewStore([{name:this.txtGeneral,panel:this.generalSettings,iconCls:"mnu-settings-general",selected:!0},{name:this.txtPageSettings,panel:this.printSettings,iconCls:"mnu-print"}]),itemTemplate:_.template(['<div id="<%= id %>" class="settings-item-wrap">','<div class="settings-icon <%= iconCls %>" style="display: inline-block;" >',"</div><%= name %>","</div>"].join(""))}),this.viewSettingsPicker.on("item:select",_.bind(function(t,e,i){var n=i.get("panel");$("#id-settings-content > div").removeClass("active"),n.$el.addClass("active"),n.show()},this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments);var t=this.viewSettingsPicker.getSelectedRec();t&&t.get("panel").show()},setMode:function(t){this.mode=t,this.mode.canPrint||this.viewSettingsPicker.store.pop(),this.generalSettings&&this.generalSettings.setMode(this.mode)},setApi:function(t){this.generalSettings&&this.generalSettings.setApi(t)},txtGeneral:"General",txtPageSettings:"Page Settings"},SSE.Views.FileMenuPanels.Settings||{})),SSE.Views.MainSettingsPrint=Common.UI.BaseView.extend(_.extend({menu:void 0,template:_.template(['<table class="main"><tbody>',"<tr>",'<td class="left"><label><%= scope.textSettings %></label></td>','<td class="right"><div id="advsettings-print-combo-sheets" class="input-group-nr" /></td>',"</tr>",'<tr class="divider"></tr>','<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.textPageSize %></label></td>','<td class="right"><div id="advsettings-print-combo-pages" class="input-group-nr" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.textPageOrientation %></label></td>','<td class="right"><span id="advsettings-print-combo-orient" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.textPageScaling %></label></td>','<td class="right"><span id="advsettings-print-combo-layout" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left" style="vertical-align: top;"><label><%= scope.strMargins %></label></td>','<td class="right" style="vertical-align: top;"><div id="advsettings-margins">','<table cols="2" class="no-padding">',"<tr>","<td><label><%= scope.strTop %></label></td>","<td><label><%= scope.strBottom %></label></td>","</tr>","<tr>",'<td><div id="advsettings-spin-margin-top"></div></td>','<td><div id="advsettings-spin-margin-bottom"></div></td>',"</tr>","<tr>","<td><label><%= scope.strLeft %></label></td>","<td><label><%= scope.strRight %></label></td>","</tr>","<tr>",'<td><div id="advsettings-spin-margin-left"></div></td>','<td><div id="advsettings-spin-margin-right"></div></td>',"</tr>","</table>","</div></td>","</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left" style="vertical-align: top;"><label><%= scope.strPrint %></label></td>','<td class="right" style="vertical-align: top;"><div id="advsettings-print">','<div id="advsettings-print-chb-grid" style="margin-bottom: 10px;"/>','<div id="advsettings-print-chb-rows"/>',"</div></td>","</tr>",'<tr class="divider"></tr>','<tr class="divider"></tr>',"<tr>",'<td class="left"></td>','<td class="right"><button id="advsettings-print-button-save" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',"</tr>","</tbody></table>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.spinners=[],this._initSettings=!0},render:function(t){return t&&this.setElement(t,!1),$(this.el).html(this.template({scope:this})),this.cmbSheet=new Common.UI.ComboBox({el:$("#advsettings-print-combo-sheets"),style:"width: 242px;",menuStyle:"min-width: 242px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.cmbPaperSize=new Common.UI.ComboBox({el:$("#advsettings-print-combo-pages"),style:"width: 242px;",menuStyle:"max-height: 280px; min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:"215.9|279.4",displayValue:"US Letter (21,59cm x 27,94cm)",caption:"US Letter"},{value:"215.9|355.6",displayValue:"US Legal (21,59cm x 35,56cm)",caption:"US Legal"},{value:"210|297",displayValue:"A4 (21cm x 29,7cm)",caption:"A4"},{value:"148|210",displayValue:"A5 (14,8cm x 21cm)",caption:"A5"},{value:"176|250",displayValue:"B5 (17,6cm x 25cm)",caption:"B5"},{value:"104.8|241.3",displayValue:"Envelope #10 (10,48cm x 24,13cm)",caption:"Envelope #10"},{value:"110|220",displayValue:"Envelope DL (11cm x 22cm)",caption:"Envelope DL"},{value:"279.4|431.8",displayValue:"Tabloid (27,94cm x 43,178m)",caption:"Tabloid"},{value:"297|420",displayValue:"A3 (29,7cm x 42cm)",caption:"A3"},{value:"304.8|457.1",displayValue:"Tabloid Oversize (30,48cm x 45,71cm)",caption:"Tabloid Oversize"},{value:"196.8|273",displayValue:"ROC 16K (19,68cm x 27,3cm)",caption:"ROC 16K"},{value:"119.9|234.9",displayValue:"Envelope Choukei 3 (11,99cm x 23,49cm)",caption:"Envelope Choukei 3"},{value:"330.2|482.5",displayValue:"Super B/A3 (33,02cm x 48,25cm)",caption:"Super B/A3"}]}),this.cmbPaperOrientation=new Common.UI.ComboBox({el:$("#advsettings-print-combo-orient"),style:"width: 132px;",menuStyle:"min-width: 132px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPageOrientation.PagePortrait,displayValue:this.strPortrait},{value:Asc.c_oAscPageOrientation.PageLandscape,displayValue:this.strLandscape}]}),this.cmbLayout=new Common.UI.ComboBox({el:$("#advsettings-print-combo-layout"),style:"width: 242px;",menuStyle:"min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textActualSize},{value:1,displayValue:this.textFitPage},{value:2,displayValue:this.textFitCols},{value:3,displayValue:this.textFitRows}]}),this.chPrintGrid=new Common.UI.CheckBox({el:$("#advsettings-print-chb-grid"),labelText:this.textPrintGrid}),this.chPrintRows=new Common.UI.CheckBox({el:$("#advsettings-print-chb-rows"),labelText:this.textPrintHeadings}),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-top"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-bottom"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-left"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-right"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginRight),this.btnOk=new Common.UI.Button({el:"#advsettings-print-button-save"}),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.fireEvent("render:after",this),this},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}for(var i=this.cmbPaperSize.store,t=0;t<i.length;t++){var n=i.at(t),o=n.get("value"),s=/^\d{3}\.?\d*/.exec(o),a=/\d{3}\.?\d*$/.exec(o);n.set("displayValue",n.get("caption")+" ("+parseFloat(Common.Utils.Metric.fnRecalcFromMM(s).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+" x "+parseFloat(Common.Utils.Metric.fnRecalcFromMM(a).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+")")}this.cmbPaperSize.onResetItems()},applySettings:function(){this.menu&&this.menu.fireEvent("settings:apply",[this.menu])},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this._initSettings&&(this.updateMetricUnit(),this._initSettings=!1),this.fireEvent("show",this)},okButtonText:"Save",strPortrait:"Portrait",strLandscape:"Landscape",textPrintGrid:"Print Gridlines",textPrintHeadings:"Print Rows and Columns Headings",strLeft:"Left",strRight:"Right",strTop:"Top",strBottom:"Bottom",strMargins:"Margins",textPageSize:"Page Size",textPageOrientation:"Page Orientation",strPrint:"Print",textSettings:"Settings for",textPageScaling:"Scaling",textActualSize:"Actual Size",textFitPage:"Fit Sheet on One Page",textFitCols:"Fit All Columns on One Page",textFitRows:"Fit All Rows on One Page"},SSE.Views.MainSettingsPrint||{})),SSE.Views.FileMenuPanels.MainSettingsGeneral=Common.UI.BaseView.extend(_.extend({el:"#panel-settings-general",menu:void 0,template:_.template(['<table class="main"><tbody>','<tr class="comments">','<td class="left"><label><%= scope.txtLiveComment %></label></td>','<td class="right"><div id="fms-chb-live-comment"/></td>',"</tr>",'<tr class="divider comments"></tr>','<tr class="comments">','<td class="left"></td>','<td class="right"><div id="fms-chb-resolved-comment"/></td>',"</tr>",'<tr class="divider comments"></tr>','<tr class="autosave">','<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>','<td class="right"><span id="fms-chb-autosave" /></td>',"</tr>",'<tr class="divider autosave"></tr>','<tr class="forcesave">','<td class="left"><label id="fms-lbl-forcesave"><%= scope.textForceSave %></label></td>','<td class="right"><span id="fms-chb-forcesave" /></td>',"</tr>",'<tr class="divider forcesave"></tr>',"<tr>",'<td class="left"><label><%= scope.textRefStyle %></label></td>','<td class="right"><div id="fms-chb-r1c1-style"/></td>',"</tr>",'<tr class="divider"></tr>','<tr class="coauth changes">','<td class="left"><label><%= scope.strCoAuthMode %></label></td>','<td class="right">','<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;vertical-align: middle;"/>','<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>',"</tr>",'<tr class="divider coauth changes"></tr>',"<tr>",'<td class="left"><label><%= scope.strZoom %></label></td>','<td class="right"><div id="fms-cmb-zoom" class="input-group-nr" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.strFontRender %></label></td>','<td class="right"><span id="fms-cmb-font-render" /></td>',"</tr>",'<tr class="divider"></tr>','<tr class="edit">','<td class="left"><label><%= scope.strUnit %></label></td>','<td class="right"><span id="fms-cmb-unit" /></td>',"</tr>",'<tr class="divider edit"></tr>','<tr class="edit">','<td class="left"><label><%= scope.strFuncLocale %></label></td>','<td class="right">','<div><div id="fms-cmb-func-locale" style="display: inline-block; margin-right: 15px;vertical-align: middle;"/>','<label id="fms-lbl-func-locale" style="vertical-align: middle;"><%= scope.strFuncLocaleEx %></label></div></td>',"</tr>",'<tr class="divider edit"></tr>','<tr class="edit">','<td class="left"><label><%= scope.strRegSettings %></label></td>','<td class="right">','<div><div id="fms-cmb-reg-settings" style="display: inline-block; margin-right: 15px;vertical-align: middle;"/>','<label id="fms-lbl-reg-settings" style="vertical-align: middle;"></label></div></td>',"</tr>",'<tr class="divider edit"></tr>',"<tr>",'<td class="left"></td>','<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',"</tr>","</tbody></table>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){$(this.el).html(this.template({scope:this})),this.chLiveComment=new Common.UI.CheckBox({el:$("#fms-chb-live-comment"),labelText:this.strLiveComment}).on("change",_.bind(function(t,e,i,n){this.chResolvedComment.setDisabled("checked"!==t.getValue())},this)),this.chResolvedComment=new Common.UI.CheckBox({el:$("#fms-chb-resolved-comment"),labelText:this.strResolvedComment}),this.chR1C1Style=new Common.UI.CheckBox({el:$("#fms-chb-r1c1-style"),labelText:this.strR1C1}),this.cmbCoAuthMode=new Common.UI.ComboBox({el:$("#fms-cmb-coauth-mode"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:1,displayValue:this.strFast,descValue:this.strCoAuthModeDescFast},{value:0,displayValue:this.strStrict,descValue:this.strCoAuthModeDescStrict}]}).on("selected",_.bind(function(t,e){1==e.value&&"checked"!==this.chAutosave.getValue()&&this.chAutosave.setValue(1),this.lblCoAuthMode.text(e.descValue)},this)),this.lblCoAuthMode=$("#fms-lbl-coauth-mode"),this.cmbZoom=new Common.UI.ComboBox({el:$("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 210px;",data:[{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90,displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbFontRender=new Common.UI.ComboBox({el:$("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling,displayValue:this.txtWin},{value:Asc.c_oAscFontRenderingModeType.noHinting,displayValue:this.txtMac},{value:Asc.c_oAscFontRenderingModeType.hinting,displayValue:this.txtNative}]}),this.chAutosave=new Common.UI.CheckBox({el:$("#fms-chb-autosave"),labelText:this.strAutosave}).on("change",_.bind(function(t,e,i,n){"checked"!==t.getValue()&&this.cmbCoAuthMode.getValue()&&(this.cmbCoAuthMode.setValue(0),this.lblCoAuthMode.text(this.strCoAuthModeDescStrict))},this)),this.lblAutosave=$("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:$("#fms-chb-forcesave"),labelText:this.strForcesave}),this.cmbUnit=new Common.UI.ComboBox({el:$("#fms-cmb-unit"),
|
|
|
style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.cmbFuncLocale=new Common.UI.ComboBox({el:$("#fms-cmb-func-locale"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:"en",displayValue:this.txtEn,exampleValue:this.txtExampleEn},{value:"de",displayValue:this.txtDe,exampleValue:this.txtExampleDe},{value:"es",displayValue:this.txtEs,exampleValue:this.txtExampleEs},{value:"fr",displayValue:this.txtFr,exampleValue:this.txtExampleFr},{value:"it",displayValue:this.txtIt,exampleValue:this.txtExampleIt},{value:"ru",displayValue:this.txtRu,exampleValue:this.txtExampleRu},{value:"pl",displayValue:this.txtPl,exampleValue:this.txtExamplePl}]}).on("selected",_.bind(function(t,e){this.updateFuncExample(e.exampleValue)},this));var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];return t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbRegSettings=new Common.UI.ComboBox({el:$("#fms-cmb-reg-settings"),style:"width: 160px;",menuStyle:"max-height: 185px;",editable:!1,cls:"input-group-nr",data:t,template:_.template(['<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control" style="padding-left: 25px !important;">','<span class="icon input-icon lang-flag"></span>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>">','<a tabindex="-1" type="menuitem" style="padding-left: 26px !important;">','<i class="icon lang-flag <%= item.langName %>" style="position: absolute;margin-left:-21px;"></i>',"<%= scope.getDisplayValue(item) %>","</a>","</li>","<% }); %>","</ul>","</span>"].join(""))}).on("selected",_.bind(function(t,e){this.updateRegionalExample(e.value)},this)),this.cmbRegSettings.scroller&&this.cmbRegSettings.scroller.update({alwaysVisibleY:!0}),this.btnApply=new Common.UI.Button({el:"#fms-btn-apply"}),this.btnApply.on("click",_.bind(this.applySettings,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings()},setMode:function(t){this.mode=t,$("tr.edit",this.el)[t.isEdit?"show":"hide"](),$("tr.autosave",this.el)[t.isEdit?"show":"hide"](),this.mode.isDesktopApp&&this.mode.isOffline&&(this.chAutosave.setCaption(this.strAutoRecover),this.lblAutosave.text(this.textAutoRecover)),$("tr.forcesave",this.el)[t.canForcesave?"show":"hide"](),$("tr.comments",this.el)[t.canCoAuthoring?"show":"hide"](),$("tr.coauth.changes",this.el)[t.isEdit&&!t.isOffline&&t.canCoAuthoring?"show":"hide"]()},setApi:function(t){this.api=t},updateSettings:function(){var t=Common.Utils.InternalSettings.get("sse-settings-zoom");t=null!==t?parseInt(t):this.mode.customization&&this.mode.customization.zoom?parseInt(this.mode.customization.zoom):100;var e=this.cmbZoom.store.findWhere({value:t});this.cmbZoom.setValue(e?parseInt(e.get("value")):t>0?t+"%":100),this.chLiveComment.setValue(Common.Utils.InternalSettings.get("sse-settings-livecomment")),this.chResolvedComment.setValue(Common.Utils.InternalSettings.get("sse-settings-resolvedcomment")),this.chR1C1Style.setValue(Common.Utils.InternalSettings.get("sse-settings-r1c1"));var i=Common.Utils.InternalSettings.get("sse-settings-coauthmode");e=this.cmbCoAuthMode.store.findWhere({value:i?1:0}),this.cmbCoAuthMode.setValue(e?e.get("value"):1),this.lblCoAuthMode.text(e?e.get("descValue"):this.strCoAuthModeDescFast),t=Common.Utils.InternalSettings.get("sse-settings-fontrender"),e=this.cmbFontRender.store.findWhere({value:parseInt(t)}),this.cmbFontRender.setValue(e?e.get("value"):window.devicePixelRatio>1?Asc.c_oAscFontRenderingModeType.noHinting:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling),t=Common.Utils.InternalSettings.get("sse-settings-unit"),e=this.cmbUnit.store.findWhere({value:t}),this.cmbUnit.setValue(e?parseInt(e.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),t=Common.Utils.InternalSettings.get("sse-settings-autosave"),this.chAutosave.setValue(1==t),this.mode.canForcesave&&this.chForcesave.setValue(Common.Utils.InternalSettings.get("sse-settings-forcesave")),t=Common.Utils.InternalSettings.get("sse-settings-func-locale"),e=this.cmbFuncLocale.store.findWhere({value:t}),!e&&t&&(e=this.cmbFuncLocale.store.findWhere({value:t.split(/[\-\_]/)[0]})),this.cmbFuncLocale.setValue(e?e.get("value"):"en"),this.updateFuncExample(e?e.get("exampleValue"):this.txtExampleEn),t=this.api.asc_getLocale(),t?(e=this.cmbRegSettings.store.findWhere({value:t}),this.cmbRegSettings.setValue(e?e.get("value"):Common.util.LanguageInfo.getLocalLanguageName(t)[1]),e&&(t=this.cmbRegSettings.getValue())):(t=this.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)):1033,this.cmbRegSettings.setValue(Common.util.LanguageInfo.getLocalLanguageName(t)[1])),this.updateRegionalExample(t)},applySettings:function(){Common.localStorage.setItem("sse-settings-zoom",this.cmbZoom.getValue()),Common.Utils.InternalSettings.set("sse-settings-zoom",Common.localStorage.getItem("sse-settings-zoom")),Common.localStorage.setItem("sse-settings-livecomment",this.chLiveComment.isChecked()?1:0),Common.localStorage.setItem("sse-settings-resolvedcomment",this.chResolvedComment.isChecked()?1:0),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("sse-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("sse-settings-r1c1",this.chR1C1Style.isChecked()?1:0),Common.localStorage.setItem("sse-settings-fontrender",this.cmbFontRender.getValue()),Common.localStorage.setItem("sse-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("sse-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("sse-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.localStorage.setItem("sse-settings-func-locale",this.cmbFuncLocale.getValue()),this.cmbRegSettings.getSelectedRecord()&&Common.localStorage.setItem("sse-settings-reg-settings",this.cmbRegSettings.getValue()),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},updateRegionalExample:function(t){if(this.api){var e="";if(t){var i=new Asc.asc_CFormatCellsInfo;i.asc_setType(Asc.c_oAscNumFormatType.None),i.asc_setSymbol(t);var n=this.api.asc_getFormatCells(i);e=this.api.asc_getLocaleExample(n[4],1000.01,t),e=e+" "+this.api.asc_getLocaleExample(n[5],Asc.cDate().getExcelDateWithTime(),t),e=e+" "+this.api.asc_getLocaleExample(n[6],Asc.cDate().getExcelDateWithTime(),t)}$("#fms-lbl-reg-settings").text(_.isEmpty(e)?"":this.strRegSettingsEx+e)}var o=this.cmbRegSettings.$el.find(".input-icon"),s=o.attr("lang"),a=Common.util.LanguageInfo.getLocalLanguageName(t)[0];s&&o.removeClass(s),o.addClass(a).attr("lang",a)},updateFuncExample:function(t){$("#fms-lbl-func-locale").text(_.isEmpty(t)?"":this.strRegSettingsEx+t)},strLiveComment:"Turn on option",strZoom:"Default Zoom Value",okButtonText:"Apply",txtLiveComment:"Live Commenting",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",strAutosave:"Turn on autosave",textAutoSave:"Autosave",txtEn:"English",txtDe:"Deutsch",txtRu:"Russian",txtPl:"Polish",txtEs:"Spanish",txtFr:"French",txtIt:"Italian",txtExampleEn:" SUM; MIN; MAX; COUNT",txtExampleDe:" SUMME; MIN; MAX; ANZAHL",txtExampleRu:" СУММ; МИН; МАКС; СЧЁТ",txtExamplePl:" SUMA; MIN; MAX; ILE.LICZB",txtExampleEs:" SUMA; MIN; MAX; CALCULAR",txtExampleFr:" SOMME; MIN; MAX; NB",txtExampleIt:" SOMMA; MIN; MAX; CONTA.NUMERI",strFuncLocale:"Formula Language",strFuncLocaleEx:"Example: SUM; MIN; MAX; COUNT",strRegSettings:"Regional Settings",strRegSettingsEx:"Example: ",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)",strResolvedComment:"Turn on display of the resolved comments",textRefStyle:"Reference Style",strR1C1:"Turn on R1C1 style"},SSE.Views.FileMenuPanels.MainSettingsGeneral||{})),SSE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:void 0,template:_.template(['<div id="id-recent-view" style="margin: 20px 0;"></div>'].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.recent=t.recent},render:function(){return $(this.el).html(this.template()),this.viewRecentPicker=new Common.UI.DataView({el:$("#id-recent-view"),store:new Common.UI.DataViewStore(this.recent),itemTemplate:_.template(['<div class="recent-wrap">','<div class="recent-icon"></div>','<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>','<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>',"</div>"].join(""))}),this.viewRecentPicker.on("item:click",_.bind(this.onRecentFileClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onRecentFileClick:function(t,e,i){this.menu&&this.menu.fireEvent("recent:open",[this.menu,i.get("url")])}}),SSE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:void 0,events:function(){return{"click .blank-document-btn":_.bind(this._onBlankDocument,this),"click .thumb-list .thumb-wrap":_.bind(this._onDocumentTemplate,this)}},template:_.template(['<h3 style="margin-top: 20px;"><%= scope.fromBlankText %></h3><hr noshade />','<div class="blank-document">','<div class="blank-document-btn">','<svg class="btn-doc-format">','<use xlink:href="#svg-format-xlsx"></use>',"</svg>","</div>",'<div class="blank-document-info">',"<h3><%= scope.newDocumentText %></h3>","<%= scope.newDescriptionText %>","</div>","</div>","<h3><%= scope.fromTemplateText %></h3><hr noshade />",'<div class="thumb-list">',"<% _.each(docs, function(item) { %>",'<div class="thumb-wrap" template="<%= item.url %>">','<div class="thumb"',"<% if (!_.isEmpty(item.icon)) { print(\" style='background-image: url(item.icon);'>\") } else { print(\"><svg class='btn-doc-format'><use xlink:href='#svg-format-blank'></use></svg>\") } %>","</div>",'<div class="title"><%= item.name %></div>',"</div>","<% }) %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return $(this.el).html(this.template({scope:this,docs:this.options[0].docs})),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},_onBlankDocument:function(){this.menu&&this.menu.fireEvent("create:new",[this.menu,"blank"])},_onDocumentTemplate:function(t){this.menu&&this.menu.fireEvent("create:new",[this.menu,t.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Spreadsheet",newDescriptionText:"Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template"},SSE.Views.FileMenuPanels.CreateNew||{})),SSE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">',"<tr>",'<td class="left"><label>'+this.txtPlacement+"</label></td>",'<td class="right"><label id="id-info-placement">-</label></td>',"</tr>","<tr>",'<td class="left"><label>'+this.txtOwner+"</label></td>",'<td class="right"><label id="id-info-owner">-</label></td>',"</tr>","<tr>",'<td class="left"><label>'+this.txtUploaded+"</label></td>",'<td class="right"><label id="id-info-uploaded">-</label></td>',"</tr>",'<tr class="divider general"></tr>','<tr class="divider general"></tr>',"<tr>",'<td class="left"><label>'+this.txtTitle+"</label></td>",'<td class="right"><div id="id-info-title"></div></td>',"</tr>","<tr>",'<td class="left"><label>'+this.txtSubject+"</label></td>",'<td class="right"><div id="id-info-subject"></div></td>',"</tr>","<tr>",'<td class="left"><label>'+this.txtComment+"</label></td>",'<td class="right"><div id="id-info-comment"></div></td>',"</tr>",'<tr class="divider"></tr>','<tr class="divider"></tr>',"<tr>",'<td class="left"><label>'+this.txtModifyDate+"</label></td>",'<td class="right"><label id="id-info-modify-date"></label></td>',"</tr>","<tr>",'<td class="left"><label>'+this.txtModifyBy+"</label></td>",'<td class="right"><label id="id-info-modify-by"></label></td>',"</tr>",'<tr class="divider modify">','<tr class="divider modify">',"<tr>",'<td class="left"><label>'+this.txtCreated+"</label></td>",'<td class="right"><label id="id-info-date"></label></td>',"</tr>","<tr>",'<td class="left"><label>'+this.txtAppName+"</label></td>",'<td class="right"><label id="id-info-appname"></label></td>',"</tr>","<tr>",'<td class="left" style="vertical-align: top;"><label style="margin-top: 3px;">'+this.txtAuthor+"</label></td>",'<td class="right" style="vertical-align: top;"><div id="id-info-author">',"<table>","<tr>",'<td><div id="id-info-add-author"><input type="text" spellcheck="false" class="form-control" placeholder="'+this.txtAddAuthor+'"></div></td>',"</tr>","</table>","</div></td>","</tr>","</table>"].join("")),this.menu=t.menu,this.coreProps=null,this.authors=[],this._locked=!1},render:function(){$(this.el).html(this.template());var t=this;this.lblPlacement=$("#id-info-placement"),this.lblOwner=$("#id-info-owner"),this.lblUploaded=$("#id-info-uploaded");var e=function(t,e){if(e.keyCode===Common.UI.Keys.ESC){var i=t._input.val(),n=t.getValue();i!==n&&(t.setValue(n),e.stopPropagation())}};return this.inputTitle=new Common.UI.InputField({el:$("#id-info-title"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putTitle(t.inputTitle.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.inputSubject=new Common.UI.InputField({el:$("#id-info-subject"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putSubject(t.inputSubject.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.inputComment=new Common.UI.InputField({el:$("#id-info-comment"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("changed:after",function(e,i,n){i!==n&&t.coreProps&&t.api&&(t.coreProps.asc_putDescription(t.inputComment.getValue()),t.api.asc_setCoreProps(t.coreProps))}).on("keydown:before",e),this.lblModifyDate=$("#id-info-modify-date"),this.lblModifyBy=$("#id-info-modify-by"),this.lblDate=$("#id-info-date"),this.lblApplication=$("#id-info-appname"),this.tblAuthor=$("#id-info-author table"),this.trAuthor=$("#id-info-add-author").closest("tr"),this.authorTpl='<tr><td><div style="display: inline-block;width: 200px;"><input type="text" spellcheck="false" class="form-control" readonly="true" value="{0}" ></div><div class="close img-commonctrl"></div></td></tr>',this.tblAuthor.on("click",function(e){var i=$(e.target);if(i.hasClass("close")&&!i.hasClass("disabled")){var n=i.closest("tr"),o=t.tblAuthor.find("tr").index(n);n.remove(),t.authors.splice(o,1),t.coreProps&&t.api&&(t.coreProps.asc_putCreator(t.authors.join(";")),t.api.asc_setCoreProps(t.coreProps))}}),this.inputAuthor=new Common.UI.InputField({el:$("#id-info-add-author"),style:"width: 200px;",validateOnBlur:!1,placeHolder:this.txtAddAuthor}).on("changed:after",function(e,i,n){if(i!=n){var o=i.trim();o&&o!==n.trim()&&(o.split(/\s*[,;]\s*/).forEach(function(e){var i=e.trim();if(i){var n=$(Common.Utils.String.format(t.authorTpl,Common.Utils.String.htmlEncode(i)));t.trAuthor.before(n),t.authors.push(e)}}),t.inputAuthor.setValue(""),t.coreProps&&t.api&&(t.coreProps.asc_putCreator(t.authors.join(";")),t.api.asc_setCoreProps(t.coreProps)))}}).on("keydown:before",e),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateFileInfo()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){if(!this.doc&&t&&t.info&&(t.info.author&&console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead."),t.info.created&&console.log("Obsolete: The 'created' parameter of the document 'info' section is deprecated. Please use 'uploaded' instead.")),this.doc=t,this.rendered){var e=!1;if(t=t||{},t.info){t.info.folder&&this.lblPlacement.text(t.info.folder),e=this._ShowHideInfoItem(this.lblPlacement,void 0!==t.info.folder&&null!==t.info.folder)||e;var i=t.info.owner||t.info.author;i&&this.lblOwner.text(i),e=this._ShowHideInfoItem(this.lblOwner,!!i)||e,i=t.info.uploaded||t.info.created,i&&this.lblUploaded.text(i),e=this._ShowHideInfoItem(this.lblUploaded,!!i)||e}else this._ShowHideDocInfo(!1);$("tr.divider.general",this.el)[e?"show":"hide"]();var n=this.api?this.api.asc_getAppProps():null;if(n&&(n=(n.asc_getApplication()||"")+" "+(n.asc_getAppVersion()||""),this.lblApplication.text(n)),this._ShowHideInfoItem(this.lblApplication,!!n),this.coreProps=this.api?this.api.asc_getCoreProps():null,this.coreProps){var i=this.coreProps.asc_getCreated();i&&this.lblDate.text(i.toLocaleString()),this._ShowHideInfoItem(this.lblDate,!!i)}}},updateFileInfo:function(){if(this.rendered){var t,e=this,i=this.api?this.api.asc_getCoreProps():null;if(this.coreProps=i,i){var n=!1;t=i.asc_getModified(),t&&this.lblModifyDate.text(t.toLocaleString()),n=this._ShowHideInfoItem(this.lblModifyDate,!!t)||n,t=i.asc_getLastModifiedBy(),t&&this.lblModifyBy.text(t),n=this._ShowHideInfoItem(this.lblModifyBy,!!t)||n,$("tr.divider.modify",this.el)[n?"show":"hide"](),t=i.asc_getTitle(),this.inputTitle.setValue(t||""),t=i.asc_getSubject(),this.inputSubject.setValue(t||""),t=i.asc_getDescription(),this.inputComment.setValue(t||""),this.tblAuthor.find("tr:not(:last-of-type)").remove(),this.authors=[],t=i.asc_getCreator(),t&&t.split(/\s*[,;]\s*/).forEach(function(t){var i=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(t)));e.trAuthor.before(i),e.authors.push(t)}),this.tblAuthor.find(".close").toggleClass("hidden",!this.mode.isEdit)}this.SetDisabled()}},_ShowHideInfoItem:function(t,e){return t.closest("tr")[e?"show":"hide"](),e},_ShowHideDocInfo:function(t){this._ShowHideInfoItem(this.lblPlacement,t),this._ShowHideInfoItem(this.lblOwner,t),this._ShowHideInfoItem(this.lblUploaded,t)},setMode:function(t){return this.mode=t,this.inputAuthor.setVisible(t.isEdit),this.tblAuthor.find(".close").toggleClass("hidden",!t.isEdit),this.SetDisabled(),this},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onLockCore",_.bind(this.onLockCore,this)),this.updateInfo(this.doc),this},onLockCore:function(t){this._locked=t,this.updateFileInfo()},SetDisabled:function(){var t=!this.mode.isEdit||this._locked;this.inputTitle.setDisabled(t),this.inputSubject.setDisabled(t),this.inputComment.setDisabled(t),this.inputAuthor.setDisabled(t),this.tblAuthor.find(".close").toggleClass("disabled",this._locked),this.tblAuthor.toggleClass("disabled",t)},txtPlacement:"Location",txtOwner:"Owner",txtUploaded:"Uploaded",txtAppName:"Application",txtTitle:"Title",txtSubject:"Subject",txtComment:"Comment",txtModifyDate:"Last Modified",txtModifyBy:"Last Modified By",txtCreated:"Created",txtAuthor:"Author",txtAddAuthor:"Add Author",txtAddText:"Add Text",txtMinutes:"min"},SSE.Views.FileMenuPanels.DocumentInfo||{})),SSE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">','<tr class="rights">','<td class="left" style="vertical-align: top;"><label>'+this.txtRights+"</label></td>",'<td class="right"><div id="id-info-rights"></div></td>',"</tr>",'<tr class="edit-rights">','<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary custom" style="margin-right: 10px;">'+this.txtBtnAccessRights+"</button></td>","</tr>","</table>"].join("")),this.templateRights=_.template(["<table>","<% _.each(users, function(item) { %>","<tr>",'<td><span class="userLink <% if (item.isLink) { %>sharedLink<% } %>"></span><span><%= Common.Utils.String.htmlEncode(item.user) %></span></td>',"<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>","</tr>","<% }); %>","</table>"].join("")),this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.cntRights=$("#id-info-rights"),this.btnEditRights=new Common.UI.Button({el:"#id-info-btn-edit"}),this.btnEditRights.on("click",_.bind(this.changeAccessRights,this)),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),Common.NotificationCenter.on("collaboration:sharing",_.bind(this.changeAccessRights,this)),Common.NotificationCenter.on("collaboration:sharingdeny",_.bind(this.onLostEditRights,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},t.info?(t.info.sharingSettings&&this.cntRights.html(this.templateRights({users:t.info.sharingSettings})),this._ShowHideInfoItem("rights",void 0!==t.info.sharingSettings&&null!==t.info.sharingSettings&&t.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&!0!==this._readonlyRights)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("rights",t),this._ShowHideInfoItem("edit-rights",t)},setMode:function(t){return this.sharingSettingsUrl=t.sharingSettingsUrl,!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&Common.Gateway.on("showsharingsettings",_.bind(this.changeAccessRights,this)),!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&Common.Gateway.on("setsharingsettings",_.bind(this.setSharingSettings,this)),this},changeAccessRights:function(t,e,i){if(!this._docAccessDlg&&!this._readonlyRights){var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.updateSharingSettings(e)}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},setSharingSettings:function(t){t&&this.updateSharingSettings(t.sharingSettings)},updateSharingSettings:function(t){this.doc.info.sharingSettings=t,this._ShowHideInfoItem("rights",void 0!==this.doc.info.sharingSettings&&null!==this.doc.info.sharingSettings&&this.doc.info.sharingSettings.length>0),this.cntRights.html(this.templateRights({users:this.doc.info.sharingSettings})),Common.NotificationCenter.trigger("mentions:clearusers",this)},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},SSE.Views.FileMenuPanels.DocumentRights||{})),SSE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:void 0,template:_.template(['<div style="width:100%; height:100%; position: relative;">','<div id="id-help-contents" style="position: absolute; width:220px; top: 0; bottom: 0;" class="no-padding"></div>','<div id="id-help-frame" style="position: absolute; left: 220px; top: 0; right: 0; bottom: 0;" class="no-padding"></div>',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"ProgramInterface/ProgramInterface.htm",name:"Introducing Spreadsheet Editor user interface",headername:"Program Interface"},{src:"ProgramInterface/FileTab.htm",name:"File tab"},{src:"ProgramInterface/HomeTab.htm",name:"Home Tab"},{src:"ProgramInterface/InsertTab.htm",name:"Insert tab"},{src:"ProgramInterface/PluginsTab.htm",name:"Plugins tab"},{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new spreadsheet or open an existing one",headername:"Basic operations"},{src:"UsageInstructions/CopyPasteData.htm",name:"Cut/copy/paste data"},{src:"UsageInstructions/UndoRedo.htm",name:"Undo/redo your actions"},{src:"UsageInstructions/ManageSheets.htm",name:"Manage sheets",headername:"Operations with sheets"},{src:"UsageInstructions/FontTypeSizeStyle.htm",name:"Set font type, size, style, and colors",headername:"Cell text formatting"},{src:"UsageInstructions/AddHyperlinks.htm",name:"Add hyperlinks"},{src:"UsageInstructions/ClearFormatting.htm",name:"Clear text, format in a cell, copy cell format"},{src:"UsageInstructions/AddBorders.htm",name:"Add borders",headername:"Editing cell properties"},{src:"UsageInstructions/AlignText.htm",name:"Align data in cells"},{src:"UsageInstructions/MergeCells.htm",name:"Merge cells"},{src:"UsageInstructions/ChangeNumberFormat.htm",name:"Change number format"},{src:"UsageInstructions/InsertDeleteCells.htm",name:"Manage cells, rows, and columns",headername:"Editing rows/columns"},{src:"UsageInstructions/SortData.htm",name:"Sort and filter data"},{src:"UsageInstructions/InsertFunction.htm",name:"Insert function",headername:"Work with functions"},{src:"UsageInstructions/UseNamedRanges.htm",name:"Use named ranges"},{src:"UsageInstructions/InsertImages.htm",name:"Insert images",headername:"Operations on objects"},{src:"UsageInstructions/InsertChart.htm",name:"Insert chart"},{src:"UsageInstructions/InsertAutoshapes.htm",name:"Insert and format autoshapes"},{src:"UsageInstructions/InsertTextObjects.htm",name:"Insert text objects"},{src:"UsageInstructions/ManipulateObjects.htm",name:"Manipulate objects"},{src:"UsageInstructions/InsertEquation.htm",name:"Insert equations",headername:"Math equations"},{src:"HelpfulHints/CollaborativeEditing.htm",name:"Collaborative spreadsheet editing",headername:"Spreadsheet co-editing"},{src:"UsageInstructions/ViewDocInfo.htm",name:"View file information",headername:"Tools and settings"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your spreadsheet"},{src:"HelpfulHints/AdvancedSettings.htm",name:"Advanced settings of Spreadsheet Editor"},{src:"HelpfulHints/Navigation.htm",name:"View settings and navigation tools"},{src:"HelpfulHints/Search.htm",name:"Search and replace functions"},{src:"HelpfulHints/About.htm",name:"About Spreadsheet Editor",headername:"Helpful hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported formats of spreadsheets"},{src:"HelpfulHints/KeyboardShortcuts.htm",name:"Keyboard shortcuts"}],Common.Utils.isIE&&(window.onhelp=function(){return!1})},render:function(){var t=this;return $(this.el).html(this.template()),this.viewHelpPicker=new Common.UI.DataView({el:$("#id-help-contents"),store:new Common.UI.DataViewStore([]),keyMoveDirection:"vertical",itemTemplate:_.template(['<div id="<%= id %>" class="help-item-wrap">','<div class="caption"><%= name %></div>',"</div>"].join(""))}),this.viewHelpPicker.on("item:add",function(t,e,i){i.has("headername")&&$(e.el).before('<div class="header-name">'+i.get("headername")+"</div>")}),this.viewHelpPicker.on("item:select",function(e,i,n){t.iFrame.src=t.urlPref+n.get("src")}),this.iFrame=document.createElement("iframe"),this.iFrame.src="",this.iFrame.align="top",this.iFrame.frameBorder="0",this.iFrame.width="100%",this.iFrame.height="100%",Common.Gateway.on("internalcommand",function(e){if("help:hyperlink"==e.type){var i=e.data,n=t.viewHelpPicker.store.find(function(t){return i.indexOf(t.get("src"))>0});n&&(t.viewHelpPicker.selectRecord(n,!0),t.viewHelpPicker.scrollToRecord(n))}}),$("#id-help-frame").append(this.iFrame),this},setLangConfig:function(t){var e=this,i=this.viewHelpPicker.store;if(t){t=t.split(/[\-\_]/)[0];var n={dataType:"json",error:function(){e.urlPref.indexOf("resources/help/en/")<0?(e.urlPref="resources/help/en/",i.url="resources/help/en/Contents.json",i.fetch(n)):(e.urlPref="resources/help/en/",i.reset(e.en_data))},success:function(){var t=i.at(0);e.viewHelpPicker.selectRecord(t),e.iFrame.src=e.urlPref+t.get("src")}};i.url="resources/help/"+t+"/Contents.json",i.fetch(n),this.urlPref="resources/help/"+t+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}}),SSE.Views.FileMenuPanels.ProtectDoc=Common.UI.BaseView.extend(_.extend({el:"#panel-protect",menu:void 0,template:_.template(['<label id="id-fms-lbl-protect-header" style="font-size: 18px;"><%= scope.strProtect %></label>','<div id="id-fms-password">','<label class="header"><%= scope.strEncrypt %></label>','<div id="fms-btn-add-pwd" style="width:190px;"></div>','<table id="id-fms-view-pwd" cols="2" width="300">',"<tr>",'<td colspan="2"><label style="cursor: default;"><%= scope.txtEncrypted %></label></td>',"</tr>","<tr>",'<td><div id="fms-btn-change-pwd" style="width:190px;"></div></td>','<td align="right"><div id="fms-btn-delete-pwd" style="width:190px; margin-left:20px;"></div></td>',"</tr>","</table>","</div>",'<div id="id-fms-signature">','<label class="header"><%= scope.strSignature %></label>','<div id="fms-btn-invisible-sign" style="width:190px; margin-bottom: 20px;"></div>','<div id="id-fms-signature-view"></div>',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu;var e=this;this.templateSignature=_.template(['<table cols="2" width="300" class="<% if (!hasRequested && !hasSigned) { %>hidden<% } %>"">',"<tr>",'<td colspan="2"><label style="cursor: default;"><%= tipText %></label></td>',"</tr>","<tr>",'<td><label class="link signature-view-link">'+e.txtView+"</label></td>",'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>">'+e.txtEdit+"</label></td>","</tr>","</table>"].join(""))},render:function(){$(this.el).html(this.template({scope:this}));var t=SSE.getController("Common.Controllers.Protection").getView();return this.btnAddPwd=t.getButton("add-password"),this.btnAddPwd.render(this.$el.find("#fms-btn-add-pwd")),this.btnAddPwd.on("click",_.bind(this.closeMenu,this)),this.btnChangePwd=t.getButton("change-password"),
|
|
|
this.btnChangePwd.render(this.$el.find("#fms-btn-change-pwd")),this.btnChangePwd.on("click",_.bind(this.closeMenu,this)),this.btnDeletePwd=t.getButton("del-password"),this.btnDeletePwd.render(this.$el.find("#fms-btn-delete-pwd")),this.btnDeletePwd.on("click",_.bind(this.closeMenu,this)),this.cntPassword=$("#id-fms-password"),this.cntPasswordView=$("#id-fms-view-pwd"),this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#fms-btn-invisible-sign")),this.btnAddInvisibleSign.on("click",_.bind(this.closeMenu,this)),this.cntSignature=$("#id-fms-signature"),this.cntSignatureView=$("#id-fms-signature-view"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.$el.on("click",".signature-edit-link",_.bind(this.onEdit,this)),this.$el.on("click",".signature-view-link",_.bind(this.onView,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSignatures(),this.updateEncrypt()},setMode:function(t){this.mode=t,this.cntSignature.toggleClass("hidden",!this.mode.isSignatureSupport),this.cntPassword.toggleClass("hidden",!this.mode.isPasswordSupport)},setApi:function(t){return this.api=t,this},closeMenu:function(){this.menu&&this.menu.hide()},onEdit:function(){this.menu&&this.menu.hide();var t=this;Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(e){"ok"==e&&t.api.asc_RemoveAllSignatures()}})},onView:function(){this.menu&&this.menu.hide(),SSE.getController("RightMenu").rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature,!0)},updateSignatures:function(){var t=this.api.asc_getRequestSignatures(),e=this.api.asc_getSignatures(),i=t&&t.length>0,n=!1,o=!1;_.each(e,function(t,e){0==t.asc_getValid()?n=!0:o=!0});var s=o?this.txtSignedInvalid:n?this.txtSigned:"";i&&(s=this.txtRequestedSignatures+(""!=s?"<br><br>":"")+s),this.cntSignatureView.html(this.templateSignature({tipText:s,hasSigned:n||o,hasRequested:i}))},updateEncrypt:function(){this.cntPasswordView.toggleClass("hidden",this.btnAddPwd.isVisible())},strProtect:"Protect Workbook",strSignature:"With Signature",txtView:"View signatures",txtEdit:"Edit workbook",txtSigned:"Valid signatures has been added to the workbook. The workbook is protected from editing.",txtSignedInvalid:"Some of the digital signatures in workbook are invalid or could not be verified. The workbook is protected from editing.",txtRequestedSignatures:"This workbook needs to be signed.",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the workbook.<br>Are you sure you want to continue?",strEncrypt:"With Password",txtEncrypted:"This workbook has been protected by password"},SSE.Views.FileMenuPanels.ProtectDoc||{}))}),define("text!spreadsheeteditor/main/app/template/PrintSettings.template",[],function(){return'<div class="settings-panel active">\r\n <div class="padding-large inner-content" >\r\n <div id="printadv-dlg-combo-range" class="input-group-nr" />\r\n <div id="printadv-dlg-chb-ignore" style="margin-top: 5px;"/>\r\n </div>\r\n <div class="padding-small"/>\r\n <div class="padding-large inner-content" >\r\n <div id="printadv-dlg-combo-sheets" class="input-group-nr" />\r\n </div>\r\n <div class="padding-large inner-content" >\r\n <div id="printadv-dlg-combo-pages" class="input-group-nr" />\r\n </div>\r\n <div class="padding-large inner-content" >\r\n <span id="printadv-dlg-combo-orient" />\r\n </div>\r\n <div class="padding-large inner-content" >\r\n <span id="printadv-dlg-combo-layout" />\r\n </div>\r\n <div id="printadv-dlg-content-to-hide">\r\n <div class="padding-large inner-content" >\r\n <table cols="2" class="no-padding">\r\n <tr>\r\n <td><label><%= scope.strTop %></label></td>\r\n <td><label><%= scope.strBottom %></label></td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small"><div id="printadv-dlg-spin-margin-top" style="margin-right: 19px;"></div></td>\r\n <td class="padding-small"><div id="printadv-dlg-spin-margin-bottom"></div></td>\r\n </tr>\r\n <tr>\r\n <td><label><%= scope.strLeft %></label></td>\r\n <td><label><%= scope.strRight %></label></td>\r\n </tr>\r\n <tr>\r\n <td><div id="printadv-dlg-spin-margin-left" style="margin-right: 15px;"></div></td>\r\n <td><div id="printadv-dlg-spin-margin-right"></div></td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="padding-small"/>\r\n <div class="inner-content">\r\n <div id="printadv-dlg-chb-grid" style="margin-bottom: 10px;"/>\r\n <div id="printadv-dlg-chb-rows"/>\r\n </div>\r\n </div>\r\n</div>\r\n'}),define("spreadsheeteditor/main/app/view/PrintSettings",["text!spreadsheeteditor/main/app/template/PrintSettings.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(t){"use strict";SSE.Views.PrintSettings=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"PrintSettings",contentWidth:280,height:475},initialize:function(e){this.type=e.type||"print",_.extend(this.options,{title:"print"==this.type?this.textTitle:this.textTitlePDF,template:['<div class="box" style="height:'+(this.options.height-85)+'px;">','<div class="menu-panel" style="overflow: hidden;">','<div style="height: 54px; line-height: 42px;" class="div-category">'+("print"==this.type?this.textPrintRange:this.textRange)+"</div>",'<div style="height: 52px; line-height: 66px;" class="div-category">'+this.textSettings+"</div>",'<div style="height: 38px; line-height: 38px;" class="div-category">'+this.textPageSize+"</div>",'<div style="height: 38px; line-height: 38px;" class="div-category">'+this.textPageOrientation+"</div>",'<div style="height: 38px; line-height: 38px;" class="div-category">'+this.textPageScaling+"</div>",'<div style="height: 108px; line-height: 33px;" class="div-category">'+this.strMargins+"</div>",'<div style="height: 58px; line-height: 40px;" class="div-category">'+("print"==this.type?this.strPrint:this.strShow)+"</div>","</div>",'<div class="content-panel">'+_.template(t)({scope:this})+"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer justify">','<button id="printadv-dlg-btn-hide" class="btn btn-text-default" style="margin-right: 55px; width: 100px;">'+this.textHideDetails+"</button>",'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 150px;">'+("print"==this.type?this.btnPrint:this.btnDownload)+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+this.cancelButtonText+"</button>","</div>"].join("")},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[]},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this),this.cmbRange=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-range"),style:"width: 132px;",menuStyle:"min-width: 132px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPrintType.ActiveSheets,displayValue:this.textCurrentSheet},{value:Asc.c_oAscPrintType.EntireWorkbook,displayValue:this.textAllSheets},{value:Asc.c_oAscPrintType.Selection,displayValue:this.textSelection}]}),this.cmbRange.on("selected",_.bind(this.comboRangeChange,this)),this.chIgnorePrintArea=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-ignore"),labelText:this.textIgnore}),this.cmbSheet=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-sheets"),style:"width: 242px;",menuStyle:"min-width: 242px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.cmbPaperSize=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-pages"),style:"width: 242px;",menuStyle:"max-height: 280px; min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:"215.9|279.4",displayValue:"US Letter (21,59cm x 27,94cm)",caption:"US Letter"},{value:"215.9|355.6",displayValue:"US Legal (21,59cm x 35,56cm)",caption:"US Legal"},{value:"210|297",displayValue:"A4 (21cm x 29,7cm)",caption:"A4"},{value:"148|210",displayValue:"A5 (14,8cm x 21cm)",caption:"A5"},{value:"176|250",displayValue:"B5 (17,6cm x 25cm)",caption:"B5"},{value:"104.8|241.3",displayValue:"Envelope #10 (10,48cm x 24,13cm)",caption:"Envelope #10"},{value:"110|220",displayValue:"Envelope DL (11cm x 22cm)",caption:"Envelope DL"},{value:"279.4|431.8",displayValue:"Tabloid (27,94cm x 43,18cm)",caption:"Tabloid"},{value:"297|420",displayValue:"A3 (29,7cm x 42cm)",caption:"A3"},{value:"304.8|457.1",displayValue:"Tabloid Oversize (30,48cm x 45,71cm)",caption:"Tabloid Oversize"},{value:"196.8|273",displayValue:"ROC 16K (19,68cm x 27,3cm)",caption:"ROC 16K"},{value:"119.9|234.9",displayValue:"Envelope Choukei 3 (11,99cm x 23,49cm)",caption:"Envelope Choukei 3"},{value:"330.2|482.5",displayValue:"Super B/A3 (33,02cm x 48,25cm)",caption:"Super B/A3"}]}),this.cmbPaperOrientation=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-orient"),style:"width: 132px;",menuStyle:"min-width: 132px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPageOrientation.PagePortrait,displayValue:this.strPortrait},{value:Asc.c_oAscPageOrientation.PageLandscape,displayValue:this.strLandscape}]}),this.chPrintGrid=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-grid"),labelText:"print"==this.type?this.textPrintGrid:this.textShowGrid}),this.chPrintRows=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-rows"),labelText:"print"==this.type?this.textPrintHeadings:this.textShowHeadings}),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-top"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-bottom"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-left"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-right"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginRight),this.cmbLayout=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-layout"),style:"width: 242px;",menuStyle:"min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textActualSize},{value:1,displayValue:this.textFitPage},{value:2,displayValue:this.textFitCols},{value:3,displayValue:this.textFitRows}]}),this.btnHide=new Common.UI.Button({el:$("#printadv-dlg-btn-hide")}),this.btnHide.on("click",_.bind(this.handlerShowDetails,this)),this.panelDetails=$("#printadv-dlg-content-to-hide"),this.updateMetricUnit(),this.options.afterrender&&this.options.afterrender.call(this);var t=Common.localStorage.getItem("sse-hide-print-settings");this.extended=null!==t&&0==parseInt(t),this.handlerShowDetails(this.btnHide)},setRange:function(t){this.cmbRange.setValue(t)},getRange:function(){return this.cmbRange.getValue()},setIgnorePrintArea:function(t){this.chIgnorePrintArea.setValue(t)},getIgnorePrintArea:function(){return"checked"==this.chIgnorePrintArea.getValue()},comboRangeChange:function(t,e){this.fireEvent("changerange",this)},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}for(var i=this.cmbPaperSize.store,t=0;t<i.length;t++){var n=i.at(t),o=n.get("value"),s=/^\d{3}\.?\d*/.exec(o),a=/\d{3}\.?\d*$/.exec(o);n.set("displayValue",n.get("caption")+" ("+parseFloat(Common.Utils.Metric.fnRecalcFromMM(s).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+" x "+parseFloat(Common.Utils.Metric.fnRecalcFromMM(a).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+")")}this.cmbPaperSize.onResetItems()},handlerShowDetails:function(t){this.extended?(this.extended=!1,this.panelDetails.css({display:"block"}),this.setHeight(475),t.setCaption(this.textHideDetails),Common.localStorage.setItem("sse-hide-print-settings",0)):(this.extended=!0,this.panelDetails.css({display:"none"}),this.setHeight(314),t.setCaption(this.textShowDetails),Common.localStorage.setItem("sse-hide-print-settings",1))},textTitle:"Print Settings",strLeft:"Left",strRight:"Right",strTop:"Top",strBottom:"Bottom",strPortrait:"Portrait",strLandscape:"Landscape",textPrintGrid:"Print Gridlines",textPrintHeadings:"Print Rows and Columns Headings",textPageSize:"Page Size",textPageOrientation:"Page Orientation",strMargins:"Margins",strPrint:"Print",btnPrint:"Save & Print",textPrintRange:"Print Range",textLayout:"Layout",textCurrentSheet:"Current Sheet",textAllSheets:"All Sheets",textSelection:"Selection",textActualSize:"Actual Size",textFitPage:"Fit Sheet on One Page",textFitCols:"Fit All Columns on One Page",textFitRows:"Fit All Rows on One Page",textShowDetails:"Show Details",cancelButtonText:"Cancel",textHideDetails:"Hide Details",textPageScaling:"Scaling",textSettings:"Sheet Settings",textTitlePDF:"PDF Settings",textShowGrid:"Show Gridlines",textShowHeadings:"Show Rows and Columns Headings",strShow:"Show",btnDownload:"Save & Download",textRange:"Range",textIgnore:"Ignore Print Area"},SSE.Views.PrintSettings||{}))}),define("spreadsheeteditor/main/app/controller/Print",["core","spreadsheeteditor/main/app/view/FileMenuPanels","spreadsheeteditor/main/app/view/PrintSettings"],function(){"use strict";SSE.Controllers.Print=Backbone.Controller.extend(_.extend({views:["MainSettingsPrint"],initialize:function(){var t=Common.localStorage.getItem("sse-print-settings-range");t=null!==t?parseInt(t):Asc.c_oAscPrintType.ActiveSheets,this.adjPrintParams=new Asc.asc_CAdjustPrint,this.adjPrintParams.asc_setPrintType(t),this._changedProps=null,this._originalPageSettings=null,this.addListeners({MainSettingsPrint:{show:_.bind(this.onShowMainSettingsPrint,this),"render:after":_.bind(this.onAfterRender,this)},PrintSettings:{changerange:_.bind(this.onChangeRange,this)}})},onLaunch:function(){this.printSettings=this.createView("MainSettingsPrint")},onAfterRender:function(t){this.printSettings.cmbSheet.on("selected",_.bind(this.comboSheetsChange,this,this.printSettings)),this.printSettings.btnOk.on("click",_.bind(this.querySavePrintSettings,this)),Common.NotificationCenter.on("print",_.bind(this.openPrintSettings,this,"print")),Common.NotificationCenter.on("download:settings",_.bind(this.openPrintSettings,this,"download")),this.registerControlEvents(this.printSettings)},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.updateSheetsInfo,this))},updateSheetsInfo:function(){this.printSettings.isVisible()?this.updateSettings(this.printSettings):this.isFillSheets=!1},updateSettings:function(t){for(var e=this.api.asc_getWorksheetsCount(),i=-1,n=[];++i<e;)this.api.asc_isWorksheetHidden(i)||n.push({displayValue:this.api.asc_getWorksheetName(i),value:i});t.cmbSheet.store.reset(n);var o=t.cmbSheet.store.findWhere({value:t.cmbSheet.getValue()})||t.cmbSheet.store.findWhere({value:this.api.asc_getActiveWorksheetIndex()});o&&t.cmbSheet.setValue(o.get("value"))},comboSheetsChange:function(t,e,i){this.fillPageOptions(t,this._changedProps[i.value]?this._changedProps[i.value]:this.api.asc_getPageOptions(i.value))},fillPageOptions:function(t,e){var i=e.asc_getPageSetup();this._originalPageSettings=i;var n=t.cmbPaperOrientation.store.findWhere({value:i.asc_getOrientation()});n&&t.cmbPaperOrientation.setValue(n.get("value"));var o=i.asc_getWidth(),s=i.asc_getHeight(),a=t.cmbPaperSize.store;n=null;for(var l=0;l<a.length;l++){var r=a.at(l),c=r.get("value"),h=parseFloat(/^\d{3}\.?\d*/.exec(c)),d=parseFloat(/\d{3}\.?\d*$/.exec(c));if(Math.abs(h-o)<.1&&Math.abs(d-s)<.1){n=r;break}}n?t.cmbPaperSize.setValue(n.get("value")):t.cmbPaperSize.setValue("Custom ("+parseFloat(Common.Utils.Metric.fnRecalcFromMM(o).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+" x "+parseFloat(Common.Utils.Metric.fnRecalcFromMM(s).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+")");var p=i.asc_getFitToWidth(),m=i.asc_getFitToHeight();p||m?p&&m?t.cmbLayout.setValue(1):p&&!m?t.cmbLayout.setValue(2):t.cmbLayout.setValue(3):t.cmbLayout.setValue(0),n=t.cmbPaperOrientation.store.findWhere({value:i.asc_getOrientation()}),n&&t.cmbPaperOrientation.setValue(n.get("value")),i=e.asc_getPageMargins(),t.spnMarginLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(i.asc_getLeft()),!0),t.spnMarginTop.setValue(Common.Utils.Metric.fnRecalcFromMM(i.asc_getTop()),!0),t.spnMarginRight.setValue(Common.Utils.Metric.fnRecalcFromMM(i.asc_getRight()),!0),t.spnMarginBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(i.asc_getBottom()),!0),t.chPrintGrid.setValue(e.asc_getGridLines(),!0),t.chPrintRows.setValue(e.asc_getHeadings(),!0)},fillPrintOptions:function(t){this.printSettingsDlg.setRange(t.asc_getPrintType()),this.printSettingsDlg.setIgnorePrintArea(!!t.asc_getIgnorePrintArea()),this.onChangeRange()},onChangeRange:function(){var t=this.printSettingsDlg.getRange(),e=this.printSettingsDlg.cmbSheet.store,i=t!==Asc.c_oAscPrintType.EntireWorkbook?e.findWhere({value:this.api.asc_getActiveWorksheetIndex()}):e.at(0);i&&(this.printSettingsDlg.cmbSheet.setValue(i.get("value")),this.comboSheetsChange(this.printSettingsDlg,this.printSettingsDlg.cmbSheet,i.toJSON())),this.printSettingsDlg.cmbSheet.setDisabled(t!==Asc.c_oAscPrintType.EntireWorkbook),this.printSettingsDlg.chIgnorePrintArea.setDisabled(t==Asc.c_oAscPrintType.Selection)},getPageOptions:function(t){var e=new Asc.asc_CPageOptions;e.asc_setGridLines("indeterminate"==t.chPrintGrid.getValue()?void 0:"checked"==t.chPrintGrid.getValue()?1:0),e.asc_setHeadings("indeterminate"==t.chPrintRows.getValue()?void 0:"checked"==t.chPrintRows.getValue()?1:0);var i=new Asc.asc_CPageSetup;i.asc_setOrientation("-"==t.cmbPaperOrientation.getValue()?void 0:t.cmbPaperOrientation.getValue());var n=/^\d{3}\.?\d*/.exec(t.cmbPaperSize.getValue()),o=/\d{3}\.?\d*$/.exec(t.cmbPaperSize.getValue());i.asc_setWidth(n?parseFloat(n[0]):this._originalPageSettings?this._originalPageSettings.asc_getWidth():void 0),i.asc_setHeight(o?parseFloat(o[0]):this._originalPageSettings?this._originalPageSettings.asc_getHeight():void 0);var s=t.cmbLayout.getValue();return i.asc_setFitToWidth(1==s||2==s),i.asc_setFitToHeight(1==s||3==s),e.asc_setPageSetup(i),i=new Asc.asc_CPageMargins,i.asc_setLeft("-"==t.spnMarginLeft.getValue()?void 0:Common.Utils.Metric.fnRecalcToMM(t.spnMarginLeft.getNumberValue())),i.asc_setTop("-"==t.spnMarginTop.getValue()?void 0:Common.Utils.Metric.fnRecalcToMM(t.spnMarginTop.getNumberValue())),i.asc_setRight("-"==t.spnMarginRight.getValue()?void 0:Common.Utils.Metric.fnRecalcToMM(t.spnMarginRight.getNumberValue())),i.asc_setBottom("-"==t.spnMarginBottom.getValue()?void 0:Common.Utils.Metric.fnRecalcToMM(t.spnMarginBottom.getNumberValue())),e.asc_setPageMargins(i),e},savePageOptions:function(t){this.api.asc_savePagePrintOptions(this._changedProps),Common.NotificationCenter.trigger("page:settings")},onShowMainSettingsPrint:function(){this._changedProps=[],this.isFillSheets||(this.isFillSheets=!0,this.updateSettings(this.printSettings));var t=this.printSettings.cmbSheet.store.findWhere({value:this.api.asc_getActiveWorksheetIndex()});t&&(this.printSettings.cmbSheet.setValue(t.get("value")),this.comboSheetsChange(this.printSettings,this.printSettings.cmbSheet,t.toJSON()))},openPrintSettings:function(t,e,i,n){if(this.printSettingsDlg&&this.printSettingsDlg.isVisible())return void(n&&Common.NotificationCenter.trigger("download:cancel"));this.api&&(this.asUrl=n,this.downloadFormat=i,this.printSettingsDlg=new SSE.Views.PrintSettings({type:t,handler:_.bind(this.resultPrintSettings,this),afterrender:_.bind(function(){this._changedProps=[],this.updateSettings(this.printSettingsDlg),this.printSettingsDlg.cmbSheet.on("selected",_.bind(this.comboSheetsChange,this,this.printSettingsDlg)),this.fillPrintOptions(this.adjPrintParams),this.registerControlEvents(this.printSettingsDlg)},this)}),this.printSettingsDlg.show())},resultPrintSettings:function(t,e){var i=SSE.getController("Toolbar").getView("Toolbar");if("ok"==t){if(!this.checkMargins(this.printSettingsDlg))return!0;this.savePageOptions(this.printSettingsDlg);var n=this.printSettingsDlg.getRange();if(this.adjPrintParams.asc_setPrintType(n),this.adjPrintParams.asc_setPageOptionsMap(this._changedProps),this.adjPrintParams.asc_setIgnorePrintArea(this.printSettingsDlg.getIgnorePrintArea()),Common.localStorage.setItem("sse-print-settings-range",n),"print"==this.printSettingsDlg.type){var o=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);o.asc_setAdvancedOptions(this.adjPrintParams),this.api.asc_Print(o)}else{var o=new Asc.asc_CDownloadOptions(this.downloadFormat,this.asUrl);o.asc_setAdvancedOptions(this.adjPrintParams),this.api.asc_DownloadAs(o)}Common.component.Analytics.trackEvent("print"==this.printSettingsDlg.type?"Print":"DownloadAs"),Common.component.Analytics.trackEvent("ToolBar","print"==this.printSettingsDlg.type?"Print":"DownloadAs"),Common.NotificationCenter.trigger("edit:complete",i)}else this.asUrl&&Common.NotificationCenter.trigger("download:cancel"),Common.NotificationCenter.trigger("edit:complete",i);this.printSettingsDlg=null},querySavePrintSettings:function(){this.checkMargins(this.printSettings)&&(this.savePageOptions(this.printSettings),this.printSettings.applySettings())},checkMargins:function(t){if(t.cmbPaperOrientation.getValue()==Asc.c_oAscPageOrientation.PagePortrait)var e=/^\d{3}\.?\d*/.exec(t.cmbPaperSize.getValue()),i=/\d{3}\.?\d*$/.exec(t.cmbPaperSize.getValue());else i=/^\d{3}\.?\d*/.exec(t.cmbPaperSize.getValue()),e=/\d{3}\.?\d*$/.exec(t.cmbPaperSize.getValue());e=e?parseFloat(e[0]):this._originalPageSettings?this._originalPageSettings.asc_getWidth():0,i=i?parseFloat(i[0]):this._originalPageSettings?this._originalPageSettings.asc_getHeight():0;var n=Common.Utils.Metric.fnRecalcToMM(t.spnMarginLeft.getNumberValue()),o=Common.Utils.Metric.fnRecalcToMM(t.spnMarginRight.getNumberValue()),s=Common.Utils.Metric.fnRecalcToMM(t.spnMarginTop.getNumberValue()),a=Common.Utils.Metric.fnRecalcToMM(t.spnMarginBottom.getNumberValue()),l=!1;return n>e?l="left":o>e-n?l="right":s>i?l="top":a>i-s&&(l="bottom"),!l||(Common.UI.warning({title:this.textWarning,msg:this.warnCheckMargings,callback:function(e,i){switch(l){case"left":return void t.spnMarginLeft.$el.focus();case"right":return void t.spnMarginRight.$el.focus();case"top":return void t.spnMarginTop.$el.focus();case"bottom":return void t.spnMarginBottom.$el.focus()}}}),!1)},registerControlEvents:function(t){t.cmbPaperSize.on("selected",_.bind(this.propertyChange,this,t)),t.cmbPaperOrientation.on("selected",_.bind(this.propertyChange,this,t)),t.cmbLayout.on("selected",_.bind(this.propertyChange,this,t)),t.spnMarginTop.on("change",_.bind(this.propertyChange,this,t)),t.spnMarginBottom.on("change",_.bind(this.propertyChange,this,t)),t.spnMarginLeft.on("change",_.bind(this.propertyChange,this,t)),t.spnMarginRight.on("change",_.bind(this.propertyChange,this,t)),t.chPrintGrid.on("change",_.bind(this.propertyChange,this,t)),t.chPrintRows.on("change",_.bind(this.propertyChange,this,t))},propertyChange:function(t){this._changedProps&&(this._changedProps[t.cmbSheet.getValue()]=this.getPageOptions(t))},getPrintParams:function(){return this.adjPrintParams},warnCheckMargings:"Margins are incorrect",strAllSheets:"All Sheets",textWarning:"Warning",txtCustom:"Custom"},SSE.Controllers.Print||{}))}),define("spreadsheeteditor/main/app/view/DataTab",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(){"use strict";SSE.Views.DataTab=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.btnUngroup.menu.on("item:click",function(e,i,n){t.fireEvent("data:ungroup",[i.value])}),t.btnUngroup.on("click",function(e,i){t.fireEvent("data:ungroup")}),t.btnGroup.menu.on("item:click",function(e,i,n){t.fireEvent("data:group",[i.value,i.checked])}),t.btnGroup.on("click",function(e,i){t.fireEvent("data:group")}),t.btnGroup.menu.on("show:before",function(e,i){t.fireEvent("data:groupsettings",[e])}),t.btnTextToColumns.on("click",function(e,i){t.fireEvent("data:tocolumns")}),t.btnShow.on("click",function(e,i){t.fireEvent("data:show")}),t.btnHide.on("click",function(e,i){t.fireEvent("data:hide")}),t.btnsSortDown.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:sort",[Asc.c_oAscSortOptions.Ascending])})}),t.btnsSortUp.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:sort",[Asc.c_oAscSortOptions.Descending])})}),t.btnsSetAutofilter.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:setfilter",[Asc.c_oAscSortOptions.Descending])})}),t.btnsClearAutofilter.forEach(function(e){e.on("click",function(e,i){t.fireEvent("data:clearfilter",[Asc.c_oAscSortOptions.Descending])})})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this),this.toolbar=t.toolbar,this.lockedControls=[];var e=this,i=e.toolbar.$el,n=SSE.enumLock;this.btnGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-cell-group",caption:this.capBtnGroup,split:!0,menu:!0,disabled:!0,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.sheetLock,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-group"),this.btnGroup),this.lockedControls.push(this.btnGroup),this.btnUngroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-cell-ungroup",caption:this.capBtnUngroup,split:!0,menu:!0,disabled:!0,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.sheetLock,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-ungroup"),this.btnUngroup),this.lockedControls.push(this.btnUngroup),this.btnTextToColumns=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-to-columns",caption:this.capBtnTextToCol,split:!1,disabled:!0,lock:[n.multiselect,n.multiselectCols,n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-text-column"),this.btnTextToColumns),this.lockedControls.push(this.btnTextToColumns),this.btnShow=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-show-details",style:"padding-right: 2px;",caption:this.capBtnTextShow,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-show-details"),this.btnShow),this.lockedControls.push(this.btnShow),this.btnHide=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-hide-details",style:"padding-right: 2px;",caption:this.capBtnTextHide,lock:[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth]}),Common.Utils.injectComponent(i.find("#slot-btn-hide-details"),this.btnHide),this.lockedControls.push(this.btnHide),this.btnsSortDown=Common.Utils.injectButtons(i.find(".slot-sortdesc"),"","btn-sort-down","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleFilter,n.editPivot,n.cantModifyFilter]),this.btnsSortUp=Common.Utils.injectButtons(i.find(".slot-sortasc"),"","btn-sort-up","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleFilter,n.editPivot,n.cantModifyFilter]),this.btnsSetAutofilter=Common.Utils.injectButtons(i.find(".slot-btn-setfilter"),"","btn-autofilter","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleFilter,n.editPivot,n.cantModifyFilter],!1,!1,!0),this.btnsClearAutofilter=Common.Utils.injectButtons(i.find(".slot-btn-clear-filter"),"","btn-clear-filter","",[n.editCell,n.selChart,n.selChartText,n.selShape,n.selShapeText,n.selImage,n.lostConnect,n.coAuth,n.ruleDelFilter,n.editPivot]),Array.prototype.push.apply(this.lockedControls,this.btnsSortDown.concat(this.btnsSortUp,this.btnsSetAutofilter,this.btnsClearAutofilter)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){i.btnUngroup.updateHint(i.tipUngroup);var e=new Common.UI.Menu({items:[{caption:i.textRows,value:"rows"},{caption:i.textColumns,value:"columns"},{caption:i.textClear,value:"clear"}]});i.btnUngroup.setMenu(e),i.btnGroup.updateHint(i.tipGroup),e=new Common.UI.Menu({items:[{caption:i.textGroupRows,value:"rows"},{caption:i.textGroupColumns,value:"columns"},{caption:"--"},{caption:i.textBelow,value:"below",checkable:!0},{caption:i.textRightOf,value:"right",checkable:!0}]}),i.btnGroup.setMenu(e),i.btnTextToColumns.updateHint(i.tipToColumns),i.btnsSortDown.forEach(function(t){t.updateHint(i.toolbar.txtSortAZ)}),i.btnsSortUp.forEach(function(t){t.updateHint(i.toolbar.txtSortZA)}),i.btnsSetAutofilter.forEach(function(t){t.updateHint(i.toolbar.txtFilter+" (Ctrl+Shift+L)")}),i.btnsClearAutofilter.forEach(function(t){t.updateHint(i.toolbar.txtClearFilter)}),t.call(i)})},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButtons:function(t){return"sort-down"==t?this.btnsSortDown:"sort-up"==t?this.btnsSortUp:"set-filter"==t?this.btnsSetAutofilter:"clear-filter"==t?this.btnsClearAutofilter:void 0===t?this.lockedControls:[]},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},capBtnGroup:"Group",capBtnUngroup:"Ungroup",textRows:"Ungroup rows",textColumns:"Ungroup columns",textGroupRows:"Group rows",textGroupColumns:"Group columns",textClear:"Clear outline",tipGroup:"Group range of cells",tipUngroup:"Ungroup range of cells",capBtnTextToCol:"Text to Columns",tipToColumns:"Separate cell text into columns",capBtnTextShow:"Show details",capBtnTextHide:"Hide details",textBelow:"Summary rows below detail",textRightOf:"Summary columns to right of detail"}}(),SSE.Views.DataTab||{}))}),define("spreadsheeteditor/main/app/view/GroupDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";SSE.Views.GroupDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg"},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div class="box">','<div id="group-radio-rows" style="margin-bottom: 5px;"></div>','<div id="group-radio-cols"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.radioRows=new Common.UI.RadioBox({el:$("#group-radio-rows"),labelText:this.textRows,name:"asc-radio-group-cells",checked:"rows"==this.options.props}),this.radioColumns=new Common.UI.RadioBox({el:$("#group-radio-cols"),labelText:this.textColumns,name:"asc-radio-group-cells",checked:"columns"==this.options.props}),
|
|
|
"rows"==this.options.props?this.radioRows.setValue(!0):this.radioColumns.setValue(!0),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.radioRows.getValue()},onPrimary:function(){return this._handleInput("ok"),!1},cancelButtonText:"Cancel",okButtonText:"Ok",textRows:"Rows",textColumns:"Columns"},SSE.Views.GroupDialog||{}))}),define("spreadsheeteditor/main/app/controller/DataTab",["core","spreadsheeteditor/main/app/view/DataTab","spreadsheeteditor/main/app/view/GroupDialog"],function(){"use strict";SSE.Controllers.DataTab=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["DataTab"],sdkViewName:"#id_main",initialize:function(){this._state={CSVOptions:new Asc.asc_CTextOptions(0,4,"")}},onLaunch:function(){},setApi:function(t){return t&&(this.api=t,this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),this.api.asc_registerCallback("asc_onWorksheetLocked",_.bind(this.onWorksheetLocked,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))),this},setConfig:function(t){this.toolbar=t.toolbar,this.view=this.createView("DataTab",{toolbar:this.toolbar.toolbar}),this.addListeners({DataTab:{"data:group":this.onGroup,"data:ungroup":this.onUngroup,"data:tocolumns":this.onTextToColumn,"data:show":this.onShowClick,"data:hide":this.onHideClick,"data:groupsettings":this.onGroupSettings},Statusbar:{"sheet:changed":this.onApiSheetChanged}})},SetDisabled:function(t){this.view&&this.view.SetDisabled(t)},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)},onSelectionChanged:function(t){this.toolbar.editMode&&this.view&&(Common.Utils.lockControls(SSE.enumLock.multiselectCols,t.asc_getSelectedColsCount()>1,{array:[this.view.btnTextToColumns]}),Common.Utils.lockControls(SSE.enumLock.multiselect,t.asc_getFlags().asc_getMultiselect(),{array:[this.view.btnTextToColumns]}))},onUngroup:function(t){var e=this;if("rows"==t)void 0!==e.api.asc_checkAddGroup(!0)&&e.api.asc_ungroup(!0);else if("columns"==t)void 0!==e.api.asc_checkAddGroup(!0)&&e.api.asc_ungroup(!1);else if("clear"==t)e.api.asc_clearOutline();else{var i=e.api.asc_checkAddGroup(!0);null===i?new SSE.Views.GroupDialog({title:e.view.capBtnUngroup,props:"rows",handler:function(t,i){"ok"==i&&e.api.asc_ungroup(t.getSettings()),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show():void 0!==i&&e.api.asc_ungroup(i)}Common.NotificationCenter.trigger("edit:complete",e.toolbar)},onGroup:function(t,e){if("rows"==t)void 0!==this.api.asc_checkAddGroup()&&this.api.asc_group(!0);else if("columns"==t)void 0!==this.api.asc_checkAddGroup()&&this.api.asc_group(!1);else if("below"==t)this.api.asc_setGroupSummary(e,!1);else if("right"==t)this.api.asc_setGroupSummary(e,!0);else{var i=this,n=i.api.asc_checkAddGroup();null===n?new SSE.Views.GroupDialog({title:i.view.capBtnGroup,props:"rows",handler:function(t,e){"ok"==e&&i.api.asc_group(t.getSettings()),Common.NotificationCenter.trigger("edit:complete",i.toolbar)}}).show():void 0!==n&&i.api.asc_group(n)}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onGroupSettings:function(t){var e=this.api.asc_getGroupSummaryBelow();t.items[3].setChecked(!!e,!0),e=this.api.asc_getGroupSummaryRight(),t.items[4].setChecked(!!e,!0)},onTextToColumn:function(){this.api.asc_TextImport(this._state.CSVOptions,_.bind(this.onTextToColumnCallback,this),!1)},onTextToColumnCallback:function(t){if(t&&t.length){var e=this;new Common.Views.OpenDialog({title:e.textWizard,closable:!0,type:Common.Utils.importTextType.Columns,preview:!0,previewData:t,settings:e._state.CSVOptions,api:e.api,handler:function(t,i,n,o){"ok"==t&&e&&e.api&&e.api.asc_TextToColumns(new Asc.asc_CTextOptions(i,n,o))}}).show()}},onShowClick:function(){this.api.asc_changeGroupDetails(!0)},onHideClick:function(){this.api.asc_changeGroupDetails(!1)},onWorksheetLocked:function(t,e){t==this.api.asc_getActiveWorksheetIndex()&&Common.Utils.lockControls(SSE.enumLock.sheetLock,e,{array:[this.view.btnGroup,this.view.btnUngroup]})},onApiSheetChanged:function(){if(this.toolbar.mode&&this.toolbar.mode.isEdit&&!this.toolbar.mode.isEditDiagram&&!this.toolbar.mode.isEditMailMerge){var t=this.api.asc_getActiveWorksheetIndex();this.onWorksheetLocked(t,this.api.asc_isWorksheetLockedOrDeleted(t))}},textWizard:"Text to Columns Wizard"},SSE.Controllers.DataTab||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Comment",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.Comment=e.Model.extend({defaults:{uid:0,guid:"",userid:0,username:"Guest",usercolor:null,date:void 0,quote:"",comment:"",resolved:!1,lock:!1,lockuserid:"",unattached:!1,id:Common.UI.getId(),time:0,showReply:!1,showReplyInPopover:!1,editText:!1,editTextInPopover:!1,last:void 0,replys:[],hideAddReply:!1,scope:null,hide:!1,hint:!1,dummy:void 0,editable:!0}}),Common.Models.Reply=e.Model.extend({defaults:{time:0,userid:0,username:"Guest",usercolor:null,reply:"",date:void 0,id:Common.UI.getId(),editText:!1,editTextInPopover:!1,scope:null,editable:!0}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Comments",["underscore","backbone","common/main/lib/model/Comment"],function(t,e){"use strict";Common.Collections.Comments=e.Collection.extend({model:Common.Models.Comment,groups:null,clearEditing:function(){this.each(function(t){t.set("editText",!1),t.set("editTextInPopover",!1),t.set("showReply",!1),t.set("showReplyInPopover",!1),t.set("hideAddReply",!1)})},getCommentsReplysCount:function(t){var e=0;return this.each(function(i){i.get("userid")==t&&e++;var n=i.get("replys");n&&n.length>0&&n.forEach(function(i){i.get("userid")==t&&e++})}),e}})}),define("text!common/main/lib/template/CommentsPopover.template",[],function(){return'<div id="<%=id%>" class="user-comment-item">\r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n <div class="user-name">\r\n <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>\r\n </div>\r\n <div class="user-date"><%=date%></div>\r\n <% if (!editTextInPopover || hint) { %>\r\n <div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply user-select" maxlength="maxCommLength" spellcheck="false" <% if (!!dummy) { %> placeholder="textMention"<% } %>><%=comment%></textarea>\r\n <% if (hideAddReply) { %>\r\n <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textAdd</button>\r\n <% } else { %>\r\n <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textEdit</button>\r\n <% } %>\r\n <button class="btn normal dlg-btn btn-inner-close">textCancel</button>\r\n </div>\r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n <div class="reply-arrow img-commonctrl"></div>\r\n <% _.each(replys, function (item) { %>\r\n <div class="reply-item-ct">\r\n <div class="user-name">\r\n <div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>\r\n </div>\r\n <div class="user-date"><%=item.get("date")%></div>\r\n <% if (!item.get("editTextInPopover")) { %>\r\n <div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(item.get("reply"))%></div>\r\n <% if (!hint) { %>\r\n <div class="btns-reply-ct">\r\n <% if (item.get("editable")) { %>\r\n <div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n <%}%>\r\n </div>\r\n <%}%>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength" spellcheck="false"><%=item.get("reply")%></textarea>\r\n <button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change-popover">textEdit</button>\r\n <button class="btn normal dlg-btn btn-inner-close">textClose</button>\r\n </div>\r\n <% } %>\r\n </div>\r\n <% }); %>\r\n\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReplyInPopover && !hideAddReply && !hint) { %>\r\n <% if (replys.length) { %>\r\n <label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } else { %>\r\n <label class="user-reply" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editTextInPopover && !lock && !hint) { %>\r\n <div class="edit-ct">\r\n <% if (editable) { %>\r\n <div class="btn-edit img-commonctrl"></div>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% } %>\r\n <% if (resolved) { %>\r\n <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>\r\n <% } else { %>\r\n <div class="btn-resolve img-commonctrl" data-toggle="tooltip"></div>\r\n <% } %>\r\n </div>\r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReplyInPopover) { %>\r\n <div class="reply-ct">\r\n <textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength" spellcheck="false"></textarea>\r\n <button class="btn normal dlg-btn primary btn-reply" id="id-comments-change-popover">textReply</button>\r\n <button class="btn normal dlg-btn btn-close">textClose</button>\r\n </div>\r\n <% } %>\r\n\r\n \x3c!-- locked user --\x3e\r\n\r\n <% if (lock) { %>\r\n <div class="lock-area" style="cursor: default;"></div>\r\n <div class="lock-author" style="cursor: default;"><%=lockuserid%></div>\r\n <% } %>\r\n\r\n</div>'}),define("text!common/main/lib/template/ReviewChangesPopover.template",[],function(){return'<div id="<%=id%>" class="user-comment-item">\r\n <div class="user-name">\r\n <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>\r\n </div>\r\n <div class="user-date"><%=date%></div>\r\n <div class="user-message limit-height"><%=changetext%></div>\r\n <div class="edit-ct">\r\n <% if (goto) { %>\r\n <div class="btn-goto img-commonctrl"></div>\r\n <% } %>\r\n <% if (!hint) { %>\r\n <% if (scope.appConfig.isReviewOnly) { %>\r\n <% if (editable) { %>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% } %>\r\n <% } else { %>\r\n <div class="btn-accept img-commonctrl"></div>\r\n <div class="btn-reject img-commonctrl"></div>\r\n <% } %>\r\n <% } %>\r\n </div>\r\n <% if (!hint && lock) { %>\r\n <div class="lock-area" style="cursor: default;"></div>\r\n <div class="lock-author" style="cursor: default;"><%=lockuser%></div>\r\n <% } %>\r\n</div>'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewPopover",["text!common/main/lib/template/CommentsPopover.template","text!common/main/lib/template/ReviewChangesPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o}Common.Views.ReviewPopover=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};return _.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1,alias:"Common.Views.ReviewPopover"},t),this.template=t.template||['<div class="box">','<div id="id-popover" class="comments-popover" style="overflow-y: hidden;position: relative;">','<div id="id-review-popover"></div>','<div id="id-comments-popover"></div>',"</div>",'<div id="id-comments-arrow" class="comments-arrow"></div>',"</div>"].join(""),this.commentsStore=t.commentsStore,this.reviewStore=t.reviewStore,this.canRequestUsers=t.canRequestUsers,this.canRequestSendNotify=t.canRequestSendNotify,this.externalUsers=[],this._state={commentsVisible:!1,reviewVisible:!1},e.tpl=_.template(this.template)(e),this.arrow={margin:20,width:10,height:30},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e),this.canRequestUsers&&(Common.Gateway.on("setusers",_.bind(this.setUsers,this)),Common.NotificationCenter.on("mentions:clearusers",_.bind(this.clearUsers,this))),this},render:function(n,o){Common.UI.Window.prototype.render.call(this);var s=this,a=this.$window;a.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var l=a.find(".body");l&&l.css("position","relative");var r=Common.UI.DataView.extend(function(){var t=s;return{options:{handleSelect:!1,allowScrollbar:!1,template:_.template('<div class="dataview-ct inner" style="overflow-y: visible;"></div>')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(t){var e=$(this.el).find("textarea");if(t)e.blur();else if(e&&e.length){var i=e.val();e.focus(),e.val(""),e.val(i)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function e(){l=t.scroller.getScrollTop(),n.scrollHeight>n.clientHeight?(i.css({height:n.scrollHeight+a+"px"}),t.calculateSizeOfContent()):(r=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(c=Math.max(n.scrollHeight+a,o),i.css({height:c+"px"})),t.calculateSizeOfContent(),t.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),t.calculateSizeOfContent()),t.scroller.scrollTop(l),t.autoScrollToEditButtons()}var i=this.$el.find("textarea"),n=null,o=50,a=0,l=0,r=0,c=0;i&&i.length&&(n=i.get(0))&&(a=.25*parseInt(i.css("lineHeight"),10),e(),i.bind("input propertychange",e)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)}}}());if(r)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new r({el:$("#id-comments-popover"),store:s.commentsStore,itemTemplate:_.template(i(t,{textAddReply:s.textAddReply,textAdd:s.textAdd,textCancel:s.textCancel,textEdit:s.textEdit,textReply:s.textReply,textClose:s.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength,textMention:s.canRequestSendNotify?s.textMention:""}))});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-resolve");o.tooltip({title:s.textResolve,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),o=$(e.el).find(".btn-resolve-check"),o.tooltip({title:s.textOpenAgain,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n,this.autoHeightTextBox()},h=function(){s._isMouseOver=!0},d=function(){s._isMouseOver=!1};this.commentsView.on("item:add",c),this.commentsView.on("item:remove",c),this.commentsView.on("item:change",c),this.commentsView.cmpEl.on("mouseover",h).on("mouseout",d),this.commentsView.on("item:click",function(t,e,i,n){function o(){s.update()}var a,l,r,c,h,d;if(a=$(n.target)){if(l=i.get("editTextInPopover"),r=i.get("showReplyInPopover"),d=i.get("hideAddReply"),c=i.get("uid"),h=a.attr("data-value"),i.get("hint"))return void s.fireEvent("comment:disableHint",[i]);if(a.hasClass("btn-edit"))_.isUndefined(h)?l||(s.fireEvent("comment:closeEditing"),i.set("editTextInPopover",!0),s.fireEvent("comment:show",[c]),this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox()):(s.fireEvent("comment:closeEditing",[c]),s.fireEvent("comment:editReply",[c,h,!0]),this.replyId=h,this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox());else if(a.hasClass("btn-delete"))_.isUndefined(h)?s.fireEvent("comment:remove",[c]):(s.fireEvent("comment:removeReply",[c,h]),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent()),s.fireEvent("comment:closeEditing"),o();else if(a.hasClass("user-reply"))s.fireEvent("comment:closeEditing"),i.set("showReplyInPopover",!0),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),this.autoHeightTextBox(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox();else if(a.hasClass("btn-reply",!1))r&&(this.clearTextBoxBind(),s.fireEvent("comment:addReply",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent(),o());else if(a.hasClass("btn-close",!1))s.fireEvent("comment:closeEditing",[c]),s.calculateSizeOfContent(),s.fireEvent("comment:show",[c]),o();else if(a.hasClass("btn-inner-edit",!1)){if(i.get("dummy")){var p=this.getActiveTextBoxVal();if(s.clearDummyText(),p.length>0)s.fireEvent("comment:addDummyComment",[p]);else{var m=s.$window.find("textarea:not(.user-message)");m&&m.length&&setTimeout(function(){m.focus()},10)}return}this.clearTextBoxBind(),_.isUndefined(this.replyId)?l&&(s.fireEvent("comment:change",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent()):(s.fireEvent("comment:changeReply",[c,this.replyId,this.getActiveTextBoxVal()]),this.replyId=void 0,s.fireEvent("comment:closeEditing")),o()}else if(a.hasClass("btn-inner-close",!1)){if(i.get("dummy"))return s.clearDummyText(),void s.hide();d&&this.getActiveTextBoxVal().length>0?(s.saveText(),i.set("hideAddReply",!1),this.getTextBox().val(s.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),s.fireEvent("comment:closeEditing",[c])),this.replyId=void 0,s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o()}else if(a.hasClass("btn-resolve",!1)){var u=a.data("bs.tooltip");u&&(u.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}else if(a.hasClass("btn-resolve-check",!1)){var u=a.data("bs.tooltip");u&&(u.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}}}),this.emailMenu=new Common.UI.Menu({maxHeight:190,cyclic:!1,items:[]}).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0}),s.$window.css({zIndex:"1001"})}).on("hide:after",function(){s.$window.css({zIndex:"990"})}),s.on({show:function(){s.commentsView.autoHeightTextBox(),s.$window.find("textarea").keydown(function(t){t.keyCode==Common.UI.Keys.ESC&&s.hide(!0)})},"animate:before":function(){var t=s.$window.find("textarea");t&&t.length&&t.focus()}})}var p=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,template:_.template('<div class="dataview-ct inner" style="overflow-y: visible;"></div>')}}}());if(p)if(this.reviewChangesView)this.reviewChangesView.render($("#id-review-popover")),this.reviewChangesView.onResetItems();else{this.reviewChangesView=new p({el:$("#id-review-popover"),store:s.reviewStore,itemTemplate:_.template(e)});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-goto");o.tooltip({title:s.textFollowMove,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n};this.reviewChangesView.on("item:add",c),this.reviewChangesView.on("item:remove",c),this.reviewChangesView.on("item:change",c),this.reviewChangesView.on("item:click",function(t,e,i,n){var o=$(n.target);if(o)if(o.hasClass("btn-accept"))s.fireEvent("reviewchange:accept",[i.get("changedata")]);else if(o.hasClass("btn-reject"))s.fireEvent("reviewchange:reject",[i.get("changedata")]);else if(o.hasClass("btn-delete"))s.fireEvent("reviewchange:delete",[i.get("changedata")]);else if(o.hasClass("btn-goto")){var a=o.data("bs.tooltip");a&&(a.dontShow=!0),s.fireEvent("reviewchange:goto",[i.get("changedata")])}})}_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:a.find("#id-popover"),minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:!0}))},showComments:function(t,e,i,n){this.options.animate=t;var o=this.commentsView.getTextBox();e&&this.textVal&&o&&o.val(this.textVal),n&&n.length&&o&&o.val(n),this.show(t),this.hookTextBox(),this._state.commentsVisible=!0},showReview:function(t,e,i){this.show(t),this._state.reviewVisible=!0},show:function(t,e,i,n){this.options.animate=t,Common.UI.Window.prototype.show.call(this),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},hideComments:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.commentsVisible=!1,this._state.reviewVisible?this.calculateSizeOfContent():this.hide()},hideReview:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.reviewVisible=!1,this._state.commentsVisible?this.calculateSizeOfContent():this.hide()},hide:function(){this.handlerHide&&this.handlerHide.apply(this,arguments),this.hideTips(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(t){this.commentsView&&t&&this.commentsView.onResetItems(),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n,o){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var s=$("#id-popover"),a=$("#id-comments-arrow"),l=$("#editor_sdk"),r=null,c=0,h="",d=0,p="",m=0,u="",g=0,b="",f=0,C=0,v=0,y=0,x=0,w=0;s&&a&&l&&l.get(0)&&(r=l.get(0).getBoundingClientRect())&&(c=r.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:c+"px"}),this.sdkBounds.width=r.width,this.sdkBounds.height=r.height,_.isUndefined(t)||(h=$("#id_vertical_scroll"),h.length?d="none"!==h.css("display")?h.width():0:(h=$("#ws-v-scrollbar"),h.length&&(d="none"!==h.css("display")?h.width():0)),this.sdkBounds.width-=d,p=$("#id_panel_left"),p.length&&(m="none"!==p.css("display")?p.width():0),u=$("#id_panel_thumbnails"),u.length&&(g="none"!==u.css("display")?u.width():0,this.sdkBounds.width-=g),C=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()-25),C=Math.max(0+m+this.arrow.width,C),a.removeClass("right").addClass("left"),_.isUndefined(i)||(v=this.$window.outerWidth())&&(t+v>this.sdkBounds.width-this.arrow.width+5&&this.leftX>v?(C=this.leftX-v+0-this.arrow.width,a.removeClass("left").addClass("right")):C=0+t+this.arrow.width),this.$window.css("left",C+"px")),_.isUndefined(e)||(b=$("#id_panel_top"),w=0,b.length?(f="none"!==b.css("display")?b.height():0,w+=this.sdkBounds.paddingTop):(b=$("#ws-h-scrollbar"),b.length&&(f="none"!==b.css("display")?b.height():0)),this.sdkBounds.height-=f,y=this.$window.outerHeight(),x=Math.min(0+c-y,this.arrowPosY+0-this.arrow.height),x=Math.max(x,w),parseInt(a.css("top"))+this.arrow.height>y&&a.css({top:y-this.arrow.height+"px"}),this.$window.css("top",x+"px"))),o||this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-comments-arrow"),i=$("#id-popover"),n=null,o=null,s=null,a=0,l="",r=0,c=0,h=0,d=0,p=0,m=0;if(i&&e&&i.get(0)){var u=this.scroller.getScrollTop();i.css({height:"100%"}),n=i.get(0).getBoundingClientRect(),n&&(o=$("#editor_sdk"))&&o.get(0)&&(s=o.get(0).getBoundingClientRect())&&(a=s.height-2*this.sdkBounds.padding,m=0,h=this.$window.outerHeight(),l=$("#id_panel_top"),l.length?(r="none"!==l.css("display")?l.height():0,m+=this.sdkBounds.paddingTop):(l=$("#ws-h-scrollbar"),l.length&&(r="none"!==l.css("display")?l.height():0)),d=Math.max(i.outerHeight(),this.$window.outerHeight()),a<=d?(this.$window.css({maxHeight:a-r+"px",top:0+r+"px"}),i.css({height:a-r-3+"px"}),c=Math.min(c,a-(r+this.arrow.margin+this.arrow.height)),e.css({top:c+"px"}),this.scroller.scrollTop(u)):(d=h,d>0&&(n.top+d>a+0||0===n.height)&&(p=Math.min(0+a-d,this.arrowPosY+0-this.arrow.height),p=Math.max(p,m),this.$window.css({top:p+"px"})),c=Math.max(this.arrow.margin,this.arrowPosY-(a-d)-this.arrow.height),c=Math.min(c,d-this.arrow.margin-this.arrow.height),e.css({top:c+"px"})))}this.$window.css({overflow:""}),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},getEditText:function(){if(this.commentsView)return this.commentsView.getActiveTextBoxVal()},saveDummyText:function(){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textDummyVal=this.commentsView.getActiveTextBoxVal())},clearDummyText:function(){if(this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1){this.textDummyVal=void 0;var t=this.commentsView.getTextBox();t&&t.val(""),this.commentsView.clearTextBoxBind()}},getDummyText:function(){return this.textDummyVal||""},hookTextBox:function(){var t=this,e=this.commentsView.getTextBox();e&&e.keydown(function(e){if(!e.ctrlKey&&!e.metaKey||e.altKey||e.keyCode!==Common.UI.Keys.RETURN){if(e.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,e.stopImmediatePropagation(),e.preventDefault()}}else{var s=$("#id-comments-change-popover");s&&s.length&&s.click(),e.stopImmediatePropagation()}t.e=e}),this.canRequestUsers&&(e&&e.keydown(function(e){e.keyCode==Common.UI.Keys.SPACE||e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.RIGHT||e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.UP?t.onEmailListMenu():e.keyCode==Common.UI.Keys.DOWN&&t.emailMenu&&t.emailMenu.rendered&&t.emailMenu.isVisible()&&_.delay(function(){var e=t.emailMenu.cmpEl.find("li:not(.divider):first");e=e.find("a"),e.focus()},10),t.e=e}),e&&e.on("input",function(e){for(var i=$(this),n=this.selectionStart,o=i.val().replace(/[\n]$/,""),s=0,a=o.length-1,l=n-1;l>=0;l--)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){s=l+1;break}for(var l=n;l<=a;l++)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){a=l-1;break}var r=o.substring(s,a+1),c=r.match(/^(?:[@]|[+](?!1))(\S*)/);c&&c.length>1&&(r=c[1],t.onEmailListMenu(r,s,a))}))},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this),this.reviewChangesView&&_.each(this.reviewChangesView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this)},isCommentsViewMouseOver:function(){return this._isMouseOver},setReviewStore:function(t){this.reviewStore=t,this.reviewChangesView&&this.reviewChangesView.setStore(this.reviewStore)},setCommentsStore:function(t){this.commentsStore=t,this.commentsView&&this.commentsView.setStore(this.commentsStore)},setUsers:function(t){this.externalUsers=t.users||[],this.isUsersLoading=!1,this._state.emailSearch&&this.onEmailListMenu(this._state.emailSearch.str,this._state.emailSearch.left,this._state.emailSearch.right),this._state.emailSearch=null},clearUsers:function(){this.externalUsers=[]},getPopover:function(t){return this.popover||(this.popover=new Common.Views.ReviewPopover(t)),this.popover},autoScrollToEditButtons:function(){var t=$("#id-comments-change-popover"),e=null,i=this.$window[0].getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)},onEmailListMenu:function(t,e,i,n){var o=this,s=o.externalUsers,a=o.emailMenu;if(s.length<1){if(this._state.emailSearch={str:t,left:e,right:i},this.isUsersLoading)return;return this.isUsersLoading=!0,void Common.Gateway.requestUsers()}if("string"==typeof t){var l=o.$window.find(Common.Utils.String.format("#menu-container-{0}",a.id)),r=this.commentsView.getTextBox(),c=r?r[0]:null,h=c?[c.offsetLeft,c.offsetTop+c.clientHeight+3]:[0,0];a.rendered||(l.length<1&&(l=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',a.id)),o.$window.append(l)),a.render(l),a.cmpEl.css("min-width",c?c.clientWidth:220),a.cmpEl.attr({tabindex:"-1"}),a.on("hide:after",function(){setTimeout(function(){var t=o.commentsView.getTextBox();t&&t.focus()},10)}));for(var d=0;d<a.items.length;d++)a.removeItem(a.items[d]),d--;if(s.length>0){t=t.toLowerCase(),t.length>0&&(s=_.filter(s,function(e){return e.email&&0===e.email.toLowerCase().indexOf(t)||e.name&&0===e.name.toLowerCase().indexOf(t)}));var p=_.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= Common.Utils.String.htmlEncode(caption) %></div><div style="color: #909090;"><%= Common.Utils.String.htmlEncode(options.value) %></div></a>'),m=!1;_.each(s,function(t,n){if(m&&!t.hasAccess&&(m=!1,a.addItem(new Common.UI.MenuItem({caption:"--"}))),t.email&&t.name){var s=new Common.UI.MenuItem({caption:t.name,value:t.email,template:p}).on("click",function(t,n){o.insertEmailToTextbox(t.options.value,e,i)});a.addItem(s),t.hasAccess&&(m=!0)}})}a.items.length>0?(l.css({left:h[0],top:h[1]}),a.menuAlignEl=r,a.show(),a.cmpEl.css("display",""),a.alignPosition("bl-tl",-5),a.scroller.update({alwaysVisibleY:!0})):a.rendered&&a.cmpEl.css("display","none")}else a.rendered&&a.cmpEl.css("display","none")},insertEmailToTextbox:function(t,e,i){var n=this.commentsView.getTextBox(),o=n.val();n.val(o.substring(0,e)+"+"+t+o.substring(i+1,o.length)),setTimeout(function(){
|
|
|
n[0].selectionStart=n[0].selectionEnd=e+t.length+1},10)},textAddReply:"Add Reply",textAdd:"Add",textCancel:"Cancel",textEdit:"Edit",textReply:"Reply",textClose:"Close",textResolve:"Resolve",textOpenAgain:"Open Again",textFollowMove:"Follow Move",textMention:"+mention will provide access to the document and send an email"},Common.Views.ReviewPopover||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Comments",["core","common/main/lib/model/Comment","common/main/lib/collection/Comments","common/main/lib/view/Comments","common/main/lib/view/ReviewPopover"],function(){"use strict";function t(){return void 0!==Asc.asc_CCommentDataWord?new Asc.asc_CCommentDataWord(null):new Asc.asc_CCommentData(null)}Common.Controllers.Comments=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Comments"],views:["Common.Views.Comments","Common.Views.ReviewPopover"],sdkViewName:"#id_main",subEditStrings:{},filter:void 0,hintmode:!1,viewmode:!1,isSelectedComment:!1,uids:[],oldUids:[],isDummyComment:!1,initialize:function(){this.addListeners({"Common.Views.Comments":{"comment:add":_.bind(this.onCreateComment,this),"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this)},"Common.Views.ReviewPopover":{"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this),"comment:disableHint":_.bind(this.disableHint,this),"comment:addDummyComment":_.bind(this.onAddDummyComment,this)}}),Common.NotificationCenter.on("comments:updatefilter",_.bind(this.onUpdateFilter,this)),Common.NotificationCenter.on("app:comment:add",_.bind(this.onAppAddComment,this)),Common.NotificationCenter.on("layout:changed",function(t){Common.Utils.asyncCall(function(t){"toolbar"!=t&&"status"!=t||!this.view.$el.is(":visible")||this.onAfterShow()},this,t)}.bind(this))},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.Comments"),this.collection&&(this.collection.comparator=function(t){return-t.get("time")}),this.popoverComments=new Common.Collections.Comments,this.popoverComments&&(this.popoverComments.comparator=function(t){return t.get("time")}),this.groupCollection=[],this.view=this.createView("Common.Views.Comments",{store:this.collection}),this.view.render(),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this)),this.bindViewEvents(this.view,this.events)},setConfig:function(t,e){this.setApi(e),t&&(this.currentUserId=t.config.user.id,this.currentUserName=t.config.user.fullname,this.sdkViewName=t.sdkviewname||this.sdkViewName,this.hintmode=t.hintmode||!1,this.viewmode=t.viewmode||!1)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this)),this.api.asc_registerCallback("asc_onRemoveComment",_.bind(this.onApiRemoveComment,this)),this.api.asc_registerCallback("asc_onChangeComments",_.bind(this.onChangeComments,this)),this.api.asc_registerCallback("asc_onRemoveComments",_.bind(this.onRemoveComments,this)),this.api.asc_registerCallback("asc_onChangeCommentData",_.bind(this.onApiChangeCommentData,this)),this.api.asc_registerCallback("asc_onLockComment",_.bind(this.onApiLockComment,this)),this.api.asc_registerCallback("asc_onUnLockComment",_.bind(this.onApiUnLockComment,this)),this.api.asc_registerCallback("asc_onShowComment",_.bind(this.onApiShowComment,this)),this.api.asc_registerCallback("asc_onHideComment",_.bind(this.onApiHideComment,this)),this.api.asc_registerCallback("asc_onUpdateCommentPosition",_.bind(this.onApiUpdateCommentPosition,this)),this.api.asc_registerCallback("asc_onDocumentPlaceChanged",_.bind(this.onDocumentPlaceChanged,this)))},setMode:function(t){return this.mode=t,this.isModeChanged=!0,this.view.viewmode=!this.mode.canComments,this.view.changeLayout(t),this},onCreateComment:function(e,i,n,o,s){if(this.api&&i&&i.length>0){var a=t();a&&(this.showPopover=!0,this.editPopover=!!n,this.hidereply=o,this.isSelectedComment=!1,this.uids=[],a.asc_putText(i),a.asc_putTime(this.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),a.asc_putUserId(this.currentUserId),a.asc_putUserName(this.currentUserName),a.asc_putSolved(!1),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(s),this.api.asc_addComment(a),this.view.showEditContainer(!1))}this.view.txtComment.focus()},onRemoveComment:function(t){this.api&&t&&this.api.asc_removeComment(t)},onResolveComment:function(e){var i=this,n=null,o=null,s=t(),a=i.findComment(e);return _.isUndefined(e)&&(e=a.get("uid")),!(!s||!a)&&(s.asc_putText(a.get("comment")),s.asc_putQuoteText(a.get("quote")),s.asc_putTime(i.utcDateToString(new Date(a.get("time")))),s.asc_putOnlyOfficeTime(i.ooDateToString(new Date(a.get("time")))),s.asc_putUserId(a.get("userid")),s.asc_putUserName(a.get("username")),s.asc_putSolved(!a.get("resolved")),s.asc_putGuid(a.get("guid")),_.isUndefined(s.asc_putDocumentFlag)||s.asc_putDocumentFlag(a.get("unattached")),n=a.get("replys"),n&&n.length&&n.forEach(function(e){(o=t())&&(o.asc_putText(e.get("reply")),o.asc_putTime(i.utcDateToString(new Date(e.get("time")))),o.asc_putOnlyOfficeTime(i.ooDateToString(new Date(e.get("time")))),o.asc_putUserId(e.get("userid")),o.asc_putUserName(e.get("username")),s.asc_addReply(o))}),i.api.asc_changeComment(e,s),!0)},onShowComment:function(t,e){var i=this.findComment(t);if(i)if(null!==i.get("quote")){if(this.api){if(this.hintmode){if(this.animate=!0,i.get("unattached")&&this.getPopover())return void this.getPopover().hideComments()}else{var n=this.popoverComments.findWhere({uid:t});if(n&&!this.getPopover().isVisible())return this.getPopover().showComments(!0),void this.api.asc_selectComment(t)}!_.isUndefined(e)&&this.hintmode&&(this.isSelectedComment=e),this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!1)}}else this.hintmode&&this.api.asc_selectComment(t),this.getPopover()&&this.getPopover().hideComments(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(e,i){if(i&&i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(r&&l)return l.asc_putText(i),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(n.currentUserId),l.asc_putUserName(n.currentUserName),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),r.set("editTextInPopover",!1),o=n.findPopupComment(e),o&&o.set("editTextInPopover",!1),n.subEditStrings[e]&&delete n.subEditStrings[e],n.subEditStrings[e+"-R"]&&delete n.subEditStrings[e+"-R"],s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),l.asc_addReply(a))}),n.api.asc_changeComment(e,l),!0}return!1},onChangeReplyComment:function(e,i,n){if(n&&n.length>0){var o=this,s=null,a=null,l=t(),r=o.findComment(e);if(l&&r)return l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(o.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(o.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(e.get("id")!==i||_.isUndefined(n)?(a.asc_putText(e.get("reply")),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username"))):(a.asc_putText(n),a.asc_putUserId(o.currentUserId),a.asc_putUserName(o.currentUserName)),a.asc_putTime(o.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(o.ooDateToString(new Date(e.get("time")))),l.asc_addReply(a))}),o.api.asc_changeComment(e,l),!0}return!1},onAddReplyComment:function(e,i){if(i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(l&&r&&(o=r.get("uid"),o&&(n.subEditStrings[o]&&delete n.subEditStrings[o],n.subEditStrings[o+"-R"]&&delete n.subEditStrings[o+"-R"],r.set("showReplyInPopover",!1)),l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),l.asc_addReply(a))}),a=t()))return a.asc_putText(i),a.asc_putTime(n.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date)),a.asc_putUserId(n.currentUserId),a.asc_putUserName(n.currentUserName),l.asc_addReply(a),n.api.asc_changeComment(e,l),n.mode&&n.mode.canRequestUsers&&n.view.pickEMail(l.asc_getGuid(),i),!0}return!1},onRemoveReplyComment:function(e,i){if(!_.isUndefined(e)&&!_.isUndefined(i)){var n=this,o=null,s=null,a=t(),l=n.findComment(e);if(a&&l)return a.asc_putText(l.get("comment")),a.asc_putQuoteText(l.get("quote")),a.asc_putTime(n.utcDateToString(new Date(l.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(l.get("time")))),a.asc_putUserId(l.get("userid")),a.asc_putUserName(l.get("username")),a.asc_putSolved(l.get("resolved")),a.asc_putGuid(l.get("guid")),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(l.get("unattached")),o=l.get("replys"),o&&o.length&&o.forEach(function(e){e.get("id")!==i&&(s=t())&&(s.asc_putText(e.get("reply")),s.asc_putTime(n.utcDateToString(new Date(e.get("time")))),s.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),s.asc_putUserId(e.get("userid")),s.asc_putUserName(e.get("username")),a.asc_addReply(s))}),n.api.asc_changeComment(e,a),!0}return!1},onShowEditReplyComment:function(t,e,i){var n,o,s,a;if(!_.isUndefined(t)&&!_.isUndefined(e))if(i){if((o=this.popoverComments.findWhere({uid:t}))&&(s=o.get("replys"),a=_.clone(o.get("replys"))))for(n=0;n<a.length;++n)if(e===a[n].get("id"))return a[n].set("editTextInPopover",!0),s.length=0,o.set("replys",a),!0}else if((o=this.collection.findWhere({uid:t}))&&(s=o.get("replys"),a=_.clone(o.get("replys"))))for(n=0;n<a.length;++n)if(e===a[n].get("id"))return a[n].set("editText",!0),s.length=0,o.set("replys",a),!0;return!1},onUpdateFilter:function(t,e){if(t){this.view.isVisible()||(this.view.needUpdateFilter=t,e=!0),this.filter=t;var i=this,n=[];if(this.filter.forEach(function(t){i.groupCollection[t]||(i.groupCollection[t]=new Backbone.Collection([],{model:Common.Models.Comment})),n=n.concat(i.groupCollection[t].models)}),this.collection.reset(n),this.collection.groups=this.filter,!e){this.getPopover()&&this.getPopover().hide(),this.view.needUpdateFilter=!1;for(var o=!0,s=this.collection.length-1;s>=0;--s)o?this.collection.at(s).set("last",!0,{silent:!0}):this.collection.at(s).get("last")&&this.collection.at(s).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.update()}}},onAppAddComment:function(t,e){this.api.can_AddQuotedComment&&!1===this.api.can_AddQuotedComment()||e||this.addDummyComment()},addCommentToGroupCollection:function(t){var e=t.get("groupName");this.groupCollection[e]||(this.groupCollection[e]=new Backbone.Collection([],{model:Common.Models.Comment})),this.groupCollection[e].push(t)},onApiAddComment:function(t,e){var i=this.readSDKComment(t,e);i&&(i.get("groupName")?(this.addCommentToGroupCollection(i),_.indexOf(this.collection.groups,i.get("groupName"))>-1&&this.collection.push(i)):this.collection.push(i),this.updateComments(!0),this.showPopover&&(null!==e.asc_getQuoteText()&&(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)),this.showPopover=void 0,this.editPopover=!1))},onApiAddComments:function(t){for(var e=0;e<t.length;++e){var i=this.readSDKComment(t[e].asc_getId(),t[e]);i.get("groupName")?this.addCommentToGroupCollection(i):this.collection.push(i)}this.updateComments(!0)},onApiRemoveComment:function(t,e){for(var i in this.groupCollection){var n=this.groupCollection[i],o=n.findWhere({uid:t});if(o){n.remove(o);break}}if(this.collection.length){var o=this.collection.findWhere({uid:t});o&&(this.collection.remove(o),e||this.updateComments(!0)),this.popoverComments.length&&(o=this.popoverComments.findWhere({uid:t}))&&(this.popoverComments.remove(o),0===this.popoverComments.length&&this.getPopover()&&this.getPopover().hideComments())}},onChangeComments:function(t){for(var e=0;e<t.length;++e)this.onApiChangeCommentData(t[e].Comment.Id,t[e].Comment,!0);this.updateComments(!0)},onRemoveComments:function(t){for(var e=0;e<t.length;++e)this.onApiRemoveComment(t[e],!0);this.updateComments(!0)},onApiChangeCommentData:function(t,e,i){var n=this,o=0,s=null,a=null,l=0,r=null,c=this.findComment(t)||this.findCommentInGroup(t);if(c){n=this,s=e.asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getOnlyOfficeTime())):""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime()));var h=this.userCollection.findOriginalUser(e.asc_getUserId());for(c.set("comment",e.asc_getText()),c.set("userid",e.asc_getUserId()),c.set("username",e.asc_getUserName()),c.set("usercolor",h?h.get("color"):null),c.set("resolved",e.asc_getSolved()),c.set("quote",e.asc_getQuoteText()),c.set("time",s.getTime()),c.set("date",n.dateToLocaleTimeString(s)),a=_.clone(c.get("replys")),a.length=0,l=e.asc_getRepliesCount(),o=0;o<l;++o)r=e.asc_getReply(o).asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getReply(o).asc_getOnlyOfficeTime())):""==e.asc_getReply(o).asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getReply(o).asc_getTime())),h=this.userCollection.findOriginalUser(e.asc_getReply(o).asc_getUserId()),a.push(new Common.Models.Reply({id:Common.UI.getId(),userid:e.asc_getReply(o).asc_getUserId(),username:e.asc_getReply(o).asc_getUserName(),usercolor:h?h.get("color"):null,date:n.dateToLocaleTimeString(r),reply:e.asc_getReply(o).asc_getText(),time:r.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:n.view,editable:n.mode.canEditComments||e.asc_getReply(o).asc_getUserId()==n.currentUserId}));c.set("replys",a),i||this.updateComments(!1,!0)}},onApiLockComment:function(t,e){var i=this.findComment(t)||this.findCommentInGroup(t),n=null;i&&this.userCollection&&(n=this.userCollection.findUser(e))&&(this.getPopover()&&this.getPopover().saveText(),this.view.saveText(),i.set("lock",!0),i.set("lockuserid",this.view.getUserName(n.get("username"))))},onApiUnLockComment:function(t){var e=this.findComment(t)||this.findCommentInGroup(t);e&&(e.set("lock",!1),this.getPopover()&&this.getPopover().loadText(),this.view.loadText())},onApiShowComment:function(t,e,i,n,o,s){var a=0===_.difference(this.uids,t).length&&0===_.difference(t,this.uids).length;if(!(s&&this.isSelectedComment&&a)||this.isModeChanged){this.mode&&!this.mode.canComments&&(s=!0);var l=this.getPopover();if(l){if(this.clearDummyComment(),this.isSelectedComment&&a&&!this.isModeChanged)return void(this.api&&(l.commentsView&&l.commentsView.setFocusToTextBox(!0),this.api.asc_enableKeyEvents(!0)));var r=0,c="",h="",d=null,p="",m=!0,u=[];for(r=0;r<t.length;++r)c=t[r],h=t[r]+"-R",(d=this.findComment(c))&&(this.subEditStrings[c]&&!s?(d.set("editTextInPopover",!0),p=this.subEditStrings[c]):this.subEditStrings[h]&&!s&&(d.set("showReplyInPopover",!0),p=this.subEditStrings[h]),d.set("hint",!_.isUndefined(s)&&s),!s&&this.hintmode&&(a&&0===this.uids.length&&(m=!1),this.oldUids.length&&0===_.difference(this.oldUids,t).length&&0===_.difference(t,this.oldUids).length&&(m=!1,this.oldUids=[])),this.animate&&(m=this.animate,this.animate=!1),this.isSelectedComment=!s||!this.hintmode,this.uids=_.clone(t),u.push(d),this._dontScrollToComment||this.view.commentsView.scrollToRecord(d),this._dontScrollToComment=!1);u.sort(function(t,e){return t.get("time")-e.get("time")}),this.popoverComments.reset(u),l.isVisible()&&l.hide(),l.setLeftTop(e,i,n),l.showComments(m,!1,!0,p)}this.isModeChanged=!1}},onApiHideComment:function(t){var e=this;if(this.getPopover()){if(this.isSelectedComment&&t)return;if(t&&this.getPopover().isCommentsViewMouseOver())return;this.popoverComments.each(function(t){t.get("editTextInPopover")&&(e.subEditStrings[t.get("uid")]=e.getPopover().getEditText()),t.get("showReplyInPopover")&&(e.subEditStrings[t.get("uid")+"-R"]=e.getPopover().getEditText())}),this.getPopover().saveText(!0),this.getPopover().hideComments(),this.collection.clearEditing(),this.popoverComments.clearEditing(),this.oldUids=_.clone(this.uids),this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset()}},onApiUpdateCommentPosition:function(t,e,i,n){var o,s=!1,a=null,l=void 0,r="",c="";if(this.getPopover())if(this.getPopover().saveText(),this.getPopover().hideTips(),i<0||this.getPopover().sdkBounds.height<i||!_.isUndefined(n)&&this.getPopover().sdkBounds.width<n)this.getPopover().hide();else{if(this.isModeChanged&&this.onApiShowComment(t,e,i,n),0===this.popoverComments.length){var h=[];for(o=0;o<t.length;++o)r=t[o],c=t[o]+"-R",(a=this.findComment(r))&&(this.subEditStrings[r]?(a.set("editTextInPopover",!0),l=this.subEditStrings[r]):this.subEditStrings[c]&&(a.set("showReplyInPopover",!0),l=this.subEditStrings[c]),h.push(a));h.sort(function(t,e){return t.get("time")-e.get("time")}),this.popoverComments.reset(h),s=!0,this.getPopover().showComments(s,void 0,void 0,l)}else this.getPopover().isVisible()||this.getPopover().showComments(!1,void 0,void 0,l);this.getPopover().setLeftTop(e,i,n,void 0,!0)}},onDocumentPlaceChanged:function(){if(this.isDummyComment&&this.getPopover()&&this.getPopover().isVisible()){var t=this.api.asc_getAnchorPosition();t&&this.getPopover().setLeftTop(t.asc_getX()+t.asc_getWidth(),t.asc_getY(),this.hintmode?t.asc_getX():void 0)}},updateComments:function(t,e,i){var n=this;n.updateCommentsTime=new Date,void 0===n.timerUpdateComments&&(n.timerUpdateComments=setInterval(function(){new Date-n.updateCommentsTime>100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=void 0,n.updateCommentsView(t,e,i))},25))},updateCommentsView:function(t,e,i){if(t&&!this.view.isVisible())return this.view.needRender=t,void this.onUpdateFilter(this.filter,!0);var n,o=!0;if(_.isUndefined(e)&&this.collection.sort(),t){for(this.onUpdateFilter(this.filter,!0),n=this.collection.length-1;n>=0;--n)o?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.needRender=!1}this.view.update(),i&&this.view.loadText()},findComment:function(t){return this.collection.findWhere({uid:t})},findPopupComment:function(t){return this.popoverComments.findWhere({id:t})},findCommentInGroup:function(t){for(var e in this.groupCollection){var i=this.groupCollection[e],n=i.findWhere({uid:t});if(n)return n}},closeEditing:function(t){if(!_.isUndefined(t)){var e=this.findPopupComment(t);e&&(e.set("editTextInPopover",!1),e.set("showReplyInPopover",!1)),this.subEditStrings[t]&&delete this.subEditStrings[t],this.subEditStrings[t+"-R"]&&delete this.subEditStrings[t+"-R"]}this.collection.clearEditing(),this.collection.each(function(t){var e=_.clone(t.get("replys"));t.get("replys").length=0,e.forEach(function(t){t.get("editText")&&t.set("editText",!1),t.get("editTextInPopover")&&t.set("editTextInPopover",!1)}),t.set("replys",e)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(t){t&&this.mode.canComments&&(t.set("hint",!1),this.api.asc_showComment(t.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(t){this.isSelectedComment=t,t&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return _.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({commentsStore:this.popoverComments,renderTo:this.sdkViewName,canRequestUsers:this.mode?this.mode.canRequestUsers:void 0,canRequestSendNotify:this.mode?this.mode.canRequestSendNotify:void 0}),this.popover.setCommentsStore(this.popoverComments)),this.popover},onUpdateUsers:function(){var t=this.userCollection,e=!1;for(var i in this.groupCollection)e=!0,this.groupCollection[i].each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")});!e&&this.collection.each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")})},readSDKComment:function(t,e){var i=e.asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getOnlyOfficeTime())):""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),n=this.userCollection.findOriginalUser(e.asc_getUserId()),o=t.substr(0,t.lastIndexOf("_")+1).match(/^(doc|sheet[0-9_]+)_/),s=new Common.Models.Comment({uid:t,guid:e.asc_getGuid(),userid:e.asc_getUserId(),username:e.asc_getUserName(),usercolor:n?n.get("color"):null,date:this.dateToLocaleTimeString(i),quote:e.asc_getQuoteText(),comment:e.asc_getText(),resolved:e.asc_getSolved(),unattached:!_.isUndefined(e.asc_getDocumentFlag)&&e.asc_getDocumentFlag(),id:Common.UI.getId(),time:i.getTime(),showReply:!1,editText:!1,last:void 0,editTextInPopover:!!this.editPopover,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?!!this.showPopover:this.hidereply,scope:this.view,editable:this.mode.canEditComments||e.asc_getUserId()==this.currentUserId,hint:!this.mode.canComments,groupName:o&&o.length>1?o[1]:null});if(s){var a=this.readSDKReplies(e);a.length&&s.set("replys",a)}return s},readSDKReplies:function(t){var e=0,i=[],n=null,o=t.asc_getRepliesCount();if(o)for(e=0;e<o;++e){n=t.asc_getReply(e).asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(t.asc_getReply(e).asc_getOnlyOfficeTime())):""==t.asc_getReply(e).asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(t.asc_getReply(e).asc_getTime()));var s=this.userCollection.findOriginalUser(t.asc_getReply(e).asc_getUserId());i.push(new Common.Models.Reply({id:Common.UI.getId(),userid:t.asc_getReply(e).asc_getUserId(),username:t.asc_getReply(e).asc_getUserName(),usercolor:s?s.get("color"):null,date:this.dateToLocaleTimeString(n),reply:t.asc_getReply(e).asc_getText(),time:n.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:this.view,editable:this.mode.canEditComments||t.asc_getReply(e).asc_getUserId()==this.currentUserId}))}return i},addDummyComment:function(){if(this.api){var t=this,e=null,i=new Date,n=this.getPopover();if(n){if(this.popoverComments.length){if(this.isDummyComment)return void _.delay(function(){n.commentsView.setFocusToTextBox()},200);this.closeEditing()}var o=this.userCollection.findOriginalUser(this.currentUserId),s=new Common.Models.Comment({id:-1,time:i.getTime(),date:this.dateToLocaleTimeString(i),userid:this.currentUserId,username:this.currentUserName,usercolor:o?o.get("color"):null,editTextInPopover:!0,showReplyInPopover:!1,hideAddReply:!0,scope:this.view,dummy:!0});this.popoverComments.reset(),this.popoverComments.push(s),this.uids=[],this.isSelectedComment=!0,this.isDummyComment=!0,_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||t.api.asc_SetDocumentPlaceChangedEnabled(!0),n.handlerHide=function(){},n.isVisible()&&n.hide(),n.handlerHide=function(e){t.clearDummyComment(e)},e=this.api.asc_getAnchorPosition(),e&&(n.setLeftTop(e.asc_getX()+e.asc_getWidth(),e.asc_getY(),this.hintmode?e.asc_getX():void 0),Common.NotificationCenter.trigger("comments:showdummy"),n.showComments(!0,!1,!0,n.getDummyText()))}}},onAddDummyComment:function(e){if(this.api&&e&&e.length>0){var i=t();i&&(this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hideComments(),this.isDummyComment=!1,i.asc_putText(e),i.asc_putTime(this.utcDateToString(new Date)),i.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),i.asc_putUserId(this.currentUserId),i.asc_putUserName(this.currentUserName),i.asc_putSolved(!1),_.isUndefined(i.asc_putDocumentFlag)||i.asc_putDocumentFlag(!1),this.api.asc_addComment(i),this.view.showEditContainer(!1),this.mode&&this.mode.canRequestUsers&&this.view.pickEMail(i.asc_getGuid(),e),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(t){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var e=this.getPopover();e&&(t&&e.clearDummyText(),e.saveDummyText(),e.handlerHide=function(){},e.isVisible()&&e.hideComments()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1),Common.NotificationCenter.trigger("comments:cleardummy")}},onEditComments:function(t){if(this.api){var e=0,i=this,n=null,o=this.api.asc_getAnchorPosition();if(o){for(this.isSelectedComment=!0,this.popoverComments.reset(),e=0;e<t.length;++e)(n=this.findComment(t[e].asc_getId()))&&(n.set("editTextInPopover",i.mode.canEditComments),n.set("hint",!1),this.popoverComments.push(n));this.getPopover()&&this.popoverComments.length>0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(o.asc_getX()+o.asc_getWidth(),o.asc_getY(),this.hintmode?o.asc_getX():void 0),this.getPopover().showComments(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var t=$(".new-comment-ct",this.view.el);t&&t.length&&"none"!==t.css("display")&&this.view.txtComment.focus(),this.view.needRender?this.updateComments(!0):this.view.needUpdateFilter&&this.onUpdateFilter(this.view.needUpdateFilter),this.view.update()}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:6e4*(new Date).getTimezoneOffset(),stringOOToLocalDate:function(t){return"string"==typeof t?parseInt(t):0},ooDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?t.getTime().toString():""},stringUtcToLocalDate:function(t){return"string"==typeof t?parseInt(t)+this.timeZoneOffsetInMs:0},utcDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?(t.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,t&&(this.prevcanComments=this.mode.canComments),this.mode.canComments=!t&&this.prevcanComments,this.closeEditing(),this.setMode(this.mode),this.updateComments(!0),this.getPopover()&&(t?this.getPopover().hide():this.getPopover().update(!0)))},clearCollections:function(){this.collection.reset(),this.groupCollection=[]}},Common.Controllers.Comments||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/User",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.User=e.Model.extend({defaults:function(){return{iid:Common.UI.getId(),id:void 0,idOriginal:void 0,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(t){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=t.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var t=0;return this.each(function(e){e.get("online")&&++t}),t},getEditingCount:function(){return this.filter(function(t){return t.get("online")&&!t.get("view")}).length},getEditingOriginalCount:function(){return this.chain().filter(function(t){return t.get("online")&&!t.get("view")}).groupBy(function(t){return t.get("idOriginal")}).size().value()},findUser:function(t){return this.find(function(e){return e.get("id")==t})},findOriginalUser:function(t){return this.find(function(e){return e.get("idOriginal")==t})}}),Common.Collections.HistoryUsers=t.Collection.extend({model:Common.Models.User,findUser:function(t){return this.find(function(e){return e.get("id")==t})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(t){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=t.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(t){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=t.Collection.extend({model:Common.Models.ChatMessage})}),define("common/main/lib/controller/Chat",["core","common/main/lib/collection/Users","common/main/lib/collection/ChatMessages","common/main/lib/view/Chat"],function(){"use strict";Common.Controllers.Chat=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Users","Common.Collections.ChatMessages"],views:["Common.Views.Chat"],initialize:function(){this.addListeners({"Common.Views.Chat":{"message:add":_.bind(this.onSendMessage,this)}});var t=this;Common.NotificationCenter.on("layout:changed",function(e){Common.Utils.asyncCall(function(e){"toolbar"!=e&&"status"!=e||!t.panelChat.$el.is(":visible")||(t.panelChat.updateLayout(!0),t.panelChat.setupAutoSizingTextBox())},this,e)})},events:{},onLaunch:function(){this.panelChat=this.createView("Common.Views.Chat",{storeUsers:this.getApplication().getCollection("Common.Collections.Users"),storeMessages:this.getApplication().getCollection("Common.Collections.ChatMessages")})},setMode:function(t){return this.mode=t,this.api&&(this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onReceiveMessage,this)),
|
|
|
this.mode.isEditDiagram||this.mode.isEditMailMerge||(this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onUsersChanged,this)),this.api.asc_registerCallback("asc_onConnectionStateChanged",_.bind(this.onUserConnection,this)),this.api.asc_coAuthoringGetUsers()),this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_coAuthoringChatGetMessages()),this},setApi:function(t){return this.api=t,this},onUsersChanged:function(t,e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var i=0;for(o in t)void 0!==o&&i++;if(i>1&&void 0==this._isCoAuthoringStopped)return this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),void Common.NotificationCenter.trigger("api:disconnect")}var n=this.getApplication().getCollection("Common.Collections.Users");if(n){var o,s,a=[];for(o in t)if(void 0!==o&&(s=t[o])){var l=new Common.Models.User({id:s.asc_getId(),idOriginal:s.asc_getIdOriginal(),username:s.asc_getUserName(),online:!0,color:s.asc_getColor(),view:s.asc_getView()});a[s.asc_getId()==e?"unshift":"push"](l)}n[n.size()>0?"add":"reset"](a)}},onUserConnection:function(t){var e=this.getApplication().getCollection("Common.Collections.Users");if(e){var i=e.findUser(t.asc_getId());i?i.set({online:t.asc_getState()}):e.add(new Common.Models.User({id:t.asc_getId(),idOriginal:t.asc_getIdOriginal(),username:t.asc_getUserName(),online:t.asc_getState(),color:t.asc_getColor(),view:t.asc_getView()}))}},onReceiveMessage:function(t,e){var i=this.getApplication().getCollection("Common.Collections.ChatMessages");if(i){var n=[];t.forEach(function(t){n.push(new Common.Models.ChatMessage({userid:t.useridoriginal,message:t.message,username:t.username}))}),i[i.size()<1||e?"reset":"add"](n)}},onSendMessage:function(t,e){if(e.length>0){var i=this;(function(t,e){for(var i=[];t;){if(t.length<e){i.push(t);break}i.push(t.substr(0,e)),t=t.substr(e)}return i})(e,2048).forEach(function(t){i.api.asc_coAuthoringChatSendMessage(t)})}},notcriticalErrorTitle:"Warning"},Common.Controllers.Chat||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Plugin",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.PluginVariation=e.Model.extend({defaults:function(){return{description:"",url:"",index:0,icons:void 0,isSystem:!1,isViewer:!1,isDisplayedInViewer:!0,EditorsSupport:["word","cell","slide"],isVisual:!1,isCustomWindow:!1,isModal:!1,isInsideMode:!1,initDataType:0,initData:"",isUpdateOleOnResize:!1,buttons:[],size:[800,600],initOnSelectionChanged:!1,visible:!0}}}),Common.Models.Plugin=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:"",baseUrl:"",guid:Common.UI.getId(),variations:[],currentVariation:0,pluginObj:void 0,allowSelected:!1,selected:!1,visible:!0,groupName:"",groupRank:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Plugins",["underscore","backbone","common/main/lib/model/Plugin"],function(t,e){"use strict";Common.Collections.Plugins=e.Collection.extend({model:Common.Models.Plugin,hasVisible:function(){return!!this.findWhere({visible:!0})}})}),define("common/main/lib/controller/Plugins",["core","common/main/lib/collection/Plugins","common/main/lib/view/Plugins"],function(){"use strict";Common.Controllers.Plugins=Backbone.Controller.extend(_.extend({models:[],appOptions:{},configPlugins:{autostart:[]},serverPlugins:{autostart:[]},collections:["Common.Collections.Plugins"],views:["Common.Views.Plugins"],initialize:function(){var t=this;this.addListeners({Toolbar:{"render:before":function(e){var i=t.getApplication().getController("Main").appOptions;if(!i.isEditMailMerge&&!i.isEditDiagram){var n={action:"plugins",caption:t.panelPlugins.groupCaption};t.$toolbarPanelPlugins=t.panelPlugins.getPanel(),e.addTab(n,t.$toolbarPanelPlugins,10)}}},"Common.Views.Plugins":{"plugin:select":function(e,i){t.api.asc_pluginRun(e,i,"")}}})},events:function(){return{"click #id-plugin-close":_.bind(this.onToolClose,this)}},onLaunch:function(){var t=this.getApplication().getCollection("Common.Collections.Plugins");this.panelPlugins=this.createView("Common.Views.Plugins",{storePlugins:t}),this.panelPlugins.on("render:after",_.bind(this.onAfterRender,this)),t.on({add:this.onAddPlugin.bind(this),reset:this.onResetPlugins.bind(this)}),this._moveOffset={x:0,y:0},this.autostart=[],Common.Gateway.on("init",this.loadConfig.bind(this)),Common.NotificationCenter.on("app:face",this.onAppShowed.bind(this))},loadConfig:function(t){var e=this;e.configPlugins.config=t.config.plugins,e.editor=window.DE?"word":window.PE?"slide":"cell"},loadPlugins:function(){this.configPlugins.config?this.getPlugins(this.configPlugins.config.pluginsData).then(function(e){t.configPlugins.plugins=e,t.mergePlugins()}).catch(function(e){t.configPlugins.plugins=!1}):this.configPlugins.plugins=!1;var t=this;Common.Utils.loadConfig("../../../../plugins.json",function(e){"error"!=e?(t.serverPlugins.config=e,t.getPlugins(t.serverPlugins.config.pluginsData).then(function(e){t.serverPlugins.plugins=e,t.mergePlugins()}).catch(function(e){t.serverPlugins.plugins=!1})):t.serverPlugins.plugins=!1})},onAppShowed:function(t){},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onPluginShow",_.bind(this.onPluginShow,this)),this.api.asc_registerCallback("asc_onPluginClose",_.bind(this.onPluginClose,this)),this.api.asc_registerCallback("asc_onPluginResize",_.bind(this.onPluginResize,this)),this.api.asc_registerCallback("asc_onPluginMouseUp",_.bind(this.onPluginMouseUp,this)),this.api.asc_registerCallback("asc_onPluginMouseMove",_.bind(this.onPluginMouseMove,this)),this.api.asc_registerCallback("asc_onPluginsReset",_.bind(this.resetPluginsList,this)),this.api.asc_registerCallback("asc_onPluginsInit",_.bind(this.onPluginsInit,this)),this.loadPlugins(),this},setMode:function(t){return this.appOptions=t,this.customPluginsComplete=!this.appOptions.canBrandingExt,this.appOptions.canBrandingExt&&this.getAppCustomPlugins(this.configPlugins),this},onAfterRender:function(t){t.viewPluginsList.on("item:click",_.bind(this.onSelectPlugin,this)),this.bindViewEvents(this.panelPlugins,this.events);var e=this;Common.NotificationCenter.on({"layout:resizestart":function(t){if(e.panelPlugins.isVisible()){var i=e.panelPlugins.currentPluginFrame.offset();e._moveOffset={x:i.left+parseInt(e.panelPlugins.currentPluginFrame.css("padding-left")),y:i.top+parseInt(e.panelPlugins.currentPluginFrame.css("padding-top"))},e.api.asc_pluginEnableMouseEvents(!0)}},"layout:resizestop":function(t){e.panelPlugins.isVisible()&&e.api.asc_pluginEnableMouseEvents(!1)}})},refreshPluginsList:function(){var t=this.getApplication().getCollection("Common.Collections.Plugins"),e=[];t.each(function(t){var i=new Asc.CPlugin;i.set_Name(t.get("name")),i.set_Guid(t.get("guid")),i.set_BaseUrl(t.get("baseUrl"));var n=t.get("variations"),o=[];n.forEach(function(t){var e=new Asc.CPluginVariation;e.set_Description(t.get("description")),e.set_Url(t.get("url")),e.set_Icons(t.get("icons")),e.set_Visual(t.get("isVisual")),e.set_CustomWindow(t.get("isCustomWindow")),e.set_System(t.get("isSystem")),e.set_Viewer(t.get("isViewer")),e.set_EditorsSupport(t.get("EditorsSupport")),e.set_Modal(t.get("isModal")),e.set_InsideMode(t.get("isInsideMode")),e.set_InitDataType(t.get("initDataType")),e.set_InitData(t.get("initData")),e.set_UpdateOleOnResize(t.get("isUpdateOleOnResize")),e.set_Buttons(t.get("buttons")),e.set_Size(t.get("size")),e.set_InitOnSelectionChanged(t.get("initOnSelectionChanged")),e.set_Events(t.get("events")),o.push(e)}),i.set_Variations(o),t.set("pluginObj",i),e.push(i)}),this.api.asc_pluginsRegister("",e),t.hasVisible()&&Common.NotificationCenter.trigger("tab:visible","plugins",!0)},onAddPlugin:function(t){var e=this;if(e.$toolbarPanelPlugins){var i=e.panelPlugins.createPluginButton(t);if(!i)return;var n=$("> .group",e.$toolbarPanelPlugins),o=$('<span class="slot"></span>').appendTo(n);i.render(o)}},onResetPlugins:function(t){var e=this;if(e.appOptions.canPlugins=!t.isEmpty(),e.$toolbarPanelPlugins){e.$toolbarPanelPlugins.empty();var i=$('<div class="group"></div>'),n=-1,o=0;t.each(function(t){var s=t.get("groupRank");s!==n&&n>-1&&o>0&&(i.appendTo(e.$toolbarPanelPlugins),$('<div class="separator long"></div>').appendTo(e.$toolbarPanelPlugins),i=$('<div class="group"></div>'),o=0);var a=e.panelPlugins.createPluginButton(t);if(a){var l=$('<span class="slot"></span>').appendTo(i);a.render(l),o++}n=s}),i.appendTo(e.$toolbarPanelPlugins)}else console.error("toolbar panel isnot created")},onSelectPlugin:function(t,e,i,n){var o=$(n.target);if(o&&o.hasClass("plugin-caret")){var s=this.panelPlugins.pluginMenu;if(s.isVisible())return void s.hide();var a,l=this,r=$(n.currentTarget),c=$(this.panelPlugins.el),h=r.offset(),d=c.offset();if(a=[h.left-d.left+r.width(),h.top-d.top+r.height()/2],void 0!=i){for(var p=0;p<s.items.length;p++)s.removeItem(s.items[p]),p--;s.removeAll();for(var m=i.get("variations"),p=0;p<m.length;p++){var u=m[p],g=new Common.UI.MenuItem({caption:p>0?u.get("description"):l.panelPlugins.textStart,value:parseInt(u.get("index"))}).on("click",function(t,e){l.api&&l.api.asc_pluginRun(i.get("guid"),t.value,"")});s.addItem(g)}}var b=c.find("#menu-plugin-container");s.rendered||(b.length<1&&(b=$('<div id="menu-plugin-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',s.id),c.append(b)),s.render(b),s.cmpEl.attr({tabindex:"-1"}),s.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),b.css({left:a[0],top:a[1]}),s.menuAlignEl=r,s.setOffset(-20,-r.height()/2-3),s.show(),_.delay(function(){s.cmpEl.focus()},10),n.stopPropagation(),n.preventDefault()}else this.api.asc_pluginRun(i.get("guid"),0,"")},onPluginShow:function(t,e,i,n){var o=t.get_Variations()[e];if(o.get_Visual()){var s=o.get_Url();if(s=(0==t.get_BaseUrl().length?s:t.get_BaseUrl())+s,n&&(s+=n),o.get_InsideMode())this.panelPlugins.openInsideMode(t.get_Name(),s,i)||this.api.asc_pluginButtonClick(-1);else{var a=this,l=o.get_CustomWindow(),r=o.get_Buttons(),c={},h=o.get_Size();(!h||h.length<2)&&(h=[800,600]),_.isArray(r)&&_.each(r,function(t,e){t.visible&&(c[e]={text:t.text,cls:"custom"+(t.primary?" primary":"")})}),a.pluginDlg=new Common.Views.PluginDlg({cls:l?"plain":"",header:!l,title:t.get_Name(),width:h[0],height:h[1],url:s,frameId:i,buttons:l?void 0:c,toolcallback:_.bind(this.onToolClose,this)}),a.pluginDlg.on({"render:after":function(t){t.getChild(".footer .dlg-btn").on("click",_.bind(a.onDlgBtnClick,a)),a.pluginContainer=a.pluginDlg.$window.find("#id-plugin-container")},close:function(t){a.pluginDlg=void 0},drag:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},resize:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])}}),a.pluginDlg.show()}}this.panelPlugins.openedPluginMode(t.get_Guid())},onPluginClose:function(t){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin&&this.panelPlugins.closeInsideMode(),this.panelPlugins.closedPluginMode(t.get_Guid()),this.runAutoStartPlugins()},onPluginResize:function(t,e,i,n){if(this.pluginDlg){var o=e&&e.length>1&&i&&i.length>1&&(i[0]>e[0]||i[1]>e[1]||0==i[0]||0==i[1]);this.pluginDlg.setResizable(o,e,i),this.pluginDlg.setInnerSize(t[0],t[1]),n&&n.call()}},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.api.asc_pluginButtonClick(parseInt(e))},onToolClose:function(){this.api.asc_pluginButtonClick(-1)},onPluginMouseUp:function(t,e){this.pluginDlg?(this.pluginDlg.binding.dragStop&&this.pluginDlg.binding.dragStop(),this.pluginDlg.binding.resizeStop&&this.pluginDlg.binding.resizeStop()):Common.NotificationCenter.trigger("frame:mouseup",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginMouseMove:function(t,e){if(this.pluginDlg){var i=this.pluginContainer.offset();this.pluginDlg.binding.drag&&this.pluginDlg.binding.drag({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top}),this.pluginDlg.binding.resize&&this.pluginDlg.binding.resize({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top})}else Common.NotificationCenter.trigger("frame:mousemove",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginsInit:function(t){!(t instanceof Array)&&(t=t.pluginsData),this.parsePlugins(t)},runAutoStartPlugins:function(){this.autostart&&this.autostart.length>0&&this.api.asc_pluginRun(this.autostart.shift(),0,"")},resetPluginsList:function(){this.getApplication().getCollection("Common.Collections.Plugins").reset()},applyUICustomization:function(){var me=this;return new Promise(function(resolve,reject){var timer_sl=setInterval(function(){if(me.customPluginsComplete){clearInterval(timer_sl);try{me.configPlugins.UIplugins&&me.configPlugins.UIplugins.forEach(function(c){c.code&&eval(c.code)})}catch(t){}resolve()}},10)})},parsePlugins:function(t,e){var i=this,n=this.getApplication().getCollection("Common.Collections.Plugins"),o=i.appOptions.isEdit,s=i.editor;if(t instanceof Array){var a=[],l=[],r=i.appOptions.lang.split(/[\-_]/)[0];t.forEach(function(t){if(!(a.some(function(e){return e.get("baseUrl")==t.baseUrl||e.get("guid")==t.guid})||n.findWhere({baseUrl:t.baseUrl})||n.findWhere({guid:t.guid}))){var e=[],i=!1;if(t.variations.forEach(function(n){var a=(o||n.isViewer&&!1!==n.isDisplayedInViewer)&&_.contains(n.EditorsSupport,s)&&!n.isSystem;if(a&&(i=!0),t.isUICustomizer)a&&l.push({url:t.baseUrl+n.url});else{var c=new Common.Models.PluginVariation(n),h=n.description;"object"==typeof n.descriptionLocale&&(h=n.descriptionLocale[r]||n.descriptionLocale.en||h||""),_.each(n.buttons,function(t,e){"object"==typeof t.textLocale&&(t.text=t.textLocale[r]||t.textLocale.en||t.text||""),t.visible=o||!1!==t.isViewer}),c.set({description:h,index:e.length,url:n.url,icons:n.icons,buttons:n.buttons,visible:a}),e.push(c)}}),e.length>0&&!t.isUICustomizer){var c=t.name;"object"==typeof t.nameLocale&&(c=t.nameLocale[r]||t.nameLocale.en||c||""),a.push(new Common.Models.Plugin({name:c,guid:t.guid,baseUrl:t.baseUrl,variations:e,currentVariation:0,visible:i,groupName:t.group?t.group.name:"",groupRank:t.group?t.group.rank:0}))}}}),!1!==e&&(i.configPlugins.UIplugins=l),!e&&n&&(a=n.models.concat(a),a.sort(function(t,e){var i=t.get("groupRank"),n=e.get("groupRank");return i<n?0==i?1:-1:i>n?0==n?-1:1:0}),n.reset(a),this.appOptions.canPlugins=!n.isEmpty())}else e||(this.appOptions.canPlugins=!1);e||this.getApplication().getController("LeftMenu").enablePlugins(),this.appOptions.canPlugins&&(this.refreshPluginsList(),this.runAutoStartPlugins())},getPlugins:function(t,e){if(!t||t.length<1)return Promise.resolve([]);e=e||function(t){return fetch(t).then(function(e){return e.ok?e.json():Promise.reject(t)}).then(function(e){return e.baseUrl=t.substring(0,t.lastIndexOf("config.json")),e})};var i=[];return t.map(e).reduce(function(t,e){return t.then(function(){return e}).then(function(t){return i.push(t),Promise.resolve(t)}).catch(function(t){return Promise.resolve(t)})},Promise.resolve()).then(function(){return Promise.resolve(i)})},mergePlugins:function(){if(void 0!==this.serverPlugins.plugins&&void 0!==this.configPlugins.plugins){var t=[],e=[],i=this.configPlugins,n=!1;if(i.plugins&&i.plugins.length>0){e=i.plugins;var o=i.config.autostart||i.config.autoStartGuid;"string"==typeof o&&(o=[o]),n=!!i.config.autoStartGuid,t=o||[]}if(i=this.serverPlugins,i.plugins&&i.plugins.length>0){e=e.concat(i.plugins);var o=i.config.autostart||i.config.autoStartGuid;"string"==typeof o&&(o=[o]),(n||i.config.autoStartGuid)&&console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration."),t=t.concat(o||[])}this.autostart=t,this.parsePlugins(e,!1)}},getAppCustomPlugins:function(t){var e=this,i=function(){e.customPluginsComplete=!0};t.config?this.getPlugins(t.config.UIpluginsData).then(function(n){e.parsePlugins(n,!0),e.getPlugins(t.UIplugins,function(t){return fetch(t.url).then(function(t){return t.ok?t.text():Promise.reject()}).then(function(e){return t.code=e,e})}).then(i,i)},i):i()}},Common.Controllers.Plugins||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/ReviewChange",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.ReviewChange=e.Model.extend({defaults:{uid:0,userid:0,username:"Guest",usercolor:null,date:void 0,changetext:"",lock:!1,lockuser:"",type:0,changedata:null,hint:!1,editable:!1,id:Common.UI.getId(),scope:null}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/ReviewChanges",["underscore","backbone","common/main/lib/model/ReviewChange"],function(t,e){"use strict";Common.Collections.ReviewChanges=e.Collection.extend({model:Common.Models.ReviewChange})}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewChanges",["common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(){"use strict";Common.Views.ReviewChanges=Common.UI.BaseView.extend(_.extend(function(){function t(t,e){this.appConfig.canReview&&(Common.NotificationCenter.trigger("reviewchanges:turn",t.pressed?"on":"off"),Common.NotificationCenter.trigger("edit:complete"))}function e(){var e=this;e.appConfig.canReview&&(this.btnAccept.on("click",function(t){e.fireEvent("reviewchange:accept",[e.btnAccept,"current"])}),this.btnAccept.menu.on("item:click",function(t,i,n){e.fireEvent("reviewchange:accept",[t,i])}),this.btnReject.on("click",function(t){e.fireEvent("reviewchange:reject",[e.btnReject,"current"])}),this.btnReject.menu.on("item:click",function(t,i,n){e.fireEvent("reviewchange:reject",[t,i])}),this.btnsTurnReview.forEach(function(i){i.on("click",t.bind(e))})),this.appConfig.canViewReview&&(this.btnPrev.on("click",function(t){e.fireEvent("reviewchange:preview",[e.btnPrev,"prev"])}),this.btnNext.on("click",function(t){e.fireEvent("reviewchange:preview",[e.btnNext,"next"])}),this.btnReviewView&&this.btnReviewView.menu.on("item:click",function(t,i,n){e.fireEvent("reviewchanges:view",[t,i])})),this.btnsSpelling.forEach(function(t){t.on("click",function(t,i){Common.NotificationCenter.trigger("spelling:turn",t.pressed?"on":"off"),Common.NotificationCenter.trigger("edit:complete",e)})}),this.btnsDocLang.forEach(function(t){t.on("click",function(t,i){e.fireEvent("lang:document",this)})}),this.btnSharing&&this.btnSharing.on("click",function(t,e){Common.NotificationCenter.trigger("collaboration:sharing")}),this.btnCoAuthMode&&this.btnCoAuthMode.menu.on("item:click",function(t,i,n){e.fireEvent("collaboration:coauthmode",[t,i])}),this.btnHistory&&this.btnHistory.on("click",function(t,e){Common.NotificationCenter.trigger("collaboration:history")}),this.btnChat&&this.btnChat.on("click",function(t,i){e.fireEvent("collaboration:chat",[t.pressed])})}return{options:{},initialize:function(t){if(Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.appConfig.canReview&&(this.btnAccept=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",caption:this.txtAccept,split:!0,iconCls:"review-save"}),this.btnReject=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",caption:this.txtReject,split:!0,iconCls:"review-deny"}),this.btnTurnOn=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-review",caption:this.txtTurnon,enableToggle:!0}),this.btnsTurnReview=[this.btnTurnOn]),this.appConfig.canViewReview&&(this.btnPrev=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"review-prev",caption:this.txtPrev}),this.btnNext=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"review-next",caption:this.txtNext}),!this.appConfig.isRestrictedEdit)){var e=_.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div><% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label><% } %></a>');this.btnReviewView=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-reviewview",caption:this.txtView,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.txtMarkupCap,checkable:!0,toggleGroup:"menuReviewView",checked:!0,value:"markup",template:e,description:this.txtMarkup},{caption:this.txtFinalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtFinal,value:"final"},{caption:this.txtOriginalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtOriginal,value:"original"}]})})}this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length&&!0!==this._readonlyRights&&(this.btnSharing=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-sharing",caption:this.txtSharing})),this.appConfig.isEdit&&!this.appConfig.isOffline&&this.appConfig.canCoAuthoring&&(this.btnCoAuthMode=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-coedit",caption:this.txtCoAuthMode,menu:!0})),this.btnsSpelling=[],this.btnsDocLang=[],this.appConfig.canUseHistory&&!this.appConfig.isDisconnected&&(this.btnHistory=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-history",caption:this.txtHistory})),this.appConfig.canCoAuthoring&&this.appConfig.canChat&&(this.btnChat=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-chat",caption:this.txtChat,enableToggle:!0}));var i=Common.localStorage.getKeysFilter();this.appPrefix=i&&i.length?i.split(",")[0]:"",Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(t){var i=this;new Promise(function(t,e){t()}).then(function(){var n=_.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div><% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label><% } %></a>');if(t.canReview&&(i.btnTurnOn.updateHint(i.tipReview),i.btnAccept.setMenu(new Common.UI.Menu({items:[{caption:i.txtAcceptCurrent,value:"current"},{caption:i.txtAcceptAll,value:"all"}]})),i.btnAccept.updateHint([i.tipAcceptCurrent,i.txtAcceptChanges]),i.btnReject.setMenu(new Common.UI.Menu({items:[{caption:i.txtRejectCurrent,value:"current"},{caption:i.txtRejectAll,value:"all"}]})),i.btnReject.updateHint([i.tipRejectCurrent,i.txtRejectChanges]),i.btnAccept.setDisabled(t.isReviewOnly),i.btnReject.setDisabled(t.isReviewOnly)),i.appConfig.canViewReview&&(i.btnPrev.updateHint(i.hintPrev),i.btnNext.updateHint(i.hintNext),i.btnReviewView&&i.btnReviewView.updateHint(i.tipReviewView)),i.btnSharing&&i.btnSharing.updateHint(i.tipSharing),i.btnHistory&&i.btnHistory.updateHint(i.tipHistory),i.btnChat&&i.btnChat.updateHint(i.txtChat+Common.Utils.String.platformKey("Alt+Q")),i.btnCoAuthMode){i.btnCoAuthMode.setMenu(new Common.UI.Menu({cls:"ppm-toolbar",style:"max-width: 220px;",items:[{caption:i.strFast,checkable:!0,toggleGroup:"menuCoauthMode",checked:!0,template:n,description:i.strFastDesc,value:1},{caption:i.strStrict,checkable:!0,toggleGroup:"menuCoauthMode",checked:!1,template:n,description:i.strStrictDesc,value:0}]})),i.btnCoAuthMode.updateHint(i.tipCoAuthMode);var o=Common.localStorage.getItem(i.appPrefix+"settings-coauthmode");null===o&&!Common.localStorage.itemExists(i.appPrefix+"settings-autosave")&&t.customization&&!1===t.customization.autosave&&(o=0),i.turnCoAuthMode((null===o||1==parseInt(o))&&!(t.isDesktopApp&&t.isOffline)&&t.canCoAuthoring)}var s,a=i.btnSharing||i.btnCoAuthMode?".separator.sharing":i.$el.find(".separator.sharing"),l=t.canComments&&t.canCoAuthoring?".separator.comments":i.$el.find(".separator.comments"),r=t.canReview||t.canViewReview?".separator.review":i.$el.find(".separator.review"),c=i.btnChat?".separator.chat":i.$el.find(".separator.chat");"object"==typeof a?a.hide().prev(".group").hide():s=a,"object"==typeof l?l.hide().prev(".group").hide():s=l,"object"==typeof r?r.hide().prevUntil(".separator.comments").hide():s=r,"object"==typeof c?c.hide().prev(".group").hide():s=c,!i.btnHistory&&s&&i.$el.find(s).hide(),Common.NotificationCenter.trigger("tab:visible","review",t.isEdit||t.canViewReview),e.call(i)})},getPanel:function(){return this.$el=$(_.template('<section id="review-changes-panel" class="panel" data-tab="review"><div class="group no-group-mask"><span id="slot-btn-sharing" class="btn-slot text x-huge"></span><span id="slot-btn-coauthmode" class="btn-slot text x-huge"></span></div><div class="separator long sharing"/><div class="group"><span class="btn-slot text x-huge slot-comment"></span></div><div class="separator long comments"/><div class="group"><span id="btn-review-on" class="btn-slot text x-huge"></span></div><div class="group no-group-mask" style="padding-left: 0;"><span id="btn-review-view" class="btn-slot text x-huge"></span></div><div class="group move-changes" style="padding-left: 0;"><span id="btn-change-prev" class="btn-slot text x-huge"></span><span id="btn-change-next" class="btn-slot text x-huge"></span><span id="btn-change-accept" class="btn-slot text x-huge"></span><span id="btn-change-reject" class="btn-slot text x-huge"></span></div><div class="separator long review"/><div class="group no-group-mask"><span id="slot-btn-chat" class="btn-slot text x-huge"></span></div><div class="separator long chat"/><div class="group no-group-mask"><span id="slot-btn-history" class="btn-slot text x-huge"></span></div></section>')({})),this.appConfig.canReview&&(this.btnAccept.render(this.$el.find("#btn-change-accept")),this.btnReject.render(this.$el.find("#btn-change-reject")),this.btnTurnOn.render(this.$el.find("#btn-review-on"))),this.btnPrev&&this.btnPrev.render(this.$el.find("#btn-change-prev")),this.btnNext&&this.btnNext.render(this.$el.find("#btn-change-next")),this.btnReviewView&&this.btnReviewView.render(this.$el.find("#btn-review-view")),this.btnSharing&&this.btnSharing.render(this.$el.find("#slot-btn-sharing")),this.btnCoAuthMode&&this.btnCoAuthMode.render(this.$el.find("#slot-btn-coauthmode")),this.btnHistory&&this.btnHistory.render(this.$el.find("#slot-btn-history")),this.btnChat&&this.btnChat.render(this.$el.find("#slot-btn-chat")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){if("turn"==t&&"statusbar"==e){var i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-ic-review",hintAnchor:"top",hint:this.tipReview,enableToggle:!0});return this.btnsTurnReview.push(i),i}return"spelling"==t?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-ic-docspell",hintAnchor:"top",hint:this.tipSetSpelling,enableToggle:!0}),this.btnsSpelling.push(i),i):"doclang"==t&&"statusbar"==e?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-ic-doclang",hintAnchor:"top",hint:this.tipSetDocLang,disabled:!0}),this.btnsDocLang.push(i),i):void 0},getUserName:function(t){return Common.Utils.String.htmlEncode(t)},turnChanges:function(t){this.btnsTurnReview.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},markChanges:function(t){this.btnsTurnReview.forEach(function(e){if(e){$(".icon",e.cmpEl)[t?"addClass":"removeClass"]("btn-ic-changes")}},this)},turnSpelling:function(t){this.btnsSpelling.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},turnCoAuthMode:function(t){this.btnCoAuthMode&&(this.btnCoAuthMode.menu.items[0].setChecked(t,!0),this.btnCoAuthMode.menu.items[1].setChecked(!t,!0))},turnChat:function(t){this.btnChat&&this.btnChat.toggle(t,!0)},turnDisplayMode:function(t){this.btnReviewView&&(this.btnReviewView.menu.items[0].setChecked("markup"==t,!0),this.btnReviewView.menu.items[1].setChecked("final"==t,!0),this.btnReviewView.menu.items[2].setChecked("original"==t,!0))},SetDisabled:function(t,e){this.btnsSpelling&&this.btnsSpelling.forEach(function(e){e&&e.setDisabled(t)},this),this.btnsDocLang&&this.btnsDocLang.forEach(function(i){i&&i.setDisabled(t||e&&e.length<1)},this),this.btnsTurnReview&&this.btnsTurnReview.forEach(function(e){e&&e.setDisabled(t)},this),this.btnChat&&this.btnChat.setDisabled(t)},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this.btnSharing&&this.btnSharing.setDisabled(!0)},txtAccept:"Accept",txtAcceptCurrent:"Accept current Changes",txtAcceptAll:"Accept all Changes",txtReject:"Reject",txtRejectCurrent:"Reject current Changes",txtRejectAll:"Reject all Changes",hintNext:"To Next Change",hintPrev:"To Previous Change",txtPrev:"Previous",txtNext:"Next",txtTurnon:"Turn On",txtSpelling:"Spell checking",txtDocLang:"Language",tipSetDocLang:"Set Document Language",tipSetSpelling:"Spell checking",tipReview:"Review",txtAcceptChanges:"Accept Changes",txtRejectChanges:"Reject Changes",txtView:"Display Mode",txtMarkup:"Text with changes (Editing)",txtFinal:"All changes like accept (Preview)",txtOriginal:"Text without changes (Preview)",tipReviewView:"Select the way you want the changes to be displayed",tipAcceptCurrent:"Accept current changes",tipRejectCurrent:"Reject current changes",txtSharing:"Sharing",tipSharing:"Manage document access rights",txtCoAuthMode:"Co-editing Mode",tipCoAuthMode:"Set co-editing mode",strFast:"Fast",strStrict:"Strict",txtHistory:"Version History",tipHistory:"Show version history",txtChat:"Chat",txtMarkupCap:"Markup",txtFinalCap:"Final",txtOriginalCap:"Original",strFastDesc:"Real-time co-editing. All changes are saved automatically.",strStrictDesc:"Use the 'Save' button to sync the changes you and others make."}}(),Common.Views.ReviewChanges||{})),Common.Views.ReviewChangesDialog=Common.UI.Window.extend(_.extend({options:{width:330,height:90,title:"Review Changes",modal:!1,cls:"review-changes modal-dlg",alias:"Common.Views.ReviewChangesDialog"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box">','<div class="input-row">','<div id="id-review-button-prev" style=""></div>','<div id="id-review-button-next" style=""></div>','<div id="id-review-button-accept" style=""></div>','<div id="id-review-button-reject" style="margin-right: 0;"></div>',"</div>","</div>"].join(""),this.options.tpl=_.template(this.template)(this.options),this.popoverChanges=this.options.popoverChanges,this.mode=this.options.mode,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnPrev=new Common.UI.Button({cls:"dlg-btn iconic",iconCls:"img-commonctrl prev",hint:this.txtPrev,hintAnchor:"top"}),this.btnPrev.render(this.$window.find("#id-review-button-prev")),this.btnNext=new Common.UI.Button({cls:" dlg-btn iconic",iconCls:"img-commonctrl next",hint:this.txtNext,hintAnchor:"top"}),this.btnNext.render(this.$window.find("#id-review-button-next")),this.btnAccept=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtAccept,split:!0,disabled:this.mode.isReviewOnly,menu:new Common.UI.Menu({items:[this.mnuAcceptCurrent=new Common.UI.MenuItem({caption:this.txtAcceptCurrent,value:"current"}),this.mnuAcceptAll=new Common.UI.MenuItem({caption:this.txtAcceptAll,value:"all"})]})}),this.btnAccept.render(this.$window.find("#id-review-button-accept")),this.btnReject=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtReject,split:!0,disabled:this.mode.isReviewOnly,menu:new Common.UI.Menu({items:[this.mnuRejectCurrent=new Common.UI.MenuItem({caption:this.txtRejectCurrent,value:"current"}),this.mnuRejectAll=new Common.UI.MenuItem({caption:this.txtRejectAll,value:"all"})]})}),this.btnReject.render(this.$window.find("#id-review-button-reject"))
|
|
|
;var t=this;return this.btnPrev.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnPrev,"prev"])}),this.btnNext.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnNext,"next"])}),this.btnAccept.on("click",function(e){t.fireEvent("reviewchange:accept",[t.btnAccept,"current"])}),this.btnAccept.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:accept",[e,i])}),this.btnReject.on("click",function(e){t.fireEvent("reviewchange:reject",[t.btnReject,"current"])}),this.btnReject.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:reject",[e,i])}),this},textTitle:"Review Changes",txtPrev:"To previous change",txtNext:"To next change",txtAccept:"Accept",txtAcceptCurrent:"Accept Current Change",txtAcceptAll:"Accept All Changes",txtReject:"Reject",txtRejectCurrent:"Reject Current Change",txtRejectAll:"Reject All Changes"},Common.Views.ReviewChangesDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/LanguageDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.LanguageDialog=Common.UI.Window.extend(_.extend({options:{header:!1,width:350,cls:"modal-dlg"},template:'<div class="box"><div class="input-row"><label><%= label %></label></div><div class="input-row" id="id-document-language"></div></div><div class="footer right"><button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button><button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button></div>',initialize:function(t){_.extend(this.options,t||{},{label:this.labelSelect,btns:{ok:this.btnOk,cancel:this.btnCancel}}),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.cmbLanguage=new Common.UI.ComboBox({el:t.find("#id-document-language"),cls:"input-group-nr",menuStyle:"min-width: 318px; max-height: 285px;",editable:!1,template:_.template(['<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control">','<span class="icon input-icon spellcheck-lang img-toolbarmenu"></span>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>">','<a tabindex="-1" type="menuitem" style="padding-left: 28px !important;" langval="<%= item.value %>">','<i class="icon <% if (item.spellcheck) { %> img-toolbarmenu spellcheck-lang <% } %>"></i>',"<%= scope.getDisplayValue(item) %>","</a>","</li>","<% }); %>","</ul>","</span>"].join("")),data:this.options.languages,search:!0}),this.cmbLanguage.scroller&&this.cmbLanguage.scroller.update({alwaysVisibleY:!0}),this.cmbLanguage.on("selected",_.bind(this.onLangSelect,this));var e=Common.util.LanguageInfo.getLocalLanguageName(this.options.current);this.cmbLanguage.setValue(e[0],e[1]),this.onLangSelect(this.cmbLanguage,this.cmbLanguage.getSelectedRecord())},close:function(t){this.getChild().find(".combobox.open").length||Common.UI.Window.prototype.close.call(this,arguments)},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,this.cmbLanguage.getValue()),this.close()},onLangSelect:function(t,e,i){t.$el.find(".input-icon").toggleClass("spellcheck-lang",e&&e.spellcheck),t._input.css("padding-left",e&&e.spellcheck?25:3)},onPrimary:function(){return this.options.handler&&this.options.handler.call(this,"ok",this.cmbLanguage.getValue()),this.close(),!1},labelSelect:"Select document language",btnCancel:"Cancel",btnOk:"Ok"},Common.Views.LanguageDialog||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ReviewChanges",["core","common/main/lib/model/ReviewChange","common/main/lib/collection/ReviewChanges","common/main/lib/view/ReviewChanges","common/main/lib/view/ReviewPopover","common/main/lib/view/LanguageDialog"],function(){"use strict";Common.Controllers.ReviewChanges=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.ReviewChanges"],views:["Common.Views.ReviewChanges","Common.Views.ReviewPopover"],sdkViewName:"#id_main",initialize:function(){this.addListeners({FileMenu:{"settings:apply":this.applySettings.bind(this)},"Common.Views.ReviewChanges":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this),"reviewchanges:view":_.bind(this.onReviewViewClick,this),"lang:document":_.bind(this.onDocLanguage,this),"collaboration:coauthmode":_.bind(this.onCoAuthMode,this)},"Common.Views.ReviewChangesDialog":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this)},"Common.Views.ReviewPopover":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:goto":_.bind(this.onGotoClick,this)}})},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.ReviewChanges"),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this._state={posx:-1e3,posy:-1e3,popoverVisible:!1,previewMode:!1},Common.NotificationCenter.on("reviewchanges:turn",this.onTurnPreview.bind(this)),Common.NotificationCenter.on("spelling:turn",this.onTurnSpelling.bind(this)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this))},setConfig:function(t,e){this.setApi(e),t&&(this.currentUserId=t.config.user.id,this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,(this.appConfig.canReview||this.appConfig.canViewReview)&&(this.api.asc_registerCallback("asc_onShowRevisionsChange",_.bind(this.onApiShowChange,this)),this.api.asc_registerCallback("asc_onUpdateRevisionsChangesPosition",_.bind(this.onApiUpdateChangePosition,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)))},setMode:function(t){return this.appConfig=t,this.popoverChanges=new Common.Collections.ReviewChanges,this.view=this.createView("Common.Views.ReviewChanges",{mode:t}),this},SetDisabled:function(t){this.dlgChanges&&this.dlgChanges.close(),this.view&&this.view.SetDisabled(t,this.langs),this.setPreviewMode(t)},setPreviewMode:function(t){if(this.viewmode!==t){this.viewmode=t,t&&(this.prevcanReview=this.appConfig.canReview),this.appConfig.canReview=!t&&this.prevcanReview;var e=this;this.popoverChanges&&this.popoverChanges.each(function(t){t.set("hint",!e.appConfig.canReview)})}},onApiShowChange:function(t){if(this.getPopover())if(t&&t.length>0){var e=this.readSDKChange(t),i=t[0].get_X(),n=t[0].get_Y(),o=Math.abs(this._state.posx-i)>.001||Math.abs(this._state.posy-n)>.001||t.length!==this._state.changes_length,s=null!==t[0].get_LockUserId(),a=this.getUserName(t[0].get_LockUserId());this.getPopover().hideTips(),this.popoverChanges.reset(e),o&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i,n)),this.getPopover().showReview(o,s,a),this.appConfig.canReview&&!this.appConfig.isReviewOnly&&this._state.lock!==s&&(this.view.btnAccept.setDisabled(1==s),this.view.btnReject.setDisabled(1==s),this.dlgChanges&&(this.dlgChanges.btnAccept.setDisabled(1==s),this.dlgChanges.btnReject.setDisabled(1==s)),this._state.lock=s),this._state.posx=i,this._state.posy=n,this._state.changes_length=t.length,this._state.popoverVisible=!0}else this._state.popoverVisible&&(this._state.posx=this._state.posy=-1e3,this._state.changes_length=0,this._state.popoverVisible=!1,this.getPopover().hideTips(),this.popoverChanges.reset(),this.getPopover().hideReview())},onApiUpdateChangePosition:function(t,e){this.getPopover()&&(e<0||this.getPopover().sdkBounds.height<e?this.getPopover().hide():this.popoverChanges.length>0&&(this.getPopover().isVisible()||this.getPopover().show(!1),this.getPopover().setLeftTop(t,e)))},findChange:function(t,e){return _.isUndefined(t)?this.collection.findWhere({id:e}):this.collection.findWhere({uid:t})},getPopover:function(){return(this.appConfig.canReview||this.appConfig.canViewReview)&&_.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({reviewStore:this.popoverChanges,renderTo:this.sdkViewName}),this.popover.setReviewStore(this.popoverChanges)),this.popover},readSDKChange:function(t){var e=this,i=[];return _.each(t,function(t){var n="",o="",s=t.get_Value(),a=t.get_MoveType();switch(t.get_Type()){case Asc.c_oAscRevisionsChangeType.TextAdd:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textInserted:e.textParaMoveTo,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.TextRem:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textDeleted:t.is_MovedDown()?e.textParaMoveFromDown:e.textParaMoveFromUp,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.ParaAdd:n=e.textParaInserted;break;case Asc.c_oAscRevisionsChangeType.ParaRem:n=e.textParaDeleted;break;case Asc.c_oAscRevisionsChangeType.TextPr:n="<b>"+e.textFormatted,void 0!==s.Get_Bold()&&(o+=(s.Get_Bold()?"":e.textNot)+e.textBold+", "),void 0!==s.Get_Italic()&&(o+=(s.Get_Italic()?"":e.textNot)+e.textItalic+", "),void 0!==s.Get_Underline()&&(o+=(s.Get_Underline()?"":e.textNot)+e.textUnderline+", "),void 0!==s.Get_Strikeout()&&(o+=(s.Get_Strikeout()?"":e.textNot)+e.textStrikeout+", "),void 0!==s.Get_DStrikeout()&&(o+=(s.Get_DStrikeout()?"":e.textNot)+e.textDStrikeout+", "),void 0!==s.Get_Caps()&&(o+=(s.Get_Caps()?"":e.textNot)+e.textCaps+", "),void 0!==s.Get_SmallCaps()&&(o+=(s.Get_SmallCaps()?"":e.textNot)+e.textSmallCaps+", "),void 0!==s.Get_VertAlign()&&(o+=(1==s.Get_VertAlign()?e.textSuperScript:2==s.Get_VertAlign()?e.textSubScript:e.textBaseline)+", "),void 0!==s.Get_Color()&&(o+=e.textColor+", "),void 0!==s.Get_Highlight()&&(o+=e.textHighlight+", "),void 0!==s.Get_Shd()&&(o+=e.textShd+", "),void 0!==s.Get_FontFamily()&&(o+=s.Get_FontFamily()+", "),void 0!==s.Get_FontSize()&&(o+=s.Get_FontSize()+", "),void 0!==s.Get_Spacing()&&(o+=e.textSpacing+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Spacing()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Position()&&(o+=e.textPosition+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Position()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Lang()&&(o+=Common.util.LanguageInfo.getLocalLanguageName(s.Get_Lang())[1]+", "),_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="</b>",n+=o;break;case Asc.c_oAscRevisionsChangeType.ParaPr:if(n="<b>"+e.textParaFormatted,s.Get_ContextualSpacing()&&(o+=(s.Get_ContextualSpacing()?e.textContextual:e.textNoContextual)+", "),void 0!==s.Get_IndLeft()&&(o+=e.textIndentLeft+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndLeft()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndRight()&&(o+=e.textIndentRight+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndRight()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndFirstLine()&&(o+=e.textFirstLine+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndFirstLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Jc())switch(s.Get_Jc()){case 0:o+=e.textRight+", ";break;case 1:o+=e.textLeft+", ";break;case 2:o+=e.textCenter+", ";break;case 3:o+=e.textJustify+", "}if(void 0!==s.Get_KeepLines()&&(o+=(s.Get_KeepLines()?e.textKeepLines:e.textNoKeepLines)+", "),s.Get_KeepNext()&&(o+=(s.Get_KeepNext()?e.textKeepNext:e.textNoKeepNext)+", "),s.Get_PageBreakBefore()&&(o+=(s.Get_PageBreakBefore()?e.textBreakBefore:e.textNoBreakBefore)+", "),void 0!==s.Get_SpacingLineRule()&&void 0!==s.Get_SpacingLine()&&(o+=e.textLineSpacing,o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_LEAST?e.textAtLeast:s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?e.textMultiple:e.textExact)+" ",o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?s.Get_SpacingLine():Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName())+", "),s.Get_SpacingBeforeAutoSpacing()?o+=e.textSpacingBefore+" "+e.textAuto+", ":void 0!==s.Get_SpacingBefore()&&(o+=e.textSpacingBefore+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingBefore()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_SpacingAfterAutoSpacing()?o+=e.textSpacingAfter+" "+e.textAuto+", ":void 0!==s.Get_SpacingAfter()&&(o+=e.textSpacingAfter+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingAfter()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_WidowControl()&&(o+=(s.Get_WidowControl()?e.textWidow:e.textNoWidow)+", "),void 0!==s.Get_Tabs()&&(o+=o+=e.textTabs+", "),void 0!==s.Get_NumPr()&&(o+=o+=e.textNum+", "),void 0!==s.Get_PStyle()){var l=e.api.asc_GetStyleNameById(s.Get_PStyle());_.isEmpty(l)||(o+=l+", ")}_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="</b>",n+=o;break;case Asc.c_oAscRevisionsChangeType.TablePr:n=e.textTableChanged;break;case Asc.c_oAscRevisionsChangeType.RowsAdd:n=e.textTableRowsAdd;break;case Asc.c_oAscRevisionsChangeType.RowsRem:n=e.textTableRowsDel}var r=""==t.get_DateTime()?new Date:new Date(t.get_DateTime()),c=e.userCollection.findOriginalUser(t.get_UserId()),h=new Common.Models.ReviewChange({uid:Common.UI.getId(),userid:t.get_UserId(),username:t.get_UserName(),usercolor:c?c.get("color"):null,date:e.dateToLocaleTimeString(r),changetext:n,id:Common.UI.getId(),lock:null!==t.get_LockUserId(),lockuser:e.getUserName(t.get_LockUserId()),type:t.get_Type(),changedata:t,scope:e.view,hint:!e.appConfig.canReview,goto:t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveTo||t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveFrom,editable:t.get_UserId()==e.currentUserId});i.push(h)}),i},getUserName:function(t){if(this.userCollection&&null!==t){var e=this.userCollection.findUser(t);if(e)return e.get("username")}return""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},onBtnPreviewClick:function(t,e){switch(e){case"prev":this.api.asc_GetPrevRevisionsChange();break;case"next":this.api.asc_GetNextRevisionsChange()}Common.NotificationCenter.trigger("edit:complete",this.view)},onAcceptClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_AcceptAllChanges():this.api.asc_AcceptChanges():this.api.asc_AcceptChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onRejectClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_RejectAllChanges():this.api.asc_RejectChanges():this.api.asc_RejectChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onDeleteClick:function(t){this.api&&this.api.asc_RejectChanges(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onGotoClick:function(t){this.api&&this.api.asc_FollowRevisionMove(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onTurnPreview:function(t){this.appConfig.isReviewOnly?this.view.turnChanges(!0):this.appConfig.canReview&&(t="on"==t,this.api.asc_SetTrackRevisions(t),Common.localStorage.setItem(this.view.appPrefix+"track-changes-"+(this.appConfig.fileKey||""),t?1:0),this.view.turnChanges(t))},onTurnSpelling:function(t){t="on"==t,this.view.turnSpelling(t),Common.localStorage.setItem(this.view.appPrefix+"settings-spellcheck",t?1:0),this.api.asc_setSpellCheck(t),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-spellcheck",t)},onReviewViewClick:function(t,e,i){this.turnDisplayMode(e.value),!this.appConfig.canReview&&Common.localStorage.setItem(this.view.appPrefix+"review-mode",e.value),Common.NotificationCenter.trigger("edit:complete",this.view)},turnDisplayMode:function(t){this.api&&("final"===t?this.api.asc_BeginViewModeInReview(!0):"original"===t?this.api.asc_BeginViewModeInReview(!1):this.api.asc_EndViewModeInReview()),this.disableEditing("final"==t||"original"==t),this._state.previewMode="final"==t||"original"==t},isPreviewChangesMode:function(){return this._state.previewMode},onCoAuthMode:function(t,e,i){if(Common.localStorage.setItem(this.view.appPrefix+"settings-coauthmode",e.value),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-coauthmode",e.value),this.api){if(this.api.asc_SetFastCollaborative(1==e.value),this.api.SetCollaborativeMarksShowType){var n=Common.localStorage.getItem(e.value?this.view.appPrefix+"settings-showchanges-fast":this.view.appPrefix+"settings-showchanges-strict");null!==n?this.api.SetCollaborativeMarksShowType("all"==n?Asc.c_oAscCollaborativeMarksShowType.All:"none"==n?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges):this.api.SetCollaborativeMarksShowType(e.value?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges)}n=Common.localStorage.getItem(this.view.appPrefix+"settings-autosave"),null===n&&this.appConfig.customization&&!1===this.appConfig.customization.autosave&&(n=0),n=e.value||null===n?1:parseInt(n),Common.localStorage.setItem(this.view.appPrefix+"settings-autosave",n),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-autosave",n),this.api.asc_setAutoSaveGap(n)}Common.NotificationCenter.trigger("edit:complete",this.view),this.view.fireEvent("settings:apply",[this])},disableEditing:function(t){var e=this.getApplication();e.getController("Toolbar").DisableToolbar(t,!1,!0),e.getController("DocumentHolder").getView().SetDisabled(t),this.appConfig.canReview&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("RightMenu").SetDisabled(t,!1),e.getController("Statusbar").getView("Statusbar").SetDisabled(t),e.getController("Navigation")&&e.getController("Navigation").SetDisabled(t),e.getController("Common.Controllers.Plugins").getView("Common.Views.Plugins").disableControls(t));var i=e.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t);var n=e.getController("LeftMenu");n.leftMenu.getMenu("file").miProtect.setDisabled(t),n.setPreviewMode(t),this.view&&(this.view.$el.find(".no-group-mask").css("opacity",1),this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(e){e&&e.setDisabled(t||!this.langs||this.langs.length<1)},this))},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){var e=this;if(e.view&&Common.localStorage.getBool(e.view.appPrefix+"settings-spellcheck",!0)&&e.view.turnSpelling(!0),t.canReview)new Promise(function(t){t()}).then(function(){var i=t.isReviewOnly||Common.localStorage.getBool(e.view.appPrefix+"track-changes-"+(t.fileKey||""));if(e.api.asc_HaveRevisionsChanges()&&e.view.markChanges(!0),function(t){e.view.turnChanges(t),e.api.asc_SetTrackRevisions(t)}(i),"object"==typeof e.appConfig.customization&&1==e.appConfig.customization.showReviewChanges){e.dlgChanges=new Common.Views.ReviewChangesDialog({popoverChanges:e.popoverChanges,mode:e.appConfig});var n=$("#editor_sdk"),o=n.offset();e.dlgChanges.show(Math.max(10,o.left+n.width()-300),Math.max(10,o.top+n.height()-150))}});else if(t.canViewReview&&(t.canViewReview=t.isEdit||e.api.asc_HaveRevisionsChanges(!0),t.canViewReview)){var i=Common.localStorage.getItem(e.view.appPrefix+"review-mode");null===i&&(i=e.appConfig.customization&&/^(original|final|markup)$/i.test(e.appConfig.customization.reviewDisplay)?e.appConfig.customization.reviewDisplay.toLocaleLowerCase():"original"),e.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i),e.view.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i)}e.view&&e.view.btnChat&&e.getApplication().getController("LeftMenu").leftMenu.btnChat.on("toggle",function(t,i){i!==e.view.btnChat.pressed&&e.view.turnChat(i)})},applySettings:function(t){this.view&&this.view.turnSpelling(Common.localStorage.getBool(this.view.appPrefix+"settings-spellcheck",!0)),this.view&&this.view.turnCoAuthMode(Common.localStorage.getBool(this.view.appPrefix+"settings-coauthmode",!0))},synchronizeChanges:function(){this.appConfig&&this.appConfig.canReview&&this.view.markChanges(this.api.asc_HaveRevisionsChanges())},setLanguages:function(t){this.langs=t,this.view&&this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(t){t&&t.setDisabled(this.langs.length<1)},this)},onDocLanguage:function(){var t=this;new Common.Views.LanguageDialog({languages:t.langs,current:t.api.asc_getDefaultLanguage(),handler:function(e,i){if("ok"==e){var n=_.findWhere(t.langs,{value:i});n&&t.api.asc_setDefaultLanguage(n.code)}}}).show()},onLostEditRights:function(){this.view&&this.view.onLostEditRights()},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)},onUpdateUsers:function(){var t=this.userCollection;this.popoverChanges&&this.popoverChanges.each(function(e){var i=t.findOriginalUser(e.get("userid"));e.set("usercolor",i?i.get("color"):null)})},textInserted:"<b>Inserted:</b>",textDeleted:"<b>Deleted:</b>",textParaInserted:"<b>Paragraph Inserted</b> ",textParaDeleted:"<b>Paragraph Deleted</b> ",textFormatted:"Formatted",textParaFormatted:"Paragraph Formatted",textNot:"Not ",textBold:"Bold",textItalic:"Italic",textStrikeout:"Strikeout",textUnderline:"Underline",textColor:"Font color",textBaseline:"Baseline",textSuperScript:"Superscript",textSubScript:"Subscript",textHighlight:"Highlight color",textSpacing:"Spacing",textDStrikeout:"Double strikeout",textCaps:"All caps",textSmallCaps:"Small caps",textPosition:"Position",textFontSize:"Font size",textShd:"Background color",textContextual:"Don't add interval between paragraphs of the same style",textNoContextual:"Add interval between paragraphs of the same style",textIndentLeft:"Indent left",textIndentRight:"Indent right",textFirstLine:"First line",textRight:"Align right",textLeft:"Align left",textCenter:"Align center",textJustify:"Align justify",textBreakBefore:"Page break before",textKeepNext:"Keep with next",textKeepLines:"Keep lines together",textNoBreakBefore:"No page break before",textNoKeepNext:"Don't keep with next",textNoKeepLines:"Don't keep lines together",textLineSpacing:"Line Spacing: ",textMultiple:"multiple",textAtLeast:"at least",textExact:"exactly",textSpacingBefore:"Spacing before",textSpacingAfter:"Spacing after",textAuto:"auto",textWidow:"Widow control",textNoWidow:"No widow control",textTabs:"Change tabs",textNum:"Change numbering",textEquation:"Equation",textImage:"Image",textChart:"Chart",textShape:"Shape",textTableChanged:"<b>Table Settings Changed</b>",textTableRowsAdd:"<b>Table Rows Added<b/>",textTableRowsDel:"<b>Table Rows Deleted<b/>",textParaMoveTo:"<b>Moved:</b>",textParaMoveFromUp:"<b>Moved Up:</b>",textParaMoveFromDown:"<b>Moved Down:</b>"},Common.Controllers.ReviewChanges||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Protection",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Protection=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.appConfig.isPasswordSupport&&(this.btnsAddPwd.concat(this.btnsChangePwd).forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"add"])})}),this.btnsDelPwd.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"delete"])})}),this.btnPwd.menu.on("item:click",function(e,i,n){t.fireEvent("protect:password",[e,i.value])})),t.appConfig.isSignatureSupport&&(this.btnSignature.menu&&this.btnSignature.menu.on("item:click",function(e,i,n){t.fireEvent("protect:signature",[i.value,!1])}),this.btnsInvisibleSignature.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:signature",["invisible"])})}))}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.btnsInvisibleSignature=[],this.btnsAddPwd=[],this.btnsDelPwd=[],this.btnsChangePwd=[],this._state={disabled:!1,hasPassword:!1,disabledPassword:!1,invisibleSignDisabled:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.appConfig.isPasswordSupport&&(this.btnAddPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-protect",caption:this.txtEncrypt}),this.btnsAddPwd.push(this.btnAddPwd),this.btnPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-protect",caption:this.txtEncrypt,menu:!0,visible:!1})),this.appConfig.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-ic-signature",caption:this.txtSignature,menu:"pe-"!==this.appPrefix}),this.btnSignature.menu||this.btnsInvisibleSignature.push(this.btnSignature)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){e.canProtect&&(e.isPasswordSupport&&(i.btnAddPwd.updateHint(i.hintAddPwd),i.btnPwd.updateHint(i.hintPwd),i.btnPwd.setMenu(new Common.UI.Menu({items:[{caption:i.txtChangePwd,value:"add"},{caption:i.txtDeletePwd,value:"delete"}]}))),i.btnSignature&&(i.btnSignature.updateHint(i.btnSignature.menu?i.hintSignature:i.txtInvisibleSignature),i.btnSignature.menu&&i.btnSignature.setMenu(new Common.UI.Menu({items:[{caption:i.txtInvisibleSignature,value:"invisible"},{caption:i.txtSignatureLine,value:"visible",disabled:i._state.disabled}]}))),Common.NotificationCenter.trigger("tab:visible","protect",!0)),t.call(i)})},getPanel:function(){return this.$el=$(_.template('<section id="protection-panel" class="panel" data-tab="protect"><div class="group"><span id="slot-btn-add-password" class="btn-slot text x-huge"></span><span id="slot-btn-change-password" class="btn-slot text x-huge"></span><span id="slot-btn-signature" class="btn-slot text x-huge"></span></div></section>')({})),this.appConfig.canProtect&&(this.btnAddPwd&&this.btnAddPwd.render(this.$el.find("#slot-btn-add-password")),this.btnPwd&&this.btnPwd.render(this.$el.find("#slot-btn-change-password")),this.btnSignature&&this.btnSignature.render(this.$el.find("#slot-btn-signature"))),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){if("signature"==t){var i=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtInvisibleSignature,disabled:this._state.invisibleSignDisabled});return this.btnsInvisibleSignature.push(i),i}if("add-password"==t){var i=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtAddPwd,disabled:this._state.disabled||this._state.disabledPassword,visible:!this._state.hasPassword});return this.btnsAddPwd.push(i),i}if("del-password"==t){var i=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtDeletePwd,disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsDelPwd.push(i),i}if("change-password"==t){var i=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtChangePwd,disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsChangePwd.push(i),i}},SetDisabled:function(t,e){this._state.disabled=t,this._state.invisibleSignDisabled=t&&!e,this.btnsInvisibleSignature&&this.btnsInvisibleSignature.forEach(function(i){i&&i.setDisabled(t&&!e)},this),this.btnSignature&&this.btnSignature.menu&&(this.btnSignature.menu.items&&this.btnSignature.menu.items[1].setDisabled(t),this.btnSignature.setDisabled(t&&!e)),this.btnsAddPwd.concat(this.btnsDelPwd,this.btnsChangePwd).forEach(function(e){e&&e.setDisabled(t||this._state.disabledPassword)},this)},onDocumentPassword:function(t,e){this._state.hasPassword=t,this._state.disabledPassword=!!e;var i=this._state.disabledPassword||this._state.disabled;this.btnsAddPwd&&this.btnsAddPwd.forEach(function(e){e&&(e.setVisible(!t),e.setDisabled(i))},this),this.btnsDelPwd.concat(this.btnsChangePwd).forEach(function(e){e&&(e.setVisible(t),e.setDisabled(i))},this),this.btnPwd.setVisible(t)},txtEncrypt:"Encrypt",txtSignature:"Signature",hintAddPwd:"Encrypt with password",hintPwd:"Change or delete password",hintSignature:"Add digital signature or signature line",txtChangePwd:"Change password",txtDeletePwd:"Delete password",txtAddPwd:"Add password",txtInvisibleSignature:"Add digital signature",txtSignatureLine:"Add Signature line"}}(),Common.Views.Protection||{}))}),define("common/main/lib/view/PasswordDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.PasswordDialog=Common.UI.Window.extend(_.extend({applyFunction:void 0,initialize:function(t){var e=this,i={};_.extend(i,{width:350,height:220,header:!0,cls:"modal-dlg",contentTemplate:"",title:e.txtTitle},t),this.template=t.template||['<div class="box" style="height:'+(i.height-85)+'px;">','<div class="input-row" style="margin-bottom: 10px;">',"<label>"+e.txtDescription+"</label>","</div>",'<div class="input-row">',"<label>"+e.txtPassword+"</label>","</div>",'<div id="id-password-txt" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+e.txtRepeat+"</label>","</div>",'<div id="id-repeat-txt" class="input-row"></div>',"</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">'+e.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+e.cancelButtonText+"</button>","</div>"].join(""),this.handler=t.handler,this.settings=t.settings,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.repeatPwd=new Common.UI.InputField({el:$("#id-repeat-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}})}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){
|
|
|
if(this.handler){if("ok"==t){if(!0!==this.inputPwd.checkValidate())return void this.inputPwd.cmpEl.find("input").focus();if(this.inputPwd.getValue()!==this.repeatPwd.getValue())return this.repeatPwd.checkValidate(),void this.repeatPwd.cmpEl.find("input").focus()}this.handler.call(this,t,this.inputPwd.getValue())}this.close()},okButtonText:"OK",cancelButtonText:"Cancel",txtTitle:"Set Password",txtPassword:"Password",txtDescription:"A Password is required to open this document",txtRepeat:"Repeat password",txtIncorrectPwd:"Confirmation password is not identical"},Common.Views.PasswordDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts"],function(){"use strict";Common.Views.SignDialog=Common.UI.Window.extend(_.extend({options:{width:370,style:"min-width: 350px;",cls:"modal-dlg"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.api=this.options.api,this.signType=this.options.signType||"invisible",this.signSize=this.options.signSize||{width:0,height:0},this.certificateId=null,this.signObject=null,this.fontStore=this.options.fontStore,this.font={size:11,name:"Arial",bold:!1,italic:!1},this.template=['<div class="box" style="height: '+("invisible"==this.signType?"132px;":"300px;")+'">','<div id="id-dlg-sign-invisible">','<div class="input-row">',"<label>"+this.textPurpose+"</label>","</div>",'<div id="id-dlg-sign-purpose" class="input-row"></div>',"</div>",'<div id="id-dlg-sign-visible">','<div class="input-row">',"<label>"+this.textInputName+"</label>","</div>",'<div id="id-dlg-sign-name" class="input-row" style="margin-bottom: 5px;"></div>','<div id="id-dlg-sign-fonts" class="input-row" style="display: inline-block;"></div>','<div id="id-dlg-sign-font-size" class="input-row" style="display: inline-block;margin-left: 3px;"></div>','<div id="id-dlg-sign-bold" style="display: inline-block;margin-left: 3px;"></div>','<div id="id-dlg-sign-italic" style="display: inline-block;margin-left: 3px;"></div>','<div style="margin: 10px 0 5px 0;">',"<label>"+this.textUseImage+"</label>","</div>",'<button id="id-dlg-sign-image" class="btn btn-text-default auto">'+this.textSelectImage+"</button>",'<div class="input-row" style="margin-top: 10px;">','<label style="font-weight: bold;">'+this.textSignature+"</label>","</div>",'<div style="border: 1px solid #cbcbcb;"><div id="signature-preview-img" style="width: 100%; height: 50px;position: relative;"></div></div>',"</div>",'<table style="margin-top: 30px;">',"<tr>",'<td><label style="font-weight: bold;margin-bottom: 3px;">'+this.textCertificate+'</label></td><td rowspan="2" style="vertical-align: top; padding-left: 30px;"><button id="id-dlg-sign-change" class="btn btn-text-default" style="">'+this.textSelect+"</button></td>","</tr>",'<tr><td><div id="id-dlg-sign-certificate" class="hidden" style="max-width: 212px;overflow: hidden;"></td></tr>',"</table>","</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.templateCertificate=_.template(['<label style="display: block;margin-bottom: 3px;"><%= Common.Utils.String.htmlEncode(name) %></label>','<label style="display: block;"><%= Common.Utils.String.htmlEncode(valid) %></label>'].join("")),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputPurpose=new Common.UI.InputField({el:$("#id-dlg-sign-purpose"),style:"width: 100%;"}),t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-name"),style:"width: 100%;",validateOnChange:!0}).on("changing",_.bind(t.onChangeName,t)),t.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#id-dlg-sign-fonts"),cls:"input-group-nr",style:"width: 234px;",menuCls:"scrollable-menu",menuStyle:"min-width: 234px;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:t.tipFontName}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),i.name,t.font.size,t.font.italic,t.font.bold),t.font.name=i.name}),this.cmbFontSize=new Common.UI.ComboBox({el:$("#id-dlg-sign-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,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"},{value:96,displayValue:"96"}]}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,i.value,t.font.italic,t.font.bold),t.font.size=i.value}),this.cmbFontSize.setValue(this.font.size),t.btnBold=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:t.textBold}),t.btnBold.render($("#id-dlg-sign-bold")),t.btnBold.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,t.font.italic,e.pressed),t.font.bold=e.pressed}),t.btnItalic=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:t.textItalic}),t.btnItalic.render($("#id-dlg-sign-italic")),t.btnItalic.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,e.pressed,t.font.bold),t.font.italic=e.pressed}),t.btnSelectImage=new Common.UI.Button({el:"#id-dlg-sign-image"}),t.btnSelectImage.on("click",_.bind(t.onSelectImage,t)),t.btnChangeCertificate=new Common.UI.Button({el:"#id-dlg-sign-change"}),t.btnChangeCertificate.on("click",_.bind(t.onChangeCertificate,t)),t.btnOk=new Common.UI.Button({el:e.find(".primary"),disabled:!0}),t.cntCertificate=$("#id-dlg-sign-certificate"),t.cntVisibleSign=$("#id-dlg-sign-visible"),t.cntInvisibleSign=$("#id-dlg-sign-invisible"),"visible"==t.signType?t.cntInvisibleSign.addClass("hidden"):t.cntVisibleSign.addClass("hidden"),e.find(".dlg-btn").on("click",_.bind(t.onBtnClick,t)),t.afterRender()},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){("visible"==t.signType?t.inputName:t.inputPurpose).cmpEl.find("input").focus()},500)},close:function(){this.api.asc_unregisterCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_unregisterCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),Common.UI.Window.prototype.close.apply(this,arguments),this.signObject&&this.signObject.destroy()},afterRender:function(){this.api&&(this.binding||(this.binding={}),this.binding.certificateChanged=_.bind(this.onCertificateChanged,this),this.api.asc_registerCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_registerCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),this.api.asc_GetDefaultCertificate()),"visible"==this.signType&&(this.cmbFonts.fillFonts(this.fontStore),this.cmbFonts.selectRecord(this.fontStore.findWhere({name:this.font.name})||this.fontStore.at(0)),this.signObject=new AscCommon.CSignatureDrawer("signature-preview-img",this.api,this.signSize.width,this.signSize.height))},getSettings:function(){var t={};return t.certificateId=this.certificateId,"invisible"==this.signType?t.purpose=this.inputPurpose.getValue():t.images=this.signObject?this.signObject.getImages():[null,null],t},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t&&(this.btnOk.isDisabled()||this.signObject&&!this.signObject.isValid()))return;this.options.handler.call(this,this,t)}this.close()},onChangeCertificate:function(){this.api.asc_SelectCertificate()},onCertificateChanged:function(t){this.certificateId=t.id;var e=t.date,i="string"==typeof e?e.split(" - "):["",""];this.cntCertificate.html(this.templateCertificate({name:t.name,valid:this.textValid.replace("%1",i[0]).replace("%2",i[1])})),this.cntCertificate.toggleClass("hidden",_.isEmpty(this.certificateId)||this.certificateId<0),this.btnChangeCertificate.setCaption(_.isEmpty(this.certificateId)||this.certificateId<0?this.textSelect:this.textChange),this.btnOk.setDisabled(_.isEmpty(this.certificateId)||this.certificateId<0)},onSelectImage:function(){this.signObject&&(this.signObject.selectImage(),this.inputName.setValue(""))},onChangeName:function(t,e){this.signObject&&this.signObject.setText(e,this.font.name,this.font.size,this.font.italic,this.font.bold)},textTitle:"Sign Document",textPurpose:"Purpose for signing this document",textCertificate:"Certificate",textValid:"Valid from %1 to %2",textChange:"Change",cancelButtonText:"Cancel",okButtonText:"Ok",textInputName:"Input signer name",textUseImage:"or click 'Select Image' to use a picture as signature",textSelectImage:"Select Image",textSignature:"Signature looks as",tipFontName:"Font Name",tipFontSize:"Font Size",textBold:"Bold",textItalic:"Italic",textSelect:"Select"},Common.Views.SignDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/CheckBox","common/main/lib/component/Window"],function(){"use strict";Common.Views.SignSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 350px;",cls:"modal-dlg",type:"edit"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box" style="height: 260px;">','<div class="input-row">',"<label>"+this.textInfo+"</label>","</div>",'<div class="input-row">',"<label>"+this.textInfoName+"</label>","</div>",'<div id="id-dlg-sign-settings-name" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+this.textInfoTitle+"</label>","</div>",'<div id="id-dlg-sign-settings-title" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+this.textInfoEmail+"</label>","</div>",'<div id="id-dlg-sign-settings-email" class="input-row" style="margin-bottom: 10px;"></div>','<div class="input-row">',"<label>"+this.textInstructions+"</label>","</div>",'<textarea id="id-dlg-sign-settings-instructions" class="form-control" style="width: 100%;height: 35px;margin-bottom: 10px;resize: none;"></textarea>','<div id="id-dlg-sign-settings-date"></div>',"</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<% if (type == "edit") { %>','<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","<% } %>","</div>"].join(""),this.api=this.options.api,this.type=this.options.type||"edit",this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-settings-name"),style:"width: 100%;",disabled:"view"==this.type}),t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-sign-settings-title"),style:"width: 100%;",disabled:"view"==this.type}),t.inputEmail=new Common.UI.InputField({el:$("#id-dlg-sign-settings-email"),style:"width: 100%;",disabled:"view"==this.type}),t.textareaInstructions=this.$window.find("textarea"),t.textareaInstructions.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation()}),"view"==this.type?this.textareaInstructions.attr("disabled","disabled"):this.textareaInstructions.removeAttr("disabled"),this.textareaInstructions.toggleClass("disabled","view"==this.type),this.chDate=new Common.UI.CheckBox({el:$("#id-dlg-sign-settings-date"),labelText:this.textShowDate,disabled:"view"==this.type}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputName.cmpEl.find("input").focus()},500)},setSettings:function(t){if(t){var e=this,i=t.asc_getSigner1();e.inputName.setValue(i||""),i=t.asc_getSigner2(),e.inputTitle.setValue(i||""),i=t.asc_getEmail(),e.inputEmail.setValue(i||""),i=t.asc_getInstructions(),e.textareaInstructions.val(i||""),e.chDate.setValue(t.asc_getShowDate())}},getSettings:function(){var t=this,e=new AscCommon.asc_CSignatureLine;return e.asc_setSigner1(t.inputName.getValue()),e.asc_setSigner2(t.inputTitle.getValue()),e.asc_setEmail(t.inputEmail.getValue()),e.asc_setInstructions(t.textareaInstructions.val()),e.asc_setShowDate("checked"==t.chDate.getValue()),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},textInfo:"Signer Info",textInfoName:"Name",textInfoTitle:"Signer Title",textInfoEmail:"E-mail",textInstructions:"Instructions for Signer",cancelButtonText:"Cancel",okButtonText:"Ok",txtEmpty:"This field is required",textAllowComment:"Allow signer to add comment in the signature dialog",textShowDate:"Show sign date in signature line",textTitle:"Signature Setup"},Common.Views.SignSettingsDialog||{}))}),void 0===Common)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Protection",["core","common/main/lib/view/Protection","common/main/lib/view/PasswordDialog","common/main/lib/view/SignDialog","common/main/lib/view/SignSettingsDialog"],function(){"use strict";Common.Controllers.Protection=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Common.Views.Protection"],sdkViewName:"#id_main",initialize:function(){this.addListeners({"Common.Views.Protection":{"protect:password":_.bind(this.onPasswordClick,this),"protect:signature":_.bind(this.onSignatureClick,this)}})},onLaunch:function(){this._state={},Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.appConfig.isPasswordSupport&&this.api.asc_registerCallback("asc_onDocumentPassword",_.bind(this.onDocumentPassword,this)),this.appConfig.isSignatureSupport&&(Common.NotificationCenter.on("protect:sign",_.bind(this.onSignatureRequest,this)),Common.NotificationCenter.on("protect:signature",_.bind(this.onSignatureClick,this)),this.api.asc_registerCallback("asc_onSignatureClick",_.bind(this.onSignatureSign,this)),this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)))},setMode:function(t){return this.appConfig=t,this.view=this.createView("Common.Views.Protection",{mode:t}),this},onDocumentPassword:function(t,e){this.view&&this.view.onDocumentPassword(t,e)},SetDisabled:function(t,e){this.view&&this.view.SetDisabled(t,e)},onPasswordClick:function(t,e){switch(e){case"add":this.addPassword();break;case"delete":this.deletePassword()}Common.NotificationCenter.trigger("edit:complete",this.view)},onSignatureRequest:function(t){this.api.asc_RequestSign(t)},onSignatureClick:function(t,e,i){switch(t){case"invisible":this.onSignatureRequest("unvisibleAdd");break;case"visible":this.addVisibleSignature(e,i)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){},addPassword:function(){var t=this;new Common.Views.PasswordDialog({api:t.api,signType:"invisible",handler:function(e,i){"ok"==e&&t.api.asc_setCurrentPassword(i),Common.NotificationCenter.trigger("edit:complete")}}).show()},deletePassword:function(){this.api.asc_resetPassword()},addInvisibleSignature:function(){var t=this;new Common.Views.SignDialog({api:t.api,signType:"invisible",handler:function(e,i){if("ok"==i){var n=e.getSettings();t.api.asc_Sign(n.certificateId)}Common.NotificationCenter.trigger("edit:complete")}}).show()},addVisibleSignature:function(t,e){var i=this,n=new Common.Views.SignSettingsDialog({type:t?"view":"edit",handler:function(e,n){t||"ok"!=n||i.api.asc_AddSignatureLine2(e.getSettings()),Common.NotificationCenter.trigger("edit:complete")}});n.show(),e&&n.setSettings(this.api.asc_getSignatureSetup(e))},signVisibleSignature:function(t,e,i){var n=this;if(_.isUndefined(n.fontStore)){n.fontStore=new Common.Collections.Fonts;var o=n.getApplication().getController("Toolbar").getView("Toolbar").cmbFontName.store.toJSON(),s=[];_.each(o,function(t,e){t.cloneid||s.push(_.clone(t))}),n.fontStore.add(s)}new Common.Views.SignDialog({api:n.api,signType:"visible",fontStore:n.fontStore,signSize:{width:e||0,height:i||0},handler:function(e,i){if("ok"==i){var o=e.getSettings();n.api.asc_Sign(o.certificateId,t,o.images[0],o.images[1])}Common.NotificationCenter.trigger("edit:complete")}}).show()},onSignatureSign:function(t,e,i,n){n?this.signVisibleSignature(t,e,i):this.addInvisibleSignature()},onApiUpdateSignatures:function(t,e){this.SetDisabled(t&&t.length>0,!0)},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)}},Common.Controllers.Protection||{}))}),define("common/main/lib/controller/Desktop",["core"],function(){"use strict";var t=function(){var t={},e=window.AscDesktopEditor;return e&&(window.on_native_message=function(i,n){if(/^style:change/.test(i)){var o=JSON.parse(n);if("toolbar"==o.element)"off"==o.action&&"native-color"==o.style&&$(".toolbar").removeClass("editor-native-color");else if("body"==o.element&&"merge"==o.action){var s=document.createElement("style");s.innerHTML=o.style,document.body.appendChild(s)}}else if(/window:features/.test(i)){var o=JSON.parse(n);"true"==o.canUndock&&(t.canUndock||(t.canUndock=!0,_.isEmpty(t)||Common.NotificationCenter.trigger("app:config",{canUndock:!0})))}else if(/window:status/.test(i)){var o=JSON.parse(n);"undocking"==o.action&&Common.NotificationCenter.trigger("undock:status",{status:"undocked"==o.status?"undocked":"docked"})}else/editor:config/.test(i)&&"request"==n&&e.execCommand("editor:config",JSON.stringify({user:t.user,extraleft:$("#box-document-title #slot-btn-dt-save").parent().width()}))},e.execCommand("webapps:events","loading"),e.execCommand("window:features","request")),{init:function(i){_.extend(t,i),t.isDesktopApp&&(Common.NotificationCenter.on("app:ready",function(i){_.extend(t,i),!!e&&e.execCommand("doc:onready",""),$(".toolbar").addClass("editor-native-color")}),Common.NotificationCenter.on("action:undocking",function(t){e.execCommand("editor:event",JSON.stringify({action:"undocking",state:"dock"==t?"dock":"undock"}))}),Common.NotificationCenter.on("app:face",function(e){t.canUndock&&Common.NotificationCenter.trigger("app:config",{canUndock:!0})}))},process:function(i){if(t.isDesktopApp&&e){if("goback"==i)return e.execCommand("go:folder",t.isOffline?"offline":t.customization.goback.url),!0;if("preloader:hide"==i)return e.execCommand("editor:onready",""),!0;if("create:new"==i&&"desktop://create.new"==t.createUrl)return e.LocalFileCreate(window.SSE?2:window.PE?1:0),!0}return!1},requestClose:function(){t.isDesktopApp&&e&&e.execCommand("editor:event",JSON.stringify({action:"close",url:t.customization.goback.url}))}}};Common.Controllers.Desktop=new t});var reqerr;require.config({baseUrl:"../../",paths:{jquery:"../vendor/jquery/jquery",underscore:"../vendor/underscore/underscore",backbone:"../vendor/backbone/backbone",bootstrap:"../vendor/bootstrap/dist/js/bootstrap",text:"../vendor/requirejs-text/text",perfectscrollbar:"common/main/lib/mods/perfect-scrollbar",jmousewheel:"../vendor/perfect-scrollbar/src/jquery.mousewheel",xregexp:"../vendor/xregexp/xregexp-all-min",sockjs:"../vendor/sockjs/sockjs.min",jszip:"../vendor/jszip/jszip.min",jsziputils:"../vendor/jszip-utils/jszip-utils.min",allfonts:"../../sdkjs/common/AllFonts",sdk:"../../sdkjs/cell/sdk-all-min",api:"api/documents/api",core:"common/main/lib/core/application",notification:"common/main/lib/core/NotificationCenter",keymaster:"common/main/lib/core/keymaster",tip:"common/main/lib/util/Tip",localstorage:"common/main/lib/util/LocalStorage",analytics:"common/Analytics",gateway:"common/Gateway",locale:"common/locale",irregularstack:"common/IrregularStack"},shim:{underscore:{exports:"_"},backbone:{deps:["underscore","jquery"],exports:"Backbone"},bootstrap:{deps:["jquery"]},perfectscrollbar:{deps:["jmousewheel"]},notification:{deps:["backbone"]},core:{deps:["backbone","notification","irregularstack"]},sdk:{deps:["jquery","underscore","allfonts","xregexp","sockjs","jszip","jsziputils"]},gateway:{deps:["jquery"]},analytics:{deps:["jquery"]}}}),require(["backbone","bootstrap","core","sdk","api","analytics","gateway","locale"],function(t,e,i){t.history.start();var n=new t.Application({nameSpace:"SSE",autoCreate:!1,controllers:["Viewport","DocumentHolder","CellEditor","FormulaDialog","Print","Toolbar","Statusbar","Spellcheck","RightMenu","LeftMenu","Main","PivotTable","DataTab","Common.Controllers.Fonts","Common.Controllers.Chat","Common.Controllers.Comments","Common.Controllers.Plugins","Common.Controllers.ReviewChanges","Common.Controllers.Protection"]});Common.Locale.apply(function(){require(["spreadsheeteditor/main/app/controller/Viewport","spreadsheeteditor/main/app/controller/DocumentHolder","spreadsheeteditor/main/app/controller/CellEditor","spreadsheeteditor/main/app/controller/Toolbar","spreadsheeteditor/main/app/controller/Statusbar","spreadsheeteditor/main/app/controller/Spellcheck","spreadsheeteditor/main/app/controller/RightMenu","spreadsheeteditor/main/app/controller/LeftMenu","spreadsheeteditor/main/app/controller/Main","spreadsheeteditor/main/app/controller/Print","spreadsheeteditor/main/app/controller/PivotTable","spreadsheeteditor/main/app/controller/DataTab","spreadsheeteditor/main/app/view/FileMenuPanels","spreadsheeteditor/main/app/view/ParagraphSettings","spreadsheeteditor/main/app/view/ImageSettings","spreadsheeteditor/main/app/view/ChartSettings","spreadsheeteditor/main/app/view/ShapeSettings","spreadsheeteditor/main/app/view/TextArtSettings","spreadsheeteditor/main/app/view/PivotSettings","spreadsheeteditor/main/app/view/FieldSettingsDialog","spreadsheeteditor/main/app/view/ValueFieldSettingsDialog","spreadsheeteditor/main/app/view/SignatureSettings","common/main/lib/util/utils","common/main/lib/util/LocalStorage","common/main/lib/controller/Fonts","common/main/lib/controller/Comments","common/main/lib/controller/Chat","common/main/lib/controller/Plugins","common/main/lib/controller/ReviewChanges","common/main/lib/controller/Protection","common/main/lib/controller/Desktop"],function(){n.start()})})},function(t){"timeout"==t.requireType&&!reqerr&&window.requireTimeourError&&(reqerr=window.requireTimeourError(),window.alert(reqerr),window.location.reload())}),define("../apps/spreadsheeteditor/main/app.js",function(){}); |