|
|
/*
|
|
|
* Copyright (c) Ascensio System SIA 2019. All rights reserved
|
|
|
*
|
|
|
* http://www.onlyoffice.com
|
|
|
*
|
|
|
* Version: 0.0.0 (build:0)
|
|
|
*/
|
|
|
function onDropDownKeyDown(t){var e=$(this),i=e.parent(),n=jQuery.Event("keydown.before.bs.dropdown"),o=jQuery.Event("keydown.after.bs.dropdown");i.trigger(n),i.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),!/^(38|40|27|13|9|37|39)$/.test(t.keyCode)||t.ctrlKey||t.altKey||(patchDropDownKeyDownAdditional.call(this,t),/(37|39)/.test(t.keyCode)||(t.preventDefault(),t.stopPropagation()))):(patchDropDownKeyDown.call(this,t),t.preventDefault(),t.stopPropagation()),i.trigger(o)}function patchDropDownKeyDown(t){if(/(38|40|27|37|39)/.test(t.keyCode)){var e=$(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=getParent(e),n=i.hasClass("open")||i.hasClass("over");if(!n||n&&27==t.keyCode){if(27==t.which){if(o=$("[role=menu] li.dropdown-submenu.over:visible",i),o.size())return o.eq(o.size()-1).removeClass("over"),!1;i.hasClass("dropdown-submenu")&&i.hasClass("over")?(i.removeClass("over"),i.find("> a").focus()):i.find("[data-toggle=dropdown]").focus()}return n?e.click():void 0}var o=$("> [role=menu] > li:not(.divider):not(.disabled):visible",i).find("> a");if(o.length){var s=o.index(o.filter(":focus"));if(39==t.keyCode){if(s<0)return;var a=o.eq(s).parent();a.hasClass("dropdown-submenu")&&!a.hasClass("over")&&(a.mouseenter(),a.addClass("focused-submenu"),_.delay(function(){var t=$("> [role=menu]",a),e=t.find("> li:not(.divider):not(.disabled):visible > a"),i=0;if(t.find("> .menu-scroll").length>0)for(var n=t.scrollTop(),o=0;o<e.length;o++)if(e[o].offsetTop>n){i=o;break}e.length>0&&e.eq(i).focus()},250))}else 37==t.keyCode?i.hasClass("dropdown-submenu")&&i.hasClass("over")&&(i.removeClass("over"),i.find("> a").focus()):(38==t.keyCode?s>0?s--:s=e.hasClass("no-cyclic")?0:o.length-1:40==t.keyCode&&(s<o.length-1?s++:s=e.hasClass("no-cyclic")?o.length-1:0),~s||(s=0),i.hasClass("dropdown-submenu")&&i.hasClass("over")&&i.addClass("focused-submenu"),o.eq(s).focus())}}}}function patchDropDownKeyDownAdditional(t){if(/(38|40|27|37|39)/.test(t.keyCode)){var e=$(this);if(/(37|39)/.test(t.keyCode)||(t.preventDefault(),t.stopPropagation()),!e.is(".disabled, :disabled")){var i=getParent(e),n=i.hasClass("open")||i.hasClass("over");if(!n||n&&(27==t.keyCode||37==t.keyCode||39==t.keyCode))return n?e.click():void 0;var o=$("> [role=menu] > li:not(.divider):not(.disabled):visible",i).find("> a");if(o.length){var s=o.index(o.filter(".focus"));38==t.keyCode?s>0?s--:s=e.hasClass("no-cyclic")?0:o.length-1:40==t.keyCode&&(s<o.length-1?s++:s=e.hasClass("no-cyclic")?o.length-1:0),~s||(s=0),o.removeClass("focus"),o.eq(s).addClass("focus")}}}}function getParent(t){var e=t.attr("data-target");e||(e=t.attr("href"),e=e&&/#/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i=e&&$(e);return i&&i.length?i:t.parent()}function clearMenus(t){$(".dropdown-toggle").each(function(e){var i=$(this).parent();i.hasClass("open")&&(i.trigger(e=$.Event("hide.bs.dropdown")),e.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown",t))})}if(function(){var t=this,e=t._,i={},n=Array.prototype,o=Object.prototype,s=Function.prototype,a=n.push,r=n.slice,l=n.concat,c=o.toString,d=o.hasOwnProperty,h=n.forEach,p=n.map,m=n.reduce,u=n.reduceRight,g=n.filter,b=n.every,f=n.some,C=n.indexOf,v=n.lastIndexOf,_=Array.isArray,y=Object.keys,w=s.bind,x=function(t){return t instanceof x?t:this instanceof x?void(this._wrapped=t):new x(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):t._=x,x.VERSION="1.5.2";var S=x.each=x.forEach=function(t,e,n){if(null!=t)if(h&&t.forEach===h)t.forEach(e,n);else if(t.length===+t.length){for(var o=0,s=t.length;o<s;o++)if(e.call(n,t[o],o,t)===i)return}else for(var a=x.keys(t),o=0,s=a.length;o<s;o++)if(e.call(n,t[a[o]],a[o],t)===i)return};x.map=x.collect=function(t,e,i){var n=[];return null==t?n:p&&t.map===p?t.map(e,i):(S(t,function(t,o,s){n.push(e.call(i,t,o,s))}),n)};var A="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(t,e,i,n){var o=arguments.length>2;if(null==t&&(t=[]),m&&t.reduce===m)return n&&(e=x.bind(e,n)),o?t.reduce(e,i):t.reduce(e);if(S(t,function(t,s,a){o?i=e.call(n,i,t,s,a):(i=t,o=!0)}),!o)throw new TypeError(A);return i},x.reduceRight=x.foldr=function(t,e,i,n){var o=arguments.length>2;if(null==t&&(t=[]),u&&t.reduceRight===u)return n&&(e=x.bind(e,n)),o?t.reduceRight(e,i):t.reduceRight(e);var s=t.length;if(s!==+s){var a=x.keys(t);s=a.length}if(S(t,function(r,l,c){l=a?a[--s]:--s,o?i=e.call(n,i,t[l],l,c):(i=t[l],o=!0)}),!o)throw new TypeError(A);return i},x.find=x.detect=function(t,e,i){var n;return T(t,function(t,o,s){if(e.call(i,t,o,s))return n=t,!0}),n},x.filter=x.select=function(t,e,i){var n=[];return null==t?n:g&&t.filter===g?t.filter(e,i):(S(t,function(t,o,s){e.call(i,t,o,s)&&n.push(t)}),n)},x.reject=function(t,e,i){return x.filter(t,function(t,n,o){return!e.call(i,t,n,o)},i)},x.every=x.all=function(t,e,n){e||(e=x.identity);var o=!0;return null==t?o:b&&t.every===b?t.every(e,n):(S(t,function(t,s,a){if(!(o=o&&e.call(n,t,s,a)))return i}),!!o)};var T=x.some=x.any=function(t,e,n){e||(e=x.identity);var o=!1;return null==t?o:f&&t.some===f?t.some(e,n):(S(t,function(t,s,a){if(o||(o=e.call(n,t,s,a)))return i}),!!o)};x.contains=x.include=function(t,e){return null!=t&&(C&&t.indexOf===C?-1!=t.indexOf(e):T(t,function(t){return t===e}))},x.invoke=function(t,e){var i=r.call(arguments,2),n=x.isFunction(e);return x.map(t,function(t){return(n?e:t[e]).apply(t,i)})},x.pluck=function(t,e){return x.map(t,function(t){return t[e]})},x.where=function(t,e,i){return x.isEmpty(e)?i?void 0:[]:x[i?"find":"filter"](t,function(t){for(var i in e)if(e[i]!==t[i])return!1;return!0})},x.findWhere=function(t,e){return x.where(t,e,!0)},x.max=function(t,e,i){if(!e&&x.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&x.isEmpty(t))return-1/0;var n={computed:-1/0,value:-1/0};return S(t,function(t,o,s){var a=e?e.call(i,t,o,s):t;a>n.computed&&(n={value:t,computed:a})}),n.value},x.min=function(t,e,i){if(!e&&x.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&x.isEmpty(t))return 1/0;var n={computed:1/0,value:1/0};return S(t,function(t,o,s){var a=e?e.call(i,t,o,s):t;a<n.computed&&(n={value:t,computed:a})}),n.value},x.shuffle=function(t){var e,i=0,n=[];return S(t,function(t){e=x.random(i++),n[i-1]=n[e],n[e]=t}),n},x.sample=function(t,e,i){return arguments.length<2||i?t[x.random(t.length-1)]:x.shuffle(t).slice(0,Math.max(0,e))};var k=function(t){return x.isFunction(t)?t:function(e){return e[t]}};x.sortBy=function(t,e,i){var n=k(e);return x.pluck(x.map(t,function(t,e,o){return{value:t,index:e,criteria:n.call(i,t,e,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 I=function(t){return function(e,i,n){var o={},s=null==i?x.identity:k(i);return S(e,function(i,a){var r=s.call(n,i,a,e);t(o,r,i)}),o}};x.groupBy=I(function(t,e,i){(x.has(t,e)?t[e]:t[e]=[]).push(i)}),x.indexBy=I(function(t,e,i){t[e]=i}),x.countBy=I(function(t,e){x.has(t,e)?t[e]++:t[e]=1}),x.sortedIndex=function(t,e,i,n){i=null==i?x.identity:k(i);for(var o=i.call(n,e),s=0,a=t.length;s<a;){var r=s+a>>>1;i.call(n,t[r])<o?s=r+1:a=r}return s},x.toArray=function(t){return t?x.isArray(t)?r.call(t):t.length===+t.length?x.map(t,x.identity):x.values(t):[]},x.size=function(t){return null==t?0:t.length===+t.length?t.length:x.keys(t).length},x.first=x.head=x.take=function(t,e,i){if(null!=t)return null==e||i?t[0]:r.call(t,0,e)},x.initial=function(t,e,i){return r.call(t,0,t.length-(null==e||i?1:e))},x.last=function(t,e,i){if(null!=t)return null==e||i?t[t.length-1]:r.call(t,Math.max(t.length-e,0))},x.rest=x.tail=x.drop=function(t,e,i){return r.call(t,null==e||i?1:e)},x.compact=function(t){return x.filter(t,x.identity)};var P=function(t,e,i){return e&&x.every(t,x.isArray)?l.apply(i,t):(S(t,function(t){x.isArray(t)||x.isArguments(t)?e?a.apply(i,t):P(t,e,i):i.push(t)}),i)};x.flatten=function(t,e){return P(t,e,[])},x.without=function(t){return x.difference(t,r.call(arguments,1))},x.uniq=x.unique=function(t,e,i,n){x.isFunction(e)&&(n=i,i=e,e=!1);var o=i?x.map(t,i,n):t,s=[],a=[];return S(o,function(i,n){(e?n&&a[a.length-1]===i:x.contains(a,i))||(a.push(i),s.push(t[n]))}),s},x.union=function(){return x.uniq(x.flatten(arguments,!0))},x.intersection=function(t){var e=r.call(arguments,1);return x.filter(x.uniq(t),function(t){return x.every(e,function(e){return x.indexOf(e,t)>=0})})},x.difference=function(t){var e=l.apply(n,r.call(arguments,1));return x.filter(t,function(t){return!x.contains(e,t)})},x.zip=function(){for(var t=x.max(x.pluck(arguments,"length").concat(0)),e=new Array(t),i=0;i<t;i++)e[i]=x.pluck(arguments,""+i);return e},x.object=function(t,e){if(null==t)return{};for(var i={},n=0,o=t.length;n<o;n++)e?i[t[n]]=e[n]:i[t[n][0]]=t[n][1];return i},x.indexOf=function(t,e,i){if(null==t)return-1;var n=0,o=t.length;if(i){if("number"!=typeof i)return n=x.sortedIndex(t,e),t[n]===e?n:-1;n=i<0?Math.max(0,o+i):i}if(C&&t.indexOf===C)return t.indexOf(e,i);for(;n<o;n++)if(t[n]===e)return n;return-1},x.lastIndexOf=function(t,e,i){if(null==t)return-1;var n=null!=i;if(v&&t.lastIndexOf===v)return n?t.lastIndexOf(e,i):t.lastIndexOf(e);for(var o=n?i:t.length;o--;)if(t[o]===e)return o;return-1},x.range=function(t,e,i){arguments.length<=1&&(e=t||0,t=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((e-t)/i),0),o=0,s=new Array(n);o<n;)s[o++]=t,t+=i;return s};var M=function(){};x.bind=function(t,e){var i,n;if(w&&t.bind===w)return w.apply(t,r.call(arguments,1));if(!x.isFunction(t))throw new TypeError;return i=r.call(arguments,2),n=function(){if(!(this instanceof n))return t.apply(e,i.concat(r.call(arguments)));M.prototype=t.prototype;var o=new M;M.prototype=null;var s=t.apply(o,i.concat(r.call(arguments)));return Object(s)===s?s:o}},x.partial=function(t){var e=r.call(arguments,1);return function(){return t.apply(this,e.concat(r.call(arguments)))}},x.bindAll=function(t){var e=r.call(arguments,1);if(0===e.length)throw new Error("bindAll must be passed function names");return S(e,function(e){t[e]=x.bind(t[e],t)}),t},x.memoize=function(t,e){var i={};return e||(e=x.identity),function(){var n=e.apply(this,arguments);return x.has(i,n)?i[n]:i[n]=t.apply(this,arguments)}},x.delay=function(t,e){var i=r.call(arguments,2);return setTimeout(function(){return t.apply(null,i)},e)},x.defer=function(t){return x.delay.apply(x,[t,1].concat(r.call(arguments,1)))},x.throttle=function(t,e,i){var n,o,s,a=null,r=0;i||(i={});var l=function(){r=!1===i.leading?0:new Date,a=null,s=t.apply(n,o)};return function(){var c=new Date;r||!1!==i.leading||(r=c);var d=e-(c-r);return n=this,o=arguments,d<=0?(clearTimeout(a),a=null,r=c,s=t.apply(n,o)):a||!1===i.trailing||(a=setTimeout(l,d)),s}},x.debounce=function(t,e,i){var n,o,s,a,r;return function(){s=this,o=arguments,a=new Date;var l=function(){var c=new Date-a;c<e?n=setTimeout(l,e-c):(n=null,i||(r=t.apply(s,o)))},c=i&&!n;return n||(n=setTimeout(l,e)),c&&(r=t.apply(s,o)),r}},x.once=function(t){var e,i=!1;return function(){return i?e:(i=!0,e=t.apply(this,arguments),t=null,e)}},x.wrap=function(t,e){return function(){var i=[t];return a.apply(i,arguments),e.apply(this,i)}},x.compose=function(){var t=arguments;return function(){for(var e=arguments,i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},x.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},x.keys=y||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var i in t)x.has(t,i)&&e.push(i);return e},x.values=function(t){for(var e=x.keys(t),i=e.length,n=new Array(i),o=0;o<i;o++)n[o]=t[e[o]];return n},x.pairs=function(t){for(var e=x.keys(t),i=e.length,n=new Array(i),o=0;o<i;o++)n[o]=[e[o],t[e[o]]];return n},x.invert=function(t){for(var e={},i=x.keys(t),n=0,o=i.length;n<o;n++)e[t[i[n]]]=i[n];return e},x.functions=x.methods=function(t){var e=[];for(var i in t)x.isFunction(t[i])&&e.push(i);return e.sort()},x.extend=function(t){return S(r.call(arguments,1),function(e){if(e)for(var i in e)t[i]=e[i]}),t},x.pick=function(t){var e={},i=l.apply(n,r.call(arguments,1));return S(i,function(i){i in t&&(e[i]=t[i])}),e},x.omit=function(t){var e={},i=l.apply(n,r.call(arguments,1));for(var o in t)x.contains(i,o)||(e[o]=t[o]);return e},x.defaults=function(t){return S(r.call(arguments,1),function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])}),t},x.clone=function(t){return x.isObject(t)?x.isArray(t)?t.slice():x.extend({},t):t},x.tap=function(t,e){return e(t),t};var B=function(t,e,i,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof x&&(t=t._wrapped),e instanceof x&&(e=e._wrapped);var o=c.call(t);if(o!=c.call(e))return!1;switch(o){case"[object String]":return t==String(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 RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var s=i.length;s--;)if(i[s]==t)return n[s]==e;var a=t.constructor,r=e.constructor;if(a!==r&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(r)&&r instanceof r))return!1;i.push(t),n.push(e);var l=0,d=!0;if("[object Array]"==o){if(l=t.length,d=l==e.length)for(;l--&&(d=B(t[l],e[l],i,n)););}else{for(var h in t)if(x.has(t,h)&&(l++,!(d=x.has(e,h)&&B(t[h],e[h],i,n))))break;if(d){for(h in e)if(x.has(e,h)&&!l--)break;d=!l}}return i.pop(),n.pop(),d};x.isEqual=function(t,e){return B(t,e,[],[])},x.isEmpty=function(t){if(null==t)return!0;if(x.isArray(t)||x.isString(t))return 0===t.length;for(var e in t)if(x.has(t,e))return!1;return!0},x.isElement=function(t){return!(!t||1!==t.nodeType)},x.isArray=_||function(t){return"[object Array]"==c.call(t)},x.isObject=function(t){return t===Object(t)},S(["Arguments","Function","String","Number","Date","RegExp"],function(t){x["is"+t]=function(e){return c.call(e)=="[object "+t+"]"}}),x.isArguments(arguments)||(x.isArguments=function(t){return!(!t||!x.has(t,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(t){return"function"==typeof t}),x.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},x.isNaN=function(t){return x.isNumber(t)&&t!=+t},x.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"==c.call(t)},x.isNull=function(t){return null===t},x.isUndefined=function(t){return void 0===t},x.has=function(t,e){return d.call(t,e)},x.noConflict=function(){return t._=e,this},x.identity=function(t){return t},x.times=function(t,e,i){for(var n=Array(Math.max(0,t)),o=0;o<t;o++)n[o]=e.call(i,o);return n},x.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var U={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};U.unescape=x.invert(U.escape);var E={escape:new RegExp("["+x.keys(U.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(U.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(t){x[t]=function(e){return null==e?"":(""+e).replace(E[t],function(e){return U[t][e]})}}),x.result=function(t,e){if(null!=t){var i=t[e];return x.isFunction(i)?i.call(t):i}},x.mixin=function(t){S(x.functions(t),function(e){var i=x[e]=t[e];x.prototype[e]=function(){var t=[this._wrapped];return a.apply(t,arguments),L.call(this,i.apply(x,t))}})};var V=0;x.uniqueId=function(t){var e=++V+"";return t?t+e:e},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var D=/(.)^/,R={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(t,e,i){var n;i=x.defaults({},i,x.templateSettings);var o=new RegExp([(i.escape||D).source,(i.interpolate||D).source,(i.evaluate||D).source].join("|")+"|$","g"),s=0,a="__p+='";t.replace(o,function(e,i,n,o,r){return a+=t.slice(s,r).replace(F,function(t){return"\\"+R[t]}),i&&(a+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(a+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),o&&(a+="';\n"+o+"\n__p+='"),s=r+e.length,e}),a+="';\n",i.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{n=new Function(i.variable||"obj","_",a)}catch(t){throw t.source=a,t}if(e)return n(e,x);var r=function(t){return n.call(this,t,x)};return r.source="function("+(i.variable||"obj")+"){\n"+a+"}",r},x.chain=function(t){return x(t).chain()};var L=function(t){return this._chain?x(t).chain():t};x.mixin(x),S(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=n[t];x.prototype[t]=function(){var i=this._wrapped;return e.apply(i,arguments),"shift"!=t&&"splice"!=t||0!==i.length||delete i[0],L.call(this,i)}}),S(["concat","join","slice"],function(t){var e=n[t];x.prototype[t]=function(){return L.call(this,e.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(t){return function(){return t._}}(this)),function(t,e){"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){var e=!!t&&"length"in t&&t.length,i=ot.type(t);return"function"!==i&&!ot.isWindow(t)&&("array"===i||0===e||"number"==typeof e&&e>0&&e-1 in t)}function n(t,e,i){if(ot.isFunction(e))return ot.grep(t,function(t,n){return!!e.call(t,n,t)!==i});if(e.nodeType)return ot.grep(t,function(t){return t===e!==i});if("string"==typeof e){if(ut.test(e))return ot.filter(e,t,i);e=ot.filter(e,t)}return ot.grep(t,function(t){return Q.call(e,t)>-1!==i})}function o(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function s(t){var e={};return ot.each(t.match(vt)||[],function(t,i){e[i]=!0}),e}function a(){Y.removeEventListener("DOMContentLoaded",a),t.removeEventListener("load",a),ot.ready()}function r(){this.expando=ot.expando+r.uid++}function l(t,e,i){var n;if(void 0===i&&1===t.nodeType)if(n="data-"+e.replace(Tt,"-$&").toLowerCase(),"string"==typeof(i=t.getAttribute(n))){try{i="true"===i||"false"!==i&&("null"===i?null:+i+""===i?+i:At.test(i)?ot.parseJSON(i):i)}catch(t){}St.set(t,e,i)}else i=void 0;return i}function c(t,e,i,n){var o,s=1,a=20,r=n?function(){return n.cur()}:function(){return ot.css(t,e,"")},l=r(),c=i&&i[3]||(ot.cssNumber[e]?"":"px"),d=(ot.cssNumber[e]||"px"!==c&&+l)&&It.exec(ot.css(t,e));if(d&&d[3]!==c){c=c||d[3],i=i||[],d=+l||1;do{s=s||".5",d/=s,ot.style(t,e,d+c)}while(s!==(s=r()/l)&&1!==s&&--a)}return i&&(d=+d||+l||0,o=i[1]?d+(i[1]+1)*i[2]:+i[2],n&&(n.unit=c,n.start=d,n.end=o)),o}function d(t,e){var i=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[];return void 0===e||e&&ot.nodeName(t,e)?ot.merge([t],i):i}function h(t,e){for(var i=0,n=t.length;i<n;i++)xt.set(t[i],"globalEval",!e||xt.get(e[i],"globalEval"))}function p(t,e,i,n,o){for(var s,a,r,l,c,p,m=e.createDocumentFragment(),u=[],g=0,b=t.length;g<b;g++)if((s=t[g])||0===s)if("object"===ot.type(s))ot.merge(u,s.nodeType?[s]:s);else if(Dt.test(s)){for(a=a||m.appendChild(e.createElement("div")),r=(Ut.exec(s)||["",""])[1].toLowerCase(),l=Vt[r]||Vt._default,a.innerHTML=l[1]+ot.htmlPrefilter(s)+l[2],p=l[0];p--;)a=a.lastChild;ot.merge(u,a.childNodes),a=m.firstChild,a.textContent=""}else u.push(e.createTextNode(s));for(m.textContent="",g=0;s=u[g++];)if(n&&ot.inArray(s,n)>-1)o&&o.push(s);else if(c=ot.contains(s.ownerDocument,s),a=d(m.appendChild(s),"script"),c&&h(a),i)for(p=0;s=a[p++];)Et.test(s.type||"")&&i.push(s);return m}function m(){return!0}function u(){return!1}function g(){try{return Y.activeElement}catch(t){}}function b(t,e,i,n,o,s){var a,r;if("object"==typeof e){"string"!=typeof i&&(n=n||i,i=void 0);for(r in e)b(t,r,i,n,e[r],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=u;else if(!o)return t;return 1===s&&(a=o,o=function(t){return ot().off(t),a.apply(this,arguments)},o.guid=a.guid||(a.guid=ot.guid++)),t.each(function(){ot.event.add(this,e,o,n,i)})}function f(t,e){return ot.nodeName(t,"table")&&ot.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function C(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function v(t){var e=zt.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function _(t,e){var i,n,o,s,a,r,l,c;if(1===e.nodeType){if(xt.hasData(t)&&(s=xt.access(t),a=xt.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++)ot.event.add(e,o,c[o][i])}St.hasData(t)&&(r=St.access(t),l=ot.extend({},r),St.set(e,l))}}function y(t,e){var i=e.nodeName.toLowerCase();"input"===i&&Bt.test(t.type)?e.checked=t.checked:"input"!==i&&"textarea"!==i||(e.defaultValue=t.defaultValue)}function w(t,e,i,n){e=J.apply([],e);var o,s,a,r,l,c,h=0,m=t.length,u=m-1,g=e[0],b=ot.isFunction(g);if(b||m>1&&"string"==typeof g&&!nt.checkClone&&Ot.test(g))return t.each(function(o){var s=t.eq(o);b&&(e[0]=g.call(this,o,s.html())),w(s,e,i,n)});if(m&&(o=p(e,t[0].ownerDocument,!1,t,n),s=o.firstChild,1===o.childNodes.length&&(o=s),s||n)){for(a=ot.map(d(o,"script"),C),r=a.length;h<m;h++)l=o,h!==u&&(l=ot.clone(l,!0,!0),r&&ot.merge(a,d(l,"script"))),i.call(t[h],l,h);if(r)for(c=a[a.length-1].ownerDocument,ot.map(a,v),h=0;h<r;h++)l=a[h],Et.test(l.type||"")&&!xt.access(l,"globalEval")&&ot.contains(c,l)&&(l.src?ot._evalUrl&&ot._evalUrl(l.src):ot.globalEval(l.textContent.replace($t,"")))}return t}function x(t,e,i){for(var n,o=e?ot.filter(e,t):t,s=0;null!=(n=o[s]);s++)i||1!==n.nodeType||ot.cleanData(d(n)),n.parentNode&&(i&&ot.contains(n.ownerDocument,n)&&h(d(n,"script")),n.parentNode.removeChild(n));return t}function S(t,e){var i=ot(e.createElement(t)).appendTo(e.body),n=ot.css(i[0],"display");return i.detach(),n}function A(t){var e=Y,i=Gt[t];return i||(i=S(t,e),"none"!==i&&i||(Wt=(Wt||ot("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement),e=Wt[0].contentDocument,e.write(),e.close(),i=S(t,e),Wt.detach()),Gt[t]=i),i}function T(t,e,i){var n,o,s,a,r=t.style;return i=i||Kt(t),a=i?i.getPropertyValue(e)||i[e]:void 0,""!==a&&void 0!==a||ot.contains(t.ownerDocument,t)||(a=ot.style(t,e)),i&&!nt.pixelMarginRight()&&qt.test(a)&&jt.test(e)&&(n=r.width,o=r.minWidth,s=r.maxWidth,r.minWidth=r.maxWidth=r.width=a,a=i.width,r.width=n,r.minWidth=o,r.maxWidth=s),void 0!==a?a+"":a}function k(t,e){return{get:function(){return t()?void delete this.get:(this.get=e).apply(this,arguments)}}}function I(t){if(t in ee)return t;for(var e=t[0].toUpperCase()+t.slice(1),i=te.length;i--;)if((t=te[i]+e)in ee)return t}function P(t,e,i){var n=It.exec(e);return n?Math.max(0,n[2]-(i||0))+(n[3]||"px"):e}function M(t,e,i,n,o){for(var s=i===(n?"border":"content")?4:"width"===e?1:0,a=0;s<4;s+=2)"margin"===i&&(a+=ot.css(t,i+Pt[s],!0,o)),n?("content"===i&&(a-=ot.css(t,"padding"+Pt[s],!0,o)),"margin"!==i&&(a-=ot.css(t,"border"+Pt[s]+"Width",!0,o))):(a+=ot.css(t,"padding"+Pt[s],!0,o),"padding"!==i&&(a+=ot.css(t,"border"+Pt[s]+"Width",!0,o)));return a}function B(e,i,n){var o=!0,s="width"===i?e.offsetWidth:e.offsetHeight,a=Kt(e),r="border-box"===ot.css(e,"boxSizing",!1,a);if(Y.msFullscreenElement&&t.top!==t&&e.getClientRects().length&&(s=Math.round(100*e.getBoundingClientRect()[i])),s<=0||null==s){if(s=T(e,i,a),(s<0||null==s)&&(s=e.style[i]),qt.test(s))return s;o=r&&(nt.boxSizingReliable()||s===e.style[i]),s=parseFloat(s)||0}return s+M(e,i,n||(r?"border":"content"),o,a)+"px"}function U(t,e){for(var i,n,o,s=[],a=0,r=t.length;a<r;a++)n=t[a],n.style&&(s[a]=xt.get(n,"olddisplay"),i=n.style.display,e?(s[a]||"none"!==i||(n.style.display=""),""===n.style.display&&Mt(n)&&(s[a]=xt.access(n,"olddisplay",A(n.nodeName)))):(o=Mt(n),"none"===i&&o||xt.set(n,"olddisplay",o?i:ot.css(n,"display"))));for(a=0;a<r;a++)n=t[a],n.style&&(e&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=e?s[a]||"":"none"));return t}function E(t,e,i,n,o){return new E.prototype.init(t,e,i,n,o)}function V(){return t.setTimeout(function(){ie=void 0}),ie=ot.now()}function D(t,e){var i,n=0,o={height:t};for(e=e?1:0;n<4;n+=2-e)i=Pt[n],o["margin"+i]=o["padding"+i]=t;return e&&(o.opacity=o.width=t),o}function R(t,e,i){for(var n,o=(H.tweeners[e]||[]).concat(H.tweeners["*"]),s=0,a=o.length;s<a;s++)if(n=o[s].call(i,e,t))return n}function F(t,e,i){var n,o,s,a,r,l,c,d=this,h={},p=t.style,m=t.nodeType&&Mt(t),u=xt.get(t,"fxshow");i.queue||(r=ot._queueHooks(t,"fx"),null==r.unqueued&&(r.unqueued=0,l=r.empty.fire,r.empty.fire=function(){r.unqueued||l()}),r.unqueued++,d.always(function(){d.always(function(){r.unqueued--,ot.queue(t,"fx").length||r.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(i.overflow=[p.overflow,p.overflowX,p.overflowY],c=ot.css(t,"display"),"inline"===("none"===c?xt.get(t,"olddisplay")||A(t.nodeName):c)&&"none"===ot.css(t,"float")&&(p.display="inline-block")),i.overflow&&(p.overflow="hidden",d.always(function(){p.overflow=i.overflow[0],p.overflowX=i.overflow[1],p.overflowY=i.overflow[2]}));for(n in e)if(o=e[n],oe.exec(o)){if(delete e[n],s=s||"toggle"===o,o===(m?"hide":"show")){if("show"!==o||!u||void 0===u[n])continue;m=!0}h[n]=u&&u[n]||ot.style(t,n)}else c=void 0;if(ot.isEmptyObject(h))"inline"===("none"===c?A(t.nodeName):c)&&(p.display=c);else{u?"hidden"in u&&(m=u.hidden):u=xt.access(t,"fxshow",{}),s&&(u.hidden=!m),m?ot(t).show():d.done(function(){ot(t).hide()}),d.done(function(){var e;xt.remove(t,"fxshow");for(e in h)ot.style(t,e,h[e])});for(n in h)a=R(m?u[n]:0,n,d),n in u||(u[n]=a.start,m&&(a.end=a.start,a.start="width"===n||"height"===n?1:0))}}function L(t,e){var i,n,o,s,a;for(i in t)if(n=ot.camelCase(i),o=e[n],s=t[i],ot.isArray(s)&&(o=s[1],s=t[i]=s[0]),i!==n&&(t[n]=s,delete t[i]),(a=ot.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 H(t,e,i){var n,o,s=0,a=H.prefilters.length,r=ot.Deferred().always(function(){delete l.elem}),l=function(){if(o)return!1;for(var e=ie||V(),i=Math.max(0,c.startTime+c.duration-e),n=i/c.duration||0,s=1-n,a=0,l=c.tweens.length;a<l;a++)c.tweens[a].run(s);return r.notifyWith(t,[c,s,i]),s<1&&l?i:(r.resolveWith(t,[c]),!1)},c=r.promise({elem:t,props:ot.extend({},e),opts:ot.extend(!0,{specialEasing:{},easing:ot.easing._default},i),originalProperties:e,originalOptions:i,startTime:ie||V(),duration:i.duration,tweens:[],createTween:function(e,i){var n=ot.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?(r.notifyWith(t,[c,1,0]),r.resolveWith(t,[c,e])):r.rejectWith(t,[c,e]),this}}),d=c.props;for(L(d,c.opts.specialEasing);s<a;s++)if(n=H.prefilters[s].call(c,t,d,c.opts))return ot.isFunction(n.stop)&&(ot._queueHooks(c.elem,c.opts.queue).stop=ot.proxy(n.stop,n)),n;return ot.map(d,R,c),ot.isFunction(c.opts.start)&&c.opts.start.call(t,c),ot.fx.timer(ot.extend(l,{elem:t,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function N(t){return t.getAttribute&&t.getAttribute("class")||""}function O(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,o=0,s=e.toLowerCase().match(vt)||[];if(ot.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 z(t,e,i,n){function o(r){var l;return s[r]=!0,ot.each(t[r]||[],function(t,r){var c=r(e,i,n);return"string"!=typeof c||a||s[c]?a?!(l=c):void 0:(e.dataTypes.unshift(c),o(c),!1)}),l}var s={},a=t===Se;return o(e.dataTypes[0])||!s["*"]&&o("*")}function $(t,e){var i,n,o=ot.ajaxSettings.flatOptions||{};for(i in e)void 0!==e[i]&&((o[i]?t:n||(n={}))[i]=e[i]);return n&&ot.extend(!0,t,n),t}function W(t,e,i){for(var n,o,s,a,r=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=t.mimeType||e.getResponseHeader("Content-Type"));if(n)for(o in r)if(r[o]&&r[o].test(n)){l.unshift(o);break}if(l[0]in i)s=l[0];else{for(o in i){if(!l[0]||t.converters[o+" "+l[0]]){s=o;break}a||(a=o)}s=s||a}if(s)return s!==l[0]&&l.unshift(s),i[s]}function G(t,e,i,n){var o,s,a,r,l,c={},d=t.dataTypes.slice();if(d[1])for(a in t.converters)c[a.toLowerCase()]=t.converters[a];for(s=d.shift();s;)if(t.responseFields[s]&&(i[t.responseFields[s]]=e),!l&&n&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=s,s=d.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(!(a=c[l+" "+s]||c["* "+s]))for(o in c)if(r=o.split(" "),r[1]===s&&(a=c[l+" "+r[0]]||c["* "+r[0]])){!0===a?a=c[o]:!0!==c[o]&&(s=r[0],d.unshift(r[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 "+l+" to "+s}}}return{state:"success",data:e}}function j(t,e,i,n){var o;if(ot.isArray(e))ot.each(e,function(e,o){i||Ie.test(t)?n(t,o):j(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,i,n)});else if(i||"object"!==ot.type(e))n(t,e);else for(o in e)j(t+"["+o+"]",e[o],i,n)}function q(t){return ot.isWindow(t)?t:9===t.nodeType&&t.defaultView}var K=[],Y=t.document,X=K.slice,J=K.concat,Z=K.push,Q=K.indexOf,tt={},et=tt.toString,it=tt.hasOwnProperty,nt={},ot=function(t,e){return new ot.fn.init(t,e)},st=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,at=/^-ms-/,rt=/-([\da-z])/gi,lt=function(t,e){return e.toUpperCase()};ot.fn=ot.prototype={jquery:"2.2.3",constructor:ot,selector:"",length:0,toArray:function(){return X.call(this)},get:function(t){return null!=t?t<0?this[t+this.length]:this[t]:X.call(this)},pushStack:function(t){var e=ot.merge(this.constructor(),t);return e.prevObject=this,e.context=this.context,e},each:function(t){return ot.each(this,t)},map:function(t){return this.pushStack(ot.map(this,function(e,i){return t.call(e,i,e)}))},slice:function(){return this.pushStack(X.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:Z,sort:K.sort,splice:K.splice},ot.extend=ot.fn.extend=function(){var t,e,i,n,o,s,a=arguments[0]||{},r=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[r]||{},r++),"object"==typeof a||ot.isFunction(a)||(a={}),r===l&&(a=this,r--);r<l;r++)if(null!=(t=arguments[r]))for(e in t)i=a[e],n=t[e],a!==n&&(c&&n&&(ot.isPlainObject(n)||(o=ot.isArray(n)))?(o?(o=!1,s=i&&ot.isArray(i)?i:[]):s=i&&ot.isPlainObject(i)?i:{},a[e]=ot.extend(c,s,n)):void 0!==n&&(a[e]=n));return a},ot.extend({expando:"jQuery"+("2.2.3"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isFunction:function(t){return"function"===ot.type(t)},isArray:Array.isArray,isWindow:function(t){return null!=t&&t===t.window},isNumeric:function(t){var e=t&&t.toString();return!ot.isArray(t)&&e-parseFloat(e)+1>=0},isPlainObject:function(t){var e;if("object"!==ot.type(t)||t.nodeType||ot.isWindow(t))return!1;if(t.constructor&&!it.call(t,"constructor")&&!it.call(t.constructor.prototype||{},"isPrototypeOf"))return!1;for(e in t);return void 0===e||it.call(t,e)},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?tt[et.call(t)]||"object":typeof t},globalEval:function(t){var e,i=eval;(t=ot.trim(t))&&(1===t.indexOf("use strict")?(e=Y.createElement("script"),e.text=t,Y.head.appendChild(e).parentNode.removeChild(e)):i(t))},camelCase:function(t){return t.replace(at,"ms-").replace(rt,lt)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e){var n,o=0
|
|
|
;if(i(t))for(n=t.length;o<n&&!1!==e.call(t[o],o,t[o]);o++);else for(o in t)if(!1===e.call(t[o],o,t[o]))break;return t},trim:function(t){return null==t?"":(t+"").replace(st,"")},makeArray:function(t,e){var n=e||[];return null!=t&&(i(Object(t))?ot.merge(n,"string"==typeof t?[t]:t):Z.call(n,t)),n},inArray:function(t,e,i){return null==e?-1:Q.call(e,t,i)},merge:function(t,e){for(var i=+e.length,n=0,o=t.length;n<i;n++)t[o++]=e[n];return t.length=o,t},grep:function(t,e,i){for(var n=[],o=0,s=t.length,a=!i;o<s;o++)!e(t[o],o)!==a&&n.push(t[o]);return n},map:function(t,e,n){var o,s,a=0,r=[];if(i(t))for(o=t.length;a<o;a++)null!=(s=e(t[a],a,n))&&r.push(s);else for(a in t)null!=(s=e(t[a],a,n))&&r.push(s);return J.apply([],r)},guid:1,proxy:function(t,e){var i,n,o;if("string"==typeof e&&(i=t[e],e=t,t=i),ot.isFunction(t))return n=X.call(arguments,2),o=function(){return t.apply(e||this,n.concat(X.call(arguments)))},o.guid=t.guid=t.guid||ot.guid++,o},now:Date.now,support:nt}),"function"==typeof Symbol&&(ot.fn[Symbol.iterator]=K[Symbol.iterator]),ot.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){tt["[object "+e+"]"]=e.toLowerCase()});var ct=function(t){function e(t,e,i,n){var o,s,a,r,c,h,p,m,u=e&&e.ownerDocument,g=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==g&&9!==g&&11!==g)return i;if(!n&&((e?e.ownerDocument||e:L)!==M&&P(e),e=e||M,U)){if(11!==g&&(h=gt.exec(t)))if(o=h[1]){if(9===g){if(!(a=e.getElementById(o)))return i;if(a.id===o)return i.push(a),i}else if(u&&(a=u.getElementById(o))&&R(e,a)&&a.id===o)return i.push(a),i}else{if(h[2])return X.apply(i,e.getElementsByTagName(t)),i;if((o=h[3])&&v.getElementsByClassName&&e.getElementsByClassName)return X.apply(i,e.getElementsByClassName(o)),i}if(v.qsa&&!$[t+" "]&&(!E||!E.test(t))){if(1!==g)u=e,m=t;else if("object"!==e.nodeName.toLowerCase()){for((r=e.getAttribute("id"))?r=r.replace(ft,"\\$&"):e.setAttribute("id",r=F),p=x(t),s=p.length,c=dt.test(r)?"#"+r:"[id='"+r+"']";s--;)p[s]=c+" "+d(p[s]);m=p.join(","),u=bt.test(t)&&l(e.parentNode)||e}if(m)try{return X.apply(i,u.querySelectorAll(m)),i}catch(t){}finally{r===F&&e.removeAttribute("id")}}}return A(t.replace(st,"$1"),e,i,n)}function i(){function t(i,n){return e.push(i+" ")>_.cacheLength&&delete t[e.shift()],t[i+" "]=n}var e=[];return t}function n(t){return t[F]=!0,t}function o(t){var e=M.createElement("div");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function s(t,e){for(var i=t.split("|"),n=i.length;n--;)_.attrHandle[i[n]]=e}function a(t,e){var i=e&&t,n=i&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||G)-(~t.sourceIndex||G);if(n)return n;if(i)for(;i=i.nextSibling;)if(i===e)return-1;return t?1:-1}function r(t){return n(function(e){return e=+e,n(function(i,n){for(var o,s=t([],i.length,e),a=s.length;a--;)i[o=s[a]]&&(i[o]=!(n[o]=i[o]))})})}function l(t){return t&&void 0!==t.getElementsByTagName&&t}function c(){}function d(t){for(var e=0,i=t.length,n="";e<i;e++)n+=t[e].value;return n}function h(t,e,i){var n=e.dir,o=i&&"parentNode"===n,s=N++;return e.first?function(e,i,s){for(;e=e[n];)if(1===e.nodeType||o)return t(e,i,s)}:function(e,i,a){var r,l,c,d=[H,s];if(a){for(;e=e[n];)if((1===e.nodeType||o)&&t(e,i,a))return!0}else for(;e=e[n];)if(1===e.nodeType||o){if(c=e[F]||(e[F]={}),l=c[e.uniqueID]||(c[e.uniqueID]={}),(r=l[n])&&r[0]===H&&r[1]===s)return d[2]=r[2];if(l[n]=d,d[2]=t(e,i,a))return!0}}}function p(t){return t.length>1?function(e,i,n){for(var o=t.length;o--;)if(!t[o](e,i,n))return!1;return!0}:t[0]}function m(t,i,n){for(var o=0,s=i.length;o<s;o++)e(t,i[o],n);return n}function u(t,e,i,n,o){for(var s,a=[],r=0,l=t.length,c=null!=e;r<l;r++)(s=t[r])&&(i&&!i(s,n,o)||(a.push(s),c&&e.push(r)));return a}function g(t,e,i,o,s,a){return o&&!o[F]&&(o=g(o)),s&&!s[F]&&(s=g(s,a)),n(function(n,a,r,l){var c,d,h,p=[],g=[],b=a.length,f=n||m(e||"*",r.nodeType?[r]:r,[]),C=!t||!n&&e?f:u(f,p,t,r,l),v=i?s||(n?t:b||o)?[]:a:C;if(i&&i(C,v,r,l),o)for(c=u(v,g),o(c,[],r,l),d=c.length;d--;)(h=c[d])&&(v[g[d]]=!(C[g[d]]=h));if(n){if(s||t){if(s){for(c=[],d=v.length;d--;)(h=v[d])&&c.push(C[d]=h);s(null,v=[],c,l)}for(d=v.length;d--;)(h=v[d])&&(c=s?Z(n,h):p[d])>-1&&(n[c]=!(a[c]=h))}}else v=u(v===a?v.splice(b,v.length):v),s?s(null,a,v,l):X.apply(a,v)})}function b(t){for(var e,i,n,o=t.length,s=_.relative[t[0].type],a=s||_.relative[" "],r=s?1:0,l=h(function(t){return t===e},a,!0),c=h(function(t){return Z(e,t)>-1},a,!0),m=[function(t,i,n){var o=!s&&(n||i!==T)||((e=i).nodeType?l(t,i,n):c(t,i,n));return e=null,o}];r<o;r++)if(i=_.relative[t[r].type])m=[h(p(m),i)];else{if(i=_.filter[t[r].type].apply(null,t[r].matches),i[F]){for(n=++r;n<o&&!_.relative[t[n].type];n++);return g(r>1&&p(m),r>1&&d(t.slice(0,r-1).concat({value:" "===t[r-2].type?"*":""})).replace(st,"$1"),i,r<n&&b(t.slice(r,n)),n<o&&b(t=t.slice(n)),n<o&&d(t))}m.push(i)}return p(m)}function f(t,i){var o=i.length>0,s=t.length>0,a=function(n,a,r,l,c){var d,h,p,m=0,g="0",b=n&&[],f=[],C=T,v=n||s&&_.find.TAG("*",c),y=H+=null==C?1:Math.random()||.1,w=v.length;for(c&&(T=a===M||a||c);g!==w&&null!=(d=v[g]);g++){if(s&&d){for(h=0,a||d.ownerDocument===M||(P(d),r=!U);p=t[h++];)if(p(d,a||M,r)){l.push(d);break}c&&(H=y)}o&&((d=!p&&d)&&m--,n&&b.push(d))}if(m+=g,o&&g!==m){for(h=0;p=i[h++];)p(b,f,a,r);if(n){if(m>0)for(;g--;)b[g]||f[g]||(f[g]=K.call(l));f=u(f)}X.apply(l,f),c&&!n&&f.length>0&&m+i.length>1&&e.uniqueSort(l)}return c&&(H=y,T=C),b};return o?n(a):a}var C,v,_,y,w,x,S,A,T,k,I,P,M,B,U,E,V,D,R,F="sizzle"+1*new Date,L=t.document,H=0,N=0,O=i(),z=i(),$=i(),W=function(t,e){return t===e&&(I=!0),0},G=1<<31,j={}.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-]|[^\\x00-\\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+"*"),rt=new RegExp("^"+tt+"*([>+~]|"+tt+")"+tt+"*"),lt=new RegExp("="+tt+"*([^\\]'\"]*?)"+tt+"*\\]","g"),ct=new RegExp(nt),dt=new RegExp("^"+et+"$"),ht={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=/'|\\/g,Ct=new RegExp("\\\\([\\da-f]{1,6}"+tt+"?|("+tt+")|.)","ig"),vt=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)},_t=function(){P()};try{X.apply(q=J.call(L.childNodes),L.childNodes),q[L.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}}}v=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:L;return n!==M&&9===n.nodeType&&n.documentElement?(M=n,B=M.documentElement,U=!w(M),(i=M.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",_t,!1):i.attachEvent&&i.attachEvent("onunload",_t)),v.attributes=o(function(t){return t.className="i",!t.getAttribute("className")}),v.getElementsByTagName=o(function(t){return t.appendChild(M.createComment("")),!t.getElementsByTagName("*").length}),v.getElementsByClassName=ut.test(M.getElementsByClassName),v.getById=o(function(t){return B.appendChild(t).id=F,!M.getElementsByName||!M.getElementsByName(F).length}),v.getById?(_.find.ID=function(t,e){if(void 0!==e.getElementById&&U){var i=e.getElementById(t);return i?[i]:[]}},_.filter.ID=function(t){var e=t.replace(Ct,vt);return function(t){return t.getAttribute("id")===e}}):(delete _.find.ID,_.filter.ID=function(t){var e=t.replace(Ct,vt);return function(t){var i=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return i&&i.value===e}}),_.find.TAG=v.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):v.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},_.find.CLASS=v.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&U)return e.getElementsByClassName(t)},V=[],E=[],(v.qsa=ut.test(M.querySelectorAll))&&(o(function(t){B.appendChild(t).innerHTML="<a id='"+F+"'></a><select id='"+F+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&E.push("[*^$]="+tt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||E.push("\\["+tt+"*(?:value|"+Q+")"),t.querySelectorAll("[id~="+F+"-]").length||E.push("~="),t.querySelectorAll(":checked").length||E.push(":checked"),t.querySelectorAll("a#"+F+"+*").length||E.push(".#.+[+~]")}),o(function(t){var e=M.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&E.push("name"+tt+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||E.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),E.push(",.*:")})),(v.matchesSelector=ut.test(D=B.matches||B.webkitMatchesSelector||B.mozMatchesSelector||B.oMatchesSelector||B.msMatchesSelector))&&o(function(t){v.disconnectedMatch=D.call(t,"div"),D.call(t,"[s!='']:x"),V.push("!=",nt)}),E=E.length&&new RegExp(E.join("|")),V=V.length&&new RegExp(V.join("|")),e=ut.test(B.compareDocumentPosition),R=e||ut.test(B.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},W=e?function(t,e){if(t===e)return I=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i||(i=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&i||!v.sortDetached&&e.compareDocumentPosition(t)===i?t===M||t.ownerDocument===L&&R(L,t)?-1:e===M||e.ownerDocument===L&&R(L,e)?1:k?Z(k,t)-Z(k,e):0:4&i?-1:1)}:function(t,e){if(t===e)return I=!0,0;var i,n=0,o=t.parentNode,s=e.parentNode,r=[t],l=[e];if(!o||!s)return t===M?-1:e===M?1:o?-1:s?1:k?Z(k,t)-Z(k,e):0;if(o===s)return a(t,e);for(i=t;i=i.parentNode;)r.unshift(i);for(i=e;i=i.parentNode;)l.unshift(i);for(;r[n]===l[n];)n++;return n?a(r[n],l[n]):r[n]===L?-1:l[n]===L?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(lt,"='$1']"),v.matchesSelector&&U&&!$[i+" "]&&(!V||!V.test(i))&&(!E||!E.test(i)))try{var n=D.call(t,i);if(n||v.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),R(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==M&&P(t);var i=_.attrHandle[e.toLowerCase()],n=i&&j.call(_.attrHandle,e.toLowerCase())?i(t,e,!U):void 0;return void 0!==n?n:v.attributes||!U?t.getAttribute(e):(n=t.getAttributeNode(e))&&n.specified?n.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,i=[],n=0,o=0;if(I=!v.detectDuplicates,k=!v.sortStable&&t.slice(0),t.sort(W),I){for(;e=t[o++];)e===t[o]&&(n=i.push(o));for(;n--;)t.splice(i[n],1)}return k=null,t},y=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+=y(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[n++];)i+=y(e);return i},_=e.selectors={cacheLength:50,createPseudo:n,match:ht,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(Ct,vt),t[3]=(t[3]||t[4]||t[5]||"").replace(Ct,vt),"~="===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 ht.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":i&&ct.test(i)&&(e=x(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(Ct,vt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=O[t+" "];return e||(e=new RegExp("(^|"+tt+")"+t+"("+tt+"|$)"))&&O(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),r="of-type"===e;return 1===n&&0===o?function(t){return!!t.parentNode}:function(e,i,l){var c,d,h,p,m,u,g=s!==a?"nextSibling":"previousSibling",b=e.parentNode,f=r&&e.nodeName.toLowerCase(),C=!l&&!r,v=!1;if(b){if(s){for(;g;){for(p=e;p=p[g];)if(r?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,h=p[F]||(p[F]={}),d=h[p.uniqueID]||(h[p.uniqueID]={}),c=d[t]||[],m=c[0]===H&&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){d[t]=[H,m,v];break}}else if(C&&(p=e,h=p[F]||(p[F]={}),d=h[p.uniqueID]||(h[p.uniqueID]={}),c=d[t]||[],m=c[0]===H&&c[1],v=m),!1===v)for(;(p=++m&&p&&p[g]||(v=m=0)||u.pop())&&((r?p.nodeName.toLowerCase()!==f:1!==p.nodeType)||!++v||(C&&(h=p[F]||(p[F]={}),d=h[p.uniqueID]||(h[p.uniqueID]={}),d[t]=[H,v]),p!==e)););return(v-=o)===n||v%n==0&&v/n>=0}}},PSEUDO:function(t,i){var o,s=_.pseudos[t]||_.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return s[F]?s(i):s.length>1?(o=[t,t,"",i],_.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=S(t.replace(st,"$1"));return o[F]?n(function(t,e,i,n){for(var s,a=o(t,null,n,[]),r=t.length;r--;)(s=a[r])&&(t[r]=!(e[r]=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(Ct,vt),function(e){return(e.textContent||e.innerText||y(e)).indexOf(t)>-1}}),lang:n(function(t){return dt.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(Ct,vt).toLowerCase(),function(e){var i;do{if(i=U?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===B},focus:function(t){return t===M.activeElement&&(!M.hasFocus||M.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return!1===t.disabled},disabled:function(t){return!0===t.disabled},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!_.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})}},_.pseudos.nth=_.pseudos.eq;for(C in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})_.pseudos[C]=function(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}(C);for(C in{submit:!0,reset:!0})_.pseudos[C]=function(t){return function(e){var i=e.nodeName.toLowerCase();return("input"===i||"button"===i)&&e.type===t}}(C);return c.prototype=_.filters=_.pseudos,_.setFilters=new c,x=e.tokenize=function(t,i){var n,o,s,a,r,l,c,d=z[t+" "];if(d)return i?0:d.slice(0);for(r=t,l=[],c=_.preFilter;r;){n&&!(o=at.exec(r))||(o&&(r=r.slice(o[0].length)||r),l.push(s=[])),n=!1,(o=rt.exec(r))&&(n=o.shift(),s.push({value:n,type:o[0].replace(st," ")}),r=r.slice(n.length));for(a in _.filter)!(o=ht[a].exec(r))||c[a]&&!(o=c[a](o))||(n=o.shift(),s.push({value:n,type:a,matches:o}),r=r.slice(n.length));if(!n)break}return i?r.length:r?e.error(t):z(t,l).slice(0)},S=e.compile=function(t,e){var i,n=[],o=[],s=$[t+" "];if(!s){for(e||(e=x(t)),i=e.length;i--;)s=b(e[i]),s[F]?n.push(s):o.push(s);s=$(t,f(o,n)),s.selector=t}return s},A=e.select=function(t,e,i,n){var o,s,a,r,c,h="function"==typeof t&&t,p=!n&&x(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&&v.getById&&9===e.nodeType&&U&&_.relative[s[1].type]){if(!(e=(_.find.ID(a.matches[0].replace(Ct,vt),e)||[])[0]))return i;h&&(e=e.parentNode),t=t.slice(s.shift().value.length)}for(o=ht.needsContext.test(t)?0:s.length;o--&&(a=s[o],!_.relative[r=a.type]);)if((c=_.find[r])&&(n=c(a.matches[0].replace(Ct,vt),bt.test(s[0].type)&&l(e.parentNode)||e))){if(s.splice(o,1),!(t=n.length&&d(s)))return X.apply(i,n),i;break}}return(h||S(t,p))(n,e,!U,i,!e||bt.test(t)&&l(e.parentNode)||e),i},v.sortStable=F.split("").sort(W).join("")===F,v.detectDuplicates=!!I,P(),v.sortDetached=o(function(t){return 1&t.compareDocumentPosition(M.createElement("div"))}),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)}),v.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);ot.find=ct,ot.expr=ct.selectors,ot.expr[":"]=ot.expr.pseudos,ot.uniqueSort=ot.unique=ct.uniqueSort,ot.text=ct.getText,ot.isXMLDoc=ct.isXML,ot.contains=ct.contains;var dt=function(t,e,i){for(var n=[],o=void 0!==i;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(o&&ot(t).is(i))break;n.push(t)}return n},ht=function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i},pt=ot.expr.match.needsContext,mt=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,ut=/^.[^:#\[\.,]*$/;ot.filter=function(t,e,i){var n=e[0];return i&&(t=":not("+t+")"),1===e.length&&1===n.nodeType?ot.find.matchesSelector(n,t)?[n]:[]:ot.find.matches(t,ot.grep(e,function(t){return 1===t.nodeType}))},ot.fn.extend({find:function(t){var e,i=this.length,n=[],o=this;if("string"!=typeof t)return this.pushStack(ot(t).filter(function(){for(e=0;e<i;e++)if(ot.contains(o[e],this))return!0}));for(e=0;e<i;e++)ot.find(t,o[e],n);return n=this.pushStack(i>1?ot.unique(n):n),n.selector=this.selector?this.selector+" "+t:t,n},filter:function(t){return this.pushStack(n(this,t||[],!1))},not:function(t){return this.pushStack(n(this,t||[],!0))},is:function(t){return!!n(this,"string"==typeof t&&pt.test(t)?ot(t):t||[],!1).length}});var gt,bt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/;(ot.fn.init=function(t,e,i){var n,o;if(!t)return this;if(i=i||gt,"string"==typeof t){if(!(n="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:bt.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 ot?e[0]:e,ot.merge(this,ot.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:Y,!0)),mt.test(n[1])&&ot.isPlainObject(e))for(n in e)ot.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}return o=Y.getElementById(n[2]),o&&o.parentNode&&(this.length=1,this[0]=o),this.context=Y,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):ot.isFunction(t)?void 0!==i.ready?i.ready(t):t(ot):(void 0!==t.selector&&(this.selector=t.selector,this.context=t.context),ot.makeArray(t,this))}).prototype=ot.fn,gt=ot(Y);var ft=/^(?:parents|prev(?:Until|All))/,Ct={children:!0,contents:!0,next:!0,prev:!0};ot.fn.extend({has:function(t){var e=ot(t,this),i=e.length;return this.filter(function(){for(var t=0;t<i;t++)if(ot.contains(this,e[t]))return!0})},closest:function(t,e){for(var i,n=0,o=this.length,s=[],a=pt.test(t)||"string"!=typeof t?ot(t,e||this.context):0;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&&ot.find.matchesSelector(i,t))){s.push(i);break}return this.pushStack(s.length>1?ot.uniqueSort(s):s)},index:function(t){return t?"string"==typeof t?Q.call(ot(t),this[0]):Q.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(ot.uniqueSort(ot.merge(this.get(),ot(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),ot.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return dt(t,"parentNode")},parentsUntil:function(t,e,i){return dt(t,"parentNode",i)},next:function(t){return o(t,"nextSibling")},prev:function(t){return o(t,"previousSibling")},nextAll:function(t){return dt(t,"nextSibling")},prevAll:function(t){return dt(t,"previousSibling")},nextUntil:function(t,e,i){return dt(t,"nextSibling",i)},prevUntil:function(t,e,i){return dt(t,"previousSibling",i)},siblings:function(t){return ht((t.parentNode||{}).firstChild,t)},children:function(t){return ht(t.firstChild)},contents:function(t){return t.contentDocument||ot.merge([],t.childNodes)}},function(t,e){ot.fn[t]=function(i,n){var o=ot.map(this,e,i);return"Until"!==t.slice(-5)&&(n=i),n&&"string"==typeof n&&(o=ot.filter(n,o)),this.length>1&&(Ct[t]||ot.uniqueSort(o),ft.test(t)&&o.reverse()),this.pushStack(o)}});var vt=/\S+/g;ot.Callbacks=function(t){t="string"==typeof t?s(t):ot.extend({},t);var e,i,n,o,a=[],r=[],l=-1,c=function(){for(o=t.once,n=e=!0;r.length;l=-1)for(i=r.shift();++l<a.length;)!1===a[l].apply(i[0],i[1])&&t.stopOnFalse&&(l=a.length,i=!1);t.memory||(i=!1),e=!1,o&&(a=i?[]:"")},d={add:function(){return a&&(i&&!e&&(l=a.length-1,r.push(i)),function e(i){ot.each(i,function(i,n){ot.isFunction(n)?t.unique&&d.has(n)||a.push(n):n&&n.length&&"string"!==ot.type(n)&&e(n)})}(arguments),i&&!e&&c()),this},remove:function(){return ot.each(arguments,function(t,e){for(var i;(i=ot.inArray(e,a,i))>-1;)a.splice(i,1),i<=l&&l--}),this},has:function(t){return t?ot.inArray(t,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return o=r=[],a=i="",this},disabled:function(){return!a},lock:function(){return o=r=[],i||(a=i=""),this},locked:function(){return!!o},fireWith:function(t,i){return o||(i=i||[],i=[t,i.slice?i.slice():i],r.push(i),e||c()),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!n}};return d},ot.extend({Deferred:function(t){var e=[["resolve","done",ot.Callbacks("once memory"),"resolved"],["reject","fail",ot.Callbacks("once memory"),"rejected"],["notify","progress",ot.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return ot.Deferred(function(i){ot.each(e,function(e,s){var a=ot.isFunction(t[e])&&t[e];o[s[1]](function(){var t=a&&a.apply(this,arguments);t&&ot.isFunction(t.promise)?t.promise().progress(i.notify).done(i.resolve).fail(i.reject):i[s[0]+"With"](this===n?i.promise():this,a?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?ot.extend(t,n):n}},o={};return n.pipe=n.then,ot.each(e,function(t,s){var a=s[2],r=s[3];n[s[1]]=a.add,r&&a.add(function(){i=r},e[1^t][2].disable,e[2][2].lock),o[s[0]]=function(){return o[s[0]+"With"](this===o?n:this,arguments),this},o[s[0]+"With"]=a.fireWith}),n.promise(o),t&&t.call(o,o),o},when:function(t){var e,i,n,o=0,s=X.call(arguments),a=s.length,r=1!==a||t&&ot.isFunction(t.promise)?a:0,l=1===r?t:ot.Deferred(),c=function(t,i,n){return function(o){i[t]=this,n[t]=arguments.length>1?X.call(arguments):o,n===e?l.notifyWith(i,n):--r||l.resolveWith(i,n)}};if(a>1)for(e=new Array(a),i=new Array(a),n=new Array(a);o<a;o++)s[o]&&ot.isFunction(s[o].promise)?s[o].promise().progress(c(o,i,e)).done(c(o,n,s)).fail(l.reject):--r;return r||l.resolveWith(n,s),l.promise()}});var _t;ot.fn.ready=function(t){return ot.ready.promise().done(t),this},ot.extend({isReady:!1,readyWait:1,holdReady:function(t){t?ot.readyWait++:ot.ready(!0)},ready:function(t){(!0===t?--ot.readyWait:ot.isReady)||(ot.isReady=!0,!0!==t&&--ot.readyWait>0||(_t.resolveWith(Y,[ot]),ot.fn.triggerHandler&&(ot(Y).triggerHandler("ready"),ot(Y).off("ready"))))}}),ot.ready.promise=function(e){return _t||(_t=ot.Deferred(),"complete"===Y.readyState||"loading"!==Y.readyState&&!Y.documentElement.doScroll?t.setTimeout(ot.ready):(Y.addEventListener("DOMContentLoaded",a),t.addEventListener("load",a))),_t.promise(e)},ot.ready.promise();var yt=function(t,e,i,n,o,s,a){var r=0,l=t.length,c=null==i;if("object"===ot.type(i)){o=!0;for(r in i)yt(t,e,r,i[r],!0,s,a)}else if(void 0!==n&&(o=!0,ot.isFunction(n)||(a=!0),c&&(a?(e.call(t,n),e=null):(c=e,e=function(t,e,i){return c.call(ot(t),i)})),e))for(;r<l;r++)e(t[r],i,a?n:n.call(t[r],r,e(t[r],i)));return o?t:c?e.call(t):l?e(t[0],i):s},wt=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType};r.uid=1,r.prototype={register:function(t,e){var i=e||{};return t.nodeType?t[this.expando]=i:Object.defineProperty(t,this.expando,{value:i,writable:!0,configurable:!0}),t[this.expando]},cache:function(t){if(!wt(t))return{};var e=t[this.expando];return e||(e={},wt(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[e]=i;else for(n in e)o[n]=e[n];return o},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][e]},access:function(t,e,i){var n;return void 0===e||e&&"string"==typeof e&&void 0===i?(n=this.get(t,e),void 0!==n?n:this.get(t,ot.camelCase(e))):(this.set(t,e,i),void 0!==i?i:e)},remove:function(t,e){var i,n,o,s=t[this.expando];if(void 0!==s){if(void 0===e)this.register(t);else{ot.isArray(e)?n=e.concat(e.map(ot.camelCase)):(o=ot.camelCase(e),e in s?n=[e,o]:(n=o,n=n in s?[n]:n.match(vt)||[])),i=n.length;for(;i--;)delete s[n[i]]}(void 0===e||ot.isEmptyObject(s))&&(t.nodeType?t[this.expando]=void 0:delete t[this.expando])}},hasData:function(t){var e=t[this.expando];return void 0!==e&&!ot.isEmptyObject(e)}};var xt=new r,St=new r,At=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Tt=/[A-Z]/g;ot.extend({hasData:function(t){return St.hasData(t)||xt.hasData(t)},data:function(t,e,i){return St.access(t,e,i)},removeData:function(t,e){St.remove(t,e)},_data:function(t,e,i){return xt.access(t,e,i)},_removeData:function(t,e){xt.remove(t,e)}}),ot.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=St.get(s),1===s.nodeType&&!xt.get(s,"hasDataAttrs"))){for(i=a.length;i--;)a[i]&&(n=a[i].name,0===n.indexOf("data-")&&(n=ot.camelCase(n.slice(5)),l(s,n,o[n])));xt.set(s,"hasDataAttrs",!0)}return o}return"object"==typeof t?this.each(function(){St.set(this,t)}):yt(this,function(e){var i,n;if(s&&void 0===e){if(void 0!==(i=St.get(s,t)||St.get(s,t.replace(Tt,"-$&").toLowerCase())))return i;if(n=ot.camelCase(t),void 0!==(i=St.get(s,n)))return i;if(void 0!==(i=l(s,n,void 0)))return i}else n=ot.camelCase(t),this.each(function(){var i=St.get(this,n);St.set(this,n,e),t.indexOf("-")>-1&&void 0!==i&&St.set(this,t,e)})},null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each(function(){St.remove(this,t)})}}),ot.extend({queue:function(t,e,i){var n;if(t)return e=(e||"fx")+"queue",n=xt.get(t,e),i&&(!n||ot.isArray(i)?n=xt.access(t,e,ot.makeArray(i)):n.push(i)),n||[]},dequeue:function(t,e){e=e||"fx";var i=ot.queue(t,e),n=i.length,o=i.shift(),s=ot._queueHooks(t,e),a=function(){ot.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 xt.get(t,i)||xt.access(t,i,{empty:ot.Callbacks("once memory").add(function(){xt.remove(t,[e+"queue",i])})})}}),ot.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length<i?ot.queue(this[0],t):void 0===e?this:this.each(function(){var i=ot.queue(this,t,e);ot._queueHooks(this,t),"fx"===t&&"inprogress"!==i[0]&&ot.dequeue(this,t)})},dequeue:function(t){return this.each(function(){ot.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var i,n=1,o=ot.Deferred(),s=this,a=this.length,r=function(){--n||o.resolveWith(s,[s])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";a--;)(i=xt.get(s[a],t+"queueHooks"))&&i.empty&&(n++,i.empty.add(r));return r(),o.promise(e)}});var kt=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,It=new RegExp("^(?:([+-])=|)("+kt+")([a-z%]*)$","i"),Pt=["Top","Right","Bottom","Left"],Mt=function(t,e){return t=e||t,"none"===ot.css(t,"display")||!ot.contains(t.ownerDocument,t)},Bt=/^(?:checkbox|radio)$/i,Ut=/<([\w:-]+)/,Et=/^$|\/(?:java|ecma)script/i,Vt={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,"",""]};Vt.optgroup=Vt.option,Vt.tbody=Vt.tfoot=Vt.colgroup=Vt.caption=Vt.thead,Vt.th=Vt.td;var Dt=/<|&#?\w+;/;!function(){var t=Y.createDocumentFragment(),e=t.appendChild(Y.createElement("div")),i=Y.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),e.appendChild(i),nt.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",nt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Rt=/^key/,Ft=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Lt=/^([^.]*)(?:\.(.+)|)/;ot.event={global:{},add:function(t,e,i,n,o){var s,a,r,l,c,d,h,p,m,u,g,b=xt.get(t);if(b)for(i.handler&&(s=i,i=s.handler,o=s.selector),i.guid||(i.guid=ot.guid++),(l=b.events)||(l=b.events={}),(a=b.handle)||(a=b.handle=function(e){
|
|
|
return void 0!==ot&&ot.event.triggered!==e.type?ot.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(vt)||[""],c=e.length;c--;)r=Lt.exec(e[c])||[],m=g=r[1],u=(r[2]||"").split(".").sort(),m&&(h=ot.event.special[m]||{},m=(o?h.delegateType:h.bindType)||m,h=ot.event.special[m]||{},d=ot.extend({type:m,origType:g,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&ot.expr.match.needsContext.test(o),namespace:u.join(".")},s),(p=l[m])||(p=l[m]=[],p.delegateCount=0,h.setup&&!1!==h.setup.call(t,n,u,a)||t.addEventListener&&t.addEventListener(m,a)),h.add&&(h.add.call(t,d),d.handler.guid||(d.handler.guid=i.guid)),o?p.splice(p.delegateCount++,0,d):p.push(d),ot.event.global[m]=!0)},remove:function(t,e,i,n,o){var s,a,r,l,c,d,h,p,m,u,g,b=xt.hasData(t)&&xt.get(t);if(b&&(l=b.events)){for(e=(e||"").match(vt)||[""],c=e.length;c--;)if(r=Lt.exec(e[c])||[],m=g=r[1],u=(r[2]||"").split(".").sort(),m){for(h=ot.event.special[m]||{},m=(n?h.delegateType:h.bindType)||m,p=l[m]||[],r=r[2]&&new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;s--;)d=p[s],!o&&g!==d.origType||i&&i.guid!==d.guid||r&&!r.test(d.namespace)||n&&n!==d.selector&&("**"!==n||!d.selector)||(p.splice(s,1),d.selector&&p.delegateCount--,h.remove&&h.remove.call(t,d));a&&!p.length&&(h.teardown&&!1!==h.teardown.call(t,u,b.handle)||ot.removeEvent(t,m,b.handle),delete l[m])}else for(m in l)ot.event.remove(t,m+e[c],i,n,!0);ot.isEmptyObject(l)&&xt.remove(t,"handle events")}},dispatch:function(t){t=ot.event.fix(t);var e,i,n,o,s,a=[],r=X.call(arguments),l=(xt.get(this,"events")||{})[t.type]||[],c=ot.event.special[t.type]||{};if(r[0]=t,t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){for(a=ot.event.handlers.call(this,t,l),e=0;(o=a[e++])&&!t.isPropagationStopped();)for(t.currentTarget=o.elem,i=0;(s=o.handlers[i++])&&!t.isImmediatePropagationStopped();)t.rnamespace&&!t.rnamespace.test(s.namespace)||(t.handleObj=s,t.data=s.data,void 0!==(n=((ot.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,r))&&!1===(t.result=n)&&(t.preventDefault(),t.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(t,e){var i,n,o,s,a=[],r=e.delegateCount,l=t.target;if(r&&l.nodeType&&("click"!==t.type||isNaN(t.button)||t.button<1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(!0!==l.disabled||"click"!==t.type)){for(n=[],i=0;i<r;i++)s=e[i],o=s.selector+" ",void 0===n[o]&&(n[o]=s.needsContext?ot(o,this).index(l)>-1:ot.find(o,this,null,[l]).length),n[o]&&n.push(s);n.length&&a.push({elem:l,handlers:n})}return r<e.length&&a.push({elem:this,handlers:e.slice(r)}),a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,e){var i,n,o,s=e.button;return null==t.pageX&&null!=e.clientX&&(i=t.target.ownerDocument||Y,n=i.documentElement,o=i.body,t.pageX=e.clientX+(n&&n.scrollLeft||o&&o.scrollLeft||0)-(n&&n.clientLeft||o&&o.clientLeft||0),t.pageY=e.clientY+(n&&n.scrollTop||o&&o.scrollTop||0)-(n&&n.clientTop||o&&o.clientTop||0)),t.which||void 0===s||(t.which=1&s?1:2&s?3:4&s?2:0),t}},fix:function(t){if(t[ot.expando])return t;var e,i,n,o=t.type,s=t,a=this.fixHooks[o];for(a||(this.fixHooks[o]=a=Ft.test(o)?this.mouseHooks:Rt.test(o)?this.keyHooks:{}),n=a.props?this.props.concat(a.props):this.props,t=new ot.Event(s),e=n.length;e--;)i=n[e],t[i]=s[i];return t.target||(t.target=Y),3===t.target.nodeType&&(t.target=t.target.parentNode),a.filter?a.filter(t,s):t},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==g()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===g()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&ot.nodeName(this,"input"))return this.click(),!1},_default:function(t){return ot.nodeName(t.target,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}}},ot.removeEvent=function(t,e,i){t.removeEventListener&&t.removeEventListener(e,i)},ot.Event=function(t,e){if(!(this instanceof ot.Event))return new ot.Event(t,e);t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&!1===t.returnValue?m:u):this.type=t,e&&ot.extend(this,e),this.timeStamp=t&&t.timeStamp||ot.now(),this[ot.expando]=!0},ot.Event.prototype={constructor:ot.Event,isDefaultPrevented:u,isPropagationStopped:u,isImmediatePropagationStopped:u,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=m,t&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=m,t&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=m,t&&t.stopImmediatePropagation(),this.stopPropagation()}},ot.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){ot.event.special[t]={delegateType:e,bindType:e,handle:function(t){var i,n=this,o=t.relatedTarget,s=t.handleObj;return o&&(o===n||ot.contains(n,o))||(t.type=s.origType,i=s.handler.apply(this,arguments),t.type=e),i}}}),ot.fn.extend({on:function(t,e,i,n){return b(this,t,e,i,n)},one:function(t,e,i,n){return b(this,t,e,i,n,1)},off:function(t,e,i){var n,o;if(t&&t.preventDefault&&t.handleObj)return n=t.handleObj,ot(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=u),this.each(function(){ot.event.remove(this,t,i,e)})}});var Ht=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Nt=/<script|<style|<link/i,Ot=/checked\s*(?:[^=]|=\s*.checked.)/i,zt=/^true\/(.*)/,$t=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;ot.extend({htmlPrefilter:function(t){return t.replace(Ht,"<$1></$2>")},clone:function(t,e,i){var n,o,s,a,r=t.cloneNode(!0),l=ot.contains(t.ownerDocument,t);if(!(nt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ot.isXMLDoc(t)))for(a=d(r),s=d(t),n=0,o=s.length;n<o;n++)y(s[n],a[n]);if(e)if(i)for(s=s||d(t),a=a||d(r),n=0,o=s.length;n<o;n++)_(s[n],a[n]);else _(t,r);return a=d(r,"script"),a.length>0&&h(a,!l&&d(t,"script")),r},cleanData:function(t){for(var e,i,n,o=ot.event.special,s=0;void 0!==(i=t[s]);s++)if(wt(i)){if(e=i[xt.expando]){if(e.events)for(n in e.events)o[n]?ot.event.remove(i,n):ot.removeEvent(i,n,e.handle);i[xt.expando]=void 0}i[St.expando]&&(i[St.expando]=void 0)}}}),ot.fn.extend({domManip:w,detach:function(t){return x(this,t,!0)},remove:function(t){return x(this,t)},text:function(t){return yt(this,function(t){return void 0===t?ot.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 w(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){f(this,t).appendChild(t)}})},prepend:function(){return w(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=f(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return w(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return w(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&&(ot.cleanData(d(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return ot.clone(this,t,e)})},html:function(t){return yt(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&&!Nt.test(t)&&!Vt[(Ut.exec(t)||["",""])[1].toLowerCase()]){t=ot.htmlPrefilter(t);try{for(;i<n;i++)e=this[i]||{},1===e.nodeType&&(ot.cleanData(d(e,!1)),e.innerHTML=t);e=0}catch(t){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=[];return w(this,arguments,function(e){var i=this.parentNode;ot.inArray(this,t)<0&&(ot.cleanData(d(this)),i&&i.replaceChild(e,this))},t)}}),ot.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){ot.fn[t]=function(t){for(var i,n=[],o=ot(t),s=o.length-1,a=0;a<=s;a++)i=a===s?this:this.clone(!0),ot(o[a])[e](i),Z.apply(n,i.get());return this.pushStack(n)}});var Wt,Gt={HTML:"block",BODY:"block"},jt=/^margin/,qt=new RegExp("^("+kt+")(?!px)[a-z%]+$","i"),Kt=function(e){var i=e.ownerDocument.defaultView;return i&&i.opener||(i=t),i.getComputedStyle(e)},Yt=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},Xt=Y.documentElement;!function(){function e(){r.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",r.innerHTML="",Xt.appendChild(a);var e=t.getComputedStyle(r);i="1%"!==e.top,s="2px"===e.marginLeft,n="4px"===e.width,r.style.marginRight="50%",o="4px"===e.marginRight,Xt.removeChild(a)}var i,n,o,s,a=Y.createElement("div"),r=Y.createElement("div");r.style&&(r.style.backgroundClip="content-box",r.cloneNode(!0).style.backgroundClip="",nt.clearCloneStyle="content-box"===r.style.backgroundClip,a.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.appendChild(r),ot.extend(nt,{pixelPosition:function(){return e(),i},boxSizingReliable:function(){return null==n&&e(),n},pixelMarginRight:function(){return null==n&&e(),o},reliableMarginLeft:function(){return null==n&&e(),s},reliableMarginRight:function(){var e,i=r.appendChild(Y.createElement("div"));return i.style.cssText=r.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",r.style.width="1px",Xt.appendChild(a),e=!parseFloat(t.getComputedStyle(i).marginRight),Xt.removeChild(a),r.removeChild(i),e}}))}();var Jt=/^(none|table(?!-c[ea]).+)/,Zt={position:"absolute",visibility:"hidden",display:"block"},Qt={letterSpacing:"0",fontWeight:"400"},te=["Webkit","O","Moz","ms"],ee=Y.createElement("div").style;ot.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=T(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,r=ot.camelCase(e),l=t.style;if(e=ot.cssProps[r]||(ot.cssProps[r]=I(r)||r),a=ot.cssHooks[e]||ot.cssHooks[r],void 0===i)return a&&"get"in a&&void 0!==(o=a.get(t,!1,n))?o:l[e];s=typeof i,"string"===s&&(o=It.exec(i))&&o[1]&&(i=c(t,e,o),s="number"),null!=i&&i===i&&("number"===s&&(i+=o&&o[3]||(ot.cssNumber[r]?"":"px")),nt.clearCloneStyle||""!==i||0!==e.indexOf("background")||(l[e]="inherit"),a&&"set"in a&&void 0===(i=a.set(t,i,n))||(l[e]=i))}},css:function(t,e,i,n){var o,s,a,r=ot.camelCase(e);return e=ot.cssProps[r]||(ot.cssProps[r]=I(r)||r),a=ot.cssHooks[e]||ot.cssHooks[r],a&&"get"in a&&(o=a.get(t,!0,i)),void 0===o&&(o=T(t,e,n)),"normal"===o&&e in Qt&&(o=Qt[e]),""===i||i?(s=parseFloat(o),!0===i||isFinite(s)?s||0:o):o}}),ot.each(["height","width"],function(t,e){ot.cssHooks[e]={get:function(t,i,n){if(i)return Jt.test(ot.css(t,"display"))&&0===t.offsetWidth?Yt(t,Zt,function(){return B(t,e,n)}):B(t,e,n)},set:function(t,i,n){var o,s=n&&Kt(t),a=n&&M(t,e,n,"border-box"===ot.css(t,"boxSizing",!1,s),s);return a&&(o=It.exec(i))&&"px"!==(o[3]||"px")&&(t.style[e]=i,i=ot.css(t,e)),P(t,i,a)}}}),ot.cssHooks.marginLeft=k(nt.reliableMarginLeft,function(t,e){if(e)return(parseFloat(T(t,"marginLeft"))||t.getBoundingClientRect().left-Yt(t,{marginLeft:0},function(){return t.getBoundingClientRect().left}))+"px"}),ot.cssHooks.marginRight=k(nt.reliableMarginRight,function(t,e){if(e)return Yt(t,{display:"inline-block"},T,[t,"marginRight"])}),ot.each({margin:"",padding:"",border:"Width"},function(t,e){ot.cssHooks[t+e]={expand:function(i){for(var n=0,o={},s="string"==typeof i?i.split(" "):[i];n<4;n++)o[t+Pt[n]+e]=s[n]||s[n-2]||s[0];return o}},jt.test(t)||(ot.cssHooks[t+e].set=P)}),ot.fn.extend({css:function(t,e){return yt(this,function(t,e,i){var n,o,s={},a=0;if(ot.isArray(e)){for(n=Kt(t),o=e.length;a<o;a++)s[e[a]]=ot.css(t,e[a],!1,n);return s}return void 0!==i?ot.style(t,e,i):ot.css(t,e)},t,e,arguments.length>1)},show:function(){return U(this,!0)},hide:function(){return U(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Mt(this)?ot(this).show():ot(this).hide()})}}),ot.Tween=E,E.prototype={constructor:E,init:function(t,e,i,n,o,s){this.elem=t,this.prop=i,this.easing=o||ot.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(ot.cssNumber[i]?"":"px")},cur:function(){var t=E.propHooks[this.prop];return t&&t.get?t.get(this):E.propHooks._default.get(this)},run:function(t){var e,i=E.propHooks[this.prop];return this.options.duration?this.pos=e=ot.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):E.propHooks._default.set(this),this}},E.prototype.init.prototype=E.prototype,E.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=ot.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){ot.fx.step[t.prop]?ot.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[ot.cssProps[t.prop]]&&!ot.cssHooks[t.prop]?t.elem[t.prop]=t.now:ot.style(t.elem,t.prop,t.now+t.unit)}}},E.propHooks.scrollTop=E.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ot.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},ot.fx=E.prototype.init,ot.fx.step={};var ie,ne,oe=/^(?:toggle|show|hide)$/,se=/queueHooks$/;ot.Animation=ot.extend(H,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return c(i.elem,t,It.exec(e),i),i}]},tweener:function(t,e){ot.isFunction(t)?(e=t,t=["*"]):t=t.match(vt);for(var i,n=0,o=t.length;n<o;n++)i=t[n],H.tweeners[i]=H.tweeners[i]||[],H.tweeners[i].unshift(e)},prefilters:[F],prefilter:function(t,e){e?H.prefilters.unshift(t):H.prefilters.push(t)}}),ot.speed=function(t,e,i){var n=t&&"object"==typeof t?ot.extend({},t):{complete:i||!i&&e||ot.isFunction(t)&&t,duration:t,easing:i&&e||e&&!ot.isFunction(e)&&e};return n.duration=ot.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in ot.fx.speeds?ot.fx.speeds[n.duration]:ot.fx.speeds._default,null!=n.queue&&!0!==n.queue||(n.queue="fx"),n.old=n.complete,n.complete=function(){ot.isFunction(n.old)&&n.old.call(this),n.queue&&ot.dequeue(this,n.queue)},n},ot.fn.extend({fadeTo:function(t,e,i,n){return this.filter(Mt).css("opacity",0).show().end().animate({opacity:e},t,i,n)},animate:function(t,e,i,n){var o=ot.isEmptyObject(t),s=ot.speed(e,i,n),a=function(){var e=H(this,ot.extend({},t),s);(o||xt.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=ot.timers,a=xt.get(this);if(o)a[o]&&a[o].stop&&n(a[o]);else for(o in a)a[o]&&a[o].stop&&se.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||ot.dequeue(this,t)})},finish:function(t){return!1!==t&&(t=t||"fx"),this.each(function(){var e,i=xt.get(this),n=i[t+"queue"],o=i[t+"queueHooks"],s=ot.timers,a=n?n.length:0;for(i.finish=!0,ot.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})}}),ot.each(["toggle","show","hide"],function(t,e){var i=ot.fn[e];ot.fn[e]=function(t,n,o){return null==t||"boolean"==typeof t?i.apply(this,arguments):this.animate(D(e,!0),t,n,o)}}),ot.each({slideDown:D("show"),slideUp:D("hide"),slideToggle:D("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){ot.fn[t]=function(t,i,n){return this.animate(e,t,i,n)}}),ot.timers=[],ot.fx.tick=function(){var t,e=0,i=ot.timers;for(ie=ot.now();e<i.length;e++)(t=i[e])()||i[e]!==t||i.splice(e--,1);i.length||ot.fx.stop(),ie=void 0},ot.fx.timer=function(t){ot.timers.push(t),t()?ot.fx.start():ot.timers.pop()},ot.fx.interval=13,ot.fx.start=function(){ne||(ne=t.setInterval(ot.fx.tick,ot.fx.interval))},ot.fx.stop=function(){t.clearInterval(ne),ne=null},ot.fx.speeds={slow:600,fast:200,_default:400},ot.fn.delay=function(e,i){return e=ot.fx?ot.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=Y.createElement("input"),e=Y.createElement("select"),i=e.appendChild(Y.createElement("option"));t.type="checkbox",nt.checkOn=""!==t.value,nt.optSelected=i.selected,e.disabled=!0,nt.optDisabled=!i.disabled,t=Y.createElement("input"),t.value="t",t.type="radio",nt.radioValue="t"===t.value}();var ae,re=ot.expr.attrHandle;ot.fn.extend({attr:function(t,e){return yt(this,ot.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){ot.removeAttr(this,t)})}}),ot.extend({attr:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?ot.prop(t,e,i):(1===s&&ot.isXMLDoc(t)||(e=e.toLowerCase(),o=ot.attrHooks[e]||(ot.expr.match.bool.test(e)?ae:void 0)),void 0!==i?null===i?void ot.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=ot.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!nt.radioValue&&"radio"===e&&ot.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n,o=0,s=e&&e.match(vt);if(s&&1===t.nodeType)for(;i=s[o++];)n=ot.propFix[i]||i,ot.expr.match.bool.test(i)&&(t[n]=!1),t.removeAttribute(i)}}),ae={set:function(t,e,i){return!1===e?ot.removeAttr(t,i):t.setAttribute(i,i),i}},ot.each(ot.expr.match.bool.source.match(/\w+/g),function(t,e){var i=re[e]||ot.find.attr;re[e]=function(t,e,n){var o,s;return n||(s=re[e],re[e]=o,o=null!=i(t,e,n)?e.toLowerCase():null,re[e]=s),o}});var le=/^(?:input|select|textarea|button)$/i,ce=/^(?:a|area)$/i;ot.fn.extend({prop:function(t,e){return yt(this,ot.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[ot.propFix[t]||t]})}}),ot.extend({prop:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&ot.isXMLDoc(t)||(e=ot.propFix[e]||e,o=ot.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=ot.find.attr(t,"tabindex");return e?parseInt(e,10):le.test(t.nodeName)||ce.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),nt.optSelected||(ot.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)}}),ot.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ot.propFix[this.toLowerCase()]=this});var de=/[\t\r\n\f]/g;ot.fn.extend({addClass:function(t){var e,i,n,o,s,a,r,l=0;if(ot.isFunction(t))return this.each(function(e){ot(this).addClass(t.call(this,e,N(this)))});if("string"==typeof t&&t)for(e=t.match(vt)||[];i=this[l++];)if(o=N(i),n=1===i.nodeType&&(" "+o+" ").replace(de," ")){for(a=0;s=e[a++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");r=ot.trim(n),o!==r&&i.setAttribute("class",r)}return this},removeClass:function(t){var e,i,n,o,s,a,r,l=0;if(ot.isFunction(t))return this.each(function(e){ot(this).removeClass(t.call(this,e,N(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(vt)||[];i=this[l++];)if(o=N(i),n=1===i.nodeType&&(" "+o+" ").replace(de," ")){for(a=0;s=e[a++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");r=ot.trim(n),o!==r&&i.setAttribute("class",r)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):ot.isFunction(t)?this.each(function(i){ot(this).toggleClass(t.call(this,i,N(this),e),e)}):this.each(function(){var e,n,o,s;if("string"===i)for(n=0,o=ot(this),s=t.match(vt)||[];e=s[n++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==i||(e=N(this),e&&xt.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":xt.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+N(i)+" ").replace(de," ").indexOf(e)>-1)return!0;return!1}});var he=/\r/g,pe=/[\x20\t\r\n\f]+/g;ot.fn.extend({val:function(t){var e,i,n,o=this[0];{if(arguments.length)return n=ot.isFunction(t),this.each(function(i){var o;1===this.nodeType&&(o=n?t.call(this,i,ot(this).val()):t,null==o?o="":"number"==typeof o?o+="":ot.isArray(o)&&(o=ot.map(o,function(t){return null==t?"":t+""})),(e=ot.valHooks[this.type]||ot.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return(e=ot.valHooks[o.type]||ot.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(o,"value"))?i:(i=o.value,"string"==typeof i?i.replace(he,""):null==i?"":i)}}}),ot.extend({valHooks:{option:{get:function(t){var e=ot.find.attr(t,"value");return null!=e?e:ot.trim(ot.text(t)).replace(pe," ")}},select:{get:function(t){for(var e,i,n=t.options,o=t.selectedIndex,s="select-one"===t.type||o<0,a=s?null:[],r=s?o+1:n.length,l=o<0?r:s?o:0;l<r;l++)if(i=n[l],(i.selected||l===o)&&(nt.optDisabled?!i.disabled:null===i.getAttribute("disabled"))&&(!i.parentNode.disabled||!ot.nodeName(i.parentNode,"optgroup"))){if(e=ot(i).val(),s)return e;a.push(e)}return a},set:function(t,e){for(var i,n,o=t.options,s=ot.makeArray(e),a=o.length;a--;)n=o[a],(n.selected=ot.inArray(ot.valHooks.option.get(n),s)>-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),ot.each(["radio","checkbox"],function(){ot.valHooks[this]={set:function(t,e){if(ot.isArray(e))return t.checked=ot.inArray(ot(t).val(),e)>-1}},nt.checkOn||(ot.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var me=/^(?:focusinfocus|focusoutblur)$/;ot.extend(ot.event,{trigger:function(e,i,n,o){var s,a,r,l,c,d,h,p=[n||Y],m=it.call(e,"type")?e.type:e,u=it.call(e,"namespace")?e.namespace.split("."):[];if(a=r=n=n||Y,3!==n.nodeType&&8!==n.nodeType&&!me.test(m+ot.event.triggered)&&(m.indexOf(".")>-1&&(u=m.split("."),m=u.shift(),u.sort()),c=m.indexOf(":")<0&&"on"+m,e=e[ot.expando]?e:new ot.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]:ot.makeArray(i,[e]),h=ot.event.special[m]||{},o||!h.trigger||!1!==h.trigger.apply(n,i))){if(!o&&!h.noBubble&&!ot.isWindow(n)){for(l=h.delegateType||m,me.test(l+m)||(a=a.parentNode);a;a=a.parentNode)p.push(a),r=a;r===(n.ownerDocument||Y)&&p.push(r.defaultView||r.parentWindow||t)}for(s=0;(a=p[s++])&&!e.isPropagationStopped();)e.type=s>1?l:h.bindType||m,d=(xt.get(a,"events")||{})[e.type]&&xt.get(a,"handle"),d&&d.apply(a,i),(d=c&&a[c])&&d.apply&&wt(a)&&(e.result=d.apply(a,i),!1===e.result&&e.preventDefault());return e.type=m,o||e.isDefaultPrevented()||h._default&&!1!==h._default.apply(p.pop(),i)||!wt(n)||c&&ot.isFunction(n[m])&&!ot.isWindow(n)&&(r=n[c],r&&(n[c]=null),ot.event.triggered=m,n[m](),ot.event.triggered=void 0,r&&(n[c]=r)),e.result}},simulate:function(t,e,i){var n=ot.extend(new ot.Event,i,{type:t,isSimulated:!0});ot.event.trigger(n,null,e),n.isDefaultPrevented()&&i.preventDefault()}}),ot.fn.extend({trigger:function(t,e){return this.each(function(){ot.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return ot.event.trigger(t,e,i,!0)}}),ot.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){ot.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),ot.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),nt.focusin="onfocusin"in t,nt.focusin||ot.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){ot.event.simulate(e,t.target,ot.event.fix(t))};ot.event.special[e]={setup:function(){var n=this.ownerDocument||this,o=xt.access(n,e);o||n.addEventListener(t,i,!0),xt.access(n,e,(o||0)+1)},teardown:function(){var n=this.ownerDocument||this,o=xt.access(n,e)-1;o?xt.access(n,e,o):(n.removeEventListener(t,i,!0),xt.remove(n,e))}}});var ue=t.location,ge=ot.now(),be=/\?/;ot.parseJSON=function(t){return JSON.parse(t+"")},ot.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||ot.error("Invalid XML: "+e),i};var fe=/#.*$/,Ce=/([?&])_=[^&]*/,ve=/^(.*?):[ \t]*([^\r\n]*)$/gm,_e=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ye=/^(?:GET|HEAD)$/,we=/^\/\//,xe={},Se={},Ae="*/".concat("*"),Te=Y.createElement("a");Te.href=ue.href,ot.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ue.href,type:"GET",isLocal:_e.test(ue.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ae,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":ot.parseJSON,"text xml":ot.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?$($(t,ot.ajaxSettings),e):$(ot.ajaxSettings,t)},ajaxPrefilter:O(xe),ajaxTransport:O(Se),ajax:function(e,i){function n(e,i,n,r){var c,h,C,v,y,x=i;2!==_&&(_=2,l&&t.clearTimeout(l),o=void 0,a=r||"",w.readyState=e>0?4:0,c=e>=200&&e<300||304===e,n&&(v=W(p,w,n)),v=G(p,v,w,c),c?(p.ifModified&&(y=w.getResponseHeader("Last-Modified"),y&&(ot.lastModified[s]=y),(y=w.getResponseHeader("etag"))&&(ot.etag[s]=y)),204===e||"HEAD"===p.type?x="nocontent":304===e?x="notmodified":(x=v.state,h=v.data,C=v.error,c=!C)):(C=x,!e&&x||(x="error",e<0&&(e=0))),w.status=e,w.statusText=(i||x)+"",c?g.resolveWith(m,[h,x,w]):g.rejectWith(m,[w,x,C]),w.statusCode(f),f=void 0,d&&u.trigger(c?"ajaxSuccess":"ajaxError",[w,p,c?h:C]),b.fireWith(m,[w,x]),d&&(u.trigger("ajaxComplete",[w,p]),--ot.active||ot.event.trigger("ajaxStop")))}"object"==typeof e&&(i=e,e=void 0),i=i||{};var o,s,a,r,l,c,d,h,p=ot.ajaxSetup({},i),m=p.context||p,u=p.context&&(m.nodeType||m.jquery)?ot(m):ot.event,g=ot.Deferred(),b=ot.Callbacks("once memory"),f=p.statusCode||{},C={},v={},_=0,y="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(2===_){if(!r)for(r={};e=ve.exec(a);)r[e[1].toLowerCase()]=e[2];e=r[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===_?a:null},setRequestHeader:function(t,e){var i=t.toLowerCase();return _||(t=v[i]=v[i]||t,C[t]=e),this},overrideMimeType:function(t){return _||(p.mimeType=t),this},statusCode:function(t){var e;if(t)if(_<2)for(e in t)f[e]=[f[e],t[e]];else w.always(t[w.status]);return this},abort:function(t){var e=t||y;return o&&o.abort(e),n(0,e),this}};if(g.promise(w).complete=b.add,w.success=w.done,w.error=w.fail,p.url=((e||p.url||ue.href)+"").replace(fe,"").replace(we,ue.protocol+"//"),p.type=i.method||i.type||p.method||p.type,p.dataTypes=ot.trim(p.dataType||"*").toLowerCase().match(vt)||[""],null==p.crossDomain){c=Y.createElement("a");try{c.href=p.url,c.href=c.href,p.crossDomain=Te.protocol+"//"+Te.host!=c.protocol+"//"+c.host}catch(t){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=ot.param(p.data,p.traditional)),z(xe,p,i,w),2===_)return w;d=ot.event&&p.global,d&&0==ot.active++&&ot.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!ye.test(p.type),s=p.url,p.hasContent||(p.data&&(s=p.url+=(be.test(s)?"&":"?")+p.data,delete p.data),!1===p.cache&&(p.url=Ce.test(s)?s.replace(Ce,"$1_="+ge++):s+(be.test(s)?"&":"?")+"_="+ge++)),p.ifModified&&(ot.lastModified[s]&&w.setRequestHeader("If-Modified-Since",ot.lastModified[s]),ot.etag[s]&&w.setRequestHeader("If-None-Match",ot.etag[s])),(p.data&&p.hasContent&&!1!==p.contentType||i.contentType)&&w.setRequestHeader("Content-Type",p.contentType),w.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Ae+"; q=0.01":""):p.accepts["*"]);for(h in p.headers)w.setRequestHeader(h,p.headers[h]);if(p.beforeSend&&(!1===p.beforeSend.call(m,w,p)||2===_))return w.abort();y="abort";for(h in{success:1,error:1,complete:1})w[h](p[h]);if(o=z(Se,p,i,w)){if(w.readyState=1,d&&u.trigger("ajaxSend",[w,p]),2===_)return w;p.async&&p.timeout>0&&(l=t.setTimeout(function(){w.abort("timeout")},p.timeout));try{_=1,o.send(C,n)}catch(t){if(!(_<2))throw t;n(-1,t)}}else n(-1,"No Transport");return w},getJSON:function(t,e,i){return ot.get(t,e,i,"json")},getScript:function(t,e){return ot.get(t,void 0,e,"script")}}),ot.each(["get","post"],function(t,e){ot[e]=function(t,i,n,o){return ot.isFunction(i)&&(o=o||n,n=i,i=void 0),ot.ajax(ot.extend({url:t,type:e,dataType:o,data:i,success:n},ot.isPlainObject(t)&&t))}}),ot._evalUrl=function(t){return ot.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},ot.fn.extend({wrapAll:function(t){var e;return ot.isFunction(t)?this.each(function(e){ot(this).wrapAll(t.call(this,e))}):(this[0]&&(e=ot(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 ot.isFunction(t)?this.each(function(e){ot(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ot(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=ot.isFunction(t);return this.each(function(i){ot(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){ot.nodeName(this,"body")||ot(this).replaceWith(this.childNodes)}).end()}}),ot.expr.filters.hidden=function(t){return!ot.expr.filters.visible(t)},ot.expr.filters.visible=function(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0};var ke=/%20/g,Ie=/\[\]$/,Pe=/\r?\n/g,Me=/^(?:submit|button|image|reset|file)$/i,Be=/^(?:input|select|textarea|keygen)/i;ot.param=function(t,e){var i,n=[],o=function(t,e){e=ot.isFunction(e)?e():null==e?"":e,n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=ot.ajaxSettings&&ot.ajaxSettings.traditional),
|
|
|
ot.isArray(t)||t.jquery&&!ot.isPlainObject(t))ot.each(t,function(){o(this.name,this.value)});else for(i in t)j(i,t[i],e,o);return n.join("&").replace(ke,"+")},ot.fn.extend({serialize:function(){return ot.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ot.prop(this,"elements");return t?ot.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ot(this).is(":disabled")&&Be.test(this.nodeName)&&!Me.test(t)&&(this.checked||!Bt.test(t))}).map(function(t,e){var i=ot(this).val();return null==i?null:ot.isArray(i)?ot.map(i,function(t){return{name:e.name,value:t.replace(Pe,"\r\n")}}):{name:e.name,value:i.replace(Pe,"\r\n")}}).get()}}),ot.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var Ue={0:200,1223:204},Ee=ot.ajaxSettings.xhr();nt.cors=!!Ee&&"withCredentials"in Ee,nt.ajax=Ee=!!Ee,ot.ajaxTransport(function(e){var i,n;if(nt.cors||Ee&&!e.crossDomain)return{send:function(o,s){var a,r=e.xhr();if(r.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)r[a]=e.xhrFields[a];e.mimeType&&r.overrideMimeType&&r.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)r.setRequestHeader(a,o[a]);i=function(t){return function(){i&&(i=n=r.onload=r.onerror=r.onabort=r.onreadystatechange=null,"abort"===t?r.abort():"error"===t?"number"!=typeof r.status?s(0,"error"):s(r.status,r.statusText):s(Ue[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=i(),n=r.onerror=i("error"),void 0!==r.onabort?r.onabort=n:r.onreadystatechange=function(){4===r.readyState&&t.setTimeout(function(){i&&n()})},i=i("abort");try{r.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}}),ot.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return ot.globalEval(t),t}}}),ot.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ot.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,o){e=ot("<script>").prop({charset:t.scriptCharset,src:t.url}).on("load error",i=function(t){e.remove(),i=null,t&&o("error"===t.type?404:200,t.type)}),Y.head.appendChild(e[0])},abort:function(){i&&i()}}}});var Ve=[],De=/(=)\?(?=&|$)|\?\?/;ot.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Ve.pop()||ot.expando+"_"+ge++;return this[t]=!0,t}}),ot.ajaxPrefilter("json jsonp",function(e,i,n){var o,s,a,r=!1!==e.jsonp&&(De.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&De.test(e.data)&&"data");if(r||"jsonp"===e.dataTypes[0])return o=e.jsonpCallback=ot.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,r?e[r]=e[r].replace(De,"$1"+o):!1!==e.jsonp&&(e.url+=(be.test(e.url)?"&":"?")+e.jsonp+"="+o),e.converters["script json"]=function(){return a||ot.error(o+" was not called"),a[0]},e.dataTypes[0]="json",s=t[o],t[o]=function(){a=arguments},n.always(function(){void 0===s?ot(t).removeProp(o):t[o]=s,e[o]&&(e.jsonpCallback=i.jsonpCallback,Ve.push(o)),a&&ot.isFunction(s)&&s(a[0]),a=s=void 0}),"script"}),ot.parseHTML=function(t,e,i){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(i=e,e=!1),e=e||Y;var n=mt.exec(t),o=!i&&[];return n?[e.createElement(n[1])]:(n=p([t],e,o),o&&o.length&&ot(o).remove(),ot.merge([],n.childNodes))};var Re=ot.fn.load;ot.fn.load=function(t,e,i){if("string"!=typeof t&&Re)return Re.apply(this,arguments);var n,o,s,a=this,r=t.indexOf(" ");return r>-1&&(n=ot.trim(t.slice(r)),t=t.slice(0,r)),ot.isFunction(e)?(i=e,e=void 0):e&&"object"==typeof e&&(o="POST"),a.length>0&&ot.ajax({url:t,type:o||"GET",dataType:"html",data:e}).done(function(t){s=arguments,a.html(n?ot("<div>").append(ot.parseHTML(t)).find(n):t)}).always(i&&function(t,e){a.each(function(){i.apply(this,s||[t.responseText,e,t])})}),this},ot.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){ot.fn[e]=function(t){return this.on(e,t)}}),ot.expr.filters.animated=function(t){return ot.grep(ot.timers,function(e){return t===e.elem}).length},ot.offset={setOffset:function(t,e,i){var n,o,s,a,r,l,c,d=ot.css(t,"position"),h=ot(t),p={};"static"===d&&(t.style.position="relative"),r=h.offset(),s=ot.css(t,"top"),l=ot.css(t,"left"),c=("absolute"===d||"fixed"===d)&&(s+l).indexOf("auto")>-1,c?(n=h.position(),a=n.top,o=n.left):(a=parseFloat(s)||0,o=parseFloat(l)||0),ot.isFunction(e)&&(e=e.call(t,i,ot.extend({},r))),null!=e.top&&(p.top=e.top-r.top+a),null!=e.left&&(p.left=e.left-r.left+o),"using"in e?e.using.call(t,p):h.css(p)}},ot.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ot.offset.setOffset(this,t,e)});var e,i,n=this[0],o={top:0,left:0},s=n&&n.ownerDocument;if(s)return e=s.documentElement,ot.contains(e,n)?(o=n.getBoundingClientRect(),i=q(s),{top:o.top+i.pageYOffset-e.clientTop,left:o.left+i.pageXOffset-e.clientLeft}):o},position:function(){if(this[0]){var t,e,i=this[0],n={top:0,left:0};return"fixed"===ot.css(i,"position")?e=i.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),ot.nodeName(t[0],"html")||(n=t.offset()),n.top+=ot.css(t[0],"borderTopWidth",!0),n.left+=ot.css(t[0],"borderLeftWidth",!0)),{top:e.top-n.top-ot.css(i,"marginTop",!0),left:e.left-n.left-ot.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===ot.css(t,"position");)t=t.offsetParent;return t||Xt})}}),ot.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var i="pageYOffset"===e;ot.fn[t]=function(n){return yt(this,function(t,n,o){var s=q(t);if(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)}}),ot.each(["top","left"],function(t,e){ot.cssHooks[e]=k(nt.pixelPosition,function(t,i){if(i)return i=T(t,e),qt.test(i)?ot(t).position()[e]+"px":i})}),ot.each({Height:"height",Width:"width"},function(t,e){ot.each({padding:"inner"+t,content:e,"":"outer"+t},function(i,n){ot.fn[n]=function(n,o){var s=arguments.length&&(i||"boolean"!=typeof n),a=i||(!0===n||!0===o?"margin":"border");return yt(this,function(e,i,n){var o;return ot.isWindow(e)?e.document.documentElement["client"+t]:9===e.nodeType?(o=e.documentElement,Math.max(e.body["scroll"+t],o["scroll"+t],e.body["offset"+t],o["offset"+t],o["client"+t])):void 0===n?ot.css(e,i,a):ot.style(e,i,n,a)},e,s?n:void 0,s,null)}})}),ot.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)},size:function(){return this.length}}),ot.fn.andSelf=ot.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return ot});var Fe=t.jQuery,Le=t.$;return ot.noConflict=function(e){return t.$===ot&&(t.$=Le),e&&t.jQuery===ot&&(t.jQuery=Fe),ot},e||(t.jQuery=t.$=ot),ot}),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 l(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(!l(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,r,c,d,h,p;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i)return this._events={},this;for(r=t?[t]:s.keys(this._events),c=0,d=r.length;c<d;c++)if(t=r[c],a=this._events[t]){if(this._events[t]=n=[],e||i)for(h=0,p=a.length;h<p;h++)o=a[h],(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(!l(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}},r=/\s+/,l=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(r.test(i)){for(var s=i.split(r),a=0,l=s.length;a<l;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],r=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,r);return;default:for(;++n<o;)(i=t[n]).callback.apply(i.ctx,e)}},d={listenTo:"on",listenToOnce:"once"};s.each(d,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 h=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(h.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,r,l,c,d,h;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,l=i.silent,r=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=s.clone(this.attributes),this.changed={}),h=this.attributes,d=this._previousAttributes,this.idAttribute in o&&(this.id=o[this.idAttribute]);for(n in o)e=o[n],s.isEqual(h[n],e)||r.push(n),s.isEqual(d[n],e)?delete this.changed[n]:this.changed[n]=e,a?delete h[n]:h[n]=e;if(!l){r.length&&(this._pending=!0);for(var p=0,m=r.length;p<m;p++)this.trigger("change:"+r[p],this,h[r[p]],i)}if(c)return this;if(!l)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,r=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({},r,n)),void 0===i.parse&&(i.parse=!0);var l=this,c=i.success;return i.success=function(t){l.attributes=r;var e=l.parse(t,i);if(i.wait&&(e=s.extend(n||{},e)),s.isObject(e)&&!l.set(e,i))return!1;c&&c(l,t,i),l.trigger("sync",l,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=r),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")||D();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){h.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:h,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,r;for(n=0,o=t.length;n<o;n++)(r=t[n]=this.get(t[n]))&&(delete this._byId[r.id],delete this._byId[r.cid],a=this.indexOf(r),this.models.splice(a,1),this.length--,e.silent||(e.index=a,r.trigger("remove",r,this,e)),this._removeReference(r));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,r,l,c,d,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,w=e.remove,x=!(g||!_||!w)&&[];for(n=0,o=t.length;n<o;n++){if(l=t[n],a=l instanceof h?r=l:l[m.prototype.idAttribute],c=this.get(a))w&&(v[c.cid]=!0),y&&(l=l===r?r.attributes:l,e.parse&&(l=c.parse(l,e)),c.set(l,e),g&&!d&&c.hasChanged(b)&&(d=!0)),t[n]=c;else if(_){if(!(r=t[n]=this._prepareModel(l,e)))continue;f.push(r),r.on("all",this._onModelEvent,this),this._byId[r.cid]=r,null!=r.id&&(this._byId[r.id]=r)}x&&x.push(c||r)}if(w){for(n=0,o=this.length;n<o;++n)v[(r=this.models[n]).cid]||C.push(r);C.length&&this.remove(C,e)}if(f.length||x&&x.length)if(g&&(d=!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{x&&(this.models.length=0);var S=x||f;for(n=0,o=S.length;n<o;n++)this.models.push(S[n])}if(d&&this.sort({silent:!0}),!e.silent){for(n=0,o=f.length;n<o;n++)(r=f[n]).trigger("add",r,this,e);(d||x&&x.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 h)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=w[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")||D()),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 r=n.beforeSend;n.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",o),r)return r.apply(this,arguments)}}"GET"===a.type||n.emulateJSON||(a.processData=!1),"PATCH"===a.type&&y&&(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=n.xhr=t.ajax(s.extend(a,n));return i.trigger("request",i,l,n),l};var y=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),w={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var x=t.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},S=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,T=/\*\w+/g,k=/[\-{}\[\]+?.,\\\^$|#\s]/g;s.extend(x.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(k,"\\$&").replace(S,"(?:$1)?").replace(A,function(t,e){return e?t:"([^/]+)"}).replace(T,"(.*?)"),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)},P=/^[#\/]|\s+$/g,M=/^\/+|\/+$/g,B=/msie [\w.]+/,U=/\/$/,E=/[?#].*$/;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(U,"");t.indexOf(i)||(t=t.slice(i.length))}else t=this.getHash();return t.replace(P,"")},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=B.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(M,"/"),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,r=a.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!r)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&r&&a.hash&&(this.fragment=this.getHash().replace(P,""),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(E,""),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 V=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};h.extend=m.extend=x.extend=C.extend=I.extend=V;var D=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,r="next"==e?"left":"right",l=this;if(s.hasClass("active"))return this.sliding=!1;var c=s[0],d=t.Event("slide.bs.carousel",{relatedTarget:c,direction:r});if(this.$element.trigger(d),!d.isDefaultPrevented()){if(this.sliding=!0,a&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=t(this.$indicators.children()[this.getItemIndex(s)]);h&&h.addClass("active")}var p=t.Event("slid.bs.carousel",{relatedTarget:c,direction:r});return t.support.transition&&this.$element.hasClass("slide")?(s.addClass(e),s[0].offsetWidth,o.addClass(r),s.addClass(r),o.one("bsTransitionEnd",function(){s.removeClass([e,r].join(" ")).addClass("active"),o.removeClass(["active",r].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(p)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)):(o.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(p)),a&&this.cycle(),this}};var n=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=i,t.fn.carousel.noConflict=function(){return t.fn.carousel=n,this};var o=function(i){var n,o=t(this),s=t(o.attr("data-target")||(n=o.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var a=t.extend({},s.data(),o.data()),r=o.attr("data-slide-to");r&&(a.interval=!1),e.call(s,a),r&&s.data("bs.carousel").to(r),i.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",o).on("click.bs.carousel.data-api","[data-slide-to]",o),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var i=t(this);e.call(i,i.data())})})}(jQuery),function(t){"use strict";function e(e){var i,n=e.attr("data-target")||(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return t(n)}function i(e){return this.each(function(){var i=t(this),o=i.data("bs.collapse"),s=t.extend({},n.DEFAULTS,i.data(),"object"==typeof e&&e);!o&&s.toggle&&/show|hide/.test(e)&&(s.toggle=!1),o||i.data("bs.collapse",o=new n(this,s)),"string"==typeof e&&o[e]()})}var n=function(e,i){this.$element=t(e),this.options=t.extend({},n.DEFAULTS,i),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};n.VERSION="3.3.7",n.TRANSITION_DURATION=350,n.DEFAULTS={toggle:!0},n.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},n.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,o=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(o&&o.length&&(e=o.data("bs.collapse"))&&e.transitioning)){var s=t.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){o&&o.length&&(i.call(o,"hide"),e||o.data("bs.collapse",null));var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var r=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return r.call(this);var l=t.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",t.proxy(r,this)).emulateTransitionEnd(n.TRANSITION_DURATION)[a](this.$element[0][l])}}}},n.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.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"),r=a?"toggle":o.data();i.call(s,r)})}(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 r={relatedTarget:this};if(s.trigger(n=t.Event("show.bs.dropdown",r)),n.isDefaultPrevented())return;o.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger(t.Event("shown.bs.dropdown",r))}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 r=o.find(".dropdown-menu li:not(.disabled):visible a");if(r.length){var l=r.index(i.target);38==i.which&&l>0&&l--,40==i.which&&l<r.length-1&&l++,~l||(l=0),r.eq(l).trigger("focus")}}}};var r=t.fn.dropdown;t.fn.dropdown=n,t.fn.dropdown.Constructor=a,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=r,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 r="hover"==a?"mouseenter":"focusin",l="hover"==a?"mouseleave":"focusout";this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+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 r="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(r);c&&(r=r.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(r).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 d=this.getPosition(),h=s[0].offsetWidth,p=s[0].offsetHeight;if(c){var m=r,u=this.getPosition(this.$viewport);r="bottom"==r&&d.bottom+p>u.bottom?"top":"top"==r&&d.top-p<u.top?"bottom":"right"==r&&d.right+h>u.width?"left":"left"==r&&d.left-h<u.left?"right":r,s.removeClass(m).addClass(r)}var g=this.getCalculatedOffset(r,d,h,p);this.applyPlacement(g,r);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),r=parseInt(n.css("margin-left"),10);isNaN(a)&&(a=0),isNaN(r)&&(r=0),e.top+=a,e.left+=r,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 l=n[0].offsetWidth,c=n[0].offsetHeight;"top"==i&&c!=s&&(e.top=e.top+s-c);var d=this.getViewportAdjustedDelta(i,e,l,c);d.left?e.left+=d.left:e.top+=d.top;var h=/top|bottom/.test(i),p=h?2*d.left-o+l:2*d.top-s+c,m=h?"offsetWidth":"offsetHeight";n.offset(e),this.replaceArrow(p,n[0][m],h)},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(),r={scroll:n?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},l=n?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},o,r,l,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 r=e.top-s-a.scroll,l=e.top+s-a.scroll+n;r<a.top?o.top=a.top-r:l>a.top+a.height&&(o.top=a.top+a.height-l)}else{var c=e.left-s,d=e.left+s+i;c<a.left?o.left=a.left-c:d>a.right&&(o.left=a.left+a.width-d)}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 r=t(n);this.activate(e.closest("li"),i),this.activate(r,r.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),r?(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"),r=o&&t.support.transition&&(a.length&&a.hasClass("fade")||!!n.find("> .fade").length);a.length&&r?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 r=null==this.affixed,l=r?o:s.top,c=r?a:e;return null!=i&&o<=i?"top":null!=n&&l+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 r=this.getState(a,e,o,s);if(this.affixed!=r){null!=this.unpin&&this.$element.css("top","");var l="affix"+(r?"-"+r:""),c=t.Event(l+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=r,this.unpin="bottom"==r?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==r&&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 r=a[e],l=n.getController(s);_.each(r,function(t){t.apply(l,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)},processMailMerge:function(t){e.trigger("processmailmerge",t)},downloadAs:function(){e.trigger("downloadas")},processMouse:function(t){e.trigger("processmouse",t)},internalCommand:function(t){e.trigger("internalcommand",t)},resetFocus:function(t){e.trigger("resetfocus",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),{ready:function(){n({event:"onReady"})},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}})},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})},collaborativeChanges:function(){n({event:"onCollaborativeChanges"})},requestRename:function(t){n({event:"onRequestRename",data:t})},metaChange:function(t){n({event:"onMetaChange",data:t})},on:function(i,n){var o=function(e,i){n.call(t,i)};e.on(i,o)}}},define("gateway",["jquery"],function(){}),void 0===Common)var Common={};if(Common.Locale=new function(){var l10n={},_createXMLHTTPObject=function(){var t;try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t||"undefined"==typeof XMLHttpRequest||(t=new XMLHttpRequest),t},_applyLocalization=function(){try{for(var t in l10n){var e=t.split(".");if(e&&e.length>2){for(var i=window,n=0;n<e.length-1;++n)void 0===i[e[n]]&&(i[e[n]]=new Object),i=i[e[n]];i&&(i[e[e.length-1]]=l10n[t])}}}catch(t){}},_get=function(prop,scope){var res="";return 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," "))};try{var langParam=_getUrlParameterByName("lang"),xhrObj=_createXMLHTTPObject();if(xhrObj&&langParam){var lang=langParam.split("-")[0];xhrObj.open("GET","locale/"+lang+".json",!1),xhrObj.send(""),l10n=eval("("+xhrObj.responseText+")")}}catch(t){}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"],r=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,c="undefined"!=typeof location&&location.href,d=c&&location.protocol&&location.protocol.replace(/\:/,""),h=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(r,"");var e=t.match(l);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,r,l=e.xdRegExp.exec(t);return!l||(s=l[2],a=l[3],a=a.split(":"),r=a[1],a=a[0],!(s&&s!==i||a&&a.toLowerCase()!==n.toLowerCase()||(r||a)&&r!==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:""),r=i.toUrl(a),l=u.useXhr||e.useXhr;if(0===r.indexOf("empty:"))return void n();!c||l(r,d,h,p)?e.get(r,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),r=a.ext?"."+a.ext:"",l=a.moduleName+r,c=n.toUrl(a.moduleName+r)+".js";e.load(l,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,l,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")),r="";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);r=String(i.toString())}finally{a.close()}e(r)}:("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,r,l={};s&&(t=t.replace(/\//g,"\\")),r=new FileUtils.File(t);try{i=n["@mozilla.org/network/file-input-stream;1"].createInstance(o.nsIFileInputStream),i.init(r,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(),l),a.close(),i.close(),e(l.value)}catch(t){throw new Error((r&&r.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,NUM_PLUS:107,NUM_MINUS:109,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,EQUALITY:187,MINUS:189},BaseView: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)switch(t.keyCode){case Common.UI.Keys.ESC:if($(".asc-loadmask").length<1)return t.preventDefault(),t.stopPropagation(),!1!==this.initConfig.closable&&("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*.9),s=Math.floor((parseInt(t)-parseInt(n))/2);this.$window.css("left",s),this.$window.css("top",o)}function n(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 o(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-parseInt(this.$window.css("left")),this.dragging.inity=t.pageY*e-parseInt(this.$window.css("top")),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-parseInt(this.$window.css("width")),this.dragging.maxy=n-parseInt(this.$window.css("height")),$(document).on("mousemove",this.binding.drag),$(document).on("mouseup",this.binding.dragStop),this.fireEvent("drag",[this,"start"])}}function s(){$(document).off("mousemove",this.binding.drag),$(document).off("mouseup",this.binding.dragStop),this.dragging.enabled=!1,this.fireEvent("drag",[this,"end"])}function a(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){Common.UI.Menu.Manager.hideAll();var e=$(t.target),i=parseInt(this.$window.css("left")),n=parseInt(this.$window.css("top"));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=parseInt(this.$window.css("width")),this.resizing.inith=parseInt(this.$window.css("height")),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,r=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+r),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-r)),$(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 l(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 c(){$(document).off("mousemove",this.binding.resize),$(document).off("mouseup",this.binding.resizeStop),$(document.body).css("cursor","auto"),this.$window.find(".resize-border").removeClass("resizing"),this.$window.find(".header").removeClass("resizing"),this.resizing.enabled=!1,this.fireEvent("resize",[this,"end"])}var d={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"),r=e.getChild(".icon"),l=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()+(l.length>0?l.height()+parseInt(l.css("margin-top")):0),r.height())),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()+(l.length>0?l.height()+parseInt(l.css("margin-top")):0),r.height())),a.height(parseInt(i.css("height"))+parseInt(o.css("height"))),e.setHeight(parseInt(a.css("height"))+parseInt(s.css("height")))),n.height()<r.height()-10&&n.css({"vertical-align":"baseline","line-height":r.height()+"px"})}function i(e){t.callback&&t.callback.call(r,e.currentTarget.attributes.result.value,!!l&&"checked"==l.getValue()),r.close(!0)}function n(t){return i({currentTarget:r.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 r=new Common.UI.Window(t),l=null;r.on({"render:after":function(t){t.getChild(".footer .dlg-btn").on("click",i),l=new Common.UI.CheckBox({el:r.$window.find(".dont-show-checkbox"),labelText:r.textDontShow}),e(t)},show:function(t){t.getChild(".footer .dlg-btn").focus()},close:function(){t.callback&&t.callback.call(r,"close")}}),r.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,d,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><% %><span class="title"><%= title %></span> </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(a,this),this.binding.dragStop=_.bind(s,this),this.binding.dragStart=_.bind(o,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))}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 r=this;return Common.NotificationCenter.on("window:close",function(){r.$window&&r.isVisible()&&r.close()}),this.fireEvent("render:after",this),this},show:function(e,o){if(this.initConfig.modal){var s=t();if(!1!==this.options.animate){var a=s.css("opacity");s.css("opacity",0),s.attr("counter",parseInt(s.attr("counter"))+1),s.show(),setTimeout(function(){s.css(n(a))},1)}else s.attr("counter",parseInt(s.attr("counter"))+1),s.show();Common.NotificationCenter.trigger("modal:show",this),this.$lastmodal=$(".asc-window.modal:not(.dethrone):visible").first().addClass("dethrone")}this.$window?this.$window.is(":visible")||(this.$window.css({opacity:0}),this.$window.show()):(this.render(),_.isNumber(e)&&_.isNumber(o)?(this.$window.css("left",Math.floor(e)),this.$window.css("top",Math.floor(o))):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),this.initConfig.modal){var i=t(),o=!0;if(i.attr("counter",parseInt(i.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),o=!(this.$lastmodal.hasClass("modal")&&this.$lastmodal.is(":visible"))),o)if(!1!==this.options.animate){var s=i.css("opacity");i.css(n(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.size()>0&&(this.$lastmodal.removeClass("dethrone"),i=!(this.$lastmodal.hasClass("modal")&&this.$lastmodal.is(":visible"))),i)if(!1!==this.options.animate){var o=e.css("opacity");e.css(n(0)),setTimeout(function(){e.css("opacity",o),parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0))},300)}else parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0));Common.NotificationCenter.trigger("modal:hide",this)}this.$window.hide(),this.$window.removeClass("notransform"),this.fireEvent("hide",this)}},isLocked:function(){return this.$window.hasClass("dethrone")||!this.options.modal&&this.$window.parent().find(".asc-window.modal:visible").length},getChild:function(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()},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: e-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: w-resize;"></div><div class="resize-border left top" style="border-top-left-radius: 5px; cursor: se-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: s-resize;"></div><div class="resize-border right top" style="border-top-right-radius: 5px; cursor: sw-resize;"></div>';this.initConfig.header&&(n+='<div class="resize-border left" style="top: 5px; height: 28px; cursor: e-resize;"></div><div class="resize-border right" style="top: 5px; height: 28px; cursor: w-resize;"></div>'),
|
|
|
this.$window.append(_.template(n)),this.binding.resize=_.bind(l,this),this.binding.resizeStop=_.bind(c,this),this.binding.resizeStart=_.bind(r,this),e&&e.length>1&&(this.initConfig.minwidth=e[0]),e&&e.length>1&&(this.initConfig.minheight=e[1]),i&&i.length>1&&(this.initConfig.maxwidth=i[0]),i&&i.length>1&&(this.initConfig.maxheight=i[1]),this.$window.find(".resize-border").on("mousedown",this.binding.resizeStart)}else this.$window.find(".resize-border").remove();this.resizable=t}},onPrimary:function(){},cancelButtonText:"Cancel",okButtonText:"OK",yesButtonText:"Yes",noButtonText:"No",closeButtonText:"Close",textWarning:"Warning",textError:"Error",textConfirmation:"Confirmation",textInformation:"Information",textDontShow:"Don't show this message again"}}(),Common.UI.Window||{}))}),define("common/main/lib/view/RenameDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.RenameDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",filename:""},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textName+"</label>","</div>",'<div id="id-dlg-newname" class="input-row"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputName=new Common.UI.InputField({el:$("#id-dlg-newname"),style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!/[\t*\+:\"<>?|\\\\\/]/gim.test(e)||t.txtInvalidName+'*+:"<>?|/'}});var e=this.getChild();e.find(".btn").on("click",_.bind(this.onBtnClick,this)),t.inputNameEl=e.find("input"),t.inputNameEl.on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputName.setValue(t.options.filename),t.inputNameEl.focus().select()},100)},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputName.checkValidate())return void this.inputNameEl.focus();this.options.handler.call(this,t,this.inputName.getValue())}this.close()},textName:"File name",cancelButtonText:"Cancel",okButtonText:"Ok",txtInvalidName:"The file name cannot contain any of the following characters: "},Common.Views.RenameDialog||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Header",["backbone","text!common/main/lib/template/Header.template","core","common/main/lib/view/RenameDialog"],function(t,e){"use strict";Common.Views.Header=t.View.extend(_.extend({options:{branding:{},headerCaption:"Default Caption",documentCaption:"",canBack:!1},el:"#header",template:_.template(e),events:{"click #header-logo":function(t){var e=this.branding&&this.branding.logo&&this.branding.logo.url?this.branding.logo.url:"http://www.onlyoffice.com",i=window.open(e);i&&i.focus()}},initialize:function(t){this.options=this.options?_({}).extend(this.options,t):t,this.headerCaption=this.options.headerCaption,this.documentCaption=this.options.documentCaption,this.canBack=this.options.canBack,this.branding=this.options.customization,this.isModified=!1},render:function(){$(this.el).html(this.template({headerCaption:this.headerCaption,documentCaption:Common.Utils.String.htmlEncode(this.documentCaption),canBack:this.canBack,textBack:this.textBack}));var t=new Common.UI.MenuItem({caption:this.openNewTabText}).on("click",function(t,e){Common.NotificationCenter.trigger("goback",!0),Common.component.Analytics.trackEvent("Back to Folder")});this.gotoDocsMenu=new Common.UI.Menu({style:"min-width: 100px;",items:[t]})},setVisible:function(t){t?this.show():this.hide()},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:86px; max-height:20px; margin: 0 8px 0 15px;"/>'),e.css({"background-image":"none",width:"auto"}))},setHeaderCaption:function(t){this.headerCaption=t;var e=$("#header-caption > div");return e&&e.html(t),t},getHeaderCaption:function(){return this.headerCaption},setDocumentCaption:function(t,e){void 0!==e&&(this.isModified=e),this.documentCaption=t,t||(t=""),this.isModified&&(t+="*");var i=$("#header-documentcaption div");return i&&i.html(Common.Utils.String.htmlEncode(t)),t},getDocumentCaption:function(){return this.documentCaption},setCanBack:function(t){this.canBack=t;var e=$("#header-back");e&&(e.off("mouseup"),e.css("display",t?"table-cell":"none"),t&&e.on("mouseup",_.bind(this.onBackClick,this)))},getCanBack:function(){return this.canBack},onBackClick:function(t){if(3==t.which){Common.UI.Menu.Manager.hideAll();var e=this,i=[t.pageX*Common.Utils.zoom(),t.pageY*Common.Utils.zoom()],n=$(this.el).find(Common.Utils.String.format("#menu-container-{0}",this.gotoDocsMenu.id));this.gotoDocsMenu.rendered||(n.length<1&&(n=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',this.gotoDocsMenu.id)),$(this.el).append(n)),this.gotoDocsMenu.render(n),this.gotoDocsMenu.cmpEl.attr({tabindex:"-1"})),_.delay(function(){n.css({left:i[0]-e.gotoDocsMenu.cmpEl.width(),top:i[1]+3}),e.gotoDocsMenu.show()},10)}else Common.NotificationCenter.trigger("goback",2==t.which),Common.component.Analytics.trackEvent("Back to Folder")},setCanRename:function(t){var e=$("#header-documentcaption div");if(t){var i=this;e.tooltip({title:i.txtRename,placement:"cursor"}),e.on("click",function(t){new Common.Views.RenameDialog({filename:i.documentCaption,handler:function(t,e){"ok"!=t||_.isEmpty(e.trim())||i.documentCaption===e.trim()||Common.Gateway.requestRename(e),Common.NotificationCenter.trigger("edit:complete",i)}}).show(e.position().left-1,20)})}else{var n=e.data("bs.tooltip");n&&(n.options.title="",n.setContent()),e.off("click")}e.css("cursor",t?"pointer":"default"),e.toggleClass("renamed",t)},textBack:"Go to Documents",openNewTabText:"Open in New Tab",txtRename:"Rename"},Common.Views.Header||{}))}),define("text!documenteditor/main/app/template/Viewport.template",[],function(){return'<div class="layout-region">\n <div id="viewport-vbox-layout" class="layout-ct vbox">\n <div id="header" class="layout-item"></div>\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="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>\n <div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>\n <div id="editor_sdk" class="layout-item"></div>\n <div id="right-menu" class="layout-item"></div>\n <div id="left-panel-history" class="layout-item" />\n <div id="review-changes-panel" style="display: none;"></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)};var i,n,o=!1;t.items.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},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())},this),this.freeze=t.freeze,this.freeze&&this.freezePanels(this.freeze)},doLayout:function(){},getElementHeight:function(t){return parseInt(t.css("height"))},getElementWidth:function(t){return parseInt(t.css("width"))},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){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("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)){var i=null,n=null,o=0,s=this.splitters[t].resizer,a="height";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()}}}),!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),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)},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+=this.getElementHeight(t.el))},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),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)},doLayout:function(t){var e,i,n=0;this.panels.forEach(function(t){t.stretch?e=t:(i=t.el.is(":visible"),i&&(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},!0!==t.rely&&(i.width=t.width),t.el.css(i),n+=this.getElementWidth(t.el))},this)}}),Common.UI.VBoxLayout.prototype.constructor=Common.UI.VBoxLayout,Common.UI.HBoxLayout.prototype.constructor=Common.UI.HBoxLayout}),define("documenteditor/main/app/view/Viewport",["text!documenteditor/main/app/template/Viewport.template","jquery","underscore","backbone","common/main/lib/component/Layout"],function(t,e,i,n){"use strict";DE.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:n[0],rely:!0},{el:n[1],rely:!0},{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}},{el:n[3],rely:!0,resize:{hidden:!0,autohide:!1,min:300,max:600}},{el:n[1],stretch:!0},{el:e(n[2]).hide(),rely:!0}]}),this},applyEditorMode:function(){var t=this,e=DE.getController("Toolbar").getView("Toolbar"),i=DE.getController("RightMenu").getView("RightMenu"),n=DE.getController("Statusbar").getView("Statusbar");t._toolbar=e.render(this.mode),t._rightMenu=i.render(this.mode);var o=Common.localStorage.getItem("de-hidden-status");null!==o&&1==parseInt(o)&&n.setVisible(!1)},setMode:function(t){t.isDisconnected?(i.isUndefined(this.mode)&&(this.mode={}),this.mode.canCoAuthoring=!1):this.mode=t}})}),define("text!documenteditor/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-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon img-toolbarmenu btn-menu-file"> </span></button>\r\n <button id="left-btn-search" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-search"> </span></button>\r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n <button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><span class="btn-icon img-toolbarmenu btn-menu-comments"> </span></button>\r\n <button id="left-btn-chat" class="btn btn-category" content-target="left-panel-chat"><span class="btn-icon img-toolbarmenu btn-menu-chat"> </span></button>\r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n <button id="left-btn-plugins" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-plugin"> </span></button>\r\n <button id="left-btn-support" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-support"> </span></button>\r\n <button id="left-btn-about" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-about"> </span></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 \x3c!-- /** coauthoring end **/ --\x3e\r\n <div id="left-panel-plugins" class="" style="display: none; height: 100%;" />\r\n </div>\r\n</div>'}),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/Button",["common/main/lib/component/BaseView","common/main/lib/component/ToggleManager"],function(){"use strict";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},template:_.template(["<% if (menu == null) { %>",'<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>">','<span class="caption"><%= caption %></span>','<% if (iconCls != "") { %>','<span class="btn-icon <%= iconCls %>"> </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">','<span class="caption"><%= caption %></span>','<% if (iconCls != "") { %>','<span class="btn-icon <%= iconCls %>"> </span>',"<% } %>",'<span class="caret img-commonctrl"></span>',"</button>","</div>","<% } else { %>",'<div class="btn-group split" id="<%= id %>" style="<%= style %>">','<button type="button" class="btn <%= cls %>">','<span class="caption"><%= caption %></span>','<% if (iconCls != "") { %>','<span class="btn-icon <%= iconCls %>"> </span>',"<% } %>","</button>",'<button type="button" class="btn <%= cls %> dropdown-toggle" data-toggle="dropdown">','<span class="caret img-commonctrl"></span>','<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.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||(e.cmpEl=$(this.template({id:e.id,cls:e.cls,iconCls:e.iconCls,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.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");e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"}),s.length>0&&e.cmpEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10)}_.isString(e.toggleGroup)&&(e.enableToggle=!0);var a=function(t){if(!e.disabled&&1==t.which){if(e.doToggle(),e.options.hint){var i=e.cmpEl.data("bs.tooltip");i&&(void 0===i.dontShow&&(i.dontShow=!0),i.hide())}e.trigger("click",e,t)}},r=function(t,n){if(!t){var s=!1;_.each($("button",i),function(t){if($(t).is(":hover"))return s=!0,!1}),s||(i.removeClass("over"),$("button",i).removeClass("over"))}if(t||!e.enableToggle||!e.allowDepress||!e.pressed){if(t&&!o&&e.enableToggle&&e.allowDepress&&!e.pressed)return void n.preventDefault();$("button:first",i).toggleClass("active",t),$("[data-toggle^=dropdown]",i).toggleClass("active",t),i.toggleClass("active",t)}},l=function(t){if(!e.disabled&&1==t.which&&o){if(e.options.hint){var n=e.cmpEl.data("bs.tooltip");n&&(void 0===n.dontShow&&(n.dontShow=!0),n.hide())}var s=i.hasClass("open");r(!s,t)}},c=function(t,e){o?r(e,t):(i.toggleClass("active",e),$("button",i).toggleClass("active",e))},d=function(t){r(!0,t),$(document).on("mouseup",h)},h=function(t){r(!1,t),$(document).off("mouseup",h)},p=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(l,this)),$("button",i).on("mousedown",_.bind(d,this))),i.on("hide.bs.dropdown",_.bind(r,e,!1)),i.on("show.bs.dropdown",_.bind(r,e,!0)),i.on("hidden.bs.dropdown",_.bind(p,e)),$("button:first",i).on("click",a)):i.on("click",a),i.on("button.internal.active",_.bind(c,e)),i.on("mouseover",function(t){e.disabled||(e.cmpEl.addClass("over"),e.trigger("mouseover",e,t))}),i.on("mouseout",function(t){e.disabled||(e.cmpEl.removeClass("over"),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.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){var s=this.cmpEl.data("bs.tooltip");s&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t))}}this.disabled=t},isDisabled:function(){return this.disabled},setIconCls:function(t){var e=$(this.el).find("span.btn-icon"),i=this.iconCls;this.iconCls=t,e.removeClass(i),e.addClass(t||"")},setVisible:function(t){this.cmpEl&&this.cmpEl.toggleClass("hidden",!t)},updateHint:function(t){if(this.options.hint=t,this.rendered){var e=this.cmpEl,i=e.closest(".asc-window");e.data("bs.tooltip")&&e.removeData("bs.tooltip"),e.attr("data-toggle","tooltip"),e.tooltip({title:t,placement:this.options.hintAnchor||"cursor"}),i.length>0&&e.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10)}},setCaption:function(t){if(this.caption!=t&&(this.caption=t,this.rendered)){var e=this.cmpEl.find("button:first > .caption").andSelf().filter("button > .caption");e.length>0?e.text(t):this.cmpEl.find("button:first").andSelf().filter("button").text(t)}},setMenu:function(t){t&&_.isObject(t)&&_.isFunction(t.render)&&(this.menu=t,this.rendered&&this.menu.render(this.cmpEl))}})}),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,r=l.call(arguments,1),c=0,d=0,h=0,p=0;if(e=t.event.fix(a),e.type="mousewheel","detail"in a&&(h=-1*a.detail),"wheelDelta"in a&&(h=a.wheelDelta),"wheelDeltaY"in a&&(h=a.wheelDeltaY),"wheelDeltaX"in a&&(d=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in a&&(h=-1*a.deltaY,c=h),"deltaX"in a&&(d=a.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===a.deltaMode){var m=t.data(this,"mousewheel-line-height");c*=m,h*=m,d*=m}else if(2===a.deltaMode){var u=t.data(this,"mousewheel-page-height");c*=u,h*=u,d*=u}return p=Math.max(Math.abs(h),Math.abs(d)),(!s||p<s)&&(s=p,n(a,p)&&(s/=40)),n(a,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/s),d=Math[d>=1?"floor":"ceil"](d/s),h=Math[h>=1?"floor":"ceil"](h/s),e.deltaX=d,e.deltaY=h,e.deltaFactor=s,e.deltaMode=0,r.unshift(e,c,d,h),o&&clearTimeout(o),o=setTimeout(i,200),(t.event.dispatch||t.event.handle).apply(this,r)}}function i(){s=null}function n(t,e){return d.settings.adjustOldDeltas&&"mousewheel"===t.type&&e%120==0}var o,s,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(t.event.fixHooks)for(var c=a.length;c;)t.event.fixHooks[a[--c]]=t.event.mouseHooks;var d=t.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=r.length;i;)this.addEventListener(r[--i],e,!1);else this.onmousewheel=e;t.data(this,"mousewheel-line-height",d.getLineHeight(this)),t.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=r.length;t;)this.removeEventListener(r[--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");var r,l,c,d,h,p,m,u,g,b,f,C=t("<div class='ps-scrollbar-x-rail'></div>").appendTo(a),v=t("<div class='ps-scrollbar-y-rail'></div>").appendTo(a),_=t("<div class='ps-scrollbar-x'></div>").appendTo(C),y=t("<div class='ps-scrollbar-y'></div>").appendTo(v),w=parseInt(C.css("bottom"),10),x=parseInt(v.css("right"),10),S=i(),A=function(t,e){var i=t+e,n=f-g;b=i<0?0:i>n?n:i;var o=parseInt(b*(p-d)/(f-g),10);a.scrollTop(o),C.css({bottom:w-o})},T=function(t,e){var i=t+e,n=c-m;u=i<0?0:i>n?n:i;var o=parseInt(u*(h-c)/(c-m),10);a.scrollLeft(o),v.css({right:x-o})},k=function(t){return s.minScrollbarLength&&(t=Math.max(t,s.minScrollbarLength)),t},I=function(){C.css({left:a.scrollLeft(),bottom:w-a.scrollTop(),width:c,display:r?"inherit":"none"}),v.hasClass("in-scrolling")?v.css({right:x-a.scrollLeft(),height:f,display:l?"inherit":"none"}):v.css({top:a.scrollTop(),right:x-a.scrollLeft(),height:f,display:l?"inherit":"none"}),_.css({left:u,width:m}),y.css({top:b,height:g})},P=function(){c=s.includePadding?a.innerWidth():a.width(),d=s.includePadding?a.innerHeight():a.height(),f=d-(s.includeMargin?parseInt(v.css("margin-top"))+parseInt(v.css("margin-bottom")):0),h=a.prop("scrollWidth"),p=a.prop("scrollHeight"),!s.suppressScrollX&&c+s.scrollXMarginOffset<h?(r=!0,m=k(parseInt(c*c/h,10)),u=parseInt(a.scrollLeft()*(c-m)/(h-c),10)):(r=!1,m=0,u=0,a.scrollLeft(0)),!s.suppressScrollY&&d+s.scrollYMarginOffset<p?(l=!0,g=k(parseInt(f*d/p,10)),b=parseInt(a.scrollTop()*(f-g)/(p-d),10)):(l=!1,g=0,b=0,a.scrollTop(0)),b>=f-g&&(b=f-g),u>=c-m&&(u=c-m),I(),s.onChange&&s.onChange(this)},M=function(){var e,i;_.bind("mousedown"+S,function(t){i=t.pageX,e=_.position().left,C.addClass("in-scrolling"),t.stopPropagation(),t.preventDefault()}),t(document).bind("mousemove"+S,function(t){C.hasClass("in-scrolling")&&(T(e,t.pageX-i),t.stopPropagation(),t.preventDefault())}),t(document).bind("mouseup"+S,function(t){C.hasClass("in-scrolling")&&C.removeClass("in-scrolling")}),e=i=null},B=function(){var e,i;y.bind("mousedown"+S,function(t){i=t.pageY,e=y.position().top,v.addClass("in-scrolling");var n=parseInt(v.css("margin-top")),o=v[0].getBoundingClientRect();v.css({position:"fixed",left:o.left,top:o.top-n}),t.stopPropagation(),t.preventDefault()}),t(document).bind("mousemove"+S,function(t){v.hasClass("in-scrolling")&&(A(e,t.pageY-i),t.stopPropagation(),t.preventDefault())}),t(document).bind("mouseup"+S,function(t){v.hasClass("in-scrolling")&&(v.removeClass("in-scrolling"),v.css({position:"",left:"",top:""}),I())}),e=i=null},U=function(t,e){var i=a.scrollTop();if(0===t){if(!l)return!1;if(0===i&&e>0||i>=p-d&&e<0)return!s.wheelPropagation}var n=a.scrollLeft();if(0===e){if(!r)return!1;if(0===n&&t<0||n>=h-c&&t>0)return!s.wheelPropagation}return!0},E=function(){s.wheelSpeed/=10;var e=!1;a.bind("mousewheel"+S,function(i,n,o,c){var d=i.deltaX*i.deltaFactor||o,h=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?l&&!r?(h?a.scrollTop(a.scrollTop()-h*s.wheelSpeed):a.scrollTop(a.scrollTop()+d*s.wheelSpeed),
|
|
|
e=!0):r&&!l&&(d?a.scrollLeft(a.scrollLeft()+d*s.wheelSpeed):a.scrollLeft(a.scrollLeft()-h*s.wheelSpeed),e=!0):(a.scrollTop(a.scrollTop()-h*s.wheelSpeed),a.scrollLeft(a.scrollLeft()+d*s.wheelSpeed)),P(),(e=e||U(d,h))&&(i.stopPropagation(),i.preventDefault())}),a.bind("MozMousePixelScroll"+S,function(t){e&&t.preventDefault()})},V=function(){var e=!1;a.bind("mouseenter"+S,function(t){e=!0}),a.bind("mouseleave"+S,function(t){e=!1});var i=!1;t(document).bind("keydown"+S,function(n){if(e&&!t(document.activeElement).is(":input,[contenteditable]")){var o=0,s=0;switch(n.which){case 37:o=-30;break;case 38:s=30;break;case 39:o=30;break;case 40:s=-30;break;case 33:s=90;break;case 32:case 34:s=-90;break;case 35:s=-d;break;case 36:s=d;break;default:return}a.scrollTop(a.scrollTop()-s),a.scrollLeft(a.scrollLeft()+o),i=U(o,s),i&&n.preventDefault()}})},D=function(){var t=function(t){t.stopPropagation()};y.bind("click"+S,t),v.bind("click"+S,function(t){var e=parseInt(g/2,10),i=t.pageY-v.offset().top-e,n=f-g,o=i/n;o<0?o=0:o>1&&(o=1),a.scrollTop((p-d)*o)}),_.bind("click"+S,t),C.bind("click"+S,function(t){var e=parseInt(m/2,10),i=t.pageX-C.offset().left-e,n=c-m,o=i/n;o<0?o=0:o>1&&(o=1),a.scrollLeft((h-c)*o)})},R=function(){var e=function(t,e){a.scrollTop(a.scrollTop()-e),a.scrollLeft(a.scrollLeft()-t),P()},i={},n=0,o={},s=null,r=!1;t(window).bind("touchstart"+S,function(t){r=!0}),t(window).bind("touchend"+S,function(t){r=!1}),a.bind("touchstart"+S,function(t){var e=t.originalEvent.targetTouches[0];i.pageX=e.pageX,i.pageY=e.pageY,n=(new Date).getTime(),null!==s&&clearInterval(s),t.stopPropagation()}),a.bind("touchmove"+S,function(t){if(!r&&1===t.originalEvent.targetTouches.length){var s=t.originalEvent.targetTouches[0],a={};a.pageX=s.pageX,a.pageY=s.pageY;var l=a.pageX-i.pageX,c=a.pageY-i.pageY;e(l,c),i=a;var d=(new Date).getTime(),h=d-n;h>0&&(o.x=l/h,o.y=c/h,n=d),t.preventDefault()}}),a.bind("touchend"+S,function(t){clearInterval(s),s=setInterval(function(){if(Math.abs(o.x)<.01&&Math.abs(o.y)<.01)return void clearInterval(s);e(30*o.x,30*o.y),o.x*=.8,o.y*=.8},10)})},F=function(){a.bind("scroll"+S,function(t){P()})},L=function(){a.unbind(S),t(window).unbind(S),t(document).unbind(S),a.data("perfect-scrollbar",null),a.data("perfect-scrollbar-update",null),a.data("perfect-scrollbar-destroy",null),_.remove(),y.remove(),C.remove(),v.remove(),_=y=c=d=h=p=m=u=w=g=b=x=null},H=function(e){a.addClass("ie").addClass("ie"+e);6===e&&(function(){var e=function(){t(this).addClass("hover")},i=function(){t(this).removeClass("hover")};a.bind("mouseenter"+S,e).bind("mouseleave"+S,i),C.bind("mouseenter"+S,e).bind("mouseleave"+S,i),v.bind("mouseenter"+S,e).bind("mouseleave"+S,i),_.bind("mouseenter"+S,e).bind("mouseleave"+S,i),y.bind("mouseenter"+S,e).bind("mouseleave"+S,i)}(),function(){I=function(){_.css({left:u+a.scrollLeft(),bottom:w,width:m}),y.css({top:b+a.scrollTop(),right:x,height:g}),_.hide().show(),y.hide().show()}}())},N="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;return function(){var t=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);t&&"msie"===t[1]&&H(parseInt(t[2],10)),P(),F(),M(),B(),D(),N&&R(),a.mousewheel&&E(),s.useKeyboard&&V(),a.data("perfect-scrollbar",a),a.data("perfect-scrollbar-update",P),a.data("perfect-scrollbar-destroy",L)}(),a})}}),void 0===Common)var Common={};if(define("common/main/lib/component/Scroller",["jmousewheel","perfectscrollbar","common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Scroller=function(){var t;return _.extend(Common.UI.BaseView.extend({options:{wheelSpeed:20,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:5,scrollYMarginOffset:5,includePadding:!0,includeMargin:!0,alwaysVisibleX:!1,alwaysVisibleY:!1},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.options.el&&this.render()},render:function(){var t=this;return t.cmpEl=$(this.el),t.rendered||(t.cmpEl.perfectScrollbar(_.extend({},t.options)),t.rendered=!0,this.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"))}}),{isMouseCapture:function(){return t}})}()}),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.txtAscMail="support@onlyoffice.com",this.txtAscTelNum="+371 660-16425",this.txtAscUrl="www.onlyoffice.com",this.txtAscName="Ascensio System SIA",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"/></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">'+this.txtAscName+"</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">'+this.txtAscAddress+"</label>","</td>","</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtMail+"</label>",'<a href="mailto:'+this.txtAscMail+'">'+this.txtAscMail+"</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">'+this.txtAscTelNum+"</label>","</td>","</tr>","<tr>",'<td colspan="3" align="center">','<a href="http://'+this.txtAscUrl+'" target="_blank">'+this.txtAscUrl+"</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">'+this.txtAscName+"</label></td>","</tr>","<tr>",'<td colspan="3" align="center">','<label class="asc-about-desc">'+this.txtAscUrl+"</label>","</td>","</tr>","</table>"].join("")),this.menu=t.menu},render:function(){var t=$(this.el);return t.html(this.template({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: ",txtAscAddress:"Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021",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"><%=scope.getUserName(username)%></div>\r\n <div class="user-date"><%=date%></div>\r\n <% if (quote!==null) { %>\r\n <div class="user-quote"><%=scope.getFixedQuote(quote)%></div>\r\n <% } %>\r\n <% if (!editText) { %>\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) { %>\r\n <div class="reply-item-ct">\r\n <div class="user-name"><%=scope.getUserName(item.get("username"))%></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 <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 <% } %>\r\n <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n </div>\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) { %>\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) { %>\r\n <div class="edit-ct">\r\n <% if (editable) { %>\r\n <div class="btn-edit img-commonctrl"></div>\r\n <% } %>\r\n <div class="btn-delete img-commonctrl"></div>\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'}),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"><%=scope.getUserName(username)%></div>\r\n <div class="user-date"><%=date%></div>\r\n <% if (!editTextInPopover || hint) { %>\r\n <div class="user-message"><%=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 <% 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"><%=scope.getUserName(item.get("username"))%></div>\r\n <div class="user-date"><%=item.get("date")%></div>\r\n <% if (!item.get("editTextInPopover")) { %>\r\n <div class="user-message"><%=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 <%}%>\r\n <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>\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-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 <% } %>\r\n <div class="btn-delete img-commonctrl"></div>\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"></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>'}),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(/opera/),a=s&&e(/version\/10\.5/),r=e(/\bchrome\b/),l=e(/webkit/),c=!r&&e(/safari/),d=c&&e(/applewebkit\/4/),h=c&&e(/version\/3/),p=c&&e(/version\/4/),m=c&&e(/version\/5\.0/),u=c&&e(/version\/5/),g=!s&&(e(/msie/)||e(/trident/)),b=g&&(e(/msie 7/)&&8!=o&&9!=o&&10!=o||7==o),f=g&&(e(/msie 8/)&&7!=o&&9!=o&&10!=o||8==o),C=g&&(e(/msie 9/)&&7!=o&&8!=o&&10!=o||9==o),v=g&&(e(/msie 10/)&&7!=o&&8!=o&&9!=o||10==o),_=g&&(e(/trident\/7\.0/)&&7!=o&&8!=o&&9!=o&&10!=o||11==o),y=g&&e(/msie 6/),w=!l&&!g&&e(/gecko/),x=w&&e(/rv:1\.9/),S=w&&e(/rv:2\.0/),A=w&&e(/rv:5\./),T=w&&e(/rv:10\./),k=x&&e(/rv:1\.9\.0/),I=x&&e(/rv:1\.9\.1/),P=x&&e(/rv:1\.9\.2/),M=e(/windows|win32/),B=e(/macintosh|mac os x/),U=e(/linux/),E=n(!0,/\bchrome\/(\d+\.\d+)/),V=n(!0,/\bfirefox\/(\d+\.\d+)/),D=n(g,/msie (\d+\.\d+)/),R=n(s,/version\/(\d+\.\d+)/),F=n(c,/version\/(\d+\.\d+)/),L=n(l,/webkit\/(\d+\.\d+)/),H=/^https/i.test(window.location.protocol),N=/^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,O=/^(((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,W=/^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,G=/(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/gi,j=/(((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,q=/((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/gi,K={Paragraph:0,Table:1,Image:2,Header:3,TextArt:4,Shape:5,Slide:6,Chart:7,MailMerge:8},Y=/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),X=this,J=function(){if(X.zoom=1,r&&!s&&!Y&&document&&document.firstElementChild&&document.body)if(window.devicePixelRatio>.1){if(window.devicePixelRatio<1.99){var t=1;X.zoom=window.devicePixelRatio/t}else{var t=2;X.zoom=window.devicePixelRatio/t}document.firstElementChild.style.zoom=1/X.zoom}else document.firstElementChild.style.zoom="normal";X.innerWidth=window.innerWidth*X.zoom,X.innerHeight=window.innerHeight*X.zoom};return X.zoom=1,X.innerWidth=window.innerWidth,X.innerHeight=window.innerHeight,J(),$(window).on("resize",J),{userAgent:t,isStrict:i,isIEQuirks:g&&!i&&(y||b||f||C),isOpera:s,isOpera10_5:a,isWebKit:l,isChrome:r,isSafari:c,isSafari3:h,isSafari4:p,isSafari5:u,isSafari5_0:m,isSafari2:d,isIE:g,isIE6:y,isIE7:b,isIE7m:y||b,isIE7p:g&&!y,isIE8:f,isIE8m:y||b||f,isIE8p:g&&!(y||b),isIE9:C,isIE9m:y||b||f||C,isIE9p:g&&!(y||b||f),isIE10:v,isIE10m:y||b||f||C||v,isIE10p:g&&!(y||b||f||C),isIE11:_,isIE11m:y||b||f||C||v||_,isIE11p:g&&!(y||b||f||C||v),isGecko:w,isGecko3:x,isGecko4:S,isGecko5:A,isGecko10:T,isFF3_0:k,isFF3_5:I,isFF3_6:P,isFF4:4<=V&&V<5,isFF5:5<=V&&V<6,isFF10:10<=V&&V<11,isLinux:U,isWindows:M,isMac:B,chromeVersion:E,firefoxVersion:V,ieVersion:D,operaVersion:R,safariVersion:F,webKitVersion:L,isSecure:H,emailRe:N,ipRe:O,hostnameRe:z,localRe:W,emailStrongRe:G,ipStrongRe:j,hostnameStrongRe:q,documentSettingsType:K,zoom:function(){return X.zoom},innerWidth:function(){return X.innerWidth},innerHeight:function(){return X.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 r=i+6*n;o={color:this.getHexColor(t[r].get_r(),t[r].get_g(),t[r].get_b()),effectId:r,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,r=i%60*(s-a)/60;360==i&&(i=0),i<60?(e.r=s,e.b=a,e.g=a+r):i<120?(e.g=s,e.b=a,e.r=s-r):i<180?(e.g=s,e.r=a,e.b=a+r):i<240?(e.b=s,e.r=a,e.g=s-r):i<300?(e.b=s,e.g=a,e.r=a+r):i<360?(e.r=s,e.g=a,e.b=s-r):(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,r=o[s].process,l=a.exec(t);if(l){var c=r(l);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 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<9||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(){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;try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t||"undefined"==typeof XMLHttpRequest||(t=new XMLHttpRequest),t},_getPluginCode=function(url){if(!url)return"";try{var xhrObj=_createXMLHTTPObject();xhrObj&&url&&(xhrObj.open("GET",url,!1),xhrObj.send(""),200==xhrObj.status&&eval(xhrObj.responseText))}catch(t){}return null};plugins.forEach(function(t){t&&_getPluginCode(t)})}},Common.Utils.fillUserInfo=function(t,e,i){var n=t||{};return!n.id&&(n.id="uid-"+Date.now()),_.isEmpty(n.name)?(_.isEmpty(n.firstname)&&_.isEmpty(n.lastname)&&(n.firstname=i),_.isEmpty(n.firstname)?n.fullname=n.lastname:_.isEmpty(n.lastname)?n.fullname=n.firstname:n.fullname=/^ru/.test(e)?n.lastname+" "+n.firstname:n.firstname+" "+n.lastname):n.fullname=n.name,n},String.prototype.strongMatch=function(t){if(t&&t instanceof RegExp){var e=this.toString().match(t);return!!(e&&e.length>0&&e[0].length==this.length)}return!1},define("common/main/lib/util/utils",function(){}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboBox",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.ComboBoxModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),value:null,displayValue:null}}}),Common.UI.ComboBoxStore=Backbone.Collection.extend({model:Common.UI.ComboBoxModel}),Common.UI.ComboBox=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",hint:!1,editable:!0,disabled:!1,menuCls:"",menuStyle:"",displayField:"displayValue",valueField:"value",scrollAlwaysVisible:!1},template:_.template(['<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',"<% }); %>","</ul>","</span>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);this.id=e.options.id||Common.UI.getId(),this.cls=e.options.cls,this.style=e.options.style,this.menuCls=e.options.menuCls,this.menuStyle=e.options.menuStyle,this.template=e.options.template||e.template,this.itemsTemplate=e.options.itemsTemplate,this.hint=e.options.hint,this.editable=e.options.editable,this.disabled=e.options.disabled,this.store=e.options.store||new Common.UI.ComboBoxStore,this.displayField=e.options.displayField,this.valueField=e.options.valueField,this.scrollAlwaysVisible=e.options.scrollAlwaysVisible,e.rendered=e.options.rendered||!1,this.lastValue=null,e.store.add(e.options.data),e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered)this.cmpEl=$(this.el);else{var i=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:i,scope:e})),this.itemsTemplate&&this.cmpEl.find("ul").append($(this.itemsTemplate({items:i,scope:e}))),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)}if(!e.rendered){var n=this.cmpEl;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"})),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,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,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)}this.scroller&&this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible}),this.trigger("show:after",this,t)},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();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},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,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))}}}())}),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);return t.html(this.template(this.model.toJSON())),t.addClass("item"),t.toggleClass("selected",this.model.get("selected")&&this.model.get("allowSelected")),t.off("click").on("click",_.bind(this.onClick,this)),t.off("dblclick").on("dblclick",_.bind(this.onDblClick,this)),t.off("contextmenu").on("contextmenu",_.bind(this.onContextMenu,this)),t.toggleClass("disabled",this.model.get("disabled")),_.isUndefined(this.model.get("cls"))||t.addClass(this.model.get("cls")),this.trigger("change",this,this.model),this},remove:function(){this.stopListening(this.model),this.trigger("remove",this,this.model),Common.UI.BaseView.prototype.remove.call(this)},onClick:function(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,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.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})),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").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10}));var i=this.cmpEl.closest(".asc-window");return i.length>0&&(this.tipZIndex=parseInt(i.css("z-index"))+10),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){this.handleSelect&&(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())},selectByIndex:function(t,e){this.store.length>0&&t>-1&&t<this.store.length&&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(){if(this.multiSelect){var t=[];return _.each(this.store.where({selected:!0}),function(e){t.push(e)}),t}return this.store.where({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").andSelf().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){if(i&&0==i.at?o.prepend(n.render().el):o.append(n.render().el),o.find(".empty-text").remove(),this.dataViewItems.push(n),t.get("tip")){var a=$(n.el);a.attr("data-toggle","tooltip"),a.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&&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").andSelf().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").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10})),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){if(this.stopListening(t),t.stopListening(),this.store.length<1&&this.emptyText.length>0){var i=$(this.el).find(".inner").andSelf().filter(".inner");i.find(".empty-text").length<=0&&i.append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>")}for(var n=0;n<this.dataViewItems.length;n++)if(_.isEqual(t,this.dataViewItems[n])){this.dataViewItems.splice(n,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.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){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;(s<i||s+o.outerHeight()>i+e.height())&&(this.scroller&&this.allowScrollbar?this.scroller.scrollTop(e.scrollTop()+s-i,0):e.scrollTop(e.scrollTop()+s-i))}},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()[0];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").andSelf().filter(".inner");t.addClass("canfocused"),t.attr("tabindex","0"),t.on(this.parentMenu&&this.useBSKeydown?"dataview:keydown":"keydown",_.bind(this.onKeyDown,this))}},showLastSelected:function(){if(this.lastSelectedRec)this.selectRecord(this.lastSelectedRec,!0),this.scrollToRecord(this.lastSelectedRec),this.lastSelectedRec=null;else{var t=this.getSelectedRec()[0];t&&this.scrollToRecord(t)}},setDisabled:function(t){this.disabled=t,$(this.el).find(".inner").andSelf().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=$(this.el).find(".inner").andSelf().filter(".inner"),i=Common.Utils.innerHeight(),n=t.outerHeight(),o=parseInt(t.css("top"));n>i?(e.css("max-height",i-parseInt(t.css("padding-top"))-parseInt(t.css("padding-bottom"))-5+"px"),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40})):e.height()<this.options.restoreHeight&&(e.css("max-height",Math.min(i-parseInt(t.css("padding-top"))-parseInt(t.css("padding-bottom"))-5,this.options.restoreHeight)+"px"),n=t.outerHeight(),o+n>i&&t.css("top",0),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40}))},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=-1,o=0,s=0,a=0;a<this.dataViewItems.length;a++){var r=$(this.dataViewItems[a].el).offset().top;s=Math.floor(($(this.dataViewItems[a].el).offset().left-i)/e),r>n&&(n=r,this._layoutParams.itemsIndexes.push([]),o=this._layoutParams.itemsIndexes.length-1),this._layoutParams.itemsIndexes[o][s]=a,this.dataViewItems[a].topIdx=o,this.dataViewItems[a].leftIdx=s,this._layoutParams.columns<s&&(this._layoutParams.columns=s)}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(Common.Views=Common.Views||{},define("common/main/lib/view/Comments",["text!common/main/lib/template/Comments.template","text!common/main/lib/template/CommentsPanel.template","text!common/main/lib/template/CommentsPopover.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,i){"use strict";function n(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.CommentsPopover=Common.UI.Window.extend({initialize:function(t){var e={};_.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1},t),this.template=t.template||['<div class="box">','<div id="id-comments-popover" class="comments-popover"></div>','<div id="id-comments-arrow" class="comments-arrow"></div>',"</div>"].join(""),this.store=t.store,this.delegate=t.delegate,e.tpl=_.template(this.template,e),this.arrow={margin:20,width:12,height:34},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.delegate,o=this.$window;o.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var s=o.find(".body");s&&s.css("position","relative"),o.on("click",_.bind(function(){o.css({zIndex:"991"}),Common.NotificationCenter.trigger("comments:click")},this)),Common.NotificationCenter.on("review:click",function(){o.css({zIndex:"990"})});var a=Common.UI.DataView.extend(function(){var e=t;return{options:{handleSelect:!1,scrollable:!0,template:_.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></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 i(){l=$(n.scroller.el).scrollTop(),s.scrollHeight>s.clientHeight?(o.css({height:s.scrollHeight+r+"px"}),e.calculateSizeOfContent()):(c=s.clientHeight)>=a&&(o.css({height:a+"px"}),s.scrollHeight>s.clientHeight&&(d=Math.max(s.scrollHeight+r,a),o.css({height:d+"px"})),e.calculateSizeOfContent(),e.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),e.calculateSizeOfContent()),n.scroller.scrollTop(l),n.autoScrollToEditButtons()}var n=this,o=this.$el.find("textarea"),s=null,a=50,r=0,l=0,c=0,d=0;o&&o.length&&(s=o.get(0))&&(r=.25*parseInt(o.css("lineHeight"),10),i(),o.bind("input propertychange",i)),this.textBox=o},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)},autoScrollToEditButtons:function(){var t=$("#id-comments-change-popover"),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(a)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new a({el:$("#id-comments-popover"),store:t.store,itemTemplate:_.template(n(i,{textAddReply:e.textAddReply,textAdd:e.textAdd,textCancel:e.textCancel,textEdit:e.textEdit,textReply:e.textReply,textClose:e.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var r=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},l=function(){t._isMouseOver=!0},c=function(){t._isMouseOver=!1};this.commentsView.on("item:add",r),this.commentsView.on("item:remove",r),this.commentsView.on("item:change",r),this.commentsView.cmpEl.on("mouseover",l).on("mouseout",c),this.commentsView.on("item:click",function(i,n,o,s){function a(){t.update()}var r,l,c,d,h,p;if(r=$(s.target)){if(l=o.get("editTextInPopover"),c=o.get("showReplyInPopover"),p=o.get("hideAddReply"),d=o.get("uid"),h=r.attr("data-value"),o.get("hint"))return void e.fireEvent("comment:disableHint",[o]);if(r.hasClass("btn-edit"))_.isUndefined(h)?l||(e.fireEvent("comment:closeEditing"),o.set("editTextInPopover",!0),e.fireEvent("comment:show",[d]),this.autoHeightTextBox(),t.calculateSizeOfContent(),t.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),t.calculateSizeOfContent(),a(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox()):(e.fireEvent("comment:closeEditing",[d]),e.fireEvent("comment:editReply",[d,h,!0]),this.replyId=h,this.autoHeightTextBox(),t.calculateSizeOfContent(),t.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),t.calculateSizeOfContent(),a(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(r.hasClass("btn-delete"))_.isUndefined(h)?e.fireEvent("comment:remove",[d]):(e.fireEvent("comment:removeReply",[d,h]),t.calculateSizeOfContent(),t.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),t.calculateSizeOfContent()),e.fireEvent("comment:closeEditing"),a();else if(r.hasClass("user-reply"))e.fireEvent("comment:closeEditing"),o.set("showReplyInPopover",!0),t.calculateSizeOfContent(),t.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),t.calculateSizeOfContent(),a(),this.autoHeightTextBox(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox();else if(r.hasClass("btn-reply",!1))c&&(this.clearTextBoxBind(),e.fireEvent("comment:addReply",[d,this.getActiveTextBoxVal()]),e.fireEvent("comment:closeEditing"),a());else if(r.hasClass("btn-close",!1))e.fireEvent("comment:closeEditing",[d]),
|
|
|
t.calculateSizeOfContent(),e.fireEvent("comment:show",[d]),a();else if(r.hasClass("btn-inner-edit",!1)){if(o.get("dummy"))return void e.fireEvent("comment:addDummyComment",[this.getActiveTextBoxVal()]);this.clearTextBoxBind(),_.isUndefined(this.replyId)?l&&(e.fireEvent("comment:change",[d,this.getActiveTextBoxVal()]),e.fireEvent("comment:closeEditing"),t.calculateSizeOfContent()):(e.fireEvent("comment:changeReply",[d,this.replyId,this.getActiveTextBoxVal()]),this.replyId=void 0,e.fireEvent("comment:closeEditing")),a()}else if(r.hasClass("btn-inner-close",!1)){if(o.get("dummy"))return void t.hide();p&&this.getActiveTextBoxVal().length>0?(t.saveText(),o.set("hideAddReply",!1),this.getTextBox().val(t.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),e.fireEvent("comment:closeEditing",[d])),this.replyId=void 0,t.calculateSizeOfContent(),t.setLeftTop(t.arrowPosX,t.arrowPosY,t.leftX),t.calculateSizeOfContent(),a()}else if(r.hasClass("btn-resolve",!1)){var m=r.data("bs.tooltip");m&&(m.dontShow=!0),e.fireEvent("comment:resolve",[d]),a()}else if(r.hasClass("btn-resolve-check",!1)){var m=r.data("bs.tooltip");m&&(m.dontShow=!0),e.fireEvent("comment:resolve",[d]),a()}}}),t.on({show:function(){t.commentsView.autoHeightTextBox(),t.$window.find("textarea").keydown(function(e){e.keyCode==Common.UI.Keys.ESC&&t.hide()})},"animate:before":function(){var e=t.$window.find("textarea");e&&e.length&&e.focus()}})}},show:function(t,e,i,n){this.options.animate=t;var o=this.commentsView.getTextBox();e&&this.textVal&&o&&o.val(this.textVal),n&&n.length&&o&&o.val(n),Common.UI.Window.prototype.show.call(this),this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.hookTextBox()},hide:function(){this.handlerHide&&this.handlerHide(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n,o){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var s=$("#id-comments-popover"),a=$("#id-comments-arrow"),r=$("#editor_sdk"),l=null,c=0,d="",h=0,p="",m=0,u="",g=0,b="",f=0,C=0,v=0,y=0,w=0,x=0;s&&a&&r&&r.get(0)&&(l=r.get(0).getBoundingClientRect())&&(c=l.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:c+"px"}),this.sdkBounds.width=l.width,this.sdkBounds.height=l.height,_.isUndefined(t)||(d=$("#id_vertical_scroll"),d.length?h="none"!==d.css("display")?d.width():0:(d=$("#ws-v-scrollbar"),d.length&&(h="none"!==d.css("display")?d.width():0)),this.sdkBounds.width-=h,p=$("#id_panel_left"),p.length&&(m="none"!==p.css("display")?p.width():0),u=$("#id_panel_thumbnails"),u.length&&(g="none"!==u.css("display")?u.width():0,this.sdkBounds.width-=g),C=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()-25),C=Math.max(0+m+this.arrow.width,C),a.removeClass("right").addClass("left"),_.isUndefined(i)||(v=this.$window.outerWidth())&&(t+v>this.sdkBounds.width-this.arrow.width+5&&this.leftX>v?(C=this.leftX-v+0-this.arrow.width,a.removeClass("left").addClass("right")):C=0+t+this.arrow.width),this.$window.css("left",C+"px")),_.isUndefined(e)||(b=$("#id_panel_top"),x=0,b.length?(f="none"!==b.css("display")?b.height():0,x+=this.sdkBounds.paddingTop):(b=$("#ws-h-scrollbar"),b.length&&(f="none"!==b.css("display")?b.height():0)),this.sdkBounds.height-=f,y=this.$window.outerHeight(),w=Math.min(0+c-y,this.arrowPosY+0-this.arrow.height),w=Math.max(w,x),this.$window.css("top",w+"px"))),o||this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-comments-arrow"),i=$("#id-comments-popover"),n=null,o=null,s=null,a=0,r="",l=0,c=0,d=0,h=0,p=0,m=0;i&&e&&i.get(0)&&(i.css({height:"100%"}),(n=i.get(0).getBoundingClientRect())&&(o=$("#editor_sdk"))&&o.get(0)&&(s=o.get(0).getBoundingClientRect())&&(a=s.height-2*this.sdkBounds.padding,m=0,d=this.$window.outerHeight(),r=$("#id_panel_top"),r.length?(l="none"!==r.css("display")?r.height():0,m+=this.sdkBounds.paddingTop):(r=$("#ws-h-scrollbar"),r.length&&(l="none"!==r.css("display")?r.height():0)),h=Math.max(i.outerHeight(),this.$window.outerHeight()),a<=h?(this.$window.css({maxHeight:a-l+"px",top:0+l+"px"}),i.css({height:a-l-3+"px"}),c=Math.min(c,a-(l+this.arrow.margin+this.arrow.width)),e.css({top:c+"px"})):(h=d,h>0&&(n.top+h>a+0||0===n.height)&&(p=Math.min(0+a-h,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-h)-this.arrow.width),c=Math.min(c,h-this.arrow.margin-this.arrow.width),e.css({top:c+"px"})))),this.$window.css({overflow:""})}},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(){this.textVal&&this.commentsView&&this.commentsView.getTextBox().val(this.textVal)},getEditText:function(){if(this.commentsView)return this.commentsView.getActiveTextBoxVal()},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})},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this)},isCommentsViewMouseOver:function(){return this._isMouseOver}}),Common.Views.Comments=Common.UI.BaseView.extend(_.extend({el:"#left-panel-comments",template:_.template(e),addCommentHeight:45,newCommentHeight:110,textBoxAutoSizeLocked:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.store=this.options.store,this.popoverComments=this.options.popoverComments},render:function(){var e=this;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 i=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&&(r=Math.max(n.scrollHeight+s,o),i.css({height:r+"px"}))),e.autoScrollToEditButtons()}var e=this,i=$(this.el).find("textarea"),n=null,o=50,s=0,a=0,r=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(i)if(this.commentsView)this.commentsView.render($(".messages-ct",e.el)),this.commentsView.onResetItems();else{this.commentsView=new i({el:$(".messages-ct",e.el),store:e.store,itemTemplate:_.template(n(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,r,l,c,d;if(a=$(o.target))if(r=n.get("editText"),l=n.get("showReply"),c=n.get("uid"),d=a.attr("data-value"),a.hasClass("btn-edit"))_.isUndefined(d)?r||(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,d]),e.commentsView.reply=d,this.autoHeightTextBox(),s(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(a.hasClass("btn-delete"))_.isUndefined(d)?e.fireEvent("comment:remove",[c]):e.fireEvent("comment:removeReply",[c,d]),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))l&&(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)?r&&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 h=a.data("bs.tooltip");h&&(h.dontShow=!0),e.fireEvent("comment:resolve",[c]),s()}else if(a.hasClass("btn-resolve-check",!1)){var h=a.data("bs.tooltip");h&&(h.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.setupLayout(),this.update(),this},update:function(){this.updateLayout(),this.updateScrolls()},updateScrolls:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},getPopover:function(t){return _.isUndefined(this.popover)&&(this.popover=new Common.Views.CommentsPopover({store:this.popoverComments,delegate:this,renderTo:t})),this.popover},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)},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()},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);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.ellipsis(Common.Utils.String.htmlEncode(t),22,!0)},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},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"},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="chat-user-<%= user.get("id") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>','<div class="color" style="background-color: <%= user.get("color") %>;" >','<label class="name"><%= scope.getUserName(user.get("username")) %></label>',"</div>","</li>"].join(""),templateUserList:_.template("<ul><% _.each(users, function(item) { %><%= _.template(usertpl, {user: item, 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" data-can-copy="true" style="color: <%= msg.get("usercolor") %>;"><%= 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._onAddUser,this),change:_.bind(this._onUsersChanged,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()},_onAddUser:function(t,e,i){this.panelUsers&&(this.panelUsers.find("ul").append(_.template(this.tplUser,{user:t,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onUsersChanged:function(t){void 0!=t.changed.online&&this.panelUsers&&(this.panelUsers.find("#chat-user-"+t.get("id"))[t.changed.online?"removeClass":"addClass"]("offline"),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onResetUsers:function(t,e){this.panelUsers&&(this.panelUsers.html(this.templateUserList({users:t.models,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.findUser(t.get("userid"));t.set({usercolor:e?e.get("color"):"#000",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)),void(this.textBoxAutoSizeLocked=void 0);_.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))))},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||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/History",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(t){"use strict";Common.Views.History=Common.UI.BaseView.extend(_.extend({el:"#left-panel-history",storeHistory:void 0,template:_.template(['<div id="history-box" class="layout-ct vbox">','<div id="history-header" class="">','<div id="history-btn-back"><%=scope.textCloseHistory%></div>',"</div>",'<div id="history-list" class="">',"</div>",'<div id="history-expand-changes" class="">','<div id="history-btn-expand"><%=scope.textHideAll%></div>',"</div>","</div>"].join("")),initialize:function(t){_.extend(this,t),Common.UI.BaseView.prototype.initialize.call(this,arguments)},render:function(t){t=t||this.el,$(t).html(this.template({scope:this})).width((parseInt(Common.localStorage.getItem("de-mainmenu-width"))||MENU_SCALE_PART)-SCALE_MIN),this.viewHistoryList=new Common.UI.DataView({el:$("#history-list"),store:this.storeHistory,enableKeyEvents:!1,itemTemplate:_.template(['<div id="<%= id %>" class="history-item-wrap <% if (!isVisible) { %>hidden<% } %>" ','style="display: block; <% if (!isRevision) { %>padding-left: 40px;<% } %><% if (canRestore && selected) { %>padding-bottom: 6px;<% } %>">','<div class="user-date"><%= created %></div>',"<% if (markedAsVersion) { %>",'<div class="user-version">ver.<%=version%></div>',"<% } %>","<% if (isRevision && hasChanges) { %>",'<div class="revision-expand img-commonctrl <% if (isExpanded) { %>up<% } %>"></div>',"<% } %>",'<div class="user-name">','<div class="color" style="display: inline-block; background-color:<%=usercolor%>;" >',"</div><%= Common.Utils.String.htmlEncode(username) %>","</div>","<% if (canRestore && selected) { %>",'<label class="revision-restore" role="presentation" tabindex="-1">'+this.textRestore+"</label>","<% } %>","</div>"].join(""))});var e=this;this.viewHistoryList.onClickItem=function(t,i,n){var o=$(n.target);if(o&&o.hasClass("revision-expand")){var s=!i.get("isExpanded");i.set("isExpanded",s);var a=e.storeHistory.findRevisions(i.get("revision"));if(a&&a.length>1)for(var r=1;r<a.length;r++)a[r].set("isVisible",s);this.scroller.update({minScrollbarLength:40})}else Common.UI.DataView.prototype.onClickItem.call(this,t,i,n);e.btnExpand.cmpEl.text(e.storeHistory.hasCollapsed()?e.textShowAll:e.textHideAll)};var i=function(t,i,n){if(n.get("isRevision")){i.btnTip&&(i.btnTip.dontShow=!0,i.btnTip.tip().remove(),i.btnTip=null);var o=$(i.el).find(".revision-expand").tooltip({title:n.get("isExpanded")?e.textHide:e.textShow,placement:"cursor"});o.length>0&&(i.btnTip=o.data("bs.tooltip"))}};return this.viewHistoryList.on("item:add",i),this.viewHistoryList.on("item:change",i),this.btnBackToDocument=new Common.UI.Button({el:$("#history-btn-back"),enableToggle:!1}),this.btnExpand=new Common.UI.Button({el:$("#history-btn-expand"),enableToggle:!1}),this.trigger("render:after",this),this},textRestore:"Restore",textShow:"Expand",textHide:"Collapse",textCloseHistory:"Close History",textHideAll:"Hide detailed changes",textShowAll:"Show detailed changes"},Common.Views.History||{}))}),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:!0},this.lockedControls=[],Common.UI.BaseView.prototype.initialize.call(this,arguments)},render:function(t){return t=t||this.el,$(t).html(this.template({scope:this})),this.$el=$(t),this.viewPluginsList=new Common.UI.DataView({el:$("#plugins-list"),store:this.storePlugins,enableKeyEvents:!1,itemTemplate:_.template(['<div id="<%= id %>" class="item-plugins" style="display: block;">','<div class="plugin-icon" style="background-image: url(<%= baseUrl %><%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 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.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},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.css("display",t?"block":"none"))},openInsideMode:function(t,e){return!!this.pluginsPanel&&(this.pluginsPanel.toggleClass("hidden",!0),this.currentPluginPanel.toggleClass("hidden",!1),this.pluginName.text(t),this.iframePlugin||(this.iframePlugin=document.createElement("iframe"),this.iframePlugin.id="plugin_iframe",this.iframePlugin.name="pluginFrameEditor",this.iframePlugin.width="100%",this.iframePlugin.height="100%",this.iframePlugin.align="top",this.iframePlugin.frameBorder=0,this.iframePlugin.scrolling="no",this.iframePlugin.onload=_.bind(this._onLoad,this),this.currentPluginFrame.append(this.iframePlugin),this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:this.currentPluginFrame})),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),this.iframePlugin.src=e),!0)},closeInsideMode:function(){this.pluginsPanel&&(this.iframePlugin&&(this.currentPluginFrame.empty(),this.iframePlugin=null),this.currentPluginPanel.toggleClass("hidden",!0),this.pluginsPanel.toggleClass("hidden",!1))},openNotVisualMode:function(t){var e=this.viewPluginsList.store.findWhere({guid:t});e&&this.viewPluginsList.cmpEl.find("#"+e.get("id")).parent().addClass("selected")},closeNotVisualMode:function(){this.viewPluginsList.cmpEl.find(".selected").removeClass("selected")},_onLoad:function(){this.loadMask&&this.loadMask.hide()},strPlugins:"Plugins",textLoading:"Loading",textStart:"Start"},Common.Views.Plugins||{})),Common.Views.PluginDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{cls:"advanced-settings-dlg",header:!0,enableKeyEvents:!1},t);var i=e.buttons&&_.size(e.buttons)>0?85:34;e.width=Common.Utils.innerWidth()-e.width<0?Common.Utils.innerWidth():e.width,e.height+=i,e.height=Common.Utils.innerHeight()-e.height<0?Common.Utils.innerHeight():e.height,this.template=['<div id="id-plugin-container" class="box" style="height:'+(e.height-i)+'px;">','<div id="id-plugin-placeholder" style="width: 100%;height: 100%;"></div>',"</div>","<% if (_.size(buttons) > 0) { %>",'<div class="separator horizontal"/>','<div class="footer" style="text-align: center;">',"<% for(var bt in buttons) { %>",'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" style="margin-right: 10px;"><%= buttons[bt].text %></button>',"<% } %>","</div>","<% } %>"].join(""),e.tpl=_.template(this.template,e),this.url=t.url||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"}),this.boxEl=this.$window.find(".body > .box"),this._headerFooterHeight=this.options.buttons&&_.size(this.options.buttons)>0?85:34,this._headerFooterHeight+=parseInt(this.$window.css("border-top-width"))+parseInt(this.$window.css("border-bottom-width"));var t=document.createElement("iframe");t.id="plugin_iframe",t.name="pluginFrameEditor",t.width="100%",t.height="100%",t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this);var e=this;setTimeout(function(){e.isLoaded||(e.loadMask=new Common.UI.LoadMask({owner:$("#id-plugin-placeholder")}),e.loadMask.setTitle(e.textLoading),e.loadMask.show(),e.isLoaded&&e.loadMask.hide())},500),t.src=this.url,$("#id-plugin-placeholder").append(t),this.on("resizing",function(t){e.boxEl.css("height",parseInt(e.$window.css("height"))-e._headerFooterHeight)})},_onLoad:function(){this.isLoaded=!0,this.loadMask&&this.loadMask.hide()},setInnerSize:function(t,e){var i=Common.Utils.innerHeight(),n=Common.Utils.innerWidth(),o=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width"));i<e+this._headerFooterHeight&&(e=i-this._headerFooterHeight),n<t+o&&(t=n-o),this.boxEl.css("height",e),Common.UI.Window.prototype.setHeight.call(this,e+this._headerFooterHeight),Common.UI.Window.prototype.setWidth.call(this,t+o),this.$window.css("left",(n-t-o)/2),this.$window.css("top",(i-e-this._headerFooterHeight)/2*.9)},textLoading:"Loading"},Common.Views.PluginDlg||{}))}),define("common/main/lib/view/SearchDialog",["common/main/lib/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="100" placeholder="'+this.textSearchStart+'">',"</div>",'<div class="input-row">','<input type="text" id="sd-text-replace" class="form-control" maxlength="100" 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){Common.UI.Window.prototype.show.call(this),!this.mode&&!t&&(t="search"),t&&this.mode!=t&&this.setMode(t),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.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.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.setHeight(230)))},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(),casesensitive:this.miMatchCase.checked,wholewords:this.miMatchWord.checked}},textTitle:"Search & Replace",textTitle2:"Search",txtBtnReplace:"Replace",txtBtnReplaceAll:"Replace All",textMatchCase:"Case sensitive",textWholeWords:"Whole words only",textHighlight:"Highlight results",textReplaceDef:"Enter the replacement text",textSearchStart:"Enter text for search",txtBtnHideReplace:"Hide Replace"},Common.UI.SearchDialog||{}))}),define("text!documenteditor/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-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 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 id="fm-btn-history" 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-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>'}),define("documenteditor/main/app/view/FileMenu",["text!documenteditor/main/app/template/FileMenu.template","underscore","common/main/lib/component/BaseView"],function(t,e){"use strict";DE.Views.FileMenu=Common.UI.BaseView.extend(e.extend({el:"#file-menu-panel",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.items=[],this.items.push(new Common.UI.MenuItem({el:$("#fm-btn-return",this.el),action:"back",caption:this.btnCloseMenuCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-save",this.el),action:"save",caption:this.btnSaveCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-edit",this.el),action:"edit",caption:this.btnToEditCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-download",this.el),action:"saveas",caption:this.btnDownloadCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-save-desktop",this.el),action:"save-desktop",caption:this.btnSaveAsCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-print",this.el),action:"print",caption:this.btnPrintCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-rename",this.el),action:"rename",caption:this.btnRenameCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-recent",this.el),action:"recent",caption:this.btnRecentFilesCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-create",this.el),action:"new",caption:this.btnCreateNewCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-info",this.el),action:"info",caption:this.btnInfoCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-rights",this.el),action:"rights",caption:this.btnRightsCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-history",this.el),action:"history",caption:this.btnHistoryCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-settings",this.el),action:"opts",caption:this.btnSettingsCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-help",this.el),action:"help",caption:this.btnHelpCaption,canFocused:!1}),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 DE.Views.FileMenuPanels.Settings({menu:t}).render(),info:new DE.Views.FileMenuPanels.DocumentInfo({menu:t}).render(),rights:new DE.Views.FileMenuPanels.DocumentRights({menu:t}).render(),help:new DE.Views.FileMenuPanels.Help({menu:t}).render()},t.$el.find(".content-box").hide(),this},show:function(t,e){this.isVisible()&&void 0===t||(t||(t=this.active||(!this.mode.canDownload||this.mode.isDesktopApp&&this.mode.isOffline?"info":"saveas")),this.$el.show(),this.selectMenu(t,e),this.mode.isEdit&&DE.getController("Toolbar").DisableToolbar(!0),this.api.asc_enableKeyEvents(!1))},hide:function(){this.$el.hide(),this.mode.isEdit&&DE.getController("Toolbar").DisableToolbar(!1),this.fireEvent("filemenu:hide",[this]),this.api.asc_enableKeyEvents(!0)},applyMode:function(){this.items[5][this.mode.canPrint?"show":"hide"](),this.items[6][this.mode.canRename&&!this.mode.isDesktopApp?"show":"hide"](),this.items[6].$el.find("+.devider")[this.mode.isDisconnected?"hide":"show"](),this.items[7][this.mode.canOpenRecent?"show":"hide"](),this.items[8][this.mode.canCreateNew?"show":"hide"](),this.items[8].$el.find("+.devider")[this.mode.canCreateNew?"show":"hide"](),this.items[3][!this.mode.canDownload&&!this.mode.canDownloadOrigin||this.mode.isDesktopApp&&this.mode.isOffline?"hide":"show"](),this.items[4][(this.mode.canDownload||this.mode.canDownloadOrigin)&&this.mode.isDesktopApp&&this.mode.isOffline?"show":"hide"](),this.items[1][this.mode.isEdit?"show":"hide"](),this.items[2][!this.mode.isEdit&&this.mode.canEdit&&this.mode.canRequestEditRights?"show":"hide"](),this.items[10][!this.mode.isOffline&&!this.mode.isReviewOnly&&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.panels.opts.setMode(this.mode),this.panels.info.setMode(this.mode).updateInfo(this.document),this.panels.rights.setMode(this.mode).updateInfo(this.document),this.mode.canCreateNew&&this.mode.templates&&this.mode.templates.length&&($("a",this.items[8].$el).text(this.btnCreateNewCaption+"..."),this.panels.new=new DE.Views.FileMenuPanels.CreateNew({menu:this,docs:this.mode.templates}).render()),this.mode.canOpenRecent&&this.mode.recent&&(this.panels.recent=new DE.Views.FileMenuPanels.RecentFiles({menu:this,recent:this.mode.recent}).render()),this.mode.isDesktopApp,this.mode.canDownload?this.panels.saveas=new DE.Views.FileMenuPanels.ViewSaveAs({menu:this}).render():this.mode.canDownloadOrigin&&$("a",this.items[3].$el).text(this.textDownload),this.panels.help.setLangConfig(this.mode.lang),this.items[11][this.mode.canUseHistory&&!this.mode.isDisconnected?"show":"hide"]()},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,this.mode.canPrint=!1,this.mode.canDownload=this.mode.canDownloadOrigin=!1):this.mode=t,e||this.applyMode()},setApi:function(t){this.api=t,this.panels.info.setApi(t)},loadDocument:function(t){this.document=t.doc},selectMenu:function(t,e){if(t){var i=this._getMenuItem(t),n=this.panels[t];i&&n&&($(".fm-btn",this.el).removeClass("active"),i.$el.addClass("active"),this.$el.find(".content-box:visible").hide(),n.show(e),this.active=t)}},_getMenuItem:function(t){return e.find(this.items,function(e){return e.options.action==t})},SetDisabled:function(t){this.items[1][t||!this.mode.isEdit?"hide":"show"](),this.items[6][t||!this.mode.canRename||this.mode.isDesktopApp?"hide":"show"]()},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...",btnHistoryCaption:"Versions History",btnSaveAsCaption:"Save as",textDownload:"Download",btnRenameCaption:"Rename...",btnCloseMenuCaption:"Close Menu"},DE.Views.FileMenu||{}))}),define("documenteditor/main/app/view/LeftMenu",["text!documenteditor/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/History","common/main/lib/view/Plugins","common/main/lib/view/About","common/main/lib/view/SearchDialog","documenteditor/main/app/view/FileMenu"],function(t,e,i,n){"use strict";DE.Views.LeftMenu=n.View.extend(i.extend({el:"#left-menu",template:i.template(t),events:function(){return{"click #left-btn-comments":i.bind(this.onCoauthOptions,this),"click #left-btn-chat":i.bind(this.onCoauthOptions,this),"click #left-btn-plugins":i.bind(this.onCoauthOptions,this),"click #left-btn-support":function(){var t=this.mode.customization;t&&t.feedback&&t.feedback.url?window.open(t.feedback.url):window.open("http://support.onlyoffice.com")}}},initialize:function(){this.minimizedMode=!0},render:function(){e(this.el).html(this.template({})),this.btnFile=new Common.UI.Button({action:"file",el:e("#left-btn-file"),hint:this.tipFile+Common.Utils.String.platformKey("Alt+F"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSearch=new Common.UI.Button({action:"search",el:e("#left-btn-search"),hint:this.tipSearch+Common.Utils.String.platformKey("Ctrl+F"),disabled:!0,enableToggle:!0}),this.btnAbout=new Common.UI.Button({action:"about",el:e("#left-btn-about"),hint:this.tipAbout,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSupport=new Common.UI.Button({action:"support",el:e("#left-btn-support"),hint:this.tipSupport,disabled:!0}),this.btnComments=new Common.UI.Button({el:e("#left-btn-comments"),hint:this.tipComments+Common.Utils.String.platformKey("Ctrl+Shift+H"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnChat=new Common.UI.Button({el:e("#left-btn-chat"),hint:this.tipChat+Common.Utils.String.platformKey("Alt+Q"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnComments.hide(),this.btnChat.hide(),this.btnComments.on("click",i.bind(this.onBtnMenuClick,this)),this.btnChat.on("click",i.bind(this.onBtnMenuClick,this)),this.btnPlugins=new Common.UI.Button({el:e("#left-btn-plugins"),hint:this.tipPlugins,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnPlugins.hide(),this.btnPlugins.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSearch.on("click",i.bind(this.onBtnMenuClick,this)),this.btnAbout.on("toggle",i.bind(this.onBtnMenuToggle,this)),this.btnFile.on("toggle",i.bind(this.onBtnMenuToggle,this));var t=new DE.Views.FileMenu({});return t.options={alias:"FileMenu"},this.btnFile.panel=t.render(),this.btnAbout.panel=new Common.Views.About({el:e("#about-menu-panel"),appName:"Document Editor"}).render(),this},onBtnMenuToggle:function(t,e){e?(t.panel.show(),this.$el.width(40),this.btnSearch.isActive()&&this.btnSearch.toggle(!1)):t.panel.hide(),this.mode.isEdit&&DE.getController("Toolbar").DisableToolbar(1==e),this.supressEvents||Common.NotificationCenter.trigger("layout:changed","leftmenu")},onBtnMenuClick:function(t,e){this.supressEvents=!0,this.btnFile.toggle(!1),this.btnAbout.toggle(!1),"search"==t.options.action||(t.pressed?this.$el.width()>40||this.$el.width(parseInt(Common.localStorage.getItem("de-mainmenu-width"))||300):(Common.localStorage.setItem("de-mainmenu-width",this.$el.width()),this.$el.width(40))),this.supressEvents=!1,Common.NotificationCenter.trigger("layout:changed","leftmenu")},onCoauthOptions:function(t){this.mode.canCoAuthoring&&(this.mode.canComments&&(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.mode.canPlugins&&this.panelPlugins&&(this.btnPlugins.pressed?this.panelPlugins.show():this.panelPlugins.hide())},setOptionsPanel:function(t,e){"chat"==t?this.panelChat=e.render("#left-panel-chat"):"comment"==t?this.panelComments=e:"history"==t?this.panelHistory=e.render("#left-panel-history"):"plugins"!=t||this.panelPlugins||(this.panelPlugins=e.render("#left-panel-plugins"))},markCoauthOptions:function(t,e){"chat"!=t||!this.btnChat.isVisible()||this.btnChat.isDisabled()||this.btnChat.pressed||this.btnChat.$el.addClass("notify"),"comments"!=t||!this.btnComments.isVisible()||this.btnComments.pressed||this.btnComments.isDisabled()&&!e||this.btnComments.$el.addClass("notify")},close:function(t){this.btnFile.toggle(!1),this.btnAbout.toggle(!1),this.$el.width(40),this.mode.canCoAuthoring&&(this.mode.canComments&&(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,!0))),this.mode.canPlugins&&this.panelPlugins&&(this.panelPlugins.hide(),this.btnPlugins.toggle(!1,!0))},isOpened:function(){var t=this.btnFile.pressed||this.btnSearch.pressed;return!t&&(t=this.btnComments.pressed||this.btnChat.pressed),t},disableMenu:function(t,e){this.btnFile.setDisabled(!1),this.btnSearch.setDisabled(!1),this.btnAbout.setDisabled(!1),this.btnSupport.setDisabled(!1),this.btnComments.setDisabled(!1),this.btnChat.setDisabled(!1),this.btnPlugins.setDisabled(!1)},showMenu:function(t,e){var i=/^(\w+):?(\w*)$/.exec(t);"file"==i[1]&&this.btnFile.isVisible()?(this.btnFile.pressed||this.btnFile.toggle(!0),this.btnFile.panel.show(i[2].length?i[2]:void 0,e)):"chat"==t?!this.btnChat.isVisible()||this.btnChat.isDisabled()||this.btnChat.pressed||(this.btnChat.toggle(!0),this.onBtnMenuClick(this.btnChat),this.onCoauthOptions(),this.panelChat.focus()):"comments"==t&&(!this.btnComments.isVisible()||this.btnComments.isDisabled()||this.btnComments.pressed||(this.btnComments.toggle(!0),this.onBtnMenuClick(this.btnComments),this.onCoauthOptions()))},getMenu:function(t){switch(t){default:return null;case"file":return this.btnFile.panel;case"about":return this.btnAbout.panel}},setMode:function(t){return this.mode=t,this.btnAbout.panel.setMode(t),this},showHistory:function(){this.panelHistory.show(),this.panelHistory.$el.width((parseInt(Common.localStorage.getItem("de-mainmenu-width"))||300)-40),Common.NotificationCenter.trigger("layout:changed","history")},setDeveloperMode:function(t){if(this.$el.is(":visible")){this.developerHint||(this.developerHint=e('<div id="developer-hint">'+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:last-of-type");this.minDevPosition=n.offset().top-n.offsetParent().offset().top+n.height()+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"},DE.Views.LeftMenu||{}))}),define("documenteditor/main/app/controller/Viewport",["core","common/main/lib/view/Header","documenteditor/main/app/view/Viewport","documenteditor/main/app/view/LeftMenu"],function(t){"use strict";DE.Controllers.Viewport=Backbone.Controller.extend({models:[],collections:[],views:["Viewport","Common.Views.Header"],initialize:function(){},setApi:function(t){this.api=t},onLaunch:function(){this.viewport=this.createView("Viewport").render(),this.header=this.createView("Common.Views.Header",{headerCaption:"Document Editor"}).render(),Common.NotificationCenter.on("layout:changed",_.bind(this.onLayoutChanged,this)),$(window).on("resize",_.bind(this.onWindowResize,this));var t=$("#left-menu"),e=$("#left-panel-history");this.viewport.hlayout.on("layout:resizedrag",function(){this.api.Resize(),Common.localStorage.setItem("de-mainmenu-width",e.is(":visible")?e.width()+SCALE_MIN:t.width())},this),this.boxSdk=$("#editor_sdk"),this.boxSdk.css("border-left","none")},onLayoutChanged:function(t){switch(t){default:this.viewport.vlayout.doLayout();case"rightmenu":this.viewport.hlayout.doLayout();break;case"history":var e=this.viewport.hlayout.items[1];e.resize.el&&(this.boxSdk.css("border-left",""),e.resize.el.show()),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",""),e.resize.el.show()):(e.resize.el.hide(),this.boxSdk.css("border-left","0 none"))),this.viewport.hlayout.doLayout();break;case"header":case"toolbar":case"status":this.viewport.vlayout.doLayout()}this.api.Resize()},onWindowResize:function(t){this.onLayoutChanged("window")}})}),$(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api","[data-toggle=dropdown], [role=menu]",onDropDownKeyDown),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/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.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")),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},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)}}),void 0===Common)var Common={};if(define("common/main/lib/component/Menu",["common/main/lib/extend/Bootstrap","common/main/lib/component/BaseView","common/main/lib/component/MenuItem","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.Menu=function(){var t=function(){var t=[],e={};return{register:function(i){e[i.id]=i,i.on("show:after",function(e){t.push(e)}).on("hide:after",function(e){var i=t.indexOf(e);i>-1&&t.splice(i,1)})},unregister:function(i){var n=t.indexOf(i);delete e[i.id],n>-1&&t.splice(n,1),i.off("show:after").off("hide:after")},hideAll:function(){return Common.NotificationCenter.trigger("menumanager:hideall"),!!(t&&t.length>0)&&(_.each(t,function(t){t&&t.hide()}),!0)}}}();return _.extend(Common.UI.BaseView.extend({options:{cls:"",style:"",itemTemplate:null,items:[],menuAlign:"tl-bl",menuAlignEl:null,offset:[0,0],cyclic:!0},template:_.template(['<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var i=this;this.id=this.options.id||Common.UI.getId(),this.itemTemplate=this.options.itemTemplate||Common.UI.MenuItem.prototype.template,this.rendered=!1,this.items=[],this.offset=[0,0],this.menuAlign=this.options.menuAlign,this.menuAlignEl=this.options.menuAlignEl,this.options.cyclic||(this.options.cls+=" no-cyclic"),_.each(this.options.items,function(t){t instanceof Common.UI.MenuItem?i.items.push(t):i.items.push(new Common.UI.MenuItem(_.extend({tagName:"li",template:i.itemTemplate},t)))}),this.options.el&&this.render(),t.register(this)},remove:function(){t.unregister(this),Common.UI.BaseView.prototype.remove.call(this)},render:function(t){var e=this;this.trigger("render:before",this),this.cmpEl=$(this.el),t?(this.setElement(t,!1),e.rendered||(this.cmpEl=$(this.template({options:e.options})),t.append(this.cmpEl))):e.rendered||(this.cmpEl=this.template({options:e.options}),$(this.el).append(this.cmpEl));var i=this.cmpEl.parent(),n="menu"===i.attr("role")?i:i.find("[role=menu]");return n&&(e.rendered||_.each(e.items||[],function(t){n.append(t.render().el),t.on("click",_.bind(e.onItemClick,e)),t.on("toggle",_.bind(e.onItemToggle,e))}),n.css({"max-height":e.options.maxHeight||"none",position:"fixed",right:"auto",left:-1e3,top:-1e3}),this.parentEl=n.parent(),this.parentEl.on("show.bs.dropdown",_.bind(e.onBeforeShowMenu,e)),this.parentEl.on("shown.bs.dropdown",_.bind(e.onAfterShowMenu,e)),this.parentEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),this.parentEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e)),this.parentEl.on("keydown.after.bs.dropdown",_.bind(e.onAfterKeydownMenu,e)),n.on("scroll",_.bind(e.onScroll,e)),n.hover(function(t){e.isOver=!0},function(t){e.isOver=!1})),this.rendered=!0,this.trigger("render:after",this),this},isVisible:function(){return this.rendered&&this.cmpEl.is(":visible")},show:function(){this.rendered&&this.parentEl&&!this.parentEl.hasClass("open")&&this.cmpEl.dropdown("toggle")},hide:function(){this.rendered&&this.parentEl&&(this.parentEl.hasClass("open")?this.cmpEl.dropdown("toggle"):this.parentEl.hasClass("over")&&this.parentEl.removeClass("over"))},insertItem:function(t,e){var i=this,n=this.cmpEl;if(e instanceof Common.UI.MenuItem||(e=new Common.UI.MenuItem(_.extend({tagName:"li",template:i.itemTemplate},e))),t<0||t>=i.items.length?i.items.push(e):i.items.splice(t,0,e),this.rendered){var o="menu"===n.attr("role")?n:n.find("[role=menu]");o&&(t<0?o.append(e.render().el):0===t?o.prepend(e.render().el):$("li:nth-child("+(t+1)+")",o).before(e.render().el),e.on("click",_.bind(i.onItemClick,i)),e.on("toggle",_.bind(i.onItemToggle,i)))}},doLayout:function(){if(this.options.maxHeight>0){if(!this.rendered)return void(this.mustLayout=!0);var t=this.cmpEl,e="menu"===t.attr("role")?t:t.find("[role=menu]");if(!e.is(":visible")){var i=[e.css("left"),e.css("top")];e.css({left:"-1000px",top:"-1000px",display:"block"})}var n=e.find("li");if(n.height()*n.length>this.options.maxHeight){var o='<div class="menu-scroll top"></div>';e.prepend(o),o='<div class="menu-scroll bottom"></div>',e.append(o),e.css({"box-shadow":"none","overflow-y":"hidden","padding-top":"18px"}),e.find("> li:last-of-type").css("margin-bottom",18);var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(e[0],s,_.bind(this.onMouseWheel,this)),e.find(".menu-scroll").on("click",_.bind(this.onScrollClick,this))}i&&e.css({display:"",left:i[0],top:i[1]})}},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.mustLayout&&(delete this.mustLayout,this.doLayout.call(this)),this.trigger("show:before",this,t),this.alignPosition()},onAfterShowMenu:function(t){if(this.trigger("show:after",this,t),this.$el.find("> ul > .menu-scroll").length){var e=this.$el.find("li .checked")[0];if(e){var i=e.offsetTop-this.options.maxHeight/2;this.scrollMenu(i<0?0:i)}}},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(t.keyCode==Common.UI.Keys.RETURN){var e=$(t.target).closest("li");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")&&t.stopPropagation()}else t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?this.fromKeyDown=!0:(t.keyCode,Common.UI.Keys.ESC)},onScroll:function(t,e){if(this.fromKeyDown){var i="menu"===this.cmpEl.attr("role")?this.cmpEl:this.cmpEl.find("[role=menu]");i.find(".menu-scroll.top").css("top",i.scrollTop()+"px"),i.find(".menu-scroll.bottom").css("bottom",-i.scrollTop()+"px")}},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)},onScrollClick:function(t){return this.scrollMenu(/top/.test(t.currentTarget.className)),!1},onMouseWheel:function(t){this.scrollMenu((t.detail&&-t.detail||t.wheelDelta)>0)},scrollMenu:function(t){this.fromKeyDown=!1;var e="menu"===this.cmpEl.attr("role")?this.cmpEl:this.cmpEl.find("[role=menu]"),i="boolean"==typeof t?e.scrollTop()+(t?-20:20):t;e.scrollTop(i),e.find(".menu-scroll.top").css("top",e.scrollTop()+"px"),e.find(".menu-scroll.bottom").css("bottom",-e.scrollTop()+"px")},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(){var t="menu"===this.cmpEl.attr("role")?this.cmpEl:this.cmpEl.find("[role=menu]"),e=this.menuAlignEl||t.parent(),i=this.menuAlign.match(/^([a-z]+)-([a-z]+)/),n=e.offset(),o=Common.Utils.innerWidth(),s=Common.Utils.innerHeight()-10,a=t.outerWidth(),r=t.outerHeight(),l=e.outerWidth(),c=e.outerHeight(),d={tl:[0,0],bl:[0,r],tr:[a,0],br:[a,r]},h={tl:[0,0],tr:[l,0],bl:[0,c],br:[l,c]},p=n.left-d[i[1]][0]+h[i[2]][0]+this.offset[0],m=n.top-d[i[1]][1]+h[i[2]][1]+this.offset[1];p+a>o&&(p=e.is("li.dropdown-submenu")?n.left-a+2:o-a),m+r>s&&(m=s-r),m<0&&(m=0),this.options.additionalAlign?this.options.additionalAlign.call(this,t,p,m):t.css({left:p,top:m})}}),{Manager:function(){return t}()})}()}),void 0===Common)var Common={};if(define("common/main/lib/view/InsertTableDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.InsertTableDialog=Common.UI.Window.extend(_.extend({options:{width:230,height:170,header:!1,style:"min-width: 230px;",cls:"modal-dlg"},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div class="box">',"<h4>"+this.txtTitle+"</h4>",'<div class="input-row" style="margin: 10px 0;">','<label class="text columns-text" style="width: 130px;">'+this.txtColumns+'</label><div class="columns-val" style="float: right;"></div>',"</div>",'<div class="input-row" style="margin: 10px 0;">','<label class="text rows-text" style="width: 130px;">'+this.txtRows+'</label><div class="rows-val" style="float: right;"></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.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.udColumns=new Common.UI.MetricSpinner({el:t.find(".columns-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:63,minValue:1,allowDecimal:!1}),this.udRows=new Common.UI.MetricSpinner({el:t.find(".rows-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:100,minValue:1,allowDecimal:!1})},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,{columns:this.udColumns.getValue(),rows:this.udRows.getValue()}),this.close()},onPrimary:function(){return this.options.handler&&this.options.handler.call(this,"ok",{columns:this.udColumns.getValue(),rows:this.udRows.getValue()}),this.close(),!1},txtTitle:"Table size",txtColumns:"Number of Columns",txtRows:"Number of Rows",textInvalidRowsCols:"You need to specify valid rows and columns count.",cancelButtonText:"Cancel",okButtonText:"Ok",txtMinText:"The minimum value for this field is {0}",txtMaxText:"The maximum value for this field is {0}"},Common.Views.InsertTableDialog||{}))}),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("text!documenteditor/main/app/template/DropcapSettingsAdvanced.template",[],function(){return'<div id="id-adv-dropcap-frame" class="settings-panel">\n <div class="inner-content">\n <table cols="3" style="width: 100%">\n <tr>\n <td colspan="3">\n <label class="header padding-small"><%= scope.textPosition %></label>\n </td>\n </tr>\n <tr>\n <td colspan="3" class="settins-cell padding-large">\n <span id="frame-advanced-button-none" style="margin-right:5px;"></span>\n <span id="frame-advanced-button-inline" style="margin-right:5px;"></span>\n <span id="frame-advanced-button-flow"></span>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan="3">\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td class="settins-cell padding-small" width="80">\n <label class="input-label"><%= scope.textWidth %></label>\n </td>\n <td class="settins-cell padding-small" width="130" style="padding-right: 10px;">\n <div id="frame-advanced-input-widthtype"></div>\n </td>\n <td class="settins-cell padding-small" width="95">\n <div id="frame-advanced-input-width"></div>\n </td>\n </tr>\n <tr>\n <td class="settins-cell padding-small" width="80">\n <label class="input-label"><%= scope.textHeight %></label>\n </td>\n <td class="settins-cell padding-small" width="130" style="padding-right: 10px;">\n <div id="frame-advanced-input-heighttype"></div>\n </td>\n <td class="settins-cell padding-small" width="95">\n <div id="frame-advanced-input-height"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan="3">\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td colspan="3">\n <label class="header"><%= scope.textHorizontal %></label>\n </td>\n </tr>\n <tr>\n <td colspan="2"></td>\n <td class="settins-cell">\n <label class="input-label"><%= scope.textRelative %></label>\n </td>\n </tr>\n <tr>\n <td class="settins-cell padding-small" width="80">\n <label class="input-label"><%= scope.textPosition %></label>\n </td>\n <td class="settins-cell padding-small" width="130" style="padding-right: 10px;">\n <div id="frame-advanced-input-hposition"></div>\n </td>\n <td class="settins-cell padding-small" width="95">\n <div id="frame-advanced-input-hrelative"></div>\n </td>\n </tr>\n <tr>\n <td class="settins-cell padding-small" colspan="2" style="padding-right: 10px;">\n <label class="input-label" style="float: right;"><%= scope.textDistance %></label>\n </td>\n <td class="settins-cell padding-small">\n <div id="frame-advanced-input-hdist"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan="3">\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td colspan="3">\n <label class="header"><%= scope.textVertical %></label>\n </td>\n </tr>\n <tr>\n <td colspan="2"></td>\n <td class="settins-cell">\n <label class="input-label"><%= scope.textRelative %></label>\n </td>\n </tr>\n <tr>\n <td class="settins-cell padding-small" width="80">\n <label class="input-label"><%= scope.textPosition %></label>\n </td>\n <td class="settins-cell padding-small" width="130" style="padding-right: 10px;">\n <div id="frame-advanced-input-vposition"></div>\n </td>\n <td class="settins-cell padding-small" width="95">\n <div id="frame-advanced-input-vrelative"></div>\n </td>\n </tr>\n <tr>\n <td class="settins-cell padding-small" colspan="2" style="padding-right: 10px;">\n <label class="input-label" style="float: right;"><%= scope.textDistance %></label>\n </td>\n <td class="settins-cell padding-small">\n <div id="frame-advanced-input-vdist"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan="3">\n <div id="frame-advanced-checkbox-move"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>\n<div id="id-adv-dropcap-dropcap" class="settings-panel">\n <div class="inner-content">\n <label class="header padding-small" style="width: 100%;"><%= scope.textPosition %></label>\n <div class="padding-small" style="width: 100%">\n <span id="drop-advanced-button-none" style="margin-right:5px;"></span>\n <span id="drop-advanced-button-intext" style="margin-right:5px;"></span>\n <span id="drop-advanced-button-inmargin" style="margin-right:5px;"></span>\n </div>\n <label class="header padding-small" style="width: 100%;"><%= scope.textParameters %></label>\n <label class="input-label"><%= scope.textFont %></label>\n <div id="drop-advanced-input-fonts" class="padding-small" style="width: 100%;"></div>\n </div>\n <div class="inner-content">\n <table cols="2" style="width: 100%;">\n <tr>\n <td width="50%">\n <label class="input-label"><%= scope.textRowHeight %></label>\n <div id="drop-advanced-input-rowheight"></div>\n </td>\n <td width="50%">\n <label class="input-label"><%= scope.textDistance %></label>\n <div id="drop-advanced-input-distance"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>\n<div id="id-adv-dropcap-borders" class="settings-panel">\n <div class="inner-content">\n <div style="width: 100%;" class="padding-small">\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBorderWidth %></label>\n <div id="drop-advanced-input-bordersize" 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="drop-advanced-button-bordercolor" style="display: inline-block;"></div>\n </div>\n </div>\n <label class="input-label padding-small" style="width: 100%;"><%= scope.textBorderDesc %></label>\n <div style="width: 100%;" class="padding-large">\n <div id="drop-advanced-borderstyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 170px;outline: 1px solid #ccc;"></div>\n <div style="display: inline-block; float:right;vertical-align: middle; width: 80px; height: 170px; padding-top: 10px; padding-left: 4px;">\n <div id="drop-advanced-button-borderline-00" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-01" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-10" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-11" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-20" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-21" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-30" style="display: inline-block;"></div>\n <div id="drop-advanced-button-borderline-31" style="display: inline-block;"></div>\n </div>\n </div>\n <div style="width: 100%;" class="padding-small">\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>\n <div id="drop-advanced-button-color" style="display: inline-block;"></div>\n </div>\n </div>\n</div>\n<div id="id-adv-dropcap-margins" class="settings-panel">\n <div class="inner-content">\n <table cols="2" style="width: 100%;">\n <tr>\n <td class="padding-small" width="50%">\n <label class="input-label"><%= scope.textTop %></label>\n <div id="drop-advanced-input-top"></div>\n </td>\n <td class="padding-small" width="50%">\n <label class="input-label"><%= scope.textLeft %></label>\n <div id="drop-advanced-input-left"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" width="50%">\n <label class="input-label"><%= scope.textBottom %></label>\n <div id="drop-advanced-input-bottom"></div>\n </td>\n <td class="padding-small" width="50%">\n <label class="input-label"><%= scope.textRight %></label>\n <div id="drop-advanced-input-right"></div>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),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.el);this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),void 0!==this.options.value&&this.setValue(this.options.value,!0),this.$chk.on("click",e.bind(this.onItemCheck,this))},render:function(){var t=$(this.el);return t.html(this.template({labelText:this.options.labelText})),this.$chk=t.find("input[type=button]"),this.$label=t.find("label"),this.rendered=!0,this},setDisabled:function(t){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={};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">','<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="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',"</li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(t){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(t,{displayField:"name",scroller:{alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(t.recent)?t.recent:3,Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),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},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.keyCode!=Common.UI.Keys.END&&t.keyCode!=Common.UI.Keys.BACKSPACE||!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)},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)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 36},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(){i.store.set(t.toJSON()),i.rendered=!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))})},onApiChangeFont:function(t){
|
|
|
var e=_.isFunction(t.get_Name)?t.get_Name():t.asc_getName();if(this.getRawValue()!==e){var i=this.store.findWhere({name:e});if($(".selected",$(this.el)).removeClass("selected"),i){this.setRawValue(i.get(this.displayField));var n=$("#"+i.get("id"),$(this.el)),o=$("ul.dropdown-menu",this.cmpEl);n&&o&&(n.addClass("selected"),this.recent<=0&&o.scrollTop(n.offset().top-o.offset().top))}else this.setRawValue(e)}},itemClicked:function(t){var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i),Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['<li id="<%= item.id %>">','<a class="font-item" tabindex="-1" type="menuitem" style="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',"</li>"].join(""),{item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t){if(t.get("type")!=FONT_TYPE_RECENT&&!this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT})){var e=this.store.where({type:FONT_TYPE_RECENT});e.length<this.recent||this.store.remove(e[this.recent-1]);var i=t.clone();i.set({type:FONT_TYPE_RECENT,id:Common.UI.getId(),cloneid:t.id}),this.store.add(i,{at:0})}},selectCandidate:function(t){var e=this,i=this._input.val().toLowerCase();this._fontsArray||(this._fontsArray=this.store.toJSON());var n=_.find(this._fontsArray,function(n){return t?n[e.displayField].toLowerCase()==i:0==n[e.displayField].toLowerCase().indexOf(i)});if(this._selectedItem=n?this.store.findWhere({id:n.id}):null,$(".selected",$(this.el)).removeClass("selected"),this._selectedItem){var o=$("#"+this._selectedItem.get("id"),$(this.el)),s=$("ul[role=menu]",$(this.el));if(o.length>0&&s.length>0){o.addClass("selected");var a=o.position().top,r=s.scrollTop();0!=a&&s.scrollTop(r+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,a=o.store.length,r=0;if(o.tiles||(o.tiles=[]),a!==o.tiles.length)for(s=o.tiles.length;s<a;++s)o.tiles.unshift(null);_.isUndefined(n)&&(n=parseInt($(o.el).find(".ps-scrollbar-x-rail").css("bottom")));var l=$(o.el).find(".dropdown-menu").height(),c=Math.max(Math.floor(l/36)+3,0),d=Math.max(Math.floor(-n/36)-1,0),h=d+c,p=$(o.el).find("a");for(s=0;s<a;++s)if(d<=s&&s<h){if(null===o.tiles[s]){var m=document.createElement("canvas"),u=m.getContext("2d");m.height=e?2*t:t,m.width=e?604:302,m.style.width="302px",m.style.height=t+"px",r=o.store.at(s).get("imgidx"),e?(u.clearRect(0,0,604,2*t),u.drawImage(o.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*r)):(u.clearRect(0,0,302,t),u.drawImage(o.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*r)),o.tiles[s]=m,$(p[s]).get(0).appendChild(m)}}else o.tiles[s]&&(o.tiles[s].parentNode.removeChild(o.tiles[s]),o.tiles[s]=null)},flushVisibleFontsTiles:function(){for(var t=this.tiles.length-1;t>=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/MetricSpinner",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MetricSpinner=Common.UI.BaseView.extend({options:{minValue:0,maxValue:100,step:1,defaultUnit:"px",allowAuto:!1,autoText:"Auto",hold:!0,speed:"medium",width:90,allowDecimal:!0},disabled:!1,value:"0 px",rendered:!1,template:'<input type="text" class="form-control"><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.DELETE||t.keyCode===Common.UI.Keys.BACKSPACE||t.keyCode===Common.UI.Keys.LEFT||t.keyCode===Common.UI.Keys.RIGHT||t.keyCode===Common.UI.Keys.HOME||t.keyCode===Common.UI.Keys.END||t.keyCode===Common.UI.Keys.ESC||t.keyCode===Common.UI.Keys.RETURN||t.keyCode===Common.UI.Keys.INSERT||t.keyCode===Common.UI.Keys.TAB||(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.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/=1e3),"ms"!=this.options.defaultUnit&&"мс"!=this.options.defaultUnit||(i*=1e3),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/=10:"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=6*i/25.4),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/TableStyler",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.CellStyler=Common.UI.BaseView.extend({options:{clickOffset:10,overwriteStyle:!0,maxBorderSize:6,halfBorderSize:!1,defaultBorderSize:1,defaultBorderColor:"#ccc"},template:_.template(['<div id="<%=id%>" class="tablestyler-cell" style="">','<div class="cell-content" style="">','<div class="content-text"></div>',"</div>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n=this,o=void 0,s={},a={},r={};n.id=n.options.id||Common.UI.getId(),n.clickOffset=n.options.clickOffset,n.overwriteStyle=n.options.overwriteStyle,n.maxBorderSize=n.options.maxBorderSize,n.halfBorderSize=n.options.halfBorderSize,n.defaultBorderSize=n.options.defaultBorderSize,n.defaultBorderColor=n.options.defaultBorderColor,n.col=n.options.col,n.row=n.options.row,e=n.defaultBorderSize,i=new Common.Utils.RGBColor(n.defaultBorderColor),s={top:e,right:e,bottom:e,left:e},a={top:i,right:i,bottom:i,left:i},r={top:1,right:1,bottom:1,left:1},n.rendered=!1;var l=function(){if(!_.isUndefined(o)){var t=s.left>.1&&s.left<1?1:s.left,e=Math.abs(n.halfBorderSize?.5*(t%2?t-1:t):t);t=s.right>.1&&s.right<1?1:s.right;var i=Math.abs(n.halfBorderSize?.5*(t%2?t+1:t):t);t=s.top>.1&&s.top<1?1:s.top;var l=Math.abs(n.halfBorderSize?.5*(t%2?t-1:t):t);t=s.bottom>.1&&s.bottom<1?1:s.bottom;var c=Math.abs(n.halfBorderSize?.5*(t%2?t+1:t):t),d="inset "+(e>.1&&e<1?1:e)+"px 0 0 "+a.left.toRGBA(r.left)+", inset "+-1*(i>.1&&i<1?1:i)+"px 0 0 "+a.right.toRGBA(r.right)+", inset 0 "+(l>.1&&l<1?1:l)+"px 0 "+a.top.toRGBA(r.top)+", inset 0 "+-1*(c>.1&&c<1?1:c)+"px 0 "+a.bottom.toRGBA(r.bottom);o.css("box-shadow",d)}};n.on("render:after",function(t){this.cmpEl&&(o=this.cmpEl.find(".cell-content"),l()),this.cmpEl.on("click",function(t){var o={x:t.pageX*Common.Utils.zoom()-n.cmpEl.offset().left,y:t.pageY*Common.Utils.zoom()-n.cmpEl.offset().top},c=function(t,e,i,n,o){var s,a,r=0;for(s=0,a=t-1;s<t;a=s++)(i[s]<=o&&o<i[a]||i[a]<=o&&o<i[s])&&n<(e[a]-e[s])*(o-i[s])/(i[a]-i[s])+e[s]&&(r=!r);return r},d=n.cmpEl.outerWidth(),h=n.cmpEl.outerHeight();c(4,[0,d,d-n.clickOffset,n.clickOffset],[0,0,n.clickOffset,n.clickOffset],o.x,o.y)?(n.overwriteStyle?s.top==e&&a.top.isEqual(i)?s.top=0:(s.top=e,a.top=i,r.top=e<1?.3:1):(s.top=s.top>0?0:e,a.top=i),n.fireEvent("borderclick",n,"t",s.top,a.top.toHex())):c(4,[d,d,d-n.clickOffset,d-n.clickOffset],[0,h,h-n.clickOffset,n.clickOffset],o.x,o.y)?(n.overwriteStyle?s.right==e&&a.right.isEqual(i)?s.right=0:(s.right=e,a.right=i,r.right=e<1?.3:1):(s.right=s.right>0?0:e,a.right=i),n.fireEvent("borderclick",n,"r",s.right,a.right.toHex())):c(4,[0,n.clickOffset,d-n.clickOffset,d],[h,h-n.clickOffset,h-n.clickOffset,h],o.x,o.y)?(n.overwriteStyle?s.bottom==e&&a.bottom.isEqual(i)?s.bottom=0:(s.bottom=e,a.bottom=i,r.bottom=e<1?.3:1):(s.bottom=s.bottom>0?0:e,a.bottom=i),n.fireEvent("borderclick",n,"b",s.bottom,a.bottom.toHex())):c(4,[0,n.clickOffset,n.clickOffset,0],[0,n.clickOffset,h-n.clickOffset,h],o.x,o.y)&&(n.overwriteStyle?s.left==e&&a.left.isEqual(i)?s.left=0:(s.left=e,a.left=i,r.left=e<1?.3:1):(s.left=s.left>0?0:e,a.left=i),n.fireEvent("borderclick",n,"l",s.left,a.left.toHex())),l()})}),n.setBordersSize=function(t,e){e=e>this.maxBorderSize?this.maxBorderSize:e,t.indexOf("t")>-1&&(s.top=e,r.top=e<1?.3:1),t.indexOf("r")>-1&&(s.right=e,r.right=e<1?.3:1),t.indexOf("b")>-1&&(s.bottom=e,r.bottom=e<1?.3:1),t.indexOf("l")>-1&&(s.left=e,r.left=e<1?.3:1),l()},n.setBordersColor=function(t,e){var i=new Common.Utils.RGBColor(e);t.indexOf("t")>-1&&(a.top=i),t.indexOf("r")>-1&&(a.right=i),t.indexOf("b")>-1&&(a.bottom=i),t.indexOf("l")>-1&&(a.left=i),l()},n.getBorderSize=function(t){switch(t){case"t":return s.top;case"r":return s.right;case"b":return s.bottom;case"l":return s.left}return null},n.getBorderColor=function(t){switch(t){case"t":return a.top.toHex();case"r":return a.right.toHex();case"b":return a.bottom.toHex();case"l":return a.left.toHex()}return null},n.setVirtualBorderSize=function(t){e=t>this.maxBorderSize?this.maxBorderSize:t},n.setVirtualBorderColor=function(t){var e=new Common.Utils.RGBColor(t);i.isEqual(e)||(i=e)},n.getVirtualBorderSize=function(){return e},n.getVirtualBorderColor=function(){return i.toHex()},n.options.el&&n.render()},render:function(t){var e=this;return this.trigger("render:before",this),e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),e.rendered=!0,this.trigger("render:after",this),this}}),Common.UI.TableStyler=Common.UI.BaseView.extend({options:{width:200,height:200,rows:2,columns:2,cellPadding:10,tablePadding:10,overwriteStyle:!0,maxBorderSize:6,spacingMode:!1,defaultBorderSize:1,defaultBorderColor:"#ccc"},template:_.template(['<div id="<%=scope.id%>" class="table-styler" style="position: relative; width: <%=scope.width%>px; height:<%=scope.height%>px;">','<div style="position: absolute; left: 0; top: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-bottom: 1px dotted gray; border-right: 1px dotted gray;"></div>','<div style="position: absolute; left: <%=scope.tablePadding%>px; top: 0; right: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;">','<div id="<%=scope.id%>-table-top-border-selector" style="position: absolute; z-index: 1; height: <%=scope.tablePadding%>px; left: 0; right: 0; top: <%=scope.tablePadding * .5%>px;">','<table width="100%" height="100%">',"<tr>",'<td id="<%=scope.id%>-table-top-border" style="height:50%; border-bottom: <%=borderSize.top%>px solid <%borderColor.top.toHex()%>;"></td>',"</tr>","<tr>","<td></td>","</tr>","</table>","</div>","</div>",'<div style="position: absolute; top: 0; right: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-bottom: 1px dotted gray; border-left: 1px dotted gray;"></div>','<div style="position: absolute; left: 0; top: <%=scope.tablePadding%>px; width: <%=scope.tablePadding%>px; height: <%=scope.height - 2 * scope.tablePadding%>px;">','<div id="<%=scope.id%>-table-left-border-selector" style="position: absolute; z-index: 1; left: <%=scope.tablePadding * .5%>px; top: 0; bottom: 0; width: <%=scope.tablePadding%>px;">','<table width="100%" height="100%">',"<tr>",'<td id="<%=scope.id%>-table-left-border" style="border-right: <%=borderSize.left%>px solid <%=borderColor.left.toHex()%>;"></td>','<td width="50%"></td>',"</tr>","</table>","</div>","</div>",'<div style="position: absolute; left: <%=scope.tablePadding%>px; top: <%=scope.tablePadding%>px; right: <%=scope.tablePadding%>px; bottom: <%=scope.tablePadding%>px;">','<table id="<%=scope.id%>-table-content" cols="<%=scope.columns%>" width="100%" height="100%" style="border-collapse: inherit; border-spacing: <%= scope.spacingMode ? scope.cellPadding : 0 %>px;">',"<% for (var row = 0; row < scope.rows; row++) { %>","<tr>","<% for (var col = 0; col < scope.columns; col++) { %>",'<td id="<%=scope.id%>-cell-container-<%=col%>-<%=row%>" class="content-box"></td>',"<% } %>","</tr>","<% } %>","</table>","</div>",'<div style="position: absolute; right: 0; top: <%=scope.tablePadding%>px; width: <%=scope.tablePadding%>px; height: <%=scope.height - 2 * scope.tablePadding%>px;">','<div id="<%=scope.id%>-table-right-border-selector" style="position: absolute; z-index: 1; right: <%=scope.tablePadding * .5%>px; top: 0; bottom: 0; width: <%=scope.tablePadding%>px;">','<table width="100%" height="100%">',"<tr>",'<td id="<%=scope.id%>-table-right-border" style="border-right: <%=borderSize.right%>px solid <%=borderColor.right.toHex()%>;"></td>','<td width="50%"></td>',"</tr>","</table>","</div>","</div>",'<div style="position: absolute; left: 0; bottom: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-top: 1pt dotted gray; border-right: 1pt dotted gray;"></div>','<div style="position: absolute; left: <%=scope.tablePadding%>px; bottom: 0; right: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;">','<div id="<%=scope.id%>-table-bottom-border-selector" style="position: absolute; z-index: 1; height: <%=scope.tablePadding%>px; left: 0; right: 0; bottom: <%=scope.tablePadding * .5%>px;">','<table width="100%" height="100%">',"<tr>",'<td id="<%=scope.id%>-table-bottom-border" style="height:50%; border-bottom: <%=borderSize.bottom%>px solid <%=borderColor.bottom.toHex()%>;"></td>',"</tr>","<tr>","<td></td>","</tr>","</table>","</div>","</div>",'<div style="position: absolute; bottom: 0; right: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-top: 1pt dotted gray; border-left: 1pt dotted gray;"></div>',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n,o,s,a,r,l,c,d,h,p,m=this;m.id=m.options.id||Common.UI.getId(),m.width=m.options.width,m.height=m.options.height,m.rows=m.options.rows,m.columns=m.options.columns,m.cellPadding=m.options.cellPadding,m.tablePadding=m.options.tablePadding,m.overwriteStyle=m.options.overwriteStyle,m.maxBorderSize=m.options.maxBorderSize,m.spacingMode=m.options.spacingMode,m.defaultBorderSize=m.options.defaultBorderSize,m.defaultBorderColor=m.options.defaultBorderColor,c=m.defaultBorderSize>m.maxBorderSize?m.maxBorderSize:m.defaultBorderSize,d=new Common.Utils.RGBColor(m.defaultBorderColor);var u={top:c,right:c,bottom:c,left:c},g={top:d,right:d,bottom:d,left:d};m.rendered=!1;var b=function(){e&&e.css("border-bottom",(u.top>.1&&u.top<1?1:u.top)+"px solid "+g.top.toRGBA(u.top<1?.2:1)),i&&i.css("border-right",(u.right>.1&&u.right<1?1:u.right)+"px solid "+g.right.toRGBA(u.right<1?.2:1)),n&&n.css("border-bottom",(u.bottom>.1&&u.bottom<1?1:u.bottom)+"px solid "+g.bottom.toRGBA(u.bottom<1?.2:1)),o&&o.css("border-right",(u.left>.1&&u.left<1?1:u.left)+"px solid "+g.left.toRGBA(u.left<1?.2:1)),f(s),f(a),f(r),f(l)},f=function(t){return t.hide(0,function(){$(this).show()})};m.on("render:after",function(t){var b=m.id;e=$("#"+b+"-table-top-border"),i=$("#"+b+"-table-right-border"),n=$("#"+b+"-table-bottom-border"),o=$("#"+b+"-table-left-border"),s=$("#"+b+"-table-top-border-selector"),a=$("#"+b+"-table-right-border-selector"),r=$("#"+b+"-table-bottom-border-selector"),l=$("#"+b+"-table-left-border-selector"),h=$("#"+b+"-table-content"),p=h.find(".cell-content"),h.find(".content-box").css("height",m.rows>1?"50%":"auto"),s.on("click",function(t){m.overwriteStyle?u.top==c&&g.top.isEqual(d)?u.top=0:(u.top=c,g.top=d):(u.top=u.top>0?0:c,g.top=d),e.css("border-bottom",(u.top>.1&&u.top<1?1:u.top)+"px solid "+g.top.toRGBA(u.top<1?.2:1)),f(s),m.fireEvent("borderclick",m,"t",u.top,g.top.toHex())}),a.on("click",function(t){m.overwriteStyle?u.right==c&&g.right.isEqual(d)?u.right=0:(u.right=c,g.right=d):(u.right=u.right>0?0:c,g.right=d),i.css("border-right",(u.right>.1&&u.right<1?1:u.right)+"px solid "+g.right.toRGBA(u.right<1?.2:1)),f(a),m.fireEvent("borderclick",m,"r",u.right,g.right.toHex())}),r.on("click",function(t){m.overwriteStyle?u.bottom==c&&g.bottom.isEqual(d)?u.bottom=0:(u.bottom=c,g.bottom=d):(u.bottom=u.bottom>0?0:c,g.bottom=d),n.css("border-bottom",(u.bottom>.1&&u.bottom<1?1:u.bottom)+"px solid "+g.bottom.toRGBA(u.bottom<1?.2:1)),f(r),m.fireEvent("borderclick",m,"b",u.bottom,g.bottom.toHex())}),l.on("click",function(t){m.overwriteStyle?u.left==c&&g.left.isEqual(d)?u.left=0:(u.left=c,g.left=d):(u.left=u.left>0?0:c,g.left=d),o.css("border-right",(u.left>.1&&u.left<1?1:u.left)+"px solid "+g.left.toRGBA(u.left<1?.2:1)),f(l),m.fireEvent("borderclick",m,"l",u.left,g.left.toHex())})}),m.getVirtualBorderSize=function(){return c},m.getVirtualBorderColor=function(){return d.toHex()},m.setVirtualBorderSize=function(t){t=t>m.maxBorderSize?m.maxBorderSize:t,c=t;for(var e=0;e<m.rows;e++)for(var i=0;i<m.columns;i++){var n=m.getCell(i,e);n.setVirtualBorderSize(t)}},m.setVirtualBorderColor=function(t){var e=new Common.Utils.RGBColor(t);if(!d.isEqual(e)){d=e;for(var i=0;i<m.rows;i++)for(var n=0;n<m.columns;n++){var o=m.getCell(n,i);o.setVirtualBorderColor(d.toHex())}}},m.setBordersSize=function(t,e){e=e>m.maxBorderSize?m.maxBorderSize:e,t.indexOf("t")>-1&&(u.top=e),t.indexOf("r")>-1&&(u.right=e),t.indexOf("b")>-1&&(u.bottom=e),t.indexOf("l")>-1&&(u.left=e),b()},m.setBordersColor=function(t,e){var i=new Common.Utils.RGBColor(e);t.indexOf("t")>-1&&(g.top=i),t.indexOf("r")>-1&&(g.right=i),t.indexOf("b")>-1&&(g.bottom=i),t.indexOf("l")>-1&&(g.left=i),b()},m.getBorderSize=function(t){switch(t){case"t":return u.top;case"r":return u.right;case"b":return u.bottom;case"l":return u.left}return null},m.getBorderColor=function(t){switch(t){case"t":return g.top.toHex();case"r":return g.right.toHex();case"b":return g.bottom.toHex();case"l":return g.left.toHex()}return null},m.setTableColor=function(t){h.css("background-color","transparent"==t?t:"#"+t)},m.setCellsColor=function(t){p.css("background-color","transparent"==t?t:"#"+t)},m.options.el&&m.render(null,{borderSize:u,borderColor:g,virtualBorderSize:c,virtualBorderColor:d})},render:function(t){var e=this,i=arguments[1];if(this.trigger("render:before",this),e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template(_.extend({scope:e},i))),t?(this.setElement(t,!1),this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),!e.rendered){this.cmpEl;this._cells=[];for(var n=0;n<e.rows;n++)for(var o=0;o<e.columns;o++){var s=new Common.UI.CellStyler({el:$("#"+e.id+"-cell-container-"+o+"-"+n),overwriteStyle:e.overwriteStyle,halfBorderSize:!e.spacingMode,defaultBorderSize:e.spacingMode?i.virtualBorderSize:0,defaultBorderColor:i.virtualBorderColor.toHex(),id:e.id+"-cell-"+o+"-"+n,col:o,row:n});this._cells.push(s),s.on("borderclick",function(t,i,n,o){var s,a,r;if("t"==i){if(t.row>0)for(s=0;s<e.columns;s++)r=e.getCell(s,t.row-1),r.setBordersSize("b",n),r.setBordersColor("b",o);for(s=0;s<e.columns;s++)r=e.getCell(s,t.row),t.halfBorderSize&&t.row<1?r.setBordersSize("t",0):r.setBordersSize("t",n),r.setBordersColor("t",o)}else if("b"==i){if(t.row<e.rows-1)for(s=0;s<e.columns;s++)r=e.getCell(s,t.row+1),r.setBordersSize("t",n),r.setBordersColor("t",o);for(s=0;s<e.columns;s++)r=e.getCell(s,t.row),t.halfBorderSize&&t.row>=e.rows-1?r.setBordersSize("b",0):r.setBordersSize("b",n),r.setBordersColor("b",o)}else if("l"==i){if(t.col>0)for(a=0;a<e.rows;a++)r=e.getCell(t.col-1,a),r.setBordersSize("r",n),r.setBordersColor("r",o);for(a=0;a<e.rows;a++)r=e.getCell(t.col,a),t.halfBorderSize&&t.col<1?r.setBordersSize("l",0):r.setBordersSize("l",n),r.setBordersColor("l",o)}else if("r"==i){if(t.col<e.columns-1)for(a=0;a<e.rows;a++)r=e.getCell(t.col+1,a),r.setBordersSize("l",n),r.setBordersColor("l",o);for(a=0;a<e.rows;a++)r=e.getCell(t.col,a),t.halfBorderSize&&t.col>=e.columns-1?r.setBordersSize("r",0):r.setBordersSize("r",n),r.setBordersColor("r",o)}})}}return e.rendered=!0,this.trigger("render:after",this),this},getCell:function(t,e){return _.findWhere(this._cells,{id:this.id+"-cell-"+t+"-"+e})}})}),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,r,l,c=this,d=($(this.el),0),h=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("+d+", 100, 100)").toHex()),r.length>0&&(r[0].innerHTML="transparent"==c.color?c.textNoColor:c.color.toUpperCase()),e.length>0&&i.length>0&&(e.css("left",h+"%"),e.css("top",100-p+"%"),i.css("top",parseInt(100*d/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]+"%"),h=s[0],p=100-s[1],m({h:d,s:h,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+"%"),d=parseInt(360*s/100),m({
|
|
|
h:d,s:h,b:p})}},f=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",b),b(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",b)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();m(e,!0)},w=function(t){var m,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),r=g.find(".color-text"),l=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",f)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),l.length>0&&(l.off("click"),l.on("click",y)),m="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),d=m.h,h=m.s,p=m.b,d==h&&d==p&&0==d&&(h=100),u())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),d=e.h,h=e.s,p=e.b,d==h&&d==p&&0==d&&(h=100),c.color=t,u()}},c.getColor=function(){return c.color},c.on("render:after",w),c.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||t.keyCode===Common.UI.Keys.DELETE||t.keyCode===Common.UI.Keys.BACKSPACE||t.keyCode===Common.UI.Keys.LEFT||t.keyCode===Common.UI.Keys.RIGHT||t.keyCode===Common.UI.Keys.HOME||t.keyCode===Common.UI.Keys.END||t.keyCode===Common.UI.Keys.ESC||t.keyCode===Common.UI.Keys.INSERT||t.keyCode===Common.UI.Keys.TAB||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&$(this.el).val(t)},getValue:function(){$(this.el).val()}})}),void 0===Common)var Common={};if(define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:1,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:2,maskExp:/[0-9]/,allowDecimal:!1}),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,r;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),r=this.spinG.getNumberValue(),s=(null==r||r<0?0:r>255?255:r).toString(16),r=this.spinB.getNumberValue(),a=(null==r||r<0?0:r>255?255:r).toString(16);break;case 2:r=this.spinR.getNumberValue(),o=(null==r||r<0?0:r>255?255:r).toString(16),s=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),r=this.spinB.getNumberValue(),a=(null==r||r<0?0:r>255?255:r).toString(16);break;case 3:r=this.spinR.getNumberValue(),o=(null==r||r<0?0:r>255?255:r).toString(16),r=this.spinG.getNumberValue(),s=(null==r||r<0?0:r>255?255:r).toString(16),a=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16)}var l=(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s)+(1==a.length?"0"+a:a);this.colorsPicker.setColor("#"+l),this.textColor.setValue(l.toUpperCase()),this.colorNew.css("background-color","#"+l)}},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)},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={};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=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");e=e?e.split(","):[];for(var i,n=-1,o=e.length<this.options.dynamiccolors?e.length:this.options.dynamiccolors;++n<o;)i=t.find(".color-dynamic-"+n),i.removeClass("dynamic-empty-color").attr("color",e[n]),i.find("span").css({"background-color":"#"+e[n]})}},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())}},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,r=0,l=0;l<n.colors.length;l++)if("string"==typeof n.colors[l]&&/[0-9A-F]{6}/.test(n.colors[l])){if(a>=e.length)continue;s=$(n.aColorElements[a]),s.removeClass("color-"+n.colors[l]),n.colors[l]=e[a].toUpperCase(),s.addClass("color-"+n.colors[l]),s.css({background:"#"+n.colors[l]}),s.find("span").first().css({background:"#"+n.colors[l]}),a++}else if("object"==typeof n.colors[l]&&void 0!==n.colors[l].effectId){if(r>=t.length)continue;s=$(n.aEffectElements[r]),t[r].color=t[r].color.toUpperCase(),n.colors[l].color!==t[r].color&&(s.removeClass("color-"+n.colors[l].color),s.addClass("color-"+t[r].color),s.css({background:"#"+t[r].color}),s.find("span").first().css({background:"#"+t[r].color})),n.colors[l].effectId!==t[r].effectId&&s.attr("effectid",""+t[r].effectId),n.colors[l].effectValue!==t[r].effectValue&&s.attr("effectvalue",""+t[r].effectValue),n.colors[l]=t[r],r++}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||{}))}),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" style="margin-bottom: 2px;" 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");i.width(this.contentWidth),e.width(e.find(".menu-panel").width()+i.outerWidth()+2),this.content_panels=e.find(".settings-panel"),this.btnsCategory.length>0&&this.btnsCategory[0].toggle(!0,!0)},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||{}))});var c_oAscFrameWrap={None:-1,Inline:!1,Flow:!0};if(define("documenteditor/main/app/view/DropcapSettingsAdvanced",["text!documenteditor/main/app/template/DropcapSettingsAdvanced.template","core","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ComboBoxFonts","common/main/lib/component/MetricSpinner","common/main/lib/component/TableStyler","common/main/lib/component/ThemeColorPalette","common/main/lib/view/AdvancedSettingsWindow"],function(t){"use strict";DE.Views.DropcapSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:320,height:380,toggleGroup:"dropcap-adv-settings-group",storageName:"de-dropcap-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,contentTemplate:_.template(t)({scope:this}),items:[{panelId:"id-adv-dropcap-frame",panelCaption:this.textFrame},{panelId:"id-adv-dropcap-dropcap",panelCaption:this.strDropcap},{panelId:"id-adv-dropcap-borders",panelCaption:this.strBorders},{panelId:"id-adv-dropcap-margins",panelCaption:this.strMargins}]},e),this.tableStylerRows=this.options.tableStylerRows,this.tableStylerColumns=this.options.tableStylerColumns,this.fontStore=this.options.fontStore,this.borderProps=this.options.borderProps,this.isFrame=this.options.isFrame,this.api=this.options.api,this.Borders={},this.BorderSize={ptValue:0,pxValue:0},this.paragraphShade="transparent",this._changedProps=null,this.ChangedBorders=void 0,this._noApply=!0,this.Margins=void 0,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){var t=this;Common.Views.AdvancedSettingsWindow.prototype.render.call(this),this.tableStyler=new Common.UI.TableStyler({el:$("#drop-advanced-borderstyler"),width:200,height:170,rows:this.tableStylerRows,columns:this.tableStylerColumns,spacingMode:!1}),_.each([[c_tableBorder.BORDER_HORIZONTAL_TOP,"t","btn-borders-large btn-adv-paragraph-top","00"],[c_tableBorder.BORDER_HORIZONTAL_CENTER,"m","btn-borders-large btn-adv-paragraph-inner-hor","01"],[c_tableBorder.BORDER_HORIZONTAL_BOTTOM,"b","btn-borders-large btn-adv-paragraph-bottom","10"],[c_tableBorder.BORDER_OUTER,"lrtb","btn-borders-large btn-adv-paragraph-outer","11"],[c_tableBorder.BORDER_VERTICAL_LEFT,"l","btn-borders-large btn-adv-paragraph-left","20"],[c_tableBorder.BORDER_ALL,"lrtbm","btn-borders-large btn-adv-paragraph-all","21"],[c_tableBorder.BORDER_VERTICAL_RIGHT,"r","btn-borders-large btn-adv-paragraph-right","30"],[c_tableBorder.BORDER_NONE,"","btn-borders-large btn-adv-paragraph-none","31"]],function(e,i){new Common.UI.Button({posId:e[0],strId:e[1],iconCls:e[2],style:"margin-left: 5px; margin-bottom: 4px;",cls:"btn-options large"}).render($("#drop-advanced-button-borderline-"+e[3])).on("click",function(e){t._ApplyBorderPreset(e.options.strId)})},this);var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);this.cmbBorderSize=new Common.UI.ComboBorderSize({el:$("#drop-advanced-input-bordersize"),style:"width: 90px;",store:new Backbone.Collection,data:[{id:Common.UI.getId(),displayValue:this.txtNoBorders,value:0,borderstyle:""},{id:Common.UI.getId(),displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{id:Common.UI.getId(),displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{id:Common.UI.getId(),displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{id:Common.UI.getId(),displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{id:Common.UI.getId(),displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{id:Common.UI.getId(),displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{id:Common.UI.getId(),displayValue:"6 "+e,value:6,pxValue:6,offsety:120}]}).on("selected",_.bind(function(t,e){this.BorderSize={ptValue:e.value,pxValue:e.pxValue},this.tableStyler.setVirtualBorderSize(this.BorderSize.pxValue)},this));var i=this.cmbBorderSize.store.at(2);this.cmbBorderSize.setValue(i.get("value")),this.BorderSize={ptValue:i.get("value"),pxValue:i.get("pxValue")},this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="drop-advanced-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="drop-advanced-border-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnBorderColor.on("render:after",function(e){t.colorsBorder=new Common.UI.ThemeColorPalette({el:$("#drop-advanced-border-color-menu")}).on("select",_.bind(function(e,i){t.btnBorderColor.setColor(i),t.tableStyler.setVirtualBorderColor("object"==typeof i?i.color:i)},t))}),this.btnBorderColor.render($("#drop-advanced-button-bordercolor")),this.btnBorderColor.setColor("000000"),this.btnBorderColor.menu.cmpEl.on("click","#drop-advanced-border-color-new",_.bind(function(){t.colorsBorder.addNewColor("object"==typeof t.btnBorderColor.color?t.btnBorderColor.color.color:t.btnBorderColor.color)},t)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="drop-advanced-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="drop-advanced-back-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnBackColor.on("render:after",function(e){t.colorsBack=new Common.UI.ThemeColorPalette({el:$("#drop-advanced-back-color-menu"),transparent:!0}).on("select",_.bind(function(e,i){t.btnBackColor.setColor(i),t.paragraphShade=i,t._changedProps&&(void 0!==t._changedProps.get_Shade()&&null!==t._changedProps.get_Shade()||t._changedProps.put_Shade(new Asc.asc_CParagraphShd),"transparent"==i?t._changedProps.get_Shade().put_Value(Asc.c_oAscShdNil):(t._changedProps.get_Shade().put_Value(Asc.c_oAscShdClear),t._changedProps.get_Shade().put_Color(Common.Utils.ThemeColor.getRgbColor(i))));var n="object"==typeof i?i.color:i;t.tableStyler.setCellsColor(n)},t))}),this.btnBackColor.render($("#drop-advanced-button-color")),this.btnBackColor.menu.cmpEl.on("click","#drop-advanced-back-color-new",_.bind(function(){t.colorsBack.addNewColor()},t)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#drop-advanced-input-top"),step:.1,width:100,value:"0 cm",defaultUnit:"cm",maxValue:55.87,minValue:0}).on("change",_.bind(function(t,e,i){this._noApply||(_.isUndefined(this.Margins)&&(this.Margins={}),this.Margins.Top=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},t)),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#drop-advanced-input-left"),step:.1,width:100,value:"0 cm",defaultUnit:"cm",maxValue:55.87,minValue:0}).on("change",_.bind(function(t,e,i){this._noApply||(_.isUndefined(this.Margins)&&(this.Margins={}),this.Margins.Left=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},t)),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#drop-advanced-input-bottom"),step:.1,width:100,value:"0 cm",defaultUnit:"cm",maxValue:55.87,minValue:0}).on("change",_.bind(function(t,e,i){this._noApply||(_.isUndefined(this.Margins)&&(this.Margins={}),this.Margins.Bottom=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},t)),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#drop-advanced-input-right"),step:.1,width:100,value:"0 cm",defaultUnit:"cm",maxValue:55.87,minValue:0}).on("change",_.bind(function(t,e,i){this._noApply||(_.isUndefined(this.Margins)&&(this.Margins={}),this.Margins.Right=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},t)),this.btnNone=new Common.UI.Button({cls:"btn x-huge btn-options",iconCls:"icon-advanced-wrap btn-drop-none",enableToggle:!0,toggleGroup:"dropAdvGroup",allowDepress:!1,hint:this.textNone}).on("toggle",_.bind(function(e,i){t._changedProps&&i&&(t._DisableElem(Asc.c_oAscDropCap.None),t._changedProps.put_DropCap(Asc.c_oAscDropCap.None))},t)),this.btnInText=new Common.UI.Button({cls:"btn x-huge btn-options",iconCls:"icon-advanced-wrap btn-drop-text",enableToggle:!0,toggleGroup:"dropAdvGroup",allowDepress:!1,hint:this.textInText}).on("toggle",_.bind(function(e,i){t._changedProps&&i&&(t._DisableElem(Asc.c_oAscDropCap.Drop),t._changedProps.put_DropCap(Asc.c_oAscDropCap.Drop))},t)),this.btnInMargin=new Common.UI.Button({cls:"btn x-huge btn-options",iconCls:"icon-advanced-wrap btn-drop-margin",enableToggle:!0,toggleGroup:"dropAdvGroup",allowDepress:!1,hint:this.textInMargin}).on("toggle",_.bind(function(e,i){t._changedProps&&i&&(t._DisableElem(Asc.c_oAscDropCap.Margin),t._changedProps.put_DropCap(Asc.c_oAscDropCap.Margin))},t)),this.spnRowHeight=new Common.UI.MetricSpinner({el:$("#drop-advanced-input-rowheight"),step:1,width:120,value:3,defaultUnit:"",maxValue:10,minValue:1,allowDecimal:!1}).on("change",_.bind(function(e,i,n){t._changedProps&&t._changedProps.put_Lines(e.getNumberValue())},t)),this.numDistance=new Common.UI.MetricSpinner({el:$("#drop-advanced-input-distance"),step:.1,width:120,value:"0 cm",defaultUnit:"cm",maxValue:55.87,minValue:0}).on("change",_.bind(function(e,i,n){t._changedProps&&t._changedProps.put_HSpace(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))},t)),this.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#drop-advanced-input-fonts"),cls:"input-group-nr",style:"width: 290px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName}).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_FontFamily(i.name)},t)),this.btnFrameNone=new Common.UI.Button({cls:"btn huge btn-options",iconCls:"icon-right-panel btn-frame-none",enableToggle:!0,toggleGroup:"frameAdvGroup",allowDepress:!1,hint:this.textNone}).on("toggle",_.bind(function(e,i){t._changedProps&&i&&(t._DisableElem(c_oAscFrameWrap.None),t._changedProps.put_Wrap(c_oAscFrameWrap.None))},t)),this.btnFrameInline=new Common.UI.Button({cls:"btn huge btn-options",iconCls:"icon-right-panel btn-frame-inline",enableToggle:!0,toggleGroup:"frameAdvGroup",allowDepress:!1,hint:this.textInline}).on("toggle",_.bind(function(e,i){t._changedProps&&i&&(t._DisableElem(c_oAscFrameWrap.Inline),t._changedProps.put_Wrap(c_oAscFrameWrap.Inline))},t)),this.btnFrameFlow=new Common.UI.Button({cls:"btn huge btn-options",iconCls:"icon-right-panel btn-frame-flow",enableToggle:!0,toggleGroup:"frameAdvGroup",allowDepress:!1,hint:this.textFlow}).on("toggle",_.bind(function(e,i){t._changedProps&&i&&(t._DisableElem(c_oAscFrameWrap.Flow),t._changedProps.put_Wrap(c_oAscFrameWrap.Flow))},t)),this._arrWidth=[{displayValue:this.textAuto,value:0},{displayValue:this.textExact,value:1}],this.cmbWidth=new Common.UI.ComboBox({el:$("#frame-advanced-input-widthtype"),cls:"input-group-nr",menuStyle:"min-width: 130px;",editable:!1,data:this._arrWidth}).on("selected",_.bind(function(e,i){t._changedProps&&(t.spnWidth.suspendEvents(),t.spnWidth.setValue(0==i.value?"":1),t.spnWidth.resumeEvents(),t._changedProps.put_W(0==i.value?void 0:Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},t)),this.cmbWidth.setValue(this._arrWidth[0].value),this.spnWidth=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-width"),maxValue:55.88,minValue:.02,step:.1,defaultUnit:"cm",value:""}).on("change",_.bind(function(e,i,n){
|
|
|
t._changedProps&&(t.cmbWidth.suspendEvents(),t.cmbWidth.setValue(this._arrWidth[1].value),t.cmbWidth.resumeEvents(),t._changedProps.put_W(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},t)),this._arrHeight=[{displayValue:this.textAuto,value:0},{displayValue:this.textExact,value:1},{displayValue:this.textAtLeast,value:2}],this.cmbHeight=new Common.UI.ComboBox({el:$("#frame-advanced-input-heighttype"),cls:"input-group-nr",menuStyle:"min-width: 130px;",editable:!1,data:this._arrHeight}).on("selected",_.bind(function(e,i){t._changedProps&&(t.spnHeight.suspendEvents(),t.spnHeight.setValue(0==i.value?"":1),t.spnHeight.resumeEvents(),t._changedProps.put_HRule(0==i.value?Asc.linerule_Auto:1==i.value?Asc.linerule_Exact:Asc.linerule_AtLeast),i.value>0&&this._changedProps.put_H(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},t)),this.cmbHeight.setValue(this._arrHeight[0].value),this.spnHeight=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-height"),maxValue:55.88,minValue:.02,step:.1,defaultUnit:"cm",value:""}).on("change",_.bind(function(e,i,n){if(t._changedProps){var o=Asc.linerule_Auto;t.cmbHeight.getValue()==t._arrHeight[1].value?o=Asc.linerule_Exact:t.cmbHeight.getValue()==t._arrHeight[2].value&&(o=Asc.linerule_AtLeast),o==Asc.linerule_Auto&&(t.cmbHeight.suspendEvents(),t.cmbHeight.setValue(t._arrHeight[2].value),o=Asc.linerule_AtLeast,t.cmbHeight.resumeEvents()),t._changedProps.put_HRule(o),t._changedProps.put_H(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))}},t)),this.spnX=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-hdist"),maxValue:55.87,minValue:0,step:.1,defaultUnit:"cm",value:"0 cm",width:"auto"}).on("change",_.bind(function(e,i,n){t._changedProps&&t._changedProps.put_HSpace(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))},t)),this.spnY=new Common.UI.MetricSpinner({el:$("#frame-advanced-input-vdist"),maxValue:55.87,minValue:0,step:.1,defaultUnit:"cm",value:"0 cm",width:"auto"}).on("change",_.bind(function(e,i,n){t._changedProps&&t._changedProps.put_VSpace(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))},t)),this._arrHAlign=[{displayValue:this.textLeft,value:Asc.c_oAscXAlign.Left},{displayValue:this.textCenter,value:Asc.c_oAscXAlign.Center},{displayValue:this.textRight,value:Asc.c_oAscXAlign.Right}],this.cmbHAlign=new Common.UI.ComboBox({el:$("#frame-advanced-input-hposition"),cls:"input-group-nr",menuStyle:"min-width: 130px;",data:this._arrHAlign}).on("changed:after",_.bind(function(e,i){t._changedProps&&(t._changedProps.put_XAlign(void 0),t._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(parseFloat(i.value))))},t)).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_XAlign(i.value)},t)),this.cmbHAlign.setValue(this._arrHAlign[0].value),this._arrHRelative=[{displayValue:this.textMargin,value:Asc.c_oAscHAnchor.Margin},{displayValue:this.textPage,value:Asc.c_oAscHAnchor.Page},{displayValue:this.textColumn,value:Asc.c_oAscHAnchor.Text}],this.cmbHRelative=new Common.UI.ComboBox({el:$("#frame-advanced-input-hrelative"),cls:"input-group-nr",menuStyle:"min-width: 95px;",data:this._arrHRelative,editable:!1}).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_HAnchor(i.value)},t)),this.cmbHRelative.setValue(this._arrHRelative[1].value),this._arrVAlign=[{displayValue:this.textTop,value:Asc.c_oAscYAlign.Top},{displayValue:this.textCenter,value:Asc.c_oAscYAlign.Center},{displayValue:this.textBottom,value:Asc.c_oAscYAlign.Bottom}],this.cmbVAlign=new Common.UI.ComboBox({el:$("#frame-advanced-input-vposition"),cls:"input-group-nr",menuStyle:"min-width: 130px;",data:this._arrVAlign}).on("changed:after",_.bind(function(e,i){t._changedProps&&(t._changedProps.put_YAlign(void 0),t._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(parseFloat(i.value))))},t)).on("selected",_.bind(function(e,i){t._changedProps&&t._changedProps.put_YAlign(i.value)},t)),this.cmbVAlign.setValue(this._arrVAlign[0].value),this._arrVRelative=[{displayValue:this.textMargin,value:Asc.c_oAscVAnchor.Margin},{displayValue:this.textPage,value:Asc.c_oAscVAnchor.Page},{displayValue:this.textParagraph,value:Asc.c_oAscVAnchor.Text}],this.cmbVRelative=new Common.UI.ComboBox({el:$("#frame-advanced-input-vrelative"),cls:"input-group-nr",menuStyle:"min-width: 95px;",data:this._arrVRelative,editable:!1}).on("selected",_.bind(function(e,i){t._changedProps&&(t._changedProps.put_VAnchor(i.value),this.chMove.setValue(i.value==Asc.c_oAscVAnchor.Text,!0))},t)),this.cmbVRelative.setValue(this._arrVRelative[2].value),this.chMove=new Common.UI.CheckBox({el:$("#frame-advanced-checkbox-move"),labelText:this.textMove}).on("change",_.bind(function(e,i){if(t._changedProps){var n=this.cmbVRelative.store.at("checked"==i?2:1);t.cmbVRelative.setValue(n.get("value")),t._changedProps.put_VAnchor(n.get("value"))}},t)),this.btnNone.render($("#drop-advanced-button-none")),this.btnInText.render($("#drop-advanced-button-intext")),this.btnInMargin.render($("#drop-advanced-button-inmargin")),this.btnFrameNone.render($("#frame-advanced-button-none")),this.btnFrameInline.render($("#frame-advanced-button-inline")),this.btnFrameFlow.render($("#frame-advanced-button-flow")),this.on("show",_.bind(this.onShowDialog,this)),this.afterRender()},afterRender:function(){this.updateMetricUnit(),this.updateThemeColors(),this.isFrame||this.cmbFonts.fillFonts(this.fontStore),this._setDefaults(this._originalProps),void 0!==this.borderProps&&(this.btnBorderColor.setColor(this.borderProps.borderColor),this.tableStyler.setVirtualBorderColor("object"==typeof this.borderProps.borderColor?this.borderProps.borderColor.color:this.borderProps.borderColor),this.cmbBorderSize.setValue(this.borderProps.borderSize.ptValue),this.BorderSize={ptValue:this.borderProps.borderSize.ptValue,pxValue:this.borderProps.borderSize.pxValue},this.tableStyler.setVirtualBorderSize(this.BorderSize.pxValue),this.colorsBorder.select(this.borderProps.borderColor)),this.setTitle(this.isFrame?this.textTitleFrame:this.textTitle);for(var t=0;t<this.tableStyler.rows;t++)for(var e=0;e<this.tableStyler.columns;e++)this.tableStyler.getCell(e,t).on("borderclick",function(t,e,i,n){void 0===this.ChangedBorders&&(this.ChangedBorders=new Asc.asc_CParagraphBorders),this._UpdateCellBordersStyle(t,e,i,n,this.Borders)},this);this.tableStyler.on("borderclick",function(t,e,i,n){void 0===this.ChangedBorders&&(this.ChangedBorders=new Asc.asc_CParagraphBorders),this._UpdateTableBordersStyle(t,e,i,n,this.Borders)},this);var i="object"==typeof this.paragraphShade?this.paragraphShade.color:this.paragraphShade;if(this.tableStyler.setCellsColor(i),this.isFrame&&this.setHeight(500),this.btnsCategory[this.isFrame?1:0].setVisible(!1),this.storageName){var n=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==n?parseInt(n):0)}},getSettings:function(){if(null===this.ChangedBorders?this._changedProps.put_Borders(this.Borders):void 0!==this.ChangedBorders&&this._changedProps.put_Borders(this.ChangedBorders),this.Margins){var t=this._changedProps.get_Borders();void 0!==t&&null!==t||(this._changedProps.put_Borders(new Asc.asc_CParagraphBorders),t=this._changedProps.get_Borders()),void 0!==this.Margins.Left&&(void 0!==t.get_Left()&&null!==t.get_Left()||t.put_Left(new Asc.asc_CTextBorder(this.Borders.get_Left())),t.get_Left().put_Space(this.Margins.Left)),void 0!==this.Margins.Top&&(void 0!==t.get_Top()&&null!==t.get_Top()||t.put_Top(new Asc.asc_CTextBorder(this.Borders.get_Top())),t.get_Top().put_Space(this.Margins.Top)),void 0!==this.Margins.Right&&(void 0!==t.get_Right()&&null!==t.get_Right()||t.put_Right(new Asc.asc_CTextBorder(this.Borders.get_Right())),t.get_Right().put_Space(this.Margins.Right)),void 0!==this.Margins.Bottom&&(void 0!==t.get_Bottom()&&null!==t.get_Bottom()||t.put_Bottom(new Asc.asc_CTextBorder(this.Borders.get_Bottom())),t.get_Bottom().put_Space(this.Margins.Bottom),void 0!==t.get_Between()&&null!==t.get_Between()||t.put_Between(new Asc.asc_CTextBorder(this.Borders.get_Between())),t.get_Between().put_Space(this.Margins.Bottom))}return this._changedProps.put_FromDropCapMenu(!this.isFrame),{paragraphProps:this._changedProps,borderProps:{borderSize:this.BorderSize,borderColor:this.btnBorderColor.color}}},onShowDialog:function(t){!this.isFrame&&this.btnNone.pressed?this._DisableElem(Asc.c_oAscDropCap.None):this.isFrame&&this.btnFrameNone.pressed&&this._DisableElem(c_oAscFrameWrap.None)},onBtnBordersClick:function(t,e){if(this.updateBordersStyle(t.options.strId,!0),this.api){var i=new Asc.CTableProp;i.put_CellBorders(this.CellBorders),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},updateThemeColors:function(){this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},updateMetricUnit:function(){var t=this;_.each([t.spnMarginTop,t.spnMarginLeft,t.spnMarginBottom,t.spnMarginRight,t.numDistance,t.spnWidth,t.spnHeight,t.spnX,t.spnY],function(t){t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)})},_setDefaults:function(t){if(t){this._noApply=!0,this._originalProps=new Asc.asc_CParagraphProperty(t);var e=t.get_FramePr();if(e){var i;if(this.isFrame){i=e.get_W(),this.cmbWidth.setValue(void 0===i?this._arrWidth[0].value:this._arrWidth[1].value),this.spnWidth.setValue(void 0!==i?Common.Utils.Metric.fnRecalcFromMM(i):""),i=e.get_HRule(),void 0!==i?(this.cmbHeight.setValue(i===Asc.linerule_Exact?this._arrHeight[1].value:this._arrHeight[2].value),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.get_H()))):(this.cmbHeight.setValue(this._arrHeight[0].value),this.spnHeight.setValue("")),i=e.get_HSpace(),this.spnX.setValue(void 0!==i?Common.Utils.Metric.fnRecalcFromMM(i):0),i=e.get_VSpace(),this.spnY.setValue(void 0!==i?Common.Utils.Metric.fnRecalcFromMM(i):0),i=e.get_HAnchor();for(var n=0;n<this._arrHRelative.length;n++)if(i==this._arrHRelative[n].value){this.cmbHRelative.setValue(this._arrHRelative[n].value);break}if(void 0!==(i=e.get_XAlign())){for(var n=0;n<this._arrHAlign.length;n++)if(i==this._arrHAlign[n].value){this.cmbHAlign.setValue(this._arrHAlign[n].value);break}}else i=e.get_X(),this.cmbHAlign.setValue(Common.Utils.Metric.fnRecalcFromMM(void 0!==i?i:0)+" "+Common.Utils.Metric.getCurrentMetricName());i=e.get_VAnchor();for(var n=0;n<this._arrVRelative.length;n++)if(i==this._arrVRelative[n].value){this.cmbVRelative.setValue(this._arrVRelative[n].value);break}if(this.chMove.setValue(i==Asc.c_oAscVAnchor.Text),void 0!==(i=e.get_YAlign())){for(var n=0;n<this._arrVAlign.length;n++)if(i==this._arrVAlign[n].value){this.cmbVAlign.setValue(this._arrVAlign[n].value);break}}else i=e.get_Y(),this.cmbVAlign.setValue(Common.Utils.Metric.fnRecalcFromMM(void 0!==i?i:0)+" "+Common.Utils.Metric.getCurrentMetricName());i=e.get_Wrap(),!1===i?this.btnFrameInline.toggle(!0,!1):this.btnFrameFlow.toggle(!0,!1)}else if(this.spnRowHeight.setValue(null!==e.get_Lines()?e.get_Lines():""),this.numDistance.setValue(null!==e.get_HSpace()?Common.Utils.Metric.fnRecalcFromMM(e.get_HSpace()):""),i=e.get_DropCap(),i==Asc.c_oAscDropCap.Drop?this.btnInText.toggle(!0,!1):i==Asc.c_oAscDropCap.Margin?this.btnInMargin.toggle(!0,!1):this.btnNone.toggle(!0,!1),i=e.get_FontFamily()){var o=this.cmbFonts.store.findWhere({name:i.get_Name()});o?this.cmbFonts.setValue(o.get("name")):this.cmbFonts.setRawValue(i.get_Name())}if(this.Borders=new Asc.asc_CParagraphBorders(e.get_Borders()),this.Borders){var s=this.Borders.get_Left(),a=null!==s&&void 0!==s&&null!==s.get_Space()&&void 0!==s.get_Space()?Common.Utils.Metric.fnRecalcFromMM(s.get_Space()):"";this.spnMarginLeft.setValue(a),s=this.Borders.get_Top(),a=null!==s&&void 0!==s&&null!==s.get_Space()&&void 0!==s.get_Space()?Common.Utils.Metric.fnRecalcFromMM(s.get_Space()):"",this.spnMarginTop.setValue(a),s=this.Borders.get_Right(),a=null!==s&&void 0!==s&&null!==s.get_Space()&&void 0!==s.get_Space()?Common.Utils.Metric.fnRecalcFromMM(s.get_Space()):"",this.spnMarginRight.setValue(a),s=this.Borders.get_Bottom(),a=null!==s&&void 0!==s&&null!==s.get_Space()&&void 0!==s.get_Space()?Common.Utils.Metric.fnRecalcFromMM(s.get_Space()):"",this.spnMarginBottom.setValue(a)}var r=e.get_Shade();if(null!==r&&void 0!==r&&r.get_Value()===Asc.c_oAscShdClear){var l=r.get_Color();l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.paragraphShade={color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}:this.paragraphShade=Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()):this.paragraphShade="transparent"}else this.paragraphShade="transparent";if(this.btnBackColor.setColor(this.paragraphShade),_.isObject(this.paragraphShade)){for(var c=!1,n=0;n<10;n++)if(Common.Utils.ThemeColor.ThemeValues[n]==this.paragraphShade.effectValue){this.colorsBack.select(this.paragraphShade,!0),c=!0;break}c||this.colorsBack.clearSelection()}else this.colorsBack.select(this.paragraphShade,!0);this._UpdateBorders()}this._noApply=!1,this._changedProps=new Asc.asc_CParagraphFrame,this.isFrame&&e&&void 0!==e.get_W()&&this._changedProps.put_W(e.get_W()),this.ChangedBorders=void 0}},_DisableElem:function(t){var e=t===Asc.c_oAscDropCap.None||t===c_oAscFrameWrap.None;_.each(this.btnsCategory,function(t){"id-adv-dropcap-borders"!=t.options.contentTarget&&"id-adv-dropcap-margins"!=t.options.contentTarget||t.setDisabled(e)}),this.isFrame?(e=t==c_oAscFrameWrap.None,this.cmbHAlign.setDisabled(e),this.cmbHRelative.setDisabled(e),this.spnX.setDisabled(e),this.cmbVAlign.setDisabled(e),this.cmbVRelative.setDisabled(e),this.spnY.setDisabled(e),this.chMove.setDisabled(e),this.cmbWidth.setDisabled(e),this.cmbHeight.setDisabled(e),this.spnWidth.setDisabled(e),this.spnHeight.setDisabled(e)):(e=t==Asc.c_oAscDropCap.None,this.spnRowHeight.setDisabled(e),this.numDistance.setDisabled(e),this.cmbFonts.setDisabled(e))},_UpdateBorders:function(){var t=this.BorderSize,e=this.btnBorderColor.color;if(this._UpdateBorder(this.Borders.get_Left(),"l"),this._UpdateBorder(this.Borders.get_Top(),"t"),this._UpdateBorder(this.Borders.get_Right(),"r"),this._UpdateBorder(this.Borders.get_Bottom(),"b"),null!==this.Borders.get_Between())for(var i=0;i<this.tableStyler.columns;i++)this._UpdateCellBorder(this.Borders.get_Between(),"b",this.tableStyler.getCell(i,0)),this._UpdateCellBorder(this.Borders.get_Between(),"t",this.tableStyler.getCell(i,1));this.tableStyler.setVirtualBorderSize(t.pxValue),this.tableStyler.setVirtualBorderColor("object"==typeof e?e.color:e)},_UpdateCellBorder:function(t,e,i){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()&&1==t.get_Value()?(i.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),i.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):i.setBordersSize(e,0)},_UpdateBorder:function(t,e){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()&&1==t.get_Value()?(this.tableStyler.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),this.tableStyler.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):this.tableStyler.setBordersSize(e,0)},_BorderPt2Px:function(t){return 0==t?0:t<.6?.5:t<=1?1:t<=1.5?2:t<=2.25?3:t<=3?4:t<=4.5?5:6},_ApplyBorderPreset:function(t){this.ChangedBorders=null,this.Borders.put_Left(this._UpdateBorderStyle(this.Borders.get_Left(),t.indexOf("l")>-1)),this.Borders.put_Top(this._UpdateBorderStyle(this.Borders.get_Top(),t.indexOf("t")>-1)),this.Borders.put_Right(this._UpdateBorderStyle(this.Borders.get_Right(),t.indexOf("r")>-1)),this.Borders.put_Bottom(this._UpdateBorderStyle(this.Borders.get_Bottom(),t.indexOf("b")>-1)),this.Borders.put_Between(this._UpdateBorderStyle(this.Borders.get_Between(),t.indexOf("m")>-1)),this._UpdateBorders()},_UpdateBorderStyle:function(t,e){if(null==t&&(t=new Asc.asc_CTextBorder),e&&this.BorderSize.ptValue>0){var i=parseFloat(this.BorderSize.ptValue);t.put_Value(1),t.put_Size(25.4*i/72);var n=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);t.put_Color(n)}else t.put_Color(new Asc.asc_CColor),t.put_Value(0);return t},_UpdateCellBordersStyle:function(t,e,i,n,o){var s=o;0==t.col&&e.indexOf("l")>-1&&(s.put_Left(this._UpdateBorderStyle(s.get_Left(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Left(new Asc.asc_CTextBorder(s.get_Left()))),t.col==this.tableStylerColumns-1&&e.indexOf("r")>-1&&(s.put_Right(this._UpdateBorderStyle(s.get_Right(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Right(new Asc.asc_CTextBorder(s.get_Right()))),0==t.row&&e.indexOf("t")>-1&&(s.put_Top(this._UpdateBorderStyle(s.get_Top(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Top(new Asc.asc_CTextBorder(s.get_Top()))),t.row==this.tableStylerRows-1&&e.indexOf("b")>-1&&(s.put_Bottom(this._UpdateBorderStyle(s.get_Bottom(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Bottom(new Asc.asc_CTextBorder(s.get_Bottom()))),(0==t.row&&e.indexOf("b")>-1||t.row==this.tableStylerRows-1&&e.indexOf("t")>-1)&&(s.put_Between(this._UpdateBorderStyle(s.get_Between(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Between(new Asc.asc_CTextBorder(s.get_Between())))},_UpdateTableBordersStyle:function(t,e,i,n,o){var s=o;e.indexOf("l")>-1&&(s.put_Left(this._UpdateBorderStyle(s.get_Left(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Left(new Asc.asc_CTextBorder(s.get_Left()))),e.indexOf("t")>-1&&(s.put_Top(this._UpdateBorderStyle(s.get_Top(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Top(new Asc.asc_CTextBorder(s.get_Top()))),e.indexOf("r")>-1&&(s.put_Right(this._UpdateBorderStyle(s.get_Right(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Right(new Asc.asc_CTextBorder(s.get_Right()))),e.indexOf("b")>-1&&(s.put_Bottom(this._UpdateBorderStyle(s.get_Bottom(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Bottom(new Asc.asc_CTextBorder(s.get_Bottom())))},textTitle:"Drop Cap - Advanced Settings",strBorders:"Borders & Fill",textBorderWidth:"Border Size",textBorderColor:"Border Color",textBackColor:"Background Color",textBorderDesc:"Click on diagramm or use buttons to select borders",cancelButtonText:"Cancel",okButtonText:"Ok",txtNoBorders:"No borders",textNewColor:"Add New Custom Color",textPosition:"Position",textAlign:"Alignment",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",textCenter:"Center",strMargins:"Margins",strDropcap:"Drop Cap",textNone:"None",textInText:"In text",textInMargin:"In margin",textParameters:"Parameters",textRowHeight:"Height in rows",textDistance:"Distance from text",textFont:"Font",textInline:"Inline frame",textFlow:"Flow frame",textFrame:"Frame",textWidth:"Width",textHeight:"Height",textAuto:"Auto",textExact:"Exactly",textAtLeast:"At least",textMove:"Move with text",textHorizontal:"Horizontal",textVertical:"Vertical",textRelative:"Relative to",textColumn:"Column",textMargin:"Margin",textPage:"Page",textParagraph:"Paragraph",tipFontName:"Font Name",textTitleFrame:"Frame - Advanced Settings"},DE.Views.DropcapSettingsAdvanced||{}))}),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(),o="function"==typeof this.options.placement?this.options.placement.call(this,n[0],this.$element[0]):this.options.placement;!1===this.options.arrow&&n.addClass("arrow-free"),this.options.cls&&n.addClass(this.options.cls);var s=/^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(o);if(i||s[2].length){var a=t.Event("show.bs.tooltip");if(this.$element.trigger(a),a.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),"object"==typeof i){var r={top:i[1]+15,left:i[0]+18},l=Common.Utils.innerWidth();r.left+n.width()>l&&(r.left=l-n.width()-30),n.offset(r).addClass("in")}else{var c=this.getPosition(),d=n[0].offsetWidth,h=n[0].offsetHeight;switch(s[1]){case"bottom":r={top:c.top+c.height+10};break;case"top":r={top:c.top-h-10}}switch(s[2]){case"left":r.left=c.left,this.$element.outerWidth()<=18&&(r.left-=4);break;case"right":r.left=c.left+c.width-d,this.$element.outerWidth()<=18&&(r.left+=4)}this.applyPlacement(r,s[1]),this.moveArrow(),n.addClass(s[1]).addClass(s[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},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||!0,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").andSelf().filter("input"),this.editable&&(this._input.on("blur",_.bind(this.onInputChanged,this)),this._input.on("keypress",_.bind(this.onKeyPress,this)),this._input.on("keyup",_.bind(this.onKeyUp,this)),this.validateOnChange&&this._input.on("input",_.bind(this.onInputChanging,this)),this.maxLength&&this._input.attr("maxlength",this.maxLength)),this.setEditable(this.editable),this.disabled&&this.setDisabled(this.disabled),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(t.keyCode===Common.UI.Keys.RETURN)this._doChange(t);else 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.DELETE||t.keyCode===Common.UI.Keys.BACKSPACE||t.keyCode===Common.UI.Keys.LEFT||t.keyCode===Common.UI.Keys.RIGHT||t.keyCode===Common.UI.Keys.HOME||t.keyCode===Common.UI.Keys.END||t.keyCode===Common.UI.Keys.ESC||t.keyCode===Common.UI.Keys.INSERT||(t.preventDefault(),t.stopPropagation())}this.trigger("keypress:after",this,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("documenteditor/main/app/view/HyperlinkSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";DE.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">',"<label>"+this.textUrl+" *</label>","</div>",'<div id="id-dlg-hyperlink-url" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+this.textDisplay+"</label>","</div>",'<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+this.textTooltip+"</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,e=this.getChild();t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-hyperlink-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){var i=t.api.asc_getUrlType($.trim(e));return t.isEmail=2==i,i>0||t.txtNotUrl}}),t.inputDisplay=new Common.UI.InputField({el:$("#id-dlg-hyperlink-display"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isTextChanged=!0}),t.inputTip=new Common.UI.InputField({el:$("#id-dlg-hyperlink-tip"),style:"width: 100%;",
|
|
|
maxLength:Asc.c_oAscMaxTooltipLength}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputUrl.cmpEl.find("input").focus()},500)},setSettings:function(t){if(t){var e=this;t.get_Value()?e.inputUrl.setValue(t.get_Value().replace(new RegExp(" ","g"),"%20")):e.inputUrl.setValue(""),null!==t.get_Text()?(e.inputDisplay.setValue(t.get_Text()),e.inputDisplay.setDisabled(!1)):(e.inputDisplay.setValue(this.textDefault),e.inputDisplay.setDisabled(!0)),this.isTextChanged=!1,e.inputTip.setValue(t.get_ToolTip())}},getSettings:function(){var t=this,e=new Asc.CHyperlinkProperty,i=$.trim(t.inputUrl.getValue());return/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(i)||(i=(t.isEmail?"mailto:":"http://")+i),i=i.replace(new RegExp("%20","g")," "),e.put_Value(i),t.inputDisplay.isDisabled()||!this.isTextChanged&&!_.isEmpty(t.inputDisplay.getValue())?e.put_Text(null):(_.isEmpty(t.inputDisplay.getValue())&&t.inputDisplay.setValue(i),e.put_Text(t.inputDisplay.getValue())),e.put_ToolTip(t.inputTip.getValue()),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){if(t.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){var e=this.inputUrl.checkValidate(),i=this.inputDisplay.checkValidate();if(!0!==e)return void this.inputUrl.cmpEl.find("input").focus();if(!0!==i)return void this.inputDisplay.cmpEl.find("input").focus()}this.options.handler.call(this,this,t)}this.close()},textUrl:"Link to",textDisplay:"Display",cancelButtonText:"Cancel",okButtonText:"Ok",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"',textTooltip:"ScreenTip text",textDefault:"Selected text",textTitle:"Hyperlink Settings"},DE.Views.HyperlinkSettingsDialog||{}))}),define("text!documenteditor/main/app/template/ParagraphSettingsAdvanced.template",[],function(){return'<div id="id-adv-paragraph-indents" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsFirstLine %></label>\r\n <div id="paragraphadv-spin-first-line" style="width: 85px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsLeftText %></label>\r\n <div id="paragraphadv-spin-indent-left"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsRightText %></label>\r\n <div id="paragraphadv-spin-indent-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large text-only"></div>\r\n <div class="inner-content text-only" style="padding-right: 0px;" >\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-break-before"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-keep-lines"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-orphan"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-keep-next"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-borders" class="settings-panel">\r\n <div class="inner-content">\r\n <div style="width: 100%;" class="padding-small">\r\n <label class="input-label"><%= scope.textBorderWidth %></label>\r\n <div id="paragraphadv-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>\r\n <div style="display: inline-block; float:right;vertical-align: middle;">\r\n <label class="input-label" ><%= scope.textBorderColor %></label>\r\n <div id="paragraphadv-border-color-btn" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n <label class="input-label padding-small" style="width: 100%;"><%= scope.textBorderDesc %></label>\r\n <div style="width: 100%;" class="padding-large">\r\n <div id="id-deparagraphstyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 170px;outline: 1px solid #ccc;"></div>\r\n <div style="display: inline-block; float:right;vertical-align: middle; width: 76px; text-align: right; height: 170px; padding-top: 10px;">\r\n <div id="paragraphadv-button-border-top" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-inner-hor" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-bottom" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-outer" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-left" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-all" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-right" style="display: inline-block;"></div>\r\n <div id="paragraphadv-button-border-none" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n <div style="width: 100%;" class="padding-small">\r\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>\r\n <div id="paragraphadv-back-color-btn" style="display: inline-block;"></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">\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.textEffects %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-strike"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-subscript"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-double-strike"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-small-caps"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="paragraphadv-checkbox-superscript"></div>\r\n </td>\r\n <td class="padding-large">\r\n <div id="paragraphadv-checkbox-all-caps"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textCharacterSpacing %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="50%">\r\n <label class="input-label"><%= scope.textSpacing %></label>\r\n <div id="paragraphadv-spin-spacing"></div>\r\n </td>\r\n <td class="padding-large text-only" width="50%">\r\n <label class="input-label"><%= scope.textPosition %></label>\r\n <div id="paragraphadv-spin-position"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <div style="border: 1px solid #cbcbcb;">\r\n <div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n </table>\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-small" style="display: inline-block;">\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-small" style="display: inline-block; float: right;">\r\n <label class="input-label"><%= scope.textDefault %></label>\r\n <div id="paraadv-spin-default-tab"></div>\r\n </div>\r\n <div class="padding-large">\r\n <div id="paraadv-list-tabs" style="width:180px; height: 94px;"></div>\r\n </div>\r\n <div class="padding-large" >\r\n <label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>\r\n <div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>\r\n <div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>\r\n <div id="paragraphadv-radio-right" style="display: block;"></div>\r\n </div>\r\n <div>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button>\r\n </div>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-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="50%">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="paraadv-number-margin-top"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="paraadv-number-margin-left"></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.textBottom %></label>\r\n <div id="paraadv-number-margin-bottom"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="paraadv-number-margin-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),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){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/ColorButton",["common/main/lib/component/Button"],function(){"use strict";Common.UI.ColorButton=Common.UI.Button.extend({options:{hint:!1,enableToggle:!1},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={};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)},onAddItem:function(t,e){var i=new Common.UI.DataViewItem({template:this.itemTemplate,model:t});if(this.innerEl||(this.innerEl=$(this.el).find(".inner"),this.innerEl.find(".empty-text").remove()),i&&this.innerEl){if(this.options.simpleAddMode)this.innerEl.append(i.render().el);else{var n=_.indexOf(this.store.models,t),o=this.innerEl.find("> div");n>0?$(o.get(n-1)).after(i.render().el):o.length>0?$(o[n]).before(i.render().el):this.innerEl.append(i.render().el)}this.dataViewItems.push(i),this.listenTo(i,"change",this.onChangeItem),this.listenTo(i,"remove",this.onRemoveItem),this.listenTo(i,"click",this.onClickItem),this.listenTo(i,"dblclick",this.onDblClickItem),this.listenTo(i,"select",this.onSelectItem),this.isSuspendEvents||this.trigger("item:add",this,i,t)}}}}())}),define("documenteditor/main/app/view/ParagraphSettingsAdvanced",["text!documenteditor/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/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ListView","common/main/lib/component/TableStyler"],function(t){"use strict";DE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:325,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"de-para-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-paragraph-indents",panelCaption:this.strParagraphIndents},{panelId:"id-adv-paragraph-borders",panelCaption:this.strBorders},{panelId:"id-adv-paragraph-font",panelCaption:this.strParagraphFont},{panelId:"id-adv-paragraph-tabs",panelCaption:this.strTabs},{panelId:"id-adv-paragraph-margins",panelCaption:this.strMargins}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.Borders={},this.BorderSize={ptValue:0,pxValue:0},this.paragraphShade="transparent",this._changedProps=null,this.ChangedBorders=void 0,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.Margins=void 0,this.spinners=[],this.tableStylerRows=this.options.tableStylerRows,this.tableStylerColumns=this.options.tableStylerColumns,this.borderProps=this.options.borderProps,this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps),this.isChart=this.options.isChart},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.numFirstLine=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-first-line"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numFirstLine.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_FirstLine(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numFirstLine),this.numIndentsLeft=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-left"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numIndentsLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_Left(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numIndentsLeft),this.numIndentsRight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-right"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numIndentsRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.chBreakBefore=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-break-before"),labelText:this.strBreakBefore}),this.chBreakBefore.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_PageBreakBefore("checked"==t.getValue())},this)),this.chKeepLines=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-keep-lines"),labelText:this.strKeepLines}),this.chKeepLines.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_KeepLines("checked"==t.getValue())},this)),this.chOrphan=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-orphan"),labelText:this.strOrphan}),this.chOrphan.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_WidowControl("checked"==t.getValue())},this)),this.chKeepNext=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-keep-next"),labelText:this.strKeepNext}),this.chKeepNext.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_KeepNext("checked"==t.getValue())},this)),this.cmbBorderSize=new Common.UI.ComboBorderSize({el:$("#paragraphadv-combo-border-size"),style:"width: 93px;"});var e=this.cmbBorderSize.store.at(2);this.BorderSize={ptValue:e.get("value"),pxValue:e.get("pxValue")},this.cmbBorderSize.setValue(this.BorderSize.ptValue),this.cmbBorderSize.on("selected",_.bind(this.onBorderSizeSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="paragraphadv-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="paragraphadv-border-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnBorderColor.on("render:after",function(e){t.colorsBorder=new Common.UI.ThemeColorPalette({el:$("#paragraphadv-border-color-menu")}),t.colorsBorder.on("select",_.bind(t.onColorsBorderSelect,t))}),this.btnBorderColor.render($("#paragraphadv-border-color-btn")),this.btnBorderColor.setColor("000000"),$("#paragraphadv-border-color-new").on("click",_.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.BordersImage=new Common.UI.TableStyler({el:$("#id-deparagraphstyler"),width:200,height:170,rows:this.tableStylerRows,columns:this.tableStylerColumns,spacingMode:!1});var i=[["lrtb","btn-borders-large btn-adv-paragraph-outer","paragraphadv-button-border-outer",this.tipOuter],["lrtbm","btn-borders-large btn-adv-paragraph-all","paragraphadv-button-border-all",this.tipAll],["","btn-borders-large btn-adv-paragraph-none","paragraphadv-button-border-none",this.tipNone],["l","btn-borders-large btn-adv-paragraph-left","paragraphadv-button-border-left",this.tipLeft],["r","btn-borders-large btn-adv-paragraph-right","paragraphadv-button-border-right",this.tipRight],["t","btn-borders-large btn-adv-paragraph-top","paragraphadv-button-border-top",this.tipTop],["m","btn-borders-large btn-adv-paragraph-inner-hor","paragraphadv-button-border-inner-hor",this.tipInner],["b","btn-borders-large btn-adv-paragraph-bottom","paragraphadv-button-border-bottom",this.tipBottom]];this._btnsBorderPosition=[],_.each(i,function(t,e,i){var n=new Common.UI.Button({style:"margin-left: 5px; margin-bottom: 4px;",cls:"btn-options large",iconCls:t[1],strId:t[0],hint:t[3]});n.render($("#"+t[2])),n.on("click",_.bind(this._ApplyBorderPreset,this)),this._btnsBorderPosition.push(n)},this),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="paragraphadv-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="paragraphadv-back-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnBackColor.on("render:after",function(e){t.colorsBack=new Common.UI.ThemeColorPalette({el:$("#paragraphadv-back-color-menu"),transparent:!0}),t.colorsBack.on("select",_.bind(t.onColorsBackSelect,t))}),this.btnBackColor.render($("#paragraphadv-back-color-btn")),$("#paragraphadv-back-color-new").on("click",_.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),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.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},this)),this.spinners.push(this.numSpacing),this.numPosition=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-position"),step:.01,width:100,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numPosition.on("change",_.bind(function(t,e,i,n){if(this._changedProps&&this._changedProps.put_Position(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_Position(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},this)),this.spinners.push(this.numPosition),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:180,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numTab),this.numDefaultTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-default-tab"),step:.1,width:107,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_DefaultTab(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}),this.tabList.store.comparator=function(t){return t.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var n=function(){t._noApply||(t._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",n),this.listenTo(this.tabList.store,"remove",n),this.listenTo(this.tabList.store,"reset",n),this.radioLeft=new Common.UI.RadioBox({el:$("#paragraphadv-radio-left"),labelText:this.textTabLeft,name:"asc-radio-tab",checked:!0}),this.radioCenter=new Common.UI.RadioBox({el:$("#paragraphadv-radio-center"),labelText:this.textTabCenter,name:"asc-radio-tab"}),this.radioRight=new Common.UI.RadioBox({el:$("#paragraphadv-radio-right"),labelText:this.textTabRight,name:"asc-radio-tab"}),this.btnAddTab=new Common.UI.Button({el:$("#paraadv-button-add-tab")}),this.btnAddTab.on("click",_.bind(this.addTab,this)),this.btnRemoveTab=new Common.UI.Button({el:$("#paraadv-button-remove-tab")}),this.btnRemoveTab.on("click",_.bind(this.removeTab,this)),this.btnRemoveAll=new Common.UI.Button({el:$("#paraadv-button-remove-all")}),this.btnRemoveAll.on("click",_.bind(this.removeAllTabs,this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#paraadv-number-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._noApply||(void 0===this.Margins&&(this.Margins={}),this.Margins.Top=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#paraadv-number-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._noApply||(void 0===this.Margins&&(this.Margins={}),this.Margins.Bottom=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#paraadv-number-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._noApply||(void 0===this.Margins&&(this.Margins={}),this.Margins.Left=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#paraadv-number-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._noApply||(void 0===this.Margins&&(this.Margins={}),this.Margins.Right=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnMarginRight),this.TextOnlySettings=$(".text-only"),this.afterRender()},getSettings:function(){if(null===this.ChangedBorders?this._changedProps.put_Borders(this.Borders):void 0!==this.ChangedBorders&&this._changedProps.put_Borders(this.ChangedBorders),this.Margins){var t=this._changedProps.get_Borders();void 0!==t&&null!==t||(this._changedProps.put_Borders(new Asc.asc_CParagraphBorders),t=this._changedProps.get_Borders()),void 0!==this.Margins.Left&&(void 0!==t.get_Left()&&null!==t.get_Left()||t.put_Left(new Asc.asc_CTextBorder(this.Borders.get_Left())),t.get_Left().put_Space(this.Margins.Left)),void 0!==this.Margins.Top&&(void 0!==t.get_Top()&&null!==t.get_Top()||t.put_Top(new Asc.asc_CTextBorder(this.Borders.get_Top())),t.get_Top().put_Space(this.Margins.Top)),void 0!==this.Margins.Right&&(void 0!==t.get_Right()&&null!==t.get_Right()||t.put_Right(new Asc.asc_CTextBorder(this.Borders.get_Right())),t.get_Right().put_Space(this.Margins.Right)),void 0!==this.Margins.Bottom&&(void 0!==t.get_Bottom()&&null!==t.get_Bottom()||t.put_Bottom(new Asc.asc_CTextBorder(this.Borders.get_Bottom())),t.get_Bottom().put_Space(this.Margins.Bottom),void 0!==t.get_Between()&&null!==t.get_Between()||t.put_Between(new Asc.asc_CTextBorder(this.Borders.get_Between())),t.get_Between().put_Space(this.Margins.Bottom))}return this._tabListChanged&&(null!==this._changedProps.get_Tabs()&&void 0!==this._changedProps.get_Tabs()||this._changedProps.put_Tabs(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.get_Tabs().add_Tab(i)},this)),{paragraphProps:this._changedProps,borderProps:{borderSize:this.BorderSize,borderColor:this.btnBorderColor.color}}},_setDefaults:function(t){if(t){if(this._originalProps=new Asc.asc_CParagraphProperty(t),this.hideTextOnlySettings(this.isChart),this.numFirstLine.setValue(null!==t.get_Ind()&&null!==t.get_Ind().get_FirstLine()?Common.Utils.Metric.fnRecalcFromMM(t.get_Ind().get_FirstLine()):"",!0),this.numIndentsLeft.setValue(null!==t.get_Ind()&&null!==t.get_Ind().get_Left()?Common.Utils.Metric.fnRecalcFromMM(t.get_Ind().get_Left()):"",!0),this.numIndentsRight.setValue(null!==t.get_Ind()&&null!==t.get_Ind().get_Right()?Common.Utils.Metric.fnRecalcFromMM(t.get_Ind().get_Right()):"",!0),this.chKeepLines.setValue(null!==t.get_KeepLines()&&void 0!==t.get_KeepLines()?t.get_KeepLines():"indeterminate",!0),this.chBreakBefore.setValue(null!==t.get_PageBreakBefore()&&void 0!==t.get_PageBreakBefore()?t.get_PageBreakBefore():"indeterminate",!0),this.chKeepNext.setValue(null!==t.get_KeepNext()&&void 0!==t.get_KeepNext()?t.get_KeepNext():"indeterminate",!0),this.chOrphan.setValue(null!==t.get_WidowControl()&&void 0!==t.get_WidowControl()?t.get_WidowControl():"indeterminate",!0),this.Borders=new Asc.asc_CParagraphBorders(t.get_Borders()),this.Borders){var e=this.Borders.get_Left(),i=null!==e&&void 0!==e&&null!==e.get_Space()&&void 0!==e.get_Space()?Common.Utils.Metric.fnRecalcFromMM(e.get_Space()):"";this.spnMarginLeft.setValue(i,!0),e=this.Borders.get_Top(),i=null!==e&&void 0!==e&&null!==e.get_Space()&&void 0!==e.get_Space()?Common.Utils.Metric.fnRecalcFromMM(e.get_Space()):"",this.spnMarginTop.setValue(i,!0),e=this.Borders.get_Right(),i=null!==e&&void 0!==e&&null!==e.get_Space()&&void 0!==e.get_Space()?Common.Utils.Metric.fnRecalcFromMM(e.get_Space()):"",this.spnMarginRight.setValue(i,!0),e=this.Borders.get_Bottom(),
|
|
|
i=null!==e&&void 0!==e&&null!==e.get_Space()&&void 0!==e.get_Space()?Common.Utils.Metric.fnRecalcFromMM(e.get_Space()):"",this.spnMarginBottom.setValue(i,!0)}var n=t.get_Shade();if(null!==n&&void 0!==n&&n.get_Value()===Asc.c_oAscShdClear){var o=n.get_Color();o?o.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.paragraphShade={color:Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()),effectValue:o.get_value()}:this.paragraphShade=Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()):this.paragraphShade="transparent"}else this.paragraphShade="transparent";if(this.btnBackColor.setColor(this.paragraphShade),"object"==typeof this.paragraphShade){for(var s=!1,a=0;a<10;a++)if(Common.Utils.ThemeColor.ThemeValues[a]==this.paragraphShade.effectValue){this.colorsBack.select(this.paragraphShade,!0),s=!0;break}s||this.colorsBack.clearSelection()}else this.colorsBack.select(this.paragraphShade,!0);this._UpdateBorders(),this._noApply=!0,this.chStrike.setValue(null!==t.get_Strikeout()&&void 0!==t.get_Strikeout()?t.get_Strikeout():"indeterminate",!0),this.chDoubleStrike.setValue(null!==t.get_DStrikeout()&&void 0!==t.get_DStrikeout()?t.get_DStrikeout():"indeterminate",!0),this.chSubscript.setValue(null!==t.get_Subscript()&&void 0!==t.get_Subscript()?t.get_Subscript():"indeterminate",!0),this.chSuperscript.setValue(null!==t.get_Superscript()&&void 0!==t.get_Superscript()?t.get_Superscript():"indeterminate",!0),this.chSmallCaps.setValue(null!==t.get_SmallCaps()&&void 0!==t.get_SmallCaps()?t.get_SmallCaps():"indeterminate",!0),this.chAllCaps.setValue(null!==t.get_AllCaps()&&void 0!==t.get_AllCaps()?t.get_AllCaps():"indeterminate",!0),this.numSpacing.setValue(null!==t.get_TextSpacing()&&void 0!==t.get_TextSpacing()?Common.Utils.Metric.fnRecalcFromMM(t.get_TextSpacing()):"",!0),this.numPosition.setValue(null!==t.get_Position()&&void 0!==t.get_Position()?Common.Utils.Metric.fnRecalcFromMM(t.get_Position()):"",!0),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(null!==t.get_DefaultTab()&&void 0!==t.get_DefaultTab()?Common.Utils.Metric.fnRecalcFromMM(parseFloat(t.get_DefaultTab().toFixed(1))):"",!0);var r=this.tabList.store,l=t.get_Tabs();if(l){for(var c=[],d=l.get_Count(),a=0;a<d;a++){var h=l.get_Tab(a),p=Common.Utils.Metric.fnRecalcFromMM(parseFloat(h.get_Pos().toFixed(1))),m=new Common.UI.DataViewModel;m.set({tabPos:p,value:parseFloat(p.toFixed(3))+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:h.get_Value()}),c.push(m)}r.reset(c,{silent:!1}),this.tabList.selectByIndex(0)}this._noApply=!1,this._changedProps=new Asc.asc_CParagraphProperty,this.ChangedBorders=void 0}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t<this.spinners.length;t++){var e=this.spinners[t];e.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),"paragraphadv-spin-spacing"==e.el.id||"paragraphadv-spin-position"==e.el.id?e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01):e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},updateThemeColors:function(){this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},afterRender:function(){if(this.updateMetricUnit(),this.updateThemeColors(),this._setDefaults(this._originalProps),void 0!==this.borderProps){this.btnBorderColor.setColor(this.borderProps.borderColor),this.BordersImage.setVirtualBorderColor("object"==typeof this.borderProps.borderColor?this.borderProps.borderColor.color:this.borderProps.borderColor),this.cmbBorderSize.setValue(this.borderProps.borderSize.ptValue);var t=this.cmbBorderSize.getSelectedRecord();t&&this.onBorderSizeSelect(this.cmbBorderSize,t),this.colorsBorder.select(this.borderProps.borderColor,!0)}for(var e=0;e<this.BordersImage.rows;e++)for(var i=0;i<this.BordersImage.columns;i++)this.BordersImage.getCell(i,e).on("borderclick",function(t,e,i,n){void 0===this.ChangedBorders&&(this.ChangedBorders=new Asc.asc_CParagraphBorders),this._UpdateCellBordersStyle(t,e,i,n,this.Borders)},this);this.BordersImage.on("borderclick",function(t,e,i,n){void 0===this.ChangedBorders&&(this.ChangedBorders=new Asc.asc_CParagraphBorders),this._UpdateTableBordersStyle(t,e,i,n,this.Borders)},this);var n="object"==typeof this.paragraphShade?this.paragraphShade.color:this.paragraphShade;if(this.BordersImage.setCellsColor(n),this.storageName){var o=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==o?parseInt(o):0)}},onStrikeChange:function(t,e,i,n){if(this._changedProps&&1!=this.checkGroup&&this._changedProps.put_Strikeout("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=1,this.chDoubleStrike.setValue(0),this._changedProps&&this._changedProps.put_DStrikeout(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_Strikeout("checked"==t.getValue()),o.put_DStrikeout("checked"==this.chDoubleStrike.getValue()),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onDoubleStrikeChange:function(t,e,i,n){if(this._changedProps&&1!=this.checkGroup&&this._changedProps.put_DStrikeout("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=1,this.chStrike.setValue(0),this._changedProps&&this._changedProps.put_Strikeout(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_DStrikeout("checked"==t.getValue()),o.put_Strikeout("checked"==this.chStrike.getValue()),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onSuperscriptChange:function(t,e,i,n){if(this._changedProps&&2!=this.checkGroup&&this._changedProps.put_Superscript("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=2,this.chSubscript.setValue(0),this._changedProps&&this._changedProps.put_Subscript(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_Superscript("checked"==t.getValue()),o.put_Subscript("checked"==this.chSubscript.getValue()),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onSubscriptChange:function(t,e,i,n){if(this._changedProps&&2!=this.checkGroup&&this._changedProps.put_Subscript("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=2,this.chSuperscript.setValue(0),this._changedProps&&this._changedProps.put_Superscript(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_Subscript("checked"==t.getValue()),o.put_Superscript("checked"==this.chSuperscript.getValue()),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onSmallCapsChange:function(t,e,i,n){if(this._changedProps&&3!=this.checkGroup&&this._changedProps.put_SmallCaps("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=3,this.chAllCaps.setValue(0),this._changedProps&&this._changedProps.put_AllCaps(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_SmallCaps("checked"==t.getValue()),o.put_AllCaps("checked"==this.chAllCaps.getValue()),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onAllCapsChange:function(t,e,i,n){if(this._changedProps&&3!=this.checkGroup&&this._changedProps.put_AllCaps("checked"==t.getValue()),this.checkGroup=0,"checked"==t.getValue()&&(this.checkGroup=3,this.chSmallCaps.setValue(0),this._changedProps&&this._changedProps.put_SmallCaps(!1),this.checkGroup=0),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_AllCaps("checked"==t.getValue()),o.put_SmallCaps("checked"==this.chSmallCaps.getValue()),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},onBorderSizeSelect:function(t,e){this.BorderSize={ptValue:e.value,pxValue:e.pxValue},this.BordersImage.setVirtualBorderSize(this.BorderSize.pxValue)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onColorsBorderSelect:function(t,e){this.btnBorderColor.setColor(e),this.BordersImage.setVirtualBorderColor("object"==typeof e?e.color:e)},onColorsBackSelect:function(t,e){this.btnBackColor.setColor(e),this.paragraphShade=e,this._changedProps&&(void 0!==this._changedProps.get_Shade()&&null!==this._changedProps.get_Shade()||this._changedProps.put_Shade(new Asc.asc_CParagraphShd),"transparent"==this.paragraphShade?this._changedProps.get_Shade().put_Value(Asc.c_oAscShdNil):(this._changedProps.get_Shade().put_Value(Asc.c_oAscShdClear),this._changedProps.get_Shade().put_Color(Common.Utils.ThemeColor.getRgbColor(this.paragraphShade))));var i="object"==typeof e?e.color:e;this.BordersImage.setCellsColor(i)},_ApplyBorderPreset:function(t){var e=t.options.strId;this.ChangedBorders=null,this.Borders.put_Left(this._UpdateBorderStyle(this.Borders.get_Left(),e.indexOf("l")>-1)),this.Borders.put_Top(this._UpdateBorderStyle(this.Borders.get_Top(),e.indexOf("t")>-1)),this.Borders.put_Right(this._UpdateBorderStyle(this.Borders.get_Right(),e.indexOf("r")>-1)),this.Borders.put_Bottom(this._UpdateBorderStyle(this.Borders.get_Bottom(),e.indexOf("b")>-1)),this.Borders.put_Between(this._UpdateBorderStyle(this.Borders.get_Between(),e.indexOf("m")>-1)),this._UpdateBorders()},_UpdateBorderStyle:function(t,e){if(null==t&&(t=new Asc.asc_CTextBorder),e&&this.BorderSize.ptValue>0){var i=parseFloat(this.BorderSize.ptValue);t.put_Value(1),t.put_Size(25.4*i/72);var n=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);t.put_Color(n)}else t.put_Color(new Asc.asc_CColor),t.put_Value(0);return t},_UpdateCellBordersStyle:function(t,e,i,n,o){var s=o;0==t.col&&e.indexOf("l")>-1&&(s.put_Left(this._UpdateBorderStyle(s.get_Left(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Left(new Asc.asc_CTextBorder(s.get_Left()))),t.col==this.tableStylerColumns-1&&e.indexOf("r")>-1&&(s.put_Right(this._UpdateBorderStyle(s.get_Right(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Right(new Asc.asc_CTextBorder(s.get_Right()))),0==t.row&&e.indexOf("t")>-1&&(s.put_Top(this._UpdateBorderStyle(s.get_Top(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Top(new Asc.asc_CTextBorder(s.get_Top()))),t.row==this.tableStylerRows-1&&e.indexOf("b")>-1&&(s.put_Bottom(this._UpdateBorderStyle(s.get_Bottom(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Bottom(new Asc.asc_CTextBorder(s.get_Bottom()))),(0==t.row&&e.indexOf("b")>-1||t.row==this.tableStylerRows-1&&e.indexOf("t")>-1)&&(s.put_Between(this._UpdateBorderStyle(s.get_Between(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Between(new Asc.asc_CTextBorder(s.get_Between())))},_UpdateTableBordersStyle:function(t,e,i,n,o){var s=o;e.indexOf("l")>-1&&(s.put_Left(this._UpdateBorderStyle(s.get_Left(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Left(new Asc.asc_CTextBorder(s.get_Left()))),e.indexOf("t")>-1&&(s.put_Top(this._UpdateBorderStyle(s.get_Top(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Top(new Asc.asc_CTextBorder(s.get_Top()))),e.indexOf("r")>-1&&(s.put_Right(this._UpdateBorderStyle(s.get_Right(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Right(new Asc.asc_CTextBorder(s.get_Right()))),e.indexOf("b")>-1&&(s.put_Bottom(this._UpdateBorderStyle(s.get_Bottom(),i>0)),this.ChangedBorders&&this.ChangedBorders.put_Bottom(new Asc.asc_CTextBorder(s.get_Bottom())))},_UpdateBorders:function(){var t=this.BorderSize,e=this.btnBorderColor.color;if(this._UpdateBorder(this.Borders.get_Left(),"l"),this._UpdateBorder(this.Borders.get_Top(),"t"),this._UpdateBorder(this.Borders.get_Right(),"r"),this._UpdateBorder(this.Borders.get_Bottom(),"b"),null!==this.Borders.get_Between())for(var i=0;i<this.BordersImage.columns;i++)this._UpdateCellBorder(this.Borders.get_Between(),"b",this.BordersImage.getCell(i,0)),this._UpdateCellBorder(this.Borders.get_Between(),"t",this.BordersImage.getCell(i,1));this.BordersImage.setVirtualBorderSize(t.pxValue),this.BordersImage.setVirtualBorderColor("object"==typeof e?e.color:e)},_UpdateCellBorder:function(t,e,i){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()&&1==t.get_Value()?(i.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),i.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):i.setBordersSize(e,0)},_UpdateBorder:function(t,e){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()&&1==t.get_Value()?(this.BordersImage.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),this.BordersImage.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):this.BordersImage.setBordersSize(e,0)},_BorderPt2Px:function(t){return 0==t?0:t<.6?.5:t<=1?1:t<=1.5?2:t<=2.25?3:t<=3?4:t<=4.5?5:6},addTab:function(t,e){var i=this.numTab.getNumberValue(),n=this.radioLeft.getValue()?1:this.radioCenter.getValue()?3:2,o=this.tabList.store,s=o.find(function(t){return Math.abs(t.get("tabPos")-i)<.001});s?s.set("tabAlign",n):(s=new Common.UI.DataViewModel,s.set({tabPos:i,value:i+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:n}),o.add(s)),this.tabList.selectRecord(s),this.tabList.scrollToRecord(s)},removeTab:function(t,e){var i=this.tabList.getSelectedRec();if(i.length>0){var n=this.tabList.store,o=_.indexOf(n.models,i[0]);n.remove(i[0]),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),1==n.tabAlign?this.radioLeft.setValue(!0):3==n.tabAlign?this.radioCenter.setValue(!0):this.radioRight.setValue(!0)},hideTextOnlySettings:function(t){this.TextOnlySettings.toggleClass("hidden",1==t),this.btnsCategory[1].setVisible(!t),this.btnsCategory[4].setVisible(!t)},textTitle:"Paragraph - Advanced Settings",strIndentsFirstLine:"First line",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Placement",strParagraphPosition:"Placement",strParagraphFont:"Font",strBreakBefore:"Page break before",strKeepLines:"Keep lines together",strBorders:"Borders & Fill",textBorderWidth:"Border Size",textBorderColor:"Border Color",textBackColor:"Background Color",textBorderDesc:"Click on diagramm or use buttons to select borders",cancelButtonText:"Cancel",okButtonText:"Ok",txtNoBorders:"No borders",textNewColor:"Add New Custom Color",textEffects:"Effects",textCharacterSpacing:"Character Spacing",textSpacing:"Spacing",textPosition:"Position",strDoubleStrike:"Double strikethrough",strStrike:"Strikethrough",strSuperscript:"Superscript",strSubscript:"Subscript",strSmallCaps:"Small caps",strAllCaps:"All caps",strOrphan:"Orphan control",strKeepNext:"Keep with next",strTabs:"Tab",textSet:"Specify",textRemove:"Remove",textRemoveAll:"Remove All",textTabLeft:"Left",textTabRight:"Right",textTabCenter:"Center",textAlign:"Alignment",textTabPosition:"Tab Position",textDefault:"Default Tab",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",strMargins:"Margins",tipTop:"Set Top Border Only",tipLeft:"Set Left Border Only",tipBottom:"Set Bottom Border Only",tipRight:"Set Right Border Only",tipAll:"Set Outer Border and All Inner Lines",tipNone:"Set No Borders",tipInner:"Set Horizontal Inner Lines Only",tipOuter:"Set Outer Border Only",noTabs:"The specified tabs will appear in this field"},DE.Views.ParagraphSettingsAdvanced||{}))}),define("text!documenteditor/main/app/template/TableSettingsAdvanced.template",[],function(){
|
|
|
return'<div id="id-adv-table-width" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td colspan="3" class="padding-small">\r\n <label class="header"><%= scope.textTableSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 11px;">\r\n <div id="tableadv-checkbox-width"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="tableadv-number-width" style="margin-right: 10px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textMeasure %></label>\r\n <div id="tableadv-cmb-unit" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="3" class="padding-large">\r\n <div id="tableadv-checkbox-autofit"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n <div class="padding-small"></div>\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textDefaultMargins %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="tableadv-number-margin-table-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="tableadv-number-margin-table-left"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textBottom %></label>\r\n <div id="tableadv-number-margin-table-bottom"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="tableadv-number-margin-table-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n <div class="padding-small"></div>\r\n <table cols="2">\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label class="header"><%= scope.textOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="tableadv-checkbox-spacing"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textAllowSpacing %></label>\r\n <div id="tableadv-number-spacing"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n </div>\r\n</div>\r\n<div id="id-adv-table-cell-props" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td colspan="3" class="padding-small">\r\n <label class="header"><%= scope.textCellSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="tableadv-checkbox-prefwidth"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textPrefWidth %></label>\r\n <div id="tableadv-number-prefwidth" style="margin-right: 10px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textMeasure %></label>\r\n <div id="tableadv-combo-prefwidth-unit" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n <div class="padding-small"></div>\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textMargins %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <div id="tableadv-checkbox-margins"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="tableadv-number-margin-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="tableadv-number-margin-left"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textBottom %></label>\r\n <div id="tableadv-number-margin-bottom"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="tableadv-number-margin-right"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small"></td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textCellOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <div id="tableadv-checkbox-wrap"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-table-wrap" class="settings-panel">\r\n <div class="inner-content padding-large">\r\n <label class="header padding-small" style="display: block;"><%= scope.textWrappingStyle %></label>\r\n <div id="tableadv-button-wrap-none" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="tableadv-button-wrap-parallel" style="display: inline-block; margin-right:5px;"></div>\r\n </div>\r\n <div class="padding-small"></div>\r\n <div class="inner-content">\r\n <div id="tableadv-panel-align" style="width: 100%;">\r\n <label class="header padding-small"><%= scope.textAlign %></label>\r\n <div class="padding-large">\r\n <div id="tableadv-button-align-left" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="tableadv-button-align-center" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="tableadv-button-align-right" style="display: inline-block; margin-right:5px;"></div>\r\n <div style="display: inline-block; vertical-align: bottom; margin-left: 20px; margin-bottom: 1px;">\r\n <label class="input-label" style="display: block;"><%= scope.textIndLeft %></label>\r\n <div id="tableadv-number-indent"></div>\r\n </div>\r\n </div>\r\n </div>\r\n <div id="tableadv-panel-distance" class="settings-hidden" style="width: 100%;">\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.textDistance %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="tableadv-number-distance-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="tableadv-number-distance-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="tableadv-number-distance-bottom"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="tableadv-number-distance-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n </div>\r\n</div>\r\n<div id="id-adv-table-borders" class="settings-panel">\r\n <div class="inner-content padding-large">\r\n <div style="width: 100%;">\r\n <label class="input-label"><%= scope.textBorderWidth %></label>\r\n <div id="tableadv-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>\r\n <div style="display: inline-block; float:right;vertical-align: middle;">\r\n <label class="input-label" ><%= scope.textBorderColor %></label>\r\n <div id="tableadv-border-color-btn" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="inner-content">\r\n <label class="input-label padding-large" style="width: 100%;"><%= scope.textBorderDesc %></label>\r\n <div id="tableadv-panel-borders" style="width: 100%;" class="padding-large">\r\n <div id="id-detablestyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 200px;outline: 1px solid #ccc;"></div>\r\n <div style="display: inline-block; vertical-align: middle; width: 76px; height: 200px; padding-top: 10px; padding-left: 10px;">\r\n <div id="tableadv-button-border-all"></div>\r\n <div id="tableadv-button-border-none"></div>\r\n <div id="tableadv-button-border-inner"></div>\r\n <div id="tableadv-button-border-outer"></div>\r\n </div>\r\n </div>\r\n <div id="tableadv-panel-borders-spacing" style="width: 100%;" class="padding-large settings-hidden">\r\n <div id="id-detablestyler-spacing" style="display: inline-block; vertical-align: middle; width: 200px; height: 200px;outline: 1px solid #ccc;"></div>\r\n <div style="display: inline-block; float:right;vertical-align: middle; width: 76px; height: 200px; padding-top: 10px;">\r\n <div id="tableadv-button-border-all-none" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-all-table" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-none-none" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-none-table" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-inner-none" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-inner-table" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-outer-none" style="display: inline-block;"></div>\r\n <div id="tableadv-button-border-outer-table" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n <div style="width: 100%;">\r\n <div id="tableadv-panel-cell-back" style="display: inline-block;">\r\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>\r\n <div id="tableadv-button-back-color" style="display: inline-block;"></div>\r\n </div>\r\n <div id="tableadv-panel-table-back" style="display: inline-block;">\r\n <label class="input-label" style="margin-right: 5px;"><%= scope.textTableBackColor %></label>\r\n <div id="tableadv-button-table-back-color" style="display: inline-block;"></div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<div id="id-adv-table-position" 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" class="padding-small">\r\n <label class="header"><%= scope.textHorizontal %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="tableadv-radio-halign"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textAlignment %></label>\r\n <div id="tableadv-combo-halign" style="width: 115px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="tableadv-combo-hrelative" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="tableadv-radio-hposition"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textPosition %></label>\r\n <div id="tableadv-spin-x"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRightOf %></label>\r\n <div id="tableadv-combo-hposition" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="3" class="padding-small">\r\n <label class="header"><%= scope.textVertical %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="tableadv-radio-valign"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textAlignment %></label>\r\n <div id="tableadv-combo-valign" style="width: 115px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="tableadv-combo-vrelative" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="tableadv-radio-vposition"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textPosition %></label>\r\n <div id="tableadv-spin-y"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textBelow %></label>\r\n <div id="tableadv-combo-vposition" style="width: 115px;"></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.textOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="tableadv-checkbox-move"></div>\r\n </td>\r\n <td>\r\n <div id="tableadv-checkbox-overlap"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-table-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="table-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="table-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>'}),define("documenteditor/main/app/view/TableSettingsAdvanced",["text!documenteditor/main/app/template/TableSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ListView","common/main/lib/component/TableStyler"],function(t){"use strict";DE.Views.TableSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:340,height:436,toggleGroup:"table-adv-settings-group",storageName:"de-table-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-table-width",panelCaption:this.textTable},{panelId:"id-adv-table-cell-props",panelCaption:this.textCellProps},{panelId:"id-adv-table-borders",panelCaption:this.textBordersBackgroung},{panelId:"id-adv-table-position",panelCaption:this.textTablePosition},{panelId:"id-adv-table-wrap",panelCaption:this.textWrap},{panelId:"id-adv-table-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._changedProps=null,this._cellBackground=null,this._state={HAlignType:Asc.c_oAscXAlign.Left,HAlignFrom:Asc.c_oAscHAnchor.Margin,HPositionFrom:Asc.c_oAscHAnchor.Margin,VAlignType:Asc.c_oAscYAlign.Top,VAlignFrom:Asc.c_oAscVAnchor.Margin,VPositionFrom:Asc.c_oAscVAnchor.Margin,spnXChanged:!1,spnYChanged:!1,fromWrapInline:!1,verticalPropChanged:!1,horizontalPropChanged:!1,alignChanged:!1},this._allTable=!1,this.TableMargins={Left:.19,Right:.19,Top:0,Bottom:0},this.CellMargins={Left:.19,Right:.19,Top:null,Bottom:null,Flag:0},this.TableBorders={},this.CellBorders={},this.ChangedTableBorders=void 0,this.ChangedCellBorders=void 0,this.BorderSize={ptValue:0,pxValue:0},this.TableColor={Value:1,Color:"transparent"},this.CellColor={Value:1,Color:"transparent"},this.IndeterminateColor="#C8C8C8",this.IndeterminateSize=4.5,this.tableStylerRows=this.options.tableStylerRows,this.tableStylerColumns=this.options.tableStylerColumns,this.borderProps=this.options.borderProps,this.pageWidth=210,this._originalProps=new Asc.CTableProp(this.options.tableProps)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this._marginsChange=function(t,e,i,n,o,s){"table"==o?this.TableMargins[s]=t.getNumberValue():this.CellMargins[s]=t.getNumberValue()},this.chWidth=new Common.UI.CheckBox({el:$("#tableadv-checkbox-width"),value:!0,labelText:""}),this.chWidth.on("change",_.bind(function(t,e,i,n){var o="checked"==e;this.nfWidth.setDisabled(!o),this.cmbUnit.setDisabled(!o),this._changedProps&&(o&&this.nfWidth.getNumberValue()>0?this._changedProps.put_Width(this.cmbUnit.getValue()?-t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(this.nfWidth.getNumberValue())):this._changedProps.put_Width(null))},this)),this.nfWidth=new Common.UI.MetricSpinner({el:$("#tableadv-number-width"),step:.1,width:115,defaultUnit:"cm",value:"10 cm",maxValue:55.88,minValue:0}),this.nfWidth.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_Width(this.cmbUnit.getValue()?-t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this));var e=Common.Utils.Metric.getCurrentMetric();this.cmbUnit=new Common.UI.ComboBox({el:$("#tableadv-cmb-unit"),style:"width: 115px;",menuStyle:"min-width: 115px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:e==Common.Utils.Metric.c_MetricUnits.pt?this.txtPt:e==Common.Utils.Metric.c_MetricUnits.inch?this.txtInch:this.txtCm},{value:1,displayValue:this.txtPercent}]}),this.cmbUnit.on("selected",_.bind(function(t,e){if(this._changedProps){var i=Common.Utils.Metric.fnRecalcFromMM(558);this.nfWidth.setDefaultUnit(e.value?"%":Common.Utils.Metric.getCurrentMetricName()),this.nfWidth.setMaxValue(e.value?parseFloat((100*i/this.pageWidth).toFixed(2)):i),this.nfWidth.setStep(e.value||Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1),this.nfWidth.setValue(e.value?100*this.nfWidth.getNumberValue()/this.pageWidth:this.pageWidth*this.nfWidth.getNumberValue()/100),this._changedProps.put_Width(e.value?-this.nfWidth.getNumberValue():Common.Utils.Metric.fnRecalcToMM(this.nfWidth.getNumberValue()))}},this)),this.chAllowSpacing=new Common.UI.CheckBox({el:$("#tableadv-checkbox-spacing"),value:!0,labelText:""}),this.chAllowSpacing.on("change",_.bind(function(t,e,i,n){var o="checked"==e;this._changedProps&&(this.nfSpacing.setDisabled(!o),this.ShowHideSpacing(o),this._changedProps&&(o&&this.nfSpacing.getNumberValue()>0?this._changedProps.put_Spacing(Common.Utils.Metric.fnRecalcToMM(this.nfSpacing.getNumberValue())):this._changedProps.put_Spacing(null)))},this)),this.nfSpacing=new Common.UI.MetricSpinner({el:$("#tableadv-number-spacing"),step:.1,width:115,defaultUnit:"cm",value:"0.5 cm",maxValue:2.14,minValue:0}),this.nfSpacing.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_Spacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.nfSpacing),this.chAutofit=new Common.UI.CheckBox({el:$("#tableadv-checkbox-autofit"),value:!0,labelText:this.textAutofit}),this.chAutofit.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_TableLayout("checked"==t.getValue()?Asc.c_oAscTableLayout.AutoFit:Asc.c_oAscTableLayout.Fixed)},this)),this.spnTableMarginTop=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-top"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnTableMarginTop.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Top"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Top(null!==this.TableMargins.Top?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Top):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginTop),this.spnTableMarginBottom=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-bottom"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnTableMarginBottom.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Bottom"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Bottom(null!==this.TableMargins.Bottom?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Bottom):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginBottom),this.spnTableMarginLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-left"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnTableMarginLeft.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Left"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Left(null!==this.TableMargins.Left?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Left):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginLeft),this.spnTableMarginRight=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-right"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnTableMarginRight.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Right"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Right(null!==this.TableMargins.Right?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Right):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginRight);var i=function(){"indeterminate"==t.CellMargins.Flag?t._changedProps.get_CellMargins().put_Flag(1):"checked"==t.CellMargins.Flag?t._changedProps.get_CellMargins().put_Flag(0):t._changedProps.get_CellMargins().put_Flag(2)};this.chCellMargins=new Common.UI.CheckBox({el:$("#tableadv-checkbox-margins"),value:!0,labelText:this.textCheckMargins}),this.chCellMargins.on("change",_.bind(function(t,e,n,o){"checked"==n&&this._originalProps&&1==this._originalProps.get_CellMargins().get_Flag()&&t.setValue("indeterminate",!0),this.fillMargins.call(this,t.getValue()),this.CellMargins.Flag=t.getValue(),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Left(null!==this.CellMargins.Left?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left):null),this._changedProps.get_CellMargins().put_Top(null!==this.CellMargins.Top?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top):null),this._changedProps.get_CellMargins().put_Bottom(null!==this.CellMargins.Bottom?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom):null),this._changedProps.get_CellMargins().put_Right(null!==this.CellMargins.Right?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right):null),i())},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-top"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginTop.on("change",_.bind(function(t,e,n,o){this._marginsChange(t,e,n,o,"cell","Top"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Top(null!==this.CellMargins.Top?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top):null),i())},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-bottom"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginBottom.on("change",_.bind(function(t,e,n,o){this._marginsChange(t,e,n,o,"cell","Bottom"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Bottom(null!==this.CellMargins.Bottom?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom):null),i())},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-left"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginLeft.on("change",_.bind(function(t,e,n,o){this._marginsChange(t,e,n,o,"cell","Left"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Left(null!==this.CellMargins.Left?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left):null),i())},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-right"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginRight.on("change",_.bind(function(t,e,n,o){this._marginsChange(t,e,n,o,"cell","Right"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Right(null!==this.CellMargins.Right?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right):null),i())},this)),this.spinners.push(this.spnMarginRight),this.chPrefWidth=new Common.UI.CheckBox({el:$("#tableadv-checkbox-prefwidth"),value:!1,labelText:""}),this.chPrefWidth.on("change",_.bind(function(t,e,i,n){var o="checked"==e;this.nfPrefWidth.setDisabled(!o),this.cmbPrefWidthUnit.setDisabled(!o),this._changedProps&&(o&&this.nfPrefWidth.getNumberValue()>0?this._changedProps.put_CellsWidth(this.cmbPrefWidthUnit.getValue()?-t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(this.nfPrefWidth.getNumberValue())):this._changedProps.put_CellsWidth(null))},this)),this.nfPrefWidth=new Common.UI.MetricSpinner({el:$("#tableadv-number-prefwidth"),step:.1,width:115,defaultUnit:"cm",value:"10 cm",maxValue:55.88,minValue:0}),this.nfPrefWidth.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_CellsWidth(this.cmbPrefWidthUnit.getValue()?-t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.cmbPrefWidthUnit=new Common.UI.ComboBox({el:$("#tableadv-combo-prefwidth-unit"),style:"width: 115px;",menuStyle:"min-width: 115px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:e==Common.Utils.Metric.c_MetricUnits.pt?this.txtPt:e==Common.Utils.Metric.c_MetricUnits.inch?this.txtInch:this.txtCm},{value:1,displayValue:this.txtPercent}]}),this.cmbPrefWidthUnit.on("selected",_.bind(function(t,e){if(this._changedProps){var i=e.value?"%":Common.Utils.Metric.getCurrentMetricName();if(this.nfPrefWidth.getUnitValue()!==i){var n=Common.Utils.Metric.fnRecalcFromMM(558);this.nfPrefWidth.setDefaultUnit(i),this.nfPrefWidth.setMaxValue(e.value?parseFloat((100*n/this.pageWidth).toFixed(2)):n),this.nfPrefWidth.setStep(e.value||Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1),this.nfPrefWidth.setValue(e.value?100*this.nfPrefWidth.getNumberValue()/this.pageWidth:this.pageWidth*this.nfPrefWidth.getNumberValue()/100),this._changedProps.put_CellsWidth(e.value?-this.nfPrefWidth.getNumberValue():Common.Utils.Metric.fnRecalcToMM(this.nfPrefWidth.getNumberValue()))}}},this)),this.chWrapText=new Common.UI.CheckBox({el:$("#tableadv-checkbox-wrap"),value:!1,labelText:this.textWrapText}),this.chWrapText.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_CellsNoWrap("checked"!=t.getValue())},this)),this.btnWrapNone=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-wrap-none",posId:c_tableWrap.TABLE_WRAP_NONE,hint:this.textWrapNoneTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablewrapGroup"}),this.btnWrapNone.render($("#tableadv-button-wrap-none")),this.btnWrapNone.on("click",_.bind(this.onBtnInlineWrapClick,this)),this.btnWrapParallel=new Common.UI.Button({
|
|
|
cls:"btn-options huge",iconCls:"icon-right-panel btn-wrap-parallel",posId:c_tableWrap.TABLE_WRAP_PARALLEL,hint:this.textWrapParallelTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablewrapGroup"}),this.btnWrapParallel.render($("#tableadv-button-wrap-parallel")),this.btnWrapParallel.on("click",_.bind(this.onBtnFlowWrapClick,this)),this.btnAlignLeft=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-table-align-left",posId:c_tableAlign.TABLE_ALIGN_LEFT,hint:this.textLeftTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablealignGroup"}),this.btnAlignLeft.render($("#tableadv-button-align-left")),this.btnAlignLeft.on("click",_.bind(function(t){this._changedProps&&t.pressed&&(this._changedProps.put_TableAlignment(t.options.posId),this._changedProps.put_TableIndent(Common.Utils.Metric.fnRecalcToMM(this.spnIndentLeft.getNumberValue())),this.spnIndentLeft.setDisabled(!t.pressed),this._state.alignChanged=!0)},this)),this.btnAlignCenter=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-table-align-center",posId:c_tableAlign.TABLE_ALIGN_CENTER,hint:this.textCenterTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablealignGroup"}),this.btnAlignCenter.render($("#tableadv-button-align-center")),this.btnAlignCenter.on("click",_.bind(function(t){this._changedProps&&t.pressed&&(this._changedProps.put_TableAlignment(t.options.posId),this._changedProps.put_TableIndent(0),this.spnIndentLeft.setDisabled(t.pressed),this._state.alignChanged=!0)},this)),this.btnAlignRight=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-table-align-right",posId:c_tableAlign.TABLE_ALIGN_RIGHT,hint:this.textRightTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"advtablealignGroup"}),this.btnAlignRight.render($("#tableadv-button-align-right")),this.btnAlignRight.on("click",_.bind(function(t){this._changedProps&&t.pressed&&(this._changedProps.put_TableAlignment(t.options.posId),this._changedProps.put_TableIndent(0),this.spnIndentLeft.setDisabled(t.pressed),this._state.alignChanged=!0)},this)),this.spnIndentLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-indent"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:38.09,minValue:-38.09}),this.spnIndentLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_TableIndent(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnIndentLeft),this.spnDistanceTop=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-top"),step:.1,width:85,defaultUnit:"cm",value:"1 cm",maxValue:55.87,minValue:0}),this.spnDistanceTop.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Top(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceTop),this.spnDistanceBottom=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-bottom"),step:.1,width:85,defaultUnit:"cm",value:"1 cm",maxValue:55.87,minValue:0}),this.spnDistanceBottom.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Bottom(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceBottom),this.spnDistanceLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-left"),step:.1,width:85,defaultUnit:"cm",value:"1 cm",maxValue:9.34,minValue:0}),this.spnDistanceLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Left(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceLeft),this.spnDistanceRight=new Common.UI.MetricSpinner({el:$("#tableadv-number-distance-right"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnDistanceRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(void 0===this._changedProps.get_TablePaddings()&&this._changedProps.put_TablePaddings(new Asc.asc_CPaddings),this._changedProps.get_TablePaddings().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnDistanceRight),this.spnX=new Common.UI.MetricSpinner({el:$("#tableadv-spin-x"),step:.1,width:115,disabled:!0,defaultUnit:"cm",defaultValue:0,value:"1 cm",maxValue:55.87,minValue:-55.87}),this.spnX.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom),this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._state.spnXChanged=!0)},this)),this.spinners.push(this.spnX),this.spnY=new Common.UI.MetricSpinner({el:$("#tableadv-spin-y"),step:.1,width:115,disabled:!0,defaultUnit:"cm",defaultValue:0,value:"1 cm",maxValue:55.87,minValue:-55.87}),this.spnY.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom),this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._state.spnYChanged=!0)},this)),this.spinners.push(this.spnY),this._arrHAlign=[{displayValue:this.textLeft,value:Asc.c_oAscXAlign.Left},{displayValue:this.textCenter,value:Asc.c_oAscXAlign.Center},{displayValue:this.textRight,value:Asc.c_oAscXAlign.Right}],this.cmbHAlign=new Common.UI.ComboBox({el:$("#tableadv-combo-halign"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHAlign}),this.cmbHAlign.setValue(this._state.HAlignType),this.cmbHAlign.on("selected",_.bind(this.onHAlignSelect,this)),this._arrHRelative=[{displayValue:this.textMargin,value:Asc.c_oAscHAnchor.Margin},{displayValue:this.textPage,value:Asc.c_oAscHAnchor.Page},{displayValue:this.textAnchorText,value:Asc.c_oAscHAnchor.Text}],this.cmbHRelative=new Common.UI.ComboBox({el:$("#tableadv-combo-hrelative"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHRelative}),this.cmbHRelative.setValue(this._state.HAlignFrom),this.cmbHRelative.on("selected",_.bind(this.onHRelativeSelect,this)),this.cmbHPosition=new Common.UI.ComboBox({el:$("#tableadv-combo-hposition"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHRelative}),this.cmbHPosition.setDisabled(!0),this.cmbHPosition.setValue(this._state.HPositionFrom),this.cmbHPosition.on("selected",_.bind(this.onHPositionSelect,this)),this._arrVAlign=[{displayValue:this.textTop,value:Asc.c_oAscYAlign.Top},{displayValue:this.textCenter,value:Asc.c_oAscYAlign.Center},{displayValue:this.textBottom,value:Asc.c_oAscYAlign.Bottom}],this.cmbVAlign=new Common.UI.ComboBox({el:$("#tableadv-combo-valign"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVAlign}),this.cmbVAlign.setValue(this._state.VAlignType),this.cmbVAlign.on("selected",_.bind(this.onVAlignSelect,this)),this._arrVRelative=[{displayValue:this.textMargin,value:Asc.c_oAscVAnchor.Margin},{displayValue:this.textPage,value:Asc.c_oAscVAnchor.Page},{displayValue:this.textAnchorText,value:Asc.c_oAscVAnchor.Text}],this.cmbVRelative=new Common.UI.ComboBox({el:$("#tableadv-combo-vrelative"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVRelative}),this.cmbVRelative.setValue(this._state.VAlignFrom),this.cmbVRelative.on("selected",_.bind(this.onVRelativeSelect,this)),this.cmbVPosition=new Common.UI.ComboBox({el:$("#tableadv-combo-vposition"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVRelative}),this.cmbVPosition.setDisabled(!0),this.cmbVPosition.setValue(this._state.VPositionFrom),this.cmbVPosition.on("selected",_.bind(this.onVPositionSelect,this)),this.radioHAlign=new Common.UI.RadioBox({el:$("#tableadv-radio-halign"),name:"asc-radio-horizontal",checked:!0}),this.radioHAlign.on("change",_.bind(this.onRadioHAlignChange,this)),this.radioHPosition=new Common.UI.RadioBox({el:$("#tableadv-radio-hposition"),name:"asc-radio-horizontal"}),this.radioHPosition.on("change",_.bind(this.onRadioHPositionChange,this)),this.radioVAlign=new Common.UI.RadioBox({el:$("#tableadv-radio-valign"),name:"asc-radio-vertical",checked:!0}),this.radioVAlign.on("change",_.bind(this.onRadioVAlignChange,this)),this.radioVPosition=new Common.UI.RadioBox({el:$("#tableadv-radio-vposition"),name:"asc-radio-vertical"}),this.radioVPosition.on("change",_.bind(this.onRadioVPositionChange,this)),this.chMove=new Common.UI.CheckBox({el:$("#tableadv-checkbox-move"),labelText:this.textMove}),this.chMove.on("change",_.bind(function(t,e,i,n){if(this._changedProps){var o=this._arrVRelative["checked"==t.getValue()?2:1].value;if(this.cmbVRelative.isDisabled()){this.cmbVPosition.setValue(o);var s=this.cmbVPosition.getSelectedRecord();s&&this.onVPositionSelect(this.cmbVPosition,s)}else{this.cmbVRelative.setValue(o);var s=this.cmbVRelative.getSelectedRecord();s&&this.onVRelativeSelect(this.cmbVRelative,s)}}},this)),this.chOverlap=new Common.UI.CheckBox({el:$("#tableadv-checkbox-overlap"),labelText:this.textOverlap}),this.chOverlap.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_AllowOverlap("checked"==t.getValue())},this)),this.cmbBorderSize=new Common.UI.ComboBorderSize({el:$("#tableadv-combo-border-size"),style:"width: 93px;"});var n=this.cmbBorderSize.store.at(1);this.BorderSize={ptValue:n.get("value"),pxValue:n.get("pxValue")},this.cmbBorderSize.setValue(this.BorderSize.ptValue),this.cmbBorderSize.on("selected",_.bind(this.onBorderSizeSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="tableadv-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="tableadv-border-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnBorderColor.on("render:after",function(e){t.colorsBorder=new Common.UI.ThemeColorPalette({el:$("#tableadv-border-color-menu")}),t.colorsBorder.on("select",_.bind(t.onColorsBorderSelect,t))}),this.btnBorderColor.render($("#tableadv-border-color-btn")),this.btnBorderColor.setColor("000000"),$("#tableadv-border-color-new").on("click",_.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="tableadv-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="tableadv-back-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnBackColor.on("render:after",function(e){t.colorsBack=new Common.UI.ThemeColorPalette({el:$("#tableadv-back-color-menu"),transparent:!0}),t.colorsBack.on("select",_.bind(t.onColorsBackSelect,t))}),this.btnBackColor.render($("#tableadv-button-back-color")),$("#tableadv-back-color-new").on("click",_.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnTableBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:_.template('<div id="tableadv-table-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="tableadv-table-back-color-new" style="padding-left:12px;">'+t.textNewColor+"</a>")}]})}),this.btnTableBackColor.on("render:after",function(e){t.colorsTableBack=new Common.UI.ThemeColorPalette({el:$("#tableadv-table-back-color-menu"),transparent:!0}),t.colorsTableBack.on("select",_.bind(t.onColorsTableBackSelect,t))}),this.btnTableBackColor.render($("#tableadv-button-table-back-color")),$("#tableadv-table-back-color-new").on("click",_.bind(this.addNewColor,this,this.colorsTableBack,this.btnTableBackColor)),this.tableBordersImageSpacing=new Common.UI.TableStyler({el:$("#id-detablestyler-spacing"),width:200,height:200,rows:this.tableStylerRows,columns:this.tableStylerColumns,spacingMode:!0}),this.tableBordersImage=new Common.UI.TableStyler({el:$("#id-detablestyler"),width:200,height:200,rows:this.tableStylerRows,columns:this.tableStylerColumns,spacingMode:!1});var o=[["cm","btn-borders-large btn-adv-position-inner","tableadv-button-border-inner",this.tipInner],["lrtb","btn-borders-large btn-adv-position-outer","tableadv-button-border-outer",this.tipOuter],["lrtbcm","btn-borders-large btn-adv-position-all","tableadv-button-border-all",this.tipAll],["","btn-borders-large btn-adv-position-none","tableadv-button-border-none",this.tipNone]];this._btnsBorderPosition=[],_.each(o,function(t,e,i){var n=new Common.UI.Button({style:"margin-left: 5px; margin-bottom: 4px;",cls:"btn-options large",iconCls:t[1],strId:t[0],hint:t[3]});n.render($("#"+t[2])),n.on("click",_.bind(this._ApplyBorderPreset,this)),this._btnsBorderPosition.push(n)},this);var s=[["cm","","btn-borders-large btn-adv-position-inner-none","tableadv-button-border-inner-none",this.tipCellInner],["lrtb","","btn-borders-large btn-adv-position-outer-none","tableadv-button-border-outer-none",this.tipCellOuter],["lrtbcm","","btn-borders-large btn-adv-position-all-none","tableadv-button-border-all-none",this.tipCellAll],["","","btn-borders-large btn-adv-position-none-none","tableadv-button-border-none-none",this.tipNone],["lrtbcm","lrtb","btn-borders-large btn-adv-position-all-table","tableadv-button-border-all-table",this.tipTableOuterCellAll],["","lrtb","btn-borders-large btn-adv-position-none-table","tableadv-button-border-none-table",this.tipOuter],["cm","lrtb","btn-borders-large btn-adv-position-inner-table","tableadv-button-border-inner-table",this.tipTableOuterCellInner],["lrtb","lrtb","btn-borders-large btn-adv-position-outer-table","tableadv-button-border-outer-table",this.tipTableOuterCellOuter]];this._btnsTableBorderPosition=[],_.each(s,function(t,e,i){var n=new Common.UI.Button({style:"margin-left: 5px; margin-bottom: 4px;",cls:"btn-options large",iconCls:t[2],strCellId:t[0],strTableId:t[1],hint:t[4]});n.render($("#"+t[3])),n.on("click",_.bind(this._ApplyBorderPreset,this)),this._btnsTableBorderPosition.push(n)},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.AlignContainer=$("#tableadv-panel-align"),this.DistanceContainer=$("#tableadv-panel-distance"),this.BordersContainer=$("#tableadv-panel-borders"),this.BordersSpacingContainer=$("#tableadv-panel-borders-spacing"),this.CellBackContainer=$("#tableadv-panel-cell-back"),this.TableBackContainer=$("#tableadv-panel-table-back"),this.btnsCategory[1].on("click",_.bind(this.onCellCategoryClick,this)),this.afterRender()},afterRender:function(){if(this.updateMetricUnit(),this.updateThemeColors(),this._setDefaults(this._originalProps),void 0!==this.borderProps){this.btnBorderColor.setColor(this.borderProps.borderColor);var t="object"==typeof this.borderProps.borderColor?this.borderProps.borderColor.color:this.borderProps.borderColor;this.tableBordersImageSpacing.setVirtualBorderColor(t),this.tableBordersImage.setVirtualBorderColor(t),this.cmbBorderSize.setValue(this.borderProps.borderSize.ptValue);var e=this.cmbBorderSize.getSelectedRecord();e&&this.onBorderSizeSelect(this.cmbBorderSize,e),this.colorsBorder.select(this.borderProps.borderColor,!0)}for(var i=0;i<this.tableBordersImageSpacing.rows;i++)for(var n=0;n<this.tableBordersImageSpacing.columns;n++)this.tableBordersImageSpacing.getCell(n,i).on("borderclick",function(t,e,i,n){void 0===this.ChangedCellBorders&&(this.ChangedCellBorders=new Asc.CBorders),this._UpdateCellBordersStyle(t,e,i,n,this.CellBorders,this.ChangedCellBorders)},this);for(this.tableBordersImageSpacing.on("borderclick",function(t,e,i,n){void 0===this.ChangedTableBorders&&(this.ChangedTableBorders=new Asc.CBorders),this._UpdateTableBordersStyle(t,e,i,n,this.TableBorders,this.ChangedTableBorders)},this),i=0;i<this.tableBordersImage.rows;i++)for(n=0;n<this.tableBordersImage.columns;n++)this.tableBordersImage.getCell(n,i).on("borderclick",function(t,e,i,n){this._allTable?void 0===this.ChangedTableBorders&&(this.ChangedTableBorders=new Asc.CBorders):void 0===this.ChangedCellBorders&&(this.ChangedCellBorders=new Asc.CBorders),this._UpdateCellBordersStyle(t,e,i,n,this._allTable?this.TableBorders:this.CellBorders,this._allTable?this.ChangedTableBorders:this.ChangedCellBorders)},this);this.tableBordersImage.on("borderclick",function(t,e,i,n){this._allTable?void 0===this.ChangedTableBorders&&(this.ChangedTableBorders=new Asc.CBorders):void 0===this.ChangedCellBorders&&(this.ChangedCellBorders=new Asc.CBorders),this._UpdateTableBordersStyle(t,e,i,n,this._allTable?this.TableBorders:this.CellBorders,this._allTable?this.ChangedTableBorders:this.ChangedCellBorders)},this);var o="object"==typeof this.CellColor.Color?this.CellColor.Color.color:this.CellColor.Color,s="object"==typeof this.TableColor.Color?this.TableColor.Color.color:this.TableColor.Color;if(this.tableBordersImageSpacing.setTableColor(s),this.tableBordersImage.setTableColor(s),this.tableBordersImageSpacing.setCellsColor(o),this.tableBordersImage.setCellsColor(this._allTable?s:o),this.storageName){var a=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==a?parseInt(a):0)}},getSettings:function(){return this._cellBackground&&(this._allTable&&(null===this._changedProps.get_Spacing()||void 0===this._changedProps.get_Spacing()&&null===this._originalProps.get_Spacing())?this._changedProps.put_CellsBackground(null):this._changedProps.put_CellsBackground(this._cellBackground)),null===this.ChangedTableBorders?this._changedProps.put_TableBorders(this.TableBorders):void 0!==this.ChangedTableBorders&&this._changedProps.put_TableBorders(this.ChangedTableBorders),null===this.ChangedCellBorders?this._changedProps.put_CellBorders(this.CellBorders):void 0!==this.ChangedCellBorders&&this._changedProps.put_CellBorders(this.ChangedCellBorders),this.isAltTitleChanged&&this._changedProps.put_TableCaption(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.put_TableDescription(this.textareaAltDescription.val()),{tableProps:this._changedProps,borderProps:{borderSize:this.BorderSize,borderColor:this.btnBorderColor.color}}},_setDefaults:function(t){if(t){this._allTable=!t.get_CellSelect(),this.pageWidth=Common.Utils.Metric.fnRecalcFromMM(t.get_PercentFullWidth());var e,i=t.get_Width(),n=Common.Utils.Metric.getCurrentMetric();this.cmbUnit.store.at(0).set("displayValue",n==Common.Utils.Metric.c_MetricUnits.pt?this.txtPt:n==Common.Utils.Metric.c_MetricUnits.inch?this.txtInch:this.txtCm),this.cmbUnit.setValue(i<0?1:0),this.nfWidth.setDefaultUnit(i<0?"%":Common.Utils.Metric.getCurrentMetricName()),i<0&&this.nfWidth.setMaxValue(parseFloat((100*Common.Utils.Metric.fnRecalcFromMM(558)/this.pageWidth).toFixed(2))),this.nfWidth.setStep(i<0||Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1),null!==i&&this.nfWidth.setValue(i>0?Common.Utils.Metric.fnRecalcFromMM(i):-i,!0),this.chWidth.setValue(null!==i,!0),e="checked"!==this.chWidth.getValue(),this.nfWidth.setDisabled(e),this.cmbUnit.setDisabled(e);var o=t.get_Spacing();null!==o&&this.nfSpacing.setValue(Common.Utils.Metric.fnRecalcFromMM(o),!0),this.chAllowSpacing.setValue(null!==o,!0),this.nfSpacing.setDisabled("checked"!==this.chAllowSpacing.getValue());var s=t.get_TableLayout();this.chAutofit.setDisabled(void 0===s),this.chAutofit.setValue(s===Asc.c_oAscTableLayout.AutoFit,!0);var a=t.get_DefaultMargins();a&&(this.TableMargins={Left:null!==a.get_Left()?Common.Utils.Metric.fnRecalcFromMM(a.get_Left()):null,Right:null!==a.get_Right()?Common.Utils.Metric.fnRecalcFromMM(a.get_Right()):null,Top:null!==a.get_Top()?Common.Utils.Metric.fnRecalcFromMM(a.get_Top()):null,Bottom:null!==a.get_Bottom()?Common.Utils.Metric.fnRecalcFromMM(a.get_Bottom()):null}),a=t.get_CellMargins();var r=void 0;a&&(this.CellMargins={Left:null!==a.get_Left()?Common.Utils.Metric.fnRecalcFromMM(a.get_Left()):null,Right:null!==a.get_Right()?Common.Utils.Metric.fnRecalcFromMM(a.get_Right()):null,Top:null!==a.get_Top()?Common.Utils.Metric.fnRecalcFromMM(a.get_Top()):null,Bottom:null!==a.get_Bottom()?Common.Utils.Metric.fnRecalcFromMM(a.get_Bottom()):null},r=a.get_Flag(),this.CellMargins.Flag=1==r?"indeterminate":0==r?"checked":"unchecked",this.chCellMargins.setValue(this.CellMargins.Flag,!0)),0===r&&(null===this.CellMargins.Left&&(this.CellMargins.Left=this.TableMargins.Left),null===this.CellMargins.Top&&(this.CellMargins.Top=this.TableMargins.Top),null===this.CellMargins.Right&&(this.CellMargins.Right=this.TableMargins.Right),null===this.CellMargins.Bottom&&(this.CellMargins.Bottom=this.TableMargins.Bottom)),this.fillMargins(this.CellMargins.Flag);var l=t.get_CellsWidth();this.cmbPrefWidthUnit.store.at(0).set("displayValue",n==Common.Utils.Metric.c_MetricUnits.pt?this.txtPt:n==Common.Utils.Metric.c_MetricUnits.inch?this.txtInch:this.txtCm),this.cmbPrefWidthUnit.setValue(l<0?1:0),this.nfPrefWidth.setDefaultUnit(l<0?"%":Common.Utils.Metric.getCurrentMetricName()),l<0&&this.nfPrefWidth.setMaxValue(parseFloat((100*Common.Utils.Metric.fnRecalcFromMM(558)/this.pageWidth).toFixed(2))),this.nfPrefWidth.setStep(l<0||Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1),null!==l&&this.nfPrefWidth.setValue(l>0?Common.Utils.Metric.fnRecalcFromMM(l):-l,!0),this.chPrefWidth.setValue(t.get_CellsWidthNotEqual()?"indeterminate":null!==l,!0),e="checked"!==this.chPrefWidth.getValue(),this.nfPrefWidth.setDisabled(e),this.cmbPrefWidthUnit.setDisabled(e);var c=!t.get_CellsNoWrap();this.chWrapText.setValue(c,!0),this._TblWrapStyleChanged(t.get_TableWrap()),this.ShowHideWrap(t.get_TableWrap()===c_tableWrap.TABLE_WRAP_NONE),this.btnWrapParallel.setDisabled(!t.get_CanBeFlow());var d=t.get_TableAlignment();null!==d&&(this._TblAlignChanged(d),this.spnIndentLeft.setValue(d!==c_tableAlign.TABLE_ALIGN_LEFT?0:Common.Utils.Metric.fnRecalcFromMM(t.get_TableIndent()),!0),this.spnIndentLeft.setDisabled(d!==c_tableAlign.TABLE_ALIGN_LEFT)),this._state.alignChanged=!1;var h=t.get_TablePaddings();h&&(this.spnDistanceTop.setValue(Common.Utils.Metric.fnRecalcFromMM(h.get_Top()),!0),this.spnDistanceLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(h.get_Left()),!0),this.spnDistanceBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(h.get_Bottom()),!0),this.spnDistanceRight.setValue(Common.Utils.Metric.fnRecalcFromMM(h.get_Right()),!0));var p=t.get_PositionH();if(p){e=p.get_RelativeFrom();for(var m=0;m<this._arrHRelative.length;m++)if(e==this._arrHRelative[m].value){this.cmbHRelative.setValue(e),this.cmbHPosition.setValue(e),this._state.HPositionFrom=e,this._state.HAlignFrom=e;break}if(p.get_UseAlign()){e=p.get_Align();for(var m=0;m<this._arrHAlign.length;m++)if(e==this._arrHAlign[m].value){this.cmbHAlign.setValue(e),this._state.HAlignType=e;break}e=this._originalProps.get_Value_X(this._state.HPositionFrom),this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(e))}else this.radioHPosition.setValue(!0),e=p.get_Value(),this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(e))}else e=this._originalProps.get_Value_X(this._state.HPositionFrom),this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(e));if(p=t.get_PositionV()){for(e=p.get_RelativeFrom(),m=0;m<this._arrVRelative.length;m++)if(e==this._arrVRelative[m].value){this.cmbVRelative.setValue(e),this.cmbVPosition.setValue(e),this._state.VAlignFrom=e,this._state.VPositionFrom=e;break}if(e==Asc.c_oAscVAnchor.Text&&this.chMove.setValue(!0,!0),p.get_UseAlign()){for(e=p.get_Align(),m=0;m<this._arrVAlign.length;m++)if(e==this._arrVAlign[m].value){this.cmbVAlign.setValue(e),this._state.VAlignType=e;break}e=t.get_Value_Y(this._state.VPositionFrom),this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(e))}else this.radioVPosition.setValue(!0),e=p.get_Value(),this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(e))}else e=t.get_Value_Y(this._state.VPositionFrom),this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(e));this.chOverlap.setValue(null!==t.get_AllowOverlap()?t.get_AllowOverlap():"indeterminate",!0),this._state.verticalPropChanged=!1,this._state.horizontalPropChanged=!1,this.TableBorders=new Asc.CBorders(t.get_TableBorders()),this.CellBorders=new Asc.CBorders(t.get_CellBorders()),this._UpdateBordersNoSpacing_(),this._UpdateBordersSpacing_();var u=null===this.CellBorders.get_InsideV()&&null===this.CellBorders.get_InsideH();this._btnsBorderPosition[0].setDisabled(u&&!this._allTable),this._btnsTableBorderPosition[0].setDisabled(u&&!this._allTable),this._btnsTableBorderPosition[6].setDisabled(u&&!this._allTable);var g=t.get_TableBackground();if(g&&0==g.get_Value()){var b=g.get_Color();b?b.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.TableColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b()),effectValue:b.get_value()}}:this.TableColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b())}:this.TableColor={Value:1,Color:"transparent"}}else this.TableColor={Value:0,Color:"transparent"};if(g=t.get_CellsBackground())if(0==g.get_Value()){var b=g.get_Color();b?b.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.CellColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b()),effectValue:b.get_value()}}:this.CellColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b())}:this.CellColor={Value:1,Color:"transparent"}}else this.CellColor={Value:1,Color:"transparent"};else this.CellColor={Value:0,Color:"transparent"};if(this.btnBackColor.setColor(this.CellColor.Color),"object"==typeof this.CellColor.Color){for(var f=!1,m=0;m<10;m++)if(Common.Utils.ThemeColor.ThemeValues[m]==this.CellColor.Color.effectValue){this.colorsBack.select(this.CellColor.Color,!0),f=!0;break}f||this.colorsBack.clearSelection()}else this.colorsBack.select(this.CellColor.Color,!0);if(this.btnTableBackColor.setColor(this.TableColor.Color),"object"==typeof this.TableColor.Color){for(var f=!1,m=0;m<10;m++)if(Common.Utils.ThemeColor.ThemeValues[m]==this.TableColor.Color.effectValue){this.colorsTableBack.select(this.TableColor.Color,!0),f=!0;break}f||this.colorsTableBack.clearSelection()}else this.colorsTableBack.select(this.TableColor.Color,!0);this.ShowHideSpacing("checked"===this.chAllowSpacing.getValue()),e=t.get_TableCaption(),this.inputAltTitle.setValue(e||""),e=t.get_TableDescription(),this.textareaAltDescription.val(e||"")}this._changedProps=new Asc.CTableProp,this._changedProps.put_CellSelect(!this._allTable),this._cellBackground=null,this.ChangedTableBorders=void 0,this.ChangedCellBorders=void 0},fillMargins:function(t){this.spnMarginLeft.setValue(null!==this.CellMargins.Left?this.CellMargins.Left:"",!0),this.spnMarginTop.setValue(null!==this.CellMargins.Top?this.CellMargins.Top:"",!0),this.spnMarginRight.setValue(null!==this.CellMargins.Right?this.CellMargins.Right:"",!0),this.spnMarginBottom.setValue(null!==this.CellMargins.Bottom?this.CellMargins.Bottom:"",!0);var e="checked"==t;this.spnMarginTop.setDisabled(e),this.spnMarginBottom.setDisabled(e),this.spnMarginLeft.setDisabled(e),this.spnMarginRight.setDisabled(e),this.spnTableMarginLeft.setValue(null!==this.TableMargins.Left?this.TableMargins.Left:"",!0),this.spnTableMarginTop.setValue(null!==this.TableMargins.Top?this.TableMargins.Top:"",!0),this.spnTableMarginRight.setValue(null!==this.TableMargins.Right?this.TableMargins.Right:"",!0),this.spnTableMarginBottom.setValue(null!==this.TableMargins.Bottom?this.TableMargins.Bottom:"",!0)},_TblWrapStyleChanged:function(t){t==c_tableWrap.TABLE_WRAP_NONE?this.btnWrapNone.toggle(!0):this.btnWrapParallel.toggle(!0),this._state.fromWrapInline=t==c_tableWrap.TABLE_WRAP_NONE},_TblAlignChanged:function(t){t==c_tableAlign.TABLE_ALIGN_LEFT?this.btnAlignLeft.toggle(!0,!0):t==c_tableAlign.TABLE_ALIGN_CENTER?this.btnAlignCenter.toggle(!0,!0):this.btnAlignRight.toggle(!0,!0)},onBtnInlineWrapClick:function(t,e){this.ShowHideWrap(!0),this._changedProps&&t.pressed&&(this._state.alignChanged&&(this._state.HAlignType===Asc.c_oAscXAlign.Left?this.btnAlignLeft.toggle(!0):this._state.HAlignType==Asc.c_oAscXAlign.Center?this.btnAlignCenter.toggle(!0):this._state.HAlignType==Asc.c_oAscXAlign.Right&&this.btnAlignRight.toggle(!0),this._state.alignChanged=!1),this._changedProps.put_TableWrap(t.options.posId),this.btnAlignLeft.pressed?this._changedProps.put_TableAlignment(c_tableAlign.TABLE_ALIGN_LEFT):this.btnAlignCenter.pressed?this._changedProps.put_TableAlignment(c_tableAlign.TABLE_ALIGN_CENTER):this._changedProps.put_TableAlignment(c_tableAlign.TABLE_ALIGN_RIGHT),this.spnIndentLeft.setDisabled(!this.btnAlignLeft.pressed),this._changedProps.put_TableIndent(Common.Utils.Metric.fnRecalcToMM(this.spnIndentLeft.getNumberValue())))},onBtnFlowWrapClick:function(t,e){this.ShowHideWrap(!1),this._changedProps&&t.pressed&&(this._changedProps.put_TableWrap(t.options.posId),this._changedProps.put_TableAlignment(null),this._changedProps.put_TableIndent(null),this._state.fromWrapInline&&!this._state.verticalPropChanged&&this.radioVPosition.setValue(!0),this._state.alignChanged?(this.btnAlignLeft.pressed?this._state.HAlignType=Asc.c_oAscXAlign.Left:this.btnAlignCenter.pressed?this._state.HAlignType=Asc.c_oAscXAlign.Center:this._state.HAlignType=Asc.c_oAscXAlign.Right,this.cmbHAlign.setValue(this._state.HAlignType),this.radioHAlign.setValue(!0),null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._changedProps.get_PositionH().put_UseAlign(!0),this._changedProps.get_PositionH().put_Align(this._state.HAlignType),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom),this._state.alignChanged=!1,this._state.horizontalPropChanged=!0):this._state.fromWrapInline&&!this._state.horizontalPropChanged&&this.radioHPosition.setValue(!0))},onHAlignSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._state.HAlignType=e.value,this._changedProps.get_PositionH().put_UseAlign(!0),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom),this._changedProps.get_PositionH().put_Align(this._state.HAlignType),this._state.alignChanged=!0)},onHRelativeSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._state.HAlignFrom=e.value,this._changedProps.get_PositionH().put_UseAlign(!0),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom),this._changedProps.get_PositionH().put_Align(this._state.HAlignType))},onHPositionSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._state.HPositionFrom=e.value,this._changedProps.get_PositionH().put_UseAlign(!1),
|
|
|
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom),!this._state.spnXChanged){var i=this._originalProps.get_Value_X(this._state.HPositionFrom);this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0)}this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()))}},onVAlignSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._state.VAlignType=e.value,this._changedProps.get_PositionV().put_UseAlign(!0),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._changedProps.get_PositionV().put_Align(this._state.VAlignType))},onVRelativeSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._state.VAlignFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!0),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._changedProps.get_PositionV().put_Align(this._state.VAlignType),this.chMove.setValue(this._state.VAlignFrom==Asc.c_oAscVAnchor.Text,!0))},onVPositionSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._state.VPositionFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom),!this._state.spnYChanged){var i=this._originalProps.get_Value_Y(this._state.VPositionFrom);this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0)}this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),this.chMove.setValue(this._state.VPositionFrom==Asc.c_oAscVAnchor.Text,!0)}},onRadioHAlignChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._changedProps.get_PositionH().put_UseAlign(e),e&&(this._changedProps.get_PositionH().put_Align(this._state.HAlignType),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom))),e&&(this.cmbHAlign.setDisabled(!1),this.cmbHRelative.setDisabled(!1),this.spnX.setDisabled(!0),this.cmbHPosition.setDisabled(!0),this._state.horizontalPropChanged=!0,this._state.alignChanged=!0)},onRadioHPositionChange:function(t,e,i){if(this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CTablePositionH),this._changedProps.get_PositionH().put_UseAlign(!e),e)){if(!this._state.spnXChanged){var n=this._originalProps.get_Value_X(this._state.HPositionFrom);this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(n))}this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom)}e&&(this.cmbHAlign.setDisabled(!0),this.cmbHRelative.setDisabled(!0),this.spnX.setDisabled(!1),this.cmbHPosition.setDisabled(!1),this._state.alignChanged=!1)},onRadioVAlignChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._changedProps.get_PositionV().put_UseAlign(e),e&&(this._changedProps.get_PositionV().put_Align(this._state.VAlignType),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._state.verticalPropChanged=!0)),e&&(this.cmbVAlign.setDisabled(!1),this.cmbVRelative.setDisabled(!1),this.spnY.setDisabled(!0),this.cmbVPosition.setDisabled(!0),this.chMove.setValue(this._state.VAlignFrom==Asc.c_oAscVAnchor.Text,!0))},onRadioVPositionChange:function(t,e,i){if(this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CTablePositionV),this._changedProps.get_PositionV().put_UseAlign(!e),e)){if(!this._state.spnYChanged){var n=this._originalProps.get_Value_Y(this._state.VPositionFrom);this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(n))}this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom)}e&&(this.cmbVAlign.setDisabled(!0),this.cmbVRelative.setDisabled(!0),this.spnY.setDisabled(!1),this.cmbVPosition.setDisabled(!1),this.chMove.setValue(this._state.VPositionFrom==Asc.c_oAscVAnchor.Text,!0))},onBorderSizeSelect:function(t,e){this.BorderSize={ptValue:e.value,pxValue:e.pxValue},this.tableBordersImage.setVirtualBorderSize(this.BorderSize.pxValue),this.tableBordersImageSpacing.setVirtualBorderSize(this.BorderSize.pxValue)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onColorsBorderSelect:function(t,e){this.btnBorderColor.setColor(e);var i="object"==typeof e?e.color:e;this.tableBordersImage.setVirtualBorderColor(i),this.tableBordersImageSpacing.setVirtualBorderColor(i)},onColorsBackSelect:function(t,e){this.btnBackColor.setColor(e),this.CellColor={Value:1,Color:e},null===this._cellBackground&&(this._cellBackground=new Asc.CBackground),"transparent"==this.CellColor.Color?(this._cellBackground.put_Value(1),this._cellBackground.put_Color(new Asc.asc_CColor(0,0,0))):(this._cellBackground.put_Value(0),this._cellBackground.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color)));var i="object"==typeof e?e.color:e;this.tableBordersImageSpacing.setCellsColor(i),this._allTable||this.tableBordersImage.setCellsColor(i)},onColorsTableBackSelect:function(t,e){if(this.btnTableBackColor.setColor(e),this.TableColor.Color=e,this._changedProps){var i=this._changedProps.get_TableBackground();void 0===i&&(i=new Asc.CBackground,this._changedProps.put_TableBackground(i)),"transparent"==this.TableColor.Color?(i.put_Value(1),i.put_Color(new Asc.asc_CColor(0,0,0))):(i.put_Value(0),i.put_Color(Common.Utils.ThemeColor.getRgbColor(this.TableColor.Color)))}var n="object"==typeof e?e.color:e;this.tableBordersImageSpacing.setTableColor(n),this.tableBordersImage.setTableColor(n),this._allTable&&this.tableBordersImage.setCellsColor(n)},_UpdateBordersSpacing_:function(){var t=this.TableBorders,e=this.BorderSize,i=this.btnBorderColor.color;this._UpdateTableBorderSpacing_(t.get_Left(),"l"),this._UpdateTableBorderSpacing_(t.get_Top(),"t"),this._UpdateTableBorderSpacing_(t.get_Right(),"r"),this._UpdateTableBorderSpacing_(t.get_Bottom(),"b"),t=this.CellBorders;for(var n=0;n<this.tableBordersImageSpacing.rows;n++)this._UpdateCellBorderSpacing_(t.get_Left(),"l",this.tableBordersImageSpacing.getCell(0,n));for(n=0;n<this.tableBordersImageSpacing.rows;n++)this._UpdateCellBorderSpacing_(t.get_Right(),"r",this.tableBordersImageSpacing.getCell(this.tableBordersImageSpacing.columns-1,n));for(n=0;n<this.tableBordersImageSpacing.columns;n++)this._UpdateCellBorderSpacing_(t.get_Top(),"t",this.tableBordersImageSpacing.getCell(n,0));for(n=0;n<this.tableBordersImageSpacing.columns;n++)this._UpdateCellBorderSpacing_(t.get_Bottom(),"b",this.tableBordersImageSpacing.getCell(n,this.tableBordersImageSpacing.rows-1));if(this._allTable&&null===t.get_InsideV()&&t.put_InsideV(new Asc.asc_CTextBorder),null!==t.get_InsideV())for(n=0;n<this.tableBordersImageSpacing.rows;n++)this._UpdateCellBorderSpacing_(t.get_InsideV(),"r",this.tableBordersImageSpacing.getCell(0,n)),this._UpdateCellBorderSpacing_(t.get_InsideV(),"l",this.tableBordersImageSpacing.getCell(1,n));if(this._allTable&&null===t.get_InsideH()&&t.put_InsideH(new Asc.asc_CTextBorder),null!==t.get_InsideH())for(n=0;n<this.tableBordersImageSpacing.columns;n++)this._UpdateCellBorderSpacing_(t.get_InsideH(),"b",this.tableBordersImageSpacing.getCell(n,0)),this._UpdateCellBorderSpacing_(t.get_InsideH(),"t",this.tableBordersImageSpacing.getCell(n,1));this.tableBordersImageSpacing.setVirtualBorderSize(e.pxValue),this.tableBordersImageSpacing.setVirtualBorderColor("object"==typeof i?i.color:i)},_UpdateCellBorderSpacing_:function(t,e,i){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()?1==t.get_Value()?(i.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),i.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):i.setBordersSize(e,0):(i.setBordersSize(e,this.IndeterminateSize),i.setBordersColor(e,this.IndeterminateColor))},_UpdateTableBorderSpacing_:function(t,e){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()?1==t.get_Value()?(this.tableBordersImageSpacing.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),this.tableBordersImageSpacing.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):this.tableBordersImageSpacing.setBordersSize(e,0):(this.tableBordersImageSpacing.setBordersSize(e,this.IndeterminateSize),this.tableBordersImageSpacing.setBordersColor(e,this.IndeterminateColor))},_UpdateBordersNoSpacing_:function(){var t=this._allTable?this.TableBorders:this.CellBorders,e=this.BorderSize,i=this.btnBorderColor.color;if(this._UpdateTableBorderNoSpacing_(t.get_Left(),"l"),this._UpdateTableBorderNoSpacing_(t.get_Top(),"t"),this._UpdateTableBorderNoSpacing_(t.get_Right(),"r"),this._UpdateTableBorderNoSpacing_(t.get_Bottom(),"b"),this._allTable&&null==t.get_InsideV()&&t.put_InsideV(new Asc.asc_CTextBorder),null!==t.get_InsideV())for(var n=0;n<this.tableBordersImage.rows;n++)this._UpdateCellBorderNoSpacing_(t.get_InsideV(),"r",this.tableBordersImage.getCell(0,n)),this._UpdateCellBorderNoSpacing_(t.get_InsideV(),"l",this.tableBordersImage.getCell(1,n));if(this._allTable&&null==t.get_InsideH()&&t.put_InsideH(new Asc.asc_CTextBorder),null!==t.get_InsideH())for(n=0;n<this.tableBordersImage.columns;n++)this._UpdateCellBorderNoSpacing_(t.get_InsideH(),"b",this.tableBordersImage.getCell(n,0)),this._UpdateCellBorderNoSpacing_(t.get_InsideH(),"t",this.tableBordersImage.getCell(n,1));this.tableBordersImage.setVirtualBorderSize(e.pxValue),this.tableBordersImage.setVirtualBorderColor("object"==typeof i?i.color:i)},_UpdateCellBorderNoSpacing_:function(t,e,i){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()?1==t.get_Value()?(i.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),i.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):i.setBordersSize(e,0):(i.setBordersSize(e,this.IndeterminateSize),i.setBordersColor(e,this.IndeterminateColor))},_UpdateTableBorderNoSpacing_:function(t,e){null!==t&&void 0!==t&&null!==t.get_Value()&&null!==t.get_Size()&&null!==t.get_Color()?1==t.get_Value()?(this.tableBordersImage.setBordersSize(e,this._BorderPt2Px(72*t.get_Size()/25.4)),this.tableBordersImage.setBordersColor(e,"rgb("+t.get_Color().get_r()+","+t.get_Color().get_g()+","+t.get_Color().get_b()+")")):this.tableBordersImage.setBordersSize(e,0):(this.tableBordersImage.setBordersSize(e,this.IndeterminateSize),this.tableBordersImage.setBordersColor(e,this.IndeterminateColor))},_BorderPt2Px:function(t){return 0==t?0:t<.6?.5:t<=1?1:t<=1.5?2:t<=2.25?3:t<=3?4:t<=4.5?5:6},_ApplyBorderPreset:function(t){var e,i=void 0!==t.options.strId?t.options.strId:t.options.strCellId,n=t.options.strTableId;if(this._allTable&&void 0===n?(e=this.TableBorders,this.ChangedTableBorders=null):(e=this.CellBorders,this.ChangedCellBorders=null),this._UpdateBorderStyle(e.get_Left(),i.indexOf("l")>-1),this._UpdateBorderStyle(e.get_Top(),i.indexOf("t")>-1),this._UpdateBorderStyle(e.get_Right(),i.indexOf("r")>-1),this._UpdateBorderStyle(e.get_Bottom(),i.indexOf("b")>-1),this._UpdateBorderStyle(e.get_InsideV(),i.indexOf("c")>-1),this._UpdateBorderStyle(e.get_InsideH(),i.indexOf("m")>-1),void 0===n)return this._UpdateBordersNoSpacing_(),void(this._allTable&&(e=this.CellBorders,this.ChangedCellBorders=null,this._UpdateBorderStyle(e.get_Left(),i.indexOf("l")>-1),this._UpdateBorderStyle(e.get_Top(),i.indexOf("t")>-1),this._UpdateBorderStyle(e.get_Right(),i.indexOf("r")>-1),this._UpdateBorderStyle(e.get_Bottom(),i.indexOf("b")>-1),this._UpdateBorderStyle(e.get_InsideV(),i.indexOf("c")>-1),this._UpdateBorderStyle(e.get_InsideH(),i.indexOf("m")>-1)));e=this.TableBorders,this.ChangedTableBorders=null,this._UpdateBorderStyle(e.get_Left(),n.indexOf("l")>-1),this._UpdateBorderStyle(e.get_Top(),n.indexOf("t")>-1),this._UpdateBorderStyle(e.get_Right(),n.indexOf("r")>-1),this._UpdateBorderStyle(e.get_Bottom(),n.indexOf("b")>-1),this._UpdateBordersSpacing_()},_UpdateCellBordersStyle:function(t,e,i,n,o,s){var a=o;0==t.col&&e.indexOf("l")>-1&&(this._UpdateBorderStyle(a.get_Left(),i>0),s&&s.put_Left(new Asc.asc_CTextBorder(a.get_Left()))),t.col==this.tableStylerColumns-1&&e.indexOf("r")>-1&&(this._UpdateBorderStyle(a.get_Right(),i>0),s&&s.put_Right(new Asc.asc_CTextBorder(a.get_Right()))),0==t.row&&e.indexOf("t")>-1&&(this._UpdateBorderStyle(a.get_Top(),i>0),s&&s.put_Top(new Asc.asc_CTextBorder(a.get_Top()))),t.row==this.tableStylerRows-1&&e.indexOf("b")>-1&&(this._UpdateBorderStyle(a.get_Bottom(),i>0),s&&s.put_Bottom(new Asc.asc_CTextBorder(a.get_Bottom()))),(0==t.col&&e.indexOf("r")>-1||t.col==this.tableStylerColumns-1&&e.indexOf("l")>-1)&&(this._UpdateBorderStyle(a.get_InsideV(),i>0),s&&s.put_InsideV(new Asc.asc_CTextBorder(a.get_InsideV()))),(0==t.row&&e.indexOf("b")>-1||t.row==this.tableStylerRows-1&&e.indexOf("t")>-1)&&(this._UpdateBorderStyle(a.get_InsideH(),i>0),s&&s.put_InsideH(new Asc.asc_CTextBorder(a.get_InsideH())))},_UpdateTableBordersStyle:function(t,e,i,n,o,s){var a=o;e.indexOf("l")>-1&&(this._UpdateBorderStyle(a.get_Left(),i>0),s&&s.put_Left(new Asc.asc_CTextBorder(a.get_Left()))),e.indexOf("t")>-1&&(this._UpdateBorderStyle(a.get_Top(),i>0),s&&s.put_Top(new Asc.asc_CTextBorder(a.get_Top()))),e.indexOf("r")>-1&&(this._UpdateBorderStyle(a.get_Right(),i>0),s&&s.put_Right(new Asc.asc_CTextBorder(a.get_Right()))),e.indexOf("b")>-1&&(this._UpdateBorderStyle(a.get_Bottom(),i>0),s&&s.put_Bottom(new Asc.asc_CTextBorder(a.get_Bottom())))},_UpdateBorderStyle:function(t,e){if(null==t)return 0;if(e&&this.BorderSize.ptValue>0){var i=parseFloat(this.BorderSize.ptValue);t.put_Value(1),t.put_Size(25.4*i/72);var n=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);t.put_Color(n)}else t.put_Color(new Asc.asc_CColor),t.put_Value(0);return t.get_Value()},onCellCategoryClick:function(t){"checked"==this.CellMargins.Flag&&this.TableMargins.isChanged&&(this.CellMargins.Left=this.TableMargins.Left,this.CellMargins.Top=this.TableMargins.Top,this.CellMargins.Right=this.TableMargins.Right,this.CellMargins.Bottom=this.TableMargins.Bottom,this.spnMarginRight.setValue(this.CellMargins.Right,!0),this.spnMarginLeft.setValue(this.CellMargins.Left,!0),this.spnMarginBottom.setValue(this.CellMargins.Bottom,!0),this.spnMarginTop.setValue(this.CellMargins.Top,!0)),this.TableMargins.isChanged=!1},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(){this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsTableBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},ShowHideWrap:function(t){this.AlignContainer.toggleClass("settings-hidden",!t),this.DistanceContainer.toggleClass("settings-hidden",t),this.btnsCategory[3].setDisabled(t)},ShowHideSpacing:function(t){this.BordersContainer.toggleClass("settings-hidden",t),this.BordersSpacingContainer.toggleClass("settings-hidden",!t),this.TableBackContainer.css("display",t||this._allTable?"inline-block":"none"),this.CellBackContainer.css("display",!t&&this._allTable?"none":"inline-block"),this.TableBackContainer.css("float",!t&&this._allTable?"none":"right"),t?this._UpdateBordersSpacing_():this._UpdateBordersNoSpacing_()},textWidth:"Width",textAllowSpacing:"Spacing between cells",textAlign:"Alignment",textIndLeft:"Indent from Left",textWidthSpaces:"Width & Spaces",textWrap:"Text Wrapping",textMargins:"Cell Margins",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",textDistance:"Distance From Text",textPosition:"Position",textWrapParallelTooltip:"Flow table",textWrapNoneTooltip:"Inline table",textLeftTooltip:"Left",textRightTooltip:"Right",textCenterTooltip:"Center",textTitle:"Table - Advanced Settings",textDefaultMargins:"Default Cell Margins",textCheckMargins:"Use default margins",textBordersBackgroung:"Borders & Background",textOnlyCells:"For selected cells only",textBorderWidth:"Border Size",textBorderColor:"Border Color",textBackColor:"Cell Background",textPreview:"Preview",textBorderDesc:"Click on diagramm or use buttons to select borders",textTableBackColor:"Table Background",cancelButtonText:"Cancel",okButtonText:"Ok",txtNoBorders:"No borders",textNewColor:"Add New Custom Color",textCenter:"Center",textMargin:"Margin",textPage:"Page",textHorizontal:"Horizontal",textVertical:"Vertical",textAlignment:"Alignment",textRelative:"relative to",textRightOf:"to the right Of",textBelow:"below",textOverlap:"Allow overlap",textMove:"Move object with text",textOptions:"Options",textAnchorText:"Text",textAutofit:"Automatically resize to fit contents",textCellProps:"Cell",tipAll:"Set Outer Border and All Inner Lines",tipNone:"Set No Borders",tipInner:"Set Inner Lines Only",tipOuter:"Set Outer Border Only",tipCellAll:"Set Borders for Inner Cells Only",tipTableOuterCellAll:"Set Outer Border and Borders for All Inner Cells",tipCellInner:"Set Vertical and Horizontal Lines for Inner Cells Only",tipTableOuterCellInner:"Set Outer Border and Vertical and Horizontal Lines for Inner Cells",tipCellOuter:"Set Outer Borders for Inner Cells Only",tipTableOuterCellOuter:"Set Table Outer Border and Outer Borders for Inner Cells",txtPercent:"Percent",txtCm:"Centimeter",txtPt:"Point",txtInch:"Inch",textCellSize:"Cell Size",textPrefWidth:"Preferred width",textMeasure:"Measure in",textCellOptions:"Cell Options",textWrapText:"Wrap text",textTable:"Table",textTableSize:"Table Size",textTablePosition:"Table Position",textWrappingStyle:"Wrapping Style",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."},DE.Views.TableSettingsAdvanced||{}))}),define("documenteditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/util/utils","common/main/lib/component/Menu","common/main/lib/view/InsertTableDialog","common/main/lib/view/CopyWarningDialog","documenteditor/main/app/view/DropcapSettingsAdvanced","documenteditor/main/app/view/HyperlinkSettingsDialog","documenteditor/main/app/view/ParagraphSettingsAdvanced","documenteditor/main/app/view/TableSettingsAdvanced"],function(t,e,i,n){"use strict";DE.Views.DocumentHolder=i.View.extend(e.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var i=this,n=DE.getCollection("Common.Collections.Users");i._TtHeight=20,i._currentSpellObj=void 0,i._currLang={},i.usertips=[],i.fastcoauthtips=[],i._currentMathObj=void 0,i._currentParaObjDisabled=!1;var o=function(n,o,s,a,r){if(!e.isUndefined(n)&&null!==n&&i.mode.isEdit){Common.UI.Menu.Manager.hideAll();var l=[s.get_X(),s.get_Y()],c=t(i.el).find(Common.Utils.String.format("#menu-container-{0}",n.id));n.rendered||(c.length<1&&(c=t(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)),t(i.el).append(c)),n.render(c),n.cmpEl.attr({tabindex:"-1"})),c.css({left:l[0],top:l[1]}),n.show(),e.isFunction(n.options.initMenu)&&(n.options.initMenu(o),n.alignPosition()),e.delay(function(){n.cmpEl.focus()},10),i.currentMenu=n}},s=function(t){if(t&&e.isArray(t)){for(var n={},o=i.textMenu,s=!0,a=0;a<t.length;a++){var r=t[a].get_ObjectType(),l=t[a].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Image==r){o=i.pictureMenu,void 0===n.imgProps&&(n.imgProps={});var c=l.get_ShapeProperties(),d=l.get_ChartProperties();if(c?c.get_FromChart()?n.imgProps.isChart=!0:n.imgProps.isShape=!0:d?n.imgProps.isChart=!0:n.imgProps.isImg=!0,n.imgProps.value=l,n.imgProps.locked=!!l&&l.get_Locked(),s=!1,!(void 0!==c&&null!==c||void 0!==d&&null!==d))break}else Asc.c_oAscTypeSelectElement.Table==r?(o=i.tableMenu,n.tableProps={},n.tableProps.value=l,n.tableProps.locked=!!l&&l.get_Locked(),s=!1):Asc.c_oAscTypeSelectElement.Paragraph==r?(n.paraProps={},n.paraProps.value=l,n.paraProps.locked=!!l&&l.get_Locked(),n.imgProps&&(n.imgProps.isChart||n.imgProps.isShape)&&void 0===n.tableProps&&(o=i.textMenu),s=!1):Asc.c_oAscTypeSelectElement.Hyperlink==r?(n.hyperProps?n.hyperProps.isSeveralLinks=!0:n.hyperProps={},n.hyperProps.value=l):Asc.c_oAscTypeSelectElement.Header==r?(n.headerProps={},n.headerProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.SpellCheck==r?(n.spellProps={},n.spellProps.value=l,i._currentSpellObj=l):Asc.c_oAscTypeSelectElement.Math==r&&(n.mathProps={},n.mathProps.value=l,i._currentMathObj=l)}return s?null:{menu_to_show:o,menu_props:n}}},a=function(t,e,n){if(i.api&&i.mode.isEdit){var a=s(i.api.getSelectedElements());a&&o(a.menu_to_show,a.menu_props,t)}},r=function(t){e.delay(function(){0==t.get_Type()?a.call(i,t):o.call(i,i.hdrMenu,{Header:t.is_Header(),PageNum:t.get_PageNum()},t)},10)},l=function(t){if(i.mode.isEdit&&i.currentMenu&&i.currentMenu.isVisible()&&i.currentMenu!==i.hdrMenu){var e=s(t);e&&e.menu_to_show===i.currentMenu&&(i.currentMenu.options.initMenu(e.menu_props),i.currentMenu.alignPosition())}},c=function(t){if(i.api){var n=e.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;e.isUndefined(n)&&(n=t.deltaY),!t.ctrlKey&&!t.metaKey||t.altKey||(n<0?i.api.zoomOut():n>0&&i.api.zoomIn(),t.preventDefault(),t.stopPropagation())}},d=function(e){if(i.api){var n=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(n===Common.UI.Keys.NUM_PLUS||n===Common.UI.Keys.EQUALITY||Common.Utils.isOpera&&43==n)return i.api.zoomIn(),e.preventDefault(),e.stopPropagation(),!1;if(n===Common.UI.Keys.NUM_MINUS||n===Common.UI.Keys.MINUS||Common.Utils.isOpera&&45==n)return i.api.zoomOut(),e.preventDefault(),e.stopPropagation(),!1}i.currentMenu&&i.currentMenu.isVisible()&&(n!=Common.UI.Keys.UP&&n!=Common.UI.Keys.DOWN||t("ul.dropdown-menu",i.currentMenu.el).focus()),n==Common.UI.Keys.ESC&&(Common.UI.Menu.Manager.hideAll(),Common.NotificationCenter.trigger("leftmenu:change","hide"))}},h=function(e){i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()},p=function(e){var n=i.cmpEl;if(n){n.on("contextmenu",function(t){return t.preventDefault(),t.stopPropagation(),!1}),n.on("click",function(t){"canvas"==t.target.localName&&n.focus()}),n.on("mousedown",function(t){"canvas"==t.target.localName&&Common.UI.Menu.Manager.hideAll()});var o=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(i.el,o,c)}t(document).on("mousewheel",c),t(document).on("keydown",d),t(window).on("resize",h),DE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",h)},m=function(t){if(n){var e=n.findUser(t);if(e)return e.get("username")}return i.guestText},u={toolTip:new Common.UI.Tooltip({owner:this,html:!0,title:"<br><b>Press Ctrl and click link</b>",cls:"link-tooltip"}),strTip:"",isHidden:!0,isVisible:!1},g=!0,b=function(t,e,n){!0===g&&(g=new Common.UI.Tooltip({owner:t.currentTarget,title:i.tipIsLocked}),g.show())},f=function(){if("object"==typeof g){g.hide(),g=void 0;for(var t=0;t<i.usertips.length;t++)i.usertips[t].off("mouseover",b),i.usertips[t].off("mouseout",C)}},C=function(t,e,i){"object"==typeof g&&g.$element&&t.currentTarget===g.$element[0]&&f()};Common.NotificationCenter.on({"window:show":function(t){u.toolTip.hide(),u.isVisible=!1,f()},"modal:show":function(t){i.hideTips()},"layout:changed":function(t){u.toolTip.hide(),u.isVisible=!1,f(),i.hideTips(),h()}});var v=function(t){t&&i.api.asc_getUrlType(t)>0&&window.open(t)},_=function(){u.isHidden=!0,i.usertips.length>0&&("object"==typeof g&&(g.hide(),g=!0),e.each(i.usertips,function(t){t.remove()})),i.usertips=[],i.usertipcount=0},y=null,w=!1,x=function(){u.isHidden&&u.isVisible&&(u.isVisible=!1,w=!0,u.toolTip.hide(function(){w=!1,y&&S(y),y=null}))},S=function(n){if(void 0===i._XY&&(i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()),n){var o,s,a=n.get_Type();if(1==a||3==a){if(w)return void(y=n);if(1==a){var r=n.get_Hyperlink();if(!r)return;s=e.isEmpty(r.get_ToolTip())?r.get_Value():r.get_ToolTip()}else s=n.get_FootnoteText(),s.length>1e3&&(s=s.substr(0,1e3)+"...");var l=!1;u.isHidden=!1,s=Common.Utils.String.htmlEncode(s),(u.tipType!==a||u.tipLength!==s.length||u.strTip.indexOf(s)<0)&&(u.toolTip.setTitle(1==a?s+"<br><b>"+i.txtPressLink+"</b>":s),u.tipLength=s.length,u.strTip=s,u.tipType=a,l=!0),o=[n.get_X(),n.get_Y()],o[1]+=i._XY[1]-15,o[0]+=i._XY[0]+5,u.isVisible&&!l||(u.isVisible=!0,u.toolTip.show([-1e4,-1e4])),l&&(u.tipHeight=u.toolTip.getBSTip().$tip.height(),u.tipWidth=u.toolTip.getBSTip().$tip.width()),l=!1,o[0]+u.tipWidth>i._BodyWidth&&(o[0]=i._BodyWidth-u.tipWidth,l=!0),o[1]-u.tipHeight<0?o[1]=l?o[1]+30:0:o[1]-=u.tipHeight,u.toolTip.getBSTip().$tip.css({top:o[1]+"px",left:o[0]+"px"})}else if(2==n.get_Type()&&i.mode.isEdit){var c;i.usertipcount>=i.usertips.length&&(c=t(document.createElement("div")),c.addClass("username-tip"),c.css({height:i._TtHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),t(document.body).append(c),g&&(c.on("mouseover",b),c.on("mouseout",C)),i.usertips.push(c)),c=i.usertips[i.usertipcount],i.usertipcount++,s=m(n.get_UserId()),o=[n.get_X()+i._XY[0],n.get_Y()+i._XY[1]],o[0]=i._BodyWidth-o[0],o[1]-=2==n.get_LockedObjectType()?i._TtHeight:0,o[1]>i._XY[1]&&o[1]+i._TtHeight<i._XY[1]+i._Height?(c.text(s),c.css({visibility:"visible",top:o[1]+"px",right:o[0]+"px"})):c.css({visibility:"hidden"})}}},A=function(e,n,o,s){for(var a,r=0;r<i.fastcoauthtips.length;r++)if(i.fastcoauthtips[r].attr("userid")==e){a=i.fastcoauthtips[r];break}a||(a=t(document.createElement("div")),a.addClass("username-tip"),a.attr("userid",e),a.css({height:i._TtHeight+"px",position:"absolute",zIndex:"900",display:"none","pointer-events":"none","background-color":"#"+Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}),a.text(m(e)),t("#id_main_view").append(a),i.fastcoauthtips.push(a),a.fadeIn(150)),a.css({top:o-i._TtHeight+"px",left:n+"px"})},T=function(t){for(var e=0;e<i.fastcoauthtips.length;e++)if(i.fastcoauthtips[e].attr("userid")==t){var n=i.fastcoauthtips[e];i.fastcoauthtips[e].fadeOut(150,function(){n.remove()}),i.fastcoauthtips.splice(e,1);break}},k=function(){var t,n,o;if(i.api&&i.mode.isEdit){var s=function(t,e){"ok"==e&&(n=t.getSettings(),!1!==o?i.api.add_Hyperlink(n):i.api.change_Hyperlink(n)),i.fireEvent("editcomplete",i)};if(!1!==(o=i.api.can_AddHyperlink()))t=new DE.Views.HyperlinkSettingsDialog({api:i.api,handler:s}),n=new Asc.CHyperlinkProperty,n.put_Text(o),t.show(),t.setSettings(n);else{var a=i.api.getSelectedElements();a&&e.isArray(a)&&e.each(a,function(t,e){a[e].get_ObjectType()==Asc.c_oAscTypeSelectElement.Hyperlink&&(n=a[e].get_ObjectValue())}),n&&(t=new DE.Views.HyperlinkSettingsDialog({api:i.api,handler:s}),t.show(),t.setSettings(n))}Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")}},I=function(t){if(i.mode.isEdit){var e=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");e&&t&&(e.setEditMode(!0),e.show(),e.setChartData(new Asc.asc_CChartBinary(t)))}},P=function(){i.mode.isEdit=!1},M=function(t){i._currLang.id=t};this.changeLanguageMenu=function(t){var e;if(null===i._currLang.id||void 0===i._currLang.id){for(e=0;e<t.items.length;e++)t.items[e].setChecked(!1);t.currentCheckedItem=void 0}else for(e=0;e<t.items.length;e++){if(t.items[e].options.langid===i._currLang.id){t.currentCheckedItem=t.items[e],t.items[e].checked||t.items[e].setChecked(!0);break}t.items[e].checked&&t.items[e].setChecked(!1)}};var B=function(){var t,n=i.api.getSelectedElements(!0);if(n&&e.isArray(n))for(var o=0;o<n.length;o++)if(n[o].get_ObjectType()==Asc.c_oAscTypeSelectElement.SpellCheck){t=n[o].get_ObjectValue(),i._currentSpellObj=t;break}t&&!1===t.get_Checked()&&null!==t.get_Variants()&&void 0!==t.get_Variants()&&(i.addWordVariants(),i.textMenu.isVisible()&&i.textMenu.alignPosition())};this.addWordVariants=function(t){e.isUndefined(t)&&(t=i.textMenu.isVisible()),i.clearWordVariants(t);var n=t?i.menuSpellMorePara:i.menuSpellMoreTable,o=t?i.menuSpellPara:i.menuSpellTable,s=[],a=[],r=i._currentSpellObj.get_Variants();r.length>0?(n.setVisible(r.length>3),n.setDisabled(i._currentParaObjDisabled),e.each(r,function(t,e){var n=new Common.UI.MenuItem({caption:t,spellword:!0,disabled:i._currentParaObjDisabled}).on("click",function(t,e){i.api&&(i.api.asc_replaceMisspelledWord(t.caption,i._currentSpellObj),i.fireEvent("editcomplete",i))});e<3?s.push(n):a.push(n)}),s.length>0&&(t?e.each(s,function(t){i.textMenu.insertItem(0,t)}):e.each(s,function(t){i.menuSpellCheckTable.menu.insertItem(0,t)})),a.length>0&&e.each(a,function(t){n.menu.insertItem(0,t)}),o.setVisible(!1)):(n.setVisible(!1),o.setVisible(!0),o.setCaption(i.noSpellVariantsText,!0))},this.clearWordVariants=function(t){for(var e=t?i.textMenu:i.menuSpellCheckTable.menu,n=0;n<e.items.length;n++)e.items[n].options.spellword&&(e.checkeditem==e.items[n]&&(e.checkeditem=void 0,e.activeItem=void 0),e.removeItem(e.items[n]),n--);t?i.menuSpellMorePara.menu.removeAll():i.menuSpellMoreTable.menu.removeAll(),i.menuSpellMorePara.menu.checkeditem=void 0,i.menuSpellMorePara.menu.activeItem=void 0,i.menuSpellMoreTable.menu.checkeditem=void 0,i.menuSpellMoreTable.menu.activeItem=void 0},this.initEquationMenu=function(){if(i._currentMathObj){var t,e=i._currentMathObj.get_Type(),n=i._currentMathObj,o=[];switch(e){case Asc.c_oAscMathInterfaceType.Accent:t=new Common.UI.MenuItem({caption:i.txtRemoveAccentChar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"remove_AccentCharacter"}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.BorderBox:t=new Common.UI.MenuItem({caption:i.txtBorderProps,equation:!0,disabled:i._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.get_HideTop()?i.txtAddTop:i.txtHideTop,equationProps:{type:e,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?i.txtAddBottom:i.txtHideBottom,equationProps:{type:e,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?i.txtAddLeft:i.txtHideLeft,equationProps:{type:e,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?i.txtAddRight:i.txtHideRight,equationProps:{type:e,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?i.txtAddHor:i.txtHideHor,equationProps:{type:e,callback:"put_HideHor",value:!n.get_HideHor()}},{
|
|
|
caption:n.get_HideVer()?i.txtAddVer:i.txtHideVer,equationProps:{type:e,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?i.txtAddLT:i.txtHideLT,equationProps:{type:e,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?i.txtAddLB:i.txtHideLB,equationProps:{type:e,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:i.txtRemoveBar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"remove_Bar"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?i.txtUnderbar:i.txtOverbar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();s==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:i.txtScriptsAfter,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtRemScripts,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)):(s==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:i.txtScriptsBefore,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:i.txtRemSubscript,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:i.txtRemSuperscript,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)));break;case Asc.c_oAscMathInterfaceType.Fraction:var a=n.get_FractionType();a!=Asc.c_oAscMathInterfaceFraction.Skewed&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:i.txtFractionStacked,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:i.txtFractionSkewed,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:i.txtFractionLinear,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?i.txtRemFractionBar:i.txtAddFractionBar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?i.txtLimitUnder:i.txtLimitOver,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtRemLimit,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,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()?i.txtShowPlaceholder:i.txtHidePlaceholder,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),o.push(t),t=new Common.UI.MenuItem({caption:i.insertText,equation:!0,disabled:i._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:i.insertRowAboveText,equationProps:{type:e,callback:"insert_MatrixRow",value:!0}},{caption:i.insertRowBelowText,equationProps:{type:e,callback:"insert_MatrixRow",value:!1}},{caption:i.insertColumnLeftText,equationProps:{type:e,callback:"insert_MatrixColumn",value:!0}},{caption:i.insertColumnRightText,equationProps:{type:e,callback:"insert_MatrixColumn",value:!1}}]})}),o.push(t),t=new Common.UI.MenuItem({caption:i.deleteText,equation:!0,disabled:i._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:i.deleteRowText,equationProps:{type:e,callback:"delete_MatrixRow"}},{caption:i.deleteColumnText,equationProps:{type:e,callback:"delete_MatrixColumn"}}]})}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtMatrixAlign,equation:!0,disabled:i._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:i.txtTop,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top,equationProps:{type:e,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:i.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:e,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:i.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:e,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtColumnAlign,equation:!0,disabled:i._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:i.leftText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left,equationProps:{type:e,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:i.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:e,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:i.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:e,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.EqArray:t=new Common.UI.MenuItem({caption:i.txtInsertEqBefore,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"insert_Equation",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtInsertEqAfter,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"insert_Equation",value:!1}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtDeleteEq,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"delete_Equation"}}),o.push(t),t=new Common.UI.MenuItem({caption:i.alignmentText,equation:!0,disabled:i._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:i.txtTop,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top,equationProps:{type:e,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:i.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:e,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:i.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:e,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new Common.UI.MenuItem({caption:i.txtLimitChange,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,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()?i.txtShowTopLimit:i.txtHideTopLimit,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideUpper",value:!n.get_HideUpper()}}),o.push(t)),void 0!==n.get_HideLower()&&(t=new Common.UI.MenuItem({caption:n.get_HideLower()?i.txtShowBottomLimit:i.txtHideBottomLimit,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideLower",value:!n.get_HideLower()}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new Common.UI.MenuItem({caption:i.txtInsertArgBefore,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"insert_DelimiterArgument",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtInsertArgAfter,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"insert_DelimiterArgument",value:!1}}),o.push(t),n.can_DeleteArgument()&&(t=new Common.UI.MenuItem({caption:i.txtDeleteArg,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"delete_DelimiterArgument"}}),o.push(t)),t=new Common.UI.MenuItem({caption:n.has_Separators()?i.txtDeleteCharsAndSeparators:i.txtDeleteChars,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"remove_DelimiterCharacters"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?i.txtShowOpenBracket:i.txtHideOpenBracket,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?i.txtShowCloseBracket:i.txtHideCloseBracket,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtStretchBrackets,equation:!0,disabled:i._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:e,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),o.push(t),t=new Common.UI.MenuItem({caption:i.txtMatchBrackets,equation:!0,disabled:!n.get_StretchBrackets()||i._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets()&&n.get_MatchBrackets(),equationProps:{type:e,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?i.txtGroupCharUnder:i.txtGroupCharOver,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,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:i.txtDeleteGroupChar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,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()?i.txtShowDegree:i.txtHideDegree,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideDegree",value:!n.get_HideDegree()}}),o.push(t)),t=new Common.UI.MenuItem({caption:i.txtDeleteRadical,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"remove_Radical"}}),o.push(t)}return n.can_IncreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:i.txtIncreaseArg,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"increase_ArgumentSize"}}),o.push(t)),n.can_DecreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:i.txtDecreaseArg,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"decrease_ArgumentSize"}}),o.push(t)),n.can_InsertManualBreak()&&(t=new Common.UI.MenuItem({caption:i.txtInsertBreak,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"insert_ManualBreak"}}),o.push(t)),n.can_DeleteManualBreak()&&(t=new Common.UI.MenuItem({caption:i.txtDeleteBreak,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"delete_ManualBreak"}}),o.push(t)),n.can_AlignToCharacter()&&(t=new Common.UI.MenuItem({caption:i.txtAlignToChar,equation:!0,disabled:i._currentParaObjDisabled,equationProps:{type:e,callback:"align_ToCharacter"}}),o.push(t)),o}},this.addEquationMenu=function(t,n){e.isUndefined(t)&&(t=i.textMenu.isVisible()),i.clearEquationMenu(t,n);var o=t?i.textMenu:i.tableMenu,s=i.initEquationMenu();return s.length>0&&e.each(s,function(t,s){t.menu?e.each(t.menu.items,function(t){t.on("click",e.bind(i.equationCallback,i,t.options.equationProps))}):t.on("click",e.bind(i.equationCallback,i,t.options.equationProps)),o.insertItem(n,t),n++}),s.length},this.clearEquationMenu=function(t,n){for(var o=t?i.textMenu:i.tableMenu,s=n;s<o.items.length&&o.items[s].options.equation;s++)o.items[s].menu?e.each(o.items[s].menu.items,function(t){t.off("click")}):o.items[s].off("click"),o.removeItem(o.items[s]),s--},this.equationCallback=function(t){if(t){var e;switch(t.type){case Asc.c_oAscMathInterfaceType.Accent:e=new CMathMenuAccent;break;case Asc.c_oAscMathInterfaceType.BorderBox:e=new CMathMenuBorderBox;break;case Asc.c_oAscMathInterfaceType.Box:e=new CMathMenuBox;break;case Asc.c_oAscMathInterfaceType.Bar:e=new CMathMenuBar;break;case Asc.c_oAscMathInterfaceType.Script:e=new CMathMenuScript;break;case Asc.c_oAscMathInterfaceType.Fraction:e=new CMathMenuFraction;break;case Asc.c_oAscMathInterfaceType.Limit:e=new CMathMenuLimit;break;case Asc.c_oAscMathInterfaceType.Matrix:e=new CMathMenuMatrix;break;case Asc.c_oAscMathInterfaceType.EqArray:e=new CMathMenuEqArray;break;case Asc.c_oAscMathInterfaceType.LargeOperator:e=new CMathMenuNary;break;case Asc.c_oAscMathInterfaceType.Delimiter:e=new CMathMenuDelimiter;break;case Asc.c_oAscMathInterfaceType.GroupChar:e=new CMathMenuGroupCharacter;break;case Asc.c_oAscMathInterfaceType.Radical:e=new CMathMenuRadical;break;case Asc.c_oAscMathInterfaceType.Common:e=new CMathMenuBase}e&&(e[t.callback](t.value),i.api.asc_SetMathProps(e))}i.fireEvent("editcomplete",i)},this.changePosition=function(){i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width(),_()},this.hideTips=function(){"object"==typeof g&&(g.hide(),g=!0),e.each(i.usertips,function(t){t.remove()}),i.usertips=[],i.usertipcount=0};var U={};U["alt+h"]=function(){!1!==i.api.can_AddQuotedComment()&&i.addComment()},Common.util.Shortcuts.delegateShortcuts({shortcuts:U}),this.setApi=function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onContextMenu",e.bind(r,this)),this.api.asc_registerCallback("asc_onMouseMoveStart",e.bind(_,this)),this.api.asc_registerCallback("asc_onMouseMoveEnd",e.bind(x,this)),this.api.asc_registerCallback("asc_onHyperlinkClick",e.bind(v,this)),this.api.asc_registerCallback("asc_onMouseMove",e.bind(S,this)),!0===this.mode.isEdit&&(this.api.asc_registerCallback("asc_onImgWrapStyleChanged",e.bind(this.onImgWrapStyleChanged,this)),this.api.asc_registerCallback("asc_onDialogAddHyperlink",k),this.api.asc_registerCallback("asc_doubleClickOnChart",I),this.api.asc_registerCallback("asc_onSpellCheckVariantsFound",e.bind(B,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",e.bind(P,this)),Common.NotificationCenter.on("api:disconnect",e.bind(P,this)),this.api.asc_registerCallback("asc_onTextLanguage",e.bind(M,this)),this.api.asc_registerCallback("asc_onParaStyleName",e.bind(this.onApiParagraphStyleChange,this)),this.api.asc_registerCallback("asc_onShowForeignCursorLabel",e.bind(A,this)),this.api.asc_registerCallback("asc_onHideForeignCursorLabel",e.bind(T,this)),this.api.asc_registerCallback("asc_onFocusObject",e.bind(l,this))),this},this.mode={},this.setMode=function(t){this.api&&t.isEdit&&(this.api.asc_registerCallback("asc_onImgWrapStyleChanged",e.bind(this.onImgWrapStyleChanged,this)),this.api.asc_registerCallback("asc_onDialogAddHyperlink",k),this.api.asc_registerCallback("asc_doubleClickOnChart",I),this.api.asc_registerCallback("asc_onSpellCheckVariantsFound",e.bind(B,this))),this.mode=t,this.mode.canCoAuthoring&&this.mode.isEdit&&this.mode.canComments?Common.util.Shortcuts.resumeEvents("alt+h"):Common.util.Shortcuts.suspendEvents("alt+h"),this.editorConfig={user:t.user}},i.on("render:after",p,i)},render:function(){return this.fireEvent("render:before",this),this.cmpEl=t(this.el),this.fireEvent("render:after",this),this},onImgWrapStyleChanged:function(t){switch(t){case Asc.c_oAscWrapStyle2.Inline:this.menuImageWrap.menu.items[0].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Square:this.menuImageWrap.menu.items[1].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Tight:this.menuImageWrap.menu.items[2].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Through:this.menuImageWrap.menu.items[3].setChecked(!0);break;case Asc.c_oAscWrapStyle2.TopAndBottom:this.menuImageWrap.menu.items[4].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Behind:this.menuImageWrap.menu.items[6].setChecked(!0);break;case Asc.c_oAscWrapStyle2.InFront:this.menuImageWrap.menu.items[5].setChecked(!0)}},onApiParagraphStyleChange:function(t){window.currentStyleName=t;var e=this.menuStyleUpdate;void 0!=e&&e.setCaption(this.updateStyleText.replace("%1",window.currentStyleName))},_applyTableWrap:function(t,i){var n=this.api.getSelectedElements();if(n&&e.isArray(n))for(var o=n.length-1;o>=0;o--){var s;if(s=n[o].get_ObjectType(),n[o].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==s){var a=new Asc.CTableProp;a.put_TableWrap(t),t==c_tableWrap.TABLE_WRAP_NONE&&(a.put_TableAlignment(i),a.put_TableIndent(0)),this.api.tblApply(a);break}}},advancedParagraphClick:function(t,i,n){var o,s=this;if(s.api){var a=s.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==l){o=new DE.Views.ParagraphSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,paragraphProps:c,borderProps:s.borderAdvancedProps,isChart:!0===t.isChart,api:s.api,handler:function(t,e){"ok"==t&&s.api&&(s.borderAdvancedProps=e.borderProps,s.api.paraApply(e.paragraphProps)),s.fireEvent("editcomplete",s)}});break}}}o&&o.show()},advancedFrameClick:function(t,i,n){var o,s=this;if(s.api){var a=s.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==l){o=new DE.Views.DropcapSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,paragraphProps:c,borderProps:s.borderAdvancedProps,api:s.api,isFrame:!0,handler:function(t,e){"ok"==t&&(s.borderAdvancedProps=e.borderProps,e.paragraphProps&&e.paragraphProps.get_Wrap()===c_oAscFrameWrap.None?s.api.removeDropcap(!1):s.api.put_FramePr(e.paragraphProps)),s.fireEvent("editcomplete",s)}});break}}}o&&o.show()},editHyperlink:function(t,e,i){var n,o=this;o.api&&(n=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:function(t,e){"ok"==e&&o.api.change_Hyperlink(n.getSettings()),o.fireEvent("editcomplete",o)}}),n.show(),n.setSettings(t.hyperProps.value))},onMenuSaveStyle:function(t,e,i){var n=this;n.api&&Common.NotificationCenter.trigger("style:commitsave",n.api.asc_GetStyleFromFormatting())},onMenuUpdateStyle:function(t,e,i){var n=this;n.api&&Common.NotificationCenter.trigger("style:commitchange",n.api.asc_GetStyleFromFormatting())},addComment:function(t,e,i){if(this.api&&this.mode.canCoAuthoring&&this.mode.isEdit&&this.mode.canComments){this.suppressEditComplete=!0;var n=DE.getController("Common.Controllers.Comments");n&&n.addDummyComment()}},addHyperlink:function(t,e,i){var n,o=this;o.api&&(n=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:function(t,e){"ok"==e&&o.api.add_Hyperlink(t.getSettings()),o.fireEvent("editcomplete",o)}}),n.show(),n.setSettings(t.hyperProps.value),Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink"))},editChartClick:function(){var t=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(t){t.setEditMode(!0),t.show();var e=this.api.asc_getChartObject();e&&t.setChartData(new Asc.asc_CChartBinary(e))}},updateThemeColors:function(){this.effectcolors=Common.Utils.ThemeColor.getEffectColors(),this.standartcolors=Common.Utils.ThemeColor.getStandartColors()},onCutCopyPaste:function(t,e){var i=this;if(i.api){if(!("cut"==t.value?i.api.Cut():"copy"==t.value?i.api.Copy():i.api.Paste())){var n=Common.localStorage.getItem("de-hide-copywarning");n&&1==parseInt(n)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("de-hide-copywarning",1),i.fireEvent("editcomplete",i)}}).show()}}i.fireEvent("editcomplete",i)},createDelayedElements:function(){var i=this,n=new Common.UI.MenuItem({caption:i.textAlign,menu:function(){function t(t,n){if(i.api){var o=new Asc.asc_CImgProperty;e.isUndefined(t.options.halign)?(o.put_PositionV(new Asc.CImagePositionV),o.get_PositionV().put_UseAlign(!0),o.get_PositionV().put_Align(t.options.valign),o.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Margin)):(o.put_PositionH(new Asc.CImagePositionH),o.get_PositionH().put_UseAlign(!0),o.get_PositionH().put_Align(t.options.halign),o.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Margin)),i.api.ImgApply(o)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textShapeAlignLeft,iconCls:"mnu-img-align-left",halign:Asc.c_oAscAlignH.Left}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignCenter,iconCls:"mnu-img-align-center",halign:Asc.c_oAscAlignH.Center}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignRight,iconCls:"mnu-img-align-right",halign:Asc.c_oAscAlignH.Right}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignTop,iconCls:"mnu-img-align-top",valign:Asc.c_oAscAlignV.Top}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignMiddle,iconCls:"mnu-img-align-middle",valign:Asc.c_oAscAlignV.Center}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignBottom,iconCls:"mnu-img-align-bottom",valign:Asc.c_oAscAlignV.Bottom}).on("click",t)]})}()}),o=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"mnu-arrange-group"}).on("click",function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Group(1),i.api.ImgApply(n)}i.fireEvent("editcomplete",this)}),s=new Common.UI.MenuItem({iconCls:"mnu-arrange-ungroup",caption:this.txtUngroup}).on("click",function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Group(-1),i.api.ImgApply(n)}i.fireEvent("editcomplete",this)}),a=new Common.UI.MenuItem({caption:i.textArrange,menu:function(){function t(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_ChangeLevel(t.options.valign),i.api.ImgApply(n)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textArrangeFront,iconCls:"mnu-arrange-front",valign:Asc.c_oAscChangeLevel.BringToFront}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeBack,iconCls:"mnu-arrange-back",valign:Asc.c_oAscChangeLevel.SendToBack}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeForward,iconCls:"mnu-arrange-forward",valign:Asc.c_oAscChangeLevel.BringForward}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeBackward,iconCls:"mnu-arrange-backward",valign:Asc.c_oAscChangeLevel.BringBackward}).on("click",t),{caption:"--"},o,s]})}()}),r=new Common.UI.MenuItem({caption:i.textEditWrapBoundary,cls:"no-icon-wrap-item"}).on("click",function(t,e){i.api&&i.api.StartChangeWrapPolygon(),i.fireEvent("editcomplete",i)});this.menuImageWrap=new Common.UI.MenuItem({caption:i.textWrap,menu:function(){function t(t,e){if(i.api){var n=new Asc.asc_CImgProperty;if(n.put_WrappingStyle(t.options.wrapType),i.menuImageWrap._originalProps.get_WrappingStyle()===Asc.c_oAscWrapStyle2.Inline&&t.wrapType!==Asc.c_oAscWrapStyle2.Inline){n.put_PositionH(new Asc.CImagePositionH),n.get_PositionH().put_UseAlign(!1),n.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var o=i.menuImageWrap._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);n.get_PositionH().put_Value(o),n.put_PositionV(new Asc.CImagePositionV),n.get_PositionV().put_UseAlign(!1),n.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),o=i.menuImageWrap._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),n.get_PositionV().put_Value(o)}i.api.ImgApply(n)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.txtInline,iconCls:"mnu-wrap-inline",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Inline,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtSquare,iconCls:"mnu-wrap-square",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Square,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtTight,iconCls:"mnu-wrap-tight",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Tight,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtThrough,iconCls:"mnu-wrap-through",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Through,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtTopAndBottom,iconCls:"mnu-wrap-topAndBottom",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.TopAndBottom,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtInFront,iconCls:"mnu-wrap-inFront",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.InFront,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtBehind,iconCls:"mnu-wrap-behind",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Behind,checkable:!0}).on("click",t),{caption:"--"},r]})}()});var l=new Common.UI.MenuItem({caption:i.advancedText}).on("click",function(t,n){var o,s;if(i.api){var a=i.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--)if(o=a[r].get_ObjectType(),s=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==o){var l;s.get_ChartProperties()||s.get_ShapeProperties()||i.menuOriginalSize.isDisabled()||!i.menuOriginalSize.isVisible()||(l=i.api.get_OriginalSizeImage())&&(l={width:l.get_ImageWidth(),height:l.get_ImageHeight()});var c=i.api.GetSectionInfo();c={width:c.get_PageWidth()-(c.get_MarginLeft()+c.get_MarginRight()),height:c.get_PageHeight()-(c.get_MarginTop()+c.get_MarginBottom())};var d=new DE.Views.ImageSettingsAdvanced({imageProps:s,sizeOriginal:l,sizeMax:c,sectionProps:i.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&i.api&&i.api.ImgApply(e.imageProps),i.fireEvent("editcomplete",i)}});d.show(),d.btnOriginalSize.setVisible(i.menuOriginalSize.isVisible());break}}}),c=new Common.UI.MenuItem({caption:i.editChartText}).on("click",e.bind(i.editChartClick,i));this.menuOriginalSize=new Common.UI.MenuItem({caption:i.originalSizeText}).on("click",function(t,e){if(i.api){var n=i.api.get_OriginalSizeImage(),o=new Asc.asc_CImgProperty;o.put_Width(n.get_ImageWidth()),o.put_Height(n.get_ImageHeight()),i.api.ImgApply(o),i.fireEvent("editcomplete",this)}});var d=new Common.UI.MenuItem({caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),h=new Common.UI.MenuItem({caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),p=new Common.UI.MenuItem({caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i));this.pictureMenu=new Common.UI.Menu({initMenu:function(t){if(!e.isUndefined(t.imgProps)){var m=!t.imgProps.value.get_CanBeFlow(),u=t.imgProps.value.get_WrappingStyle();if(i.menuImageWrap._originalProps=t.imgProps.value,m)for(var g=0;g<6;g++)i.menuImageWrap.menu.items[g].setChecked(!1);else switch(u){case Asc.c_oAscWrapStyle2.Inline:i.menuImageWrap.menu.items[0].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Square:i.menuImageWrap.menu.items[1].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Tight:i.menuImageWrap.menu.items[2].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Through:i.menuImageWrap.menu.items[3].setChecked(!0);break;case Asc.c_oAscWrapStyle2.TopAndBottom:i.menuImageWrap.menu.items[4].setChecked(!0);break;case Asc.c_oAscWrapStyle2.Behind:i.menuImageWrap.menu.items[6].setChecked(!0);break;case Asc.c_oAscWrapStyle2.InFront:i.menuImageWrap.menu.items[5].setChecked(!0);break;default:for(var g=0;g<6;g++)i.menuImageWrap.menu.items[g].setChecked(!1)}e.each(i.menuImageWrap.menu.items,function(t){t.setDisabled(m)});var b=t.imgProps.isImg&&t.imgProps.isChart||t.imgProps.isImg&&t.imgProps.isShape||t.imgProps.isShape&&t.imgProps.isChart;b?l.setCaption(i.advancedText,!0):l.setCaption(t.imgProps.isImg?i.imageText:t.imgProps.isChart?i.chartText:i.shapeText,!0),c.setVisible(!e.isNull(t.imgProps.value.get_ChartProperties())&&!b),i.menuOriginalSize.setVisible(e.isNull(t.imgProps.value.get_ChartProperties())&&e.isNull(t.imgProps.value.get_ShapeProperties())&&!b),i.pictureMenu.items[7].setVisible(c.isVisible()||i.menuOriginalSize.isVisible());var f=t.imgProps.locked||void 0!==t.headerProps&&t.headerProps.locked;c.isVisible()&&c.setDisabled(f||t.imgProps.value.get_SeveralCharts()),i.menuOriginalSize.setDisabled(f||null===t.imgProps.value.get_ImageUrl()||void 0===t.imgProps.value.get_ImageUrl()),l.setDisabled(f),n.setDisabled(f||u==Asc.c_oAscWrapStyle2.Inline),a.setDisabled(u==Asc.c_oAscWrapStyle2.Inline),i.api&&(s.setDisabled(f||!i.api.CanUnGroup()),o.setDisabled(f||!i.api.CanGroup()),r.setDisabled(f||!i.api.CanChangeWrapPolygon())),i.menuImageWrap.setDisabled(f||t.imgProps.value.get_FromGroup()||m&&r.isDisabled());var C=i.api&&i.api.can_CopyCut();d.setDisabled(!C),p.setDisabled(f||!C),h.setDisabled(f)}},items:[p,d,h,{caption:"--"},a,n,i.menuImageWrap,{caption:"--"},i.menuOriginalSize,c,{caption:"--"},l]}).on("hide:after",function(t,e,n){n||i.fireEvent("editcomplete",i),i.currentMenu=null});var m=function(t,e){i._applyTableWrap(c_tableWrap.TABLE_WRAP_NONE,t.options.align)},u=new Common.UI.MenuItem({caption:i.inlineText,toggleGroup:"popuptablewrapping",checkable:!0,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuTableAlignLeft=new Common.UI.MenuItem({caption:i.textShapeAlignLeft,toggleGroup:"popuptablealign",checkable:!0,checked:!1,align:c_tableAlign.TABLE_ALIGN_LEFT}).on("click",e.bind(m,i)),i.menuTableAlignCenter=new Common.UI.MenuItem({caption:i.textShapeAlignCenter,toggleGroup:"popuptablealign",checkable:!0,checked:!1,align:c_tableAlign.TABLE_ALIGN_CENTER}).on("click",e.bind(m,i)),i.menuTableAlignRight=new Common.UI.MenuItem({caption:i.textShapeAlignRight,toggleGroup:"popuptablealign",checkable:!0,checked:!1,align:c_tableAlign.TABLE_ALIGN_RIGHT}).on("click",e.bind(m,i))]})}),g=new Common.UI.MenuItem({caption:i.flowoverText,toggleGroup:"popuptablewrapping",checkable:!0,checked:!0}).on("click",function(t){i._applyTableWrap(c_tableWrap.TABLE_WRAP_PARALLEL)}),b=new Common.UI.MenuItem({caption:i.mergeCellsText}).on("click",function(t){i.api&&i.api.MergeCells()
|
|
|
}),f=new Common.UI.MenuItem({caption:i.splitCellsText}).on("click",function(t){i.api&&new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&(i.api&&i.api.SplitCell(e.columns,e.rows),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Table"))}}).show()}),C=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsVAlign(t.options.valign),i.api.tblApply(n)}},v=new Common.UI.MenuItem({caption:i.cellAlignText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuTableCellTop=new Common.UI.MenuItem({caption:i.topCellText,toggleGroup:"popuptablecellalign",checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Top}).on("click",e.bind(C,i)),i.menuTableCellCenter=new Common.UI.MenuItem({caption:i.centerCellText,toggleGroup:"popuptablecellalign",checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Center}).on("click",e.bind(C,i)),i.menuTableCellBottom=new Common.UI.MenuItem({caption:i.bottomCellText,toggleGroup:"popuptablecellalign",checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Bottom}).on("click",e.bind(C,i))]})}),_=new Common.UI.MenuItem({caption:i.advancedTableText}).on("click",function(t,n,o){var s;if(i.api){var a=i.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==l){s=new DE.Views.TableSettingsAdvanced({tableStylerRows:null===c.get_CellBorders().get_InsideH()&&1==c.get_CellSelect()?1:2,tableStylerColumns:null===c.get_CellBorders().get_InsideV()&&1==c.get_CellSelect()?1:2,tableProps:c,borderProps:i.borderAdvancedProps,sectionProps:i.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&i.api&&(i.borderAdvancedProps=e.borderProps,i.api.tblApply(e.tableProps)),i.fireEvent("editcomplete",i)}});break}}}s&&s.show()}),y=new Common.UI.MenuItem({caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),w=new Common.UI.MenuItem({caption:"--"}),x=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),S=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api&&i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i)}),A=new Common.UI.MenuItem({caption:i.hyperlinkText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[x,S]})}),T=new Common.UI.MenuItem({caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),k=new Common.UI.MenuItem({caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i));i.menuSpellTable=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMoreTable=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[]})}),i.langTableMenu=new Common.UI.MenuItem({caption:i.langText,menu:new Common.UI.Menu({menuAlign:"tl-tr",maxHeight:300,items:[]}).on("show:after",function(t){})});var I=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i))}),P=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i))}),M=new Common.UI.MenuItem({caption:"--"}),B=new Common.UI.MenuItem({caption:"--"});i.menuSpellCheckTable=new Common.UI.MenuItem({caption:i.spellcheckText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuSpellTable,i.menuSpellMoreTable,M,I,P,{caption:"--"},i.langTableMenu]})});var U=new Common.UI.MenuItem({caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),E=new Common.UI.MenuItem({caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),V=new Common.UI.MenuItem({caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),D=new Common.UI.MenuItem({caption:"--"}),R=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsTextDirection(t.options.direction),i.api.tblApply(n)}},F=new Common.UI.MenuItem({caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar",menuAlign:"tl-tr",items:[i.menuTableDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"mnu-direct-horiz",checkable:!0,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.LRTB}).on("click",e.bind(R,i)),i.menuTableDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"mnu-direct-rdown",checkable:!0,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.TBRL}).on("click",e.bind(R,i)),i.menuTableDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"mnu-direct-rup",checkable:!0,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.BTLR}).on("click",e.bind(R,i))]})});this.tableMenu=new Common.UI.Menu({initMenu:function(t){if(!e.isUndefined(t.tableProps)){for(var n=t.mathProps&&t.mathProps.value,o=7;o<22;o++)i.tableMenu.items[o].setVisible(!n);var s=t.tableProps.value.get_CellsVAlign();i.menuTableCellTop.setChecked(s==Asc.c_oAscVertAlignJc.Top),i.menuTableCellCenter.setChecked(s==Asc.c_oAscVertAlignJc.Center),i.menuTableCellBottom.setChecked(s==Asc.c_oAscVertAlignJc.Bottom);var a=t.tableProps.value.get_TableWrap()==c_tableWrap.TABLE_WRAP_PARALLEL;a?g.setChecked(!0):u.setChecked(!0),s=t.tableProps.value.get_TableAlignment(),i.menuTableAlignLeft.setChecked(!a&&s===c_tableAlign.TABLE_ALIGN_LEFT),i.menuTableAlignCenter.setChecked(!a&&s===c_tableAlign.TABLE_ALIGN_CENTER),i.menuTableAlignRight.setChecked(!a&&s===c_tableAlign.TABLE_ALIGN_RIGHT);var r=t.tableProps.value.get_CellsTextDirection();i.menuTableDirectH.setChecked(r==Asc.c_oAscCellTextDirection.LRTB),i.menuTableDirect90.setChecked(r==Asc.c_oAscCellTextDirection.TBRL),i.menuTableDirect270.setChecked(r==Asc.c_oAscCellTextDirection.BTLR);var l=t.tableProps.locked||void 0!==t.headerProps&&t.headerProps.locked;i.tableMenu.items[8].setDisabled(l),i.tableMenu.items[9].setDisabled(l),i.api&&(b.setDisabled(l||!i.api.CheckBeforeMergeCells()),f.setDisabled(l||!i.api.CheckBeforeSplitCells())),v.setDisabled(l),F.setDisabled(l),u.setDisabled(l),g.setDisabled(l||!t.tableProps.value.get_CanBeFlow()),_.setDisabled(l);var c=i.api&&i.api.can_CopyCut();U.setDisabled(!c),V.setDisabled(l||!c),E.setDisabled(l);var d=null;i.api&&(d=i.api.can_AddHyperlink()),k.setVisible(void 0===t.hyperProps&&!1!==d),A.setVisible(void 0!==t.hyperProps),w.setVisible(k.isVisible()||A.isVisible()),x.hyperProps=t.hyperProps,!1!==d&&(k.hyperProps={},k.hyperProps.value=new Asc.CHyperlinkProperty,k.hyperProps.value.put_Text(d)),T.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),T.setDisabled(void 0!==t.paraProps&&!0===t.paraProps.locked),y.setVisible(void 0!==t.paraProps),i._currentParaObjDisabled=l=t.paraProps.locked||void 0!==t.headerProps&&t.headerProps.locked,k.setDisabled(l),A.setDisabled(l||void 0!==t.hyperProps&&!0===t.hyperProps.isSeveralLinks),y.setDisabled(l),i.menuSpellCheckTable.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),B.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langTableMenu.setDisabled(l),void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!1):(i.menuSpellTable.setCaption(i.loadSpellText,!0),i.clearWordVariants(!1),i.menuSpellMoreTable.setVisible(!1)),i.menuSpellCheckTable.isVisible()&&i._currLang.id!==i._currLang.tableid&&(i.changeLanguageMenu(i.langTableMenu.menu),i._currLang.tableid=i._currLang.id);var h=0;n?h=i.addEquationMenu(!1,6):i.clearEquationMenu(!1,6),D.setVisible(n&&h>0)}},items:[i.menuSpellCheckTable,B,V,U,E,{caption:"--"},D,{caption:i.selectText,menu:new Common.UI.Menu({menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(t){i.api&&i.api.selectRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(t){i.api&&i.api.selectColumn()}),new Common.UI.MenuItem({caption:i.cellText}).on("click",function(t){i.api&&i.api.selectCell()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(t){i.api&&i.api.selectTable()})]})},{caption:i.insertText,menu:new Common.UI.Menu({menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.insertColumnLeftText}).on("click",function(t){i.api&&i.api.addColumnLeft()}),new Common.UI.MenuItem({caption:i.insertColumnRightText}).on("click",function(t){i.api&&i.api.addColumnRight()}),new Common.UI.MenuItem({caption:i.insertRowAboveText}).on("click",function(t){i.api&&i.api.addRowAbove()}),new Common.UI.MenuItem({caption:i.insertRowBelowText}).on("click",function(t){i.api&&i.api.addRowBelow()})]})},{caption:i.deleteText,menu:new Common.UI.Menu({menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(t){i.api&&i.api.remRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(t){i.api&&i.api.remColumn()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(t){i.api&&i.api.remTable()})]})},{caption:"--"},b,f,{caption:"--"},v,F,{caption:"--"},u,g,{caption:"--"},_,{caption:"--"},T,k,A,w,y]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var L=new Common.UI.MenuItem({caption:i.breakBeforeText,checkable:!0}).on("click",function(t,e){i.api.put_PageBreak(t.checked)}),H=new Common.UI.MenuItem({caption:i.keepLinesText,checkable:!0}).on("click",function(t,e){i.api.put_KeepLines(t.checked)}),N=function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_VerticalTextAlign(t.options.valign),i.api.ImgApply(n)}},O=new Common.UI.MenuItem({caption:i.vertAlignText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuParagraphTop=new Common.UI.MenuItem({caption:i.topCellText,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Top}).on("click",e.bind(N,i)),i.menuParagraphCenter=new Common.UI.MenuItem({caption:i.centerCellText,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Center}).on("click",e.bind(N,i)),i.menuParagraphBottom=new Common.UI.MenuItem({caption:i.bottomCellText,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Bottom}).on("click",e.bind(N,i))]})}),z=function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Vert(t.options.direction),i.api.ImgApply(n)}},$=new Common.UI.MenuItem({caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar",menuAlign:"tl-tr",items:[i.menuParagraphDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"mnu-direct-horiz",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}).on("click",e.bind(z,i)),i.menuParagraphDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"mnu-direct-rdown",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}).on("click",e.bind(z,i)),i.menuParagraphDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"mnu-direct-rup",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270}).on("click",e.bind(z,i))]})}),W=new Common.UI.MenuItem({caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),G=new Common.UI.MenuItem({caption:i.advancedFrameText}).on("click",e.bind(i.advancedFrameClick,i)),j=new Common.UI.MenuItem({caption:"--"}),q=new Common.UI.MenuItem({caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),K=new Common.UI.MenuItem({caption:"--"}),Y=new Common.UI.MenuItem({caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),X=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),J=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i)}),Z=new Common.UI.MenuItem({caption:i.hyperlinkText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[X,J]})}),Q=new Common.UI.MenuItemSeparator,tt=new Common.UI.MenuItem({caption:i.styleText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[i.menuStyleSave=new Common.UI.MenuItem({caption:i.saveStyleText}).on("click",e.bind(i.onMenuSaveStyle,i)),i.menuStyleUpdate=new Common.UI.MenuItem({caption:i.updateStyleText.replace("%1",window.currentStyleName)}).on("click",e.bind(i.onMenuUpdateStyle,i))]})});i.menuSpellPara=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMorePara=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({menuAlign:"tl-tr",style:"max-height: 300px;",items:[]})}),i.langParaMenu=new Common.UI.MenuItem({caption:i.langText,menu:new Common.UI.Menu({menuAlign:"tl-tr",maxHeight:300,items:[]}).on("show:after",function(t){})});var et=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i)}),it=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i)}),nt=new Common.UI.MenuItem({caption:"--"}),ot=new Common.UI.MenuItem({caption:"--"}),st=new Common.UI.MenuItem({caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),at=new Common.UI.MenuItem({caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),rt=new Common.UI.MenuItem({caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),lt=new Common.UI.MenuItem({caption:"--"});this.textMenu=new Common.UI.Menu({initMenu:function(t){var n=t.imgProps&&t.imgProps.value&&!e.isNull(t.imgProps.value.get_ShapeProperties()),o=t.imgProps&&t.imgProps.value&&!e.isNull(t.imgProps.value.get_ChartProperties()),s=t.mathProps&&t.mathProps.value;if(O.setVisible(n&&!o&&!s),$.setVisible(n&&!o&&!s),n||o){var a=t.imgProps.value.get_VerticalTextAlign();i.menuParagraphTop.setChecked(a==Asc.c_oAscVAlign.Top),i.menuParagraphCenter.setChecked(a==Asc.c_oAscVAlign.Center),i.menuParagraphBottom.setChecked(a==Asc.c_oAscVAlign.Bottom);var r=t.imgProps.value.get_Vert();i.menuParagraphDirectH.setChecked(r==Asc.c_oAscVertDrawingText.normal),i.menuParagraphDirect90.setChecked(r==Asc.c_oAscVertDrawingText.vert),i.menuParagraphDirect270.setChecked(r==Asc.c_oAscVertDrawingText.vert270)}W.isChart=t.imgProps&&t.imgProps.isChart,L.setVisible(!n&&!o&&!s),H.setVisible(!n&&!o&&!s),t.paraProps&&(L.setChecked(t.paraProps.value.get_PageBreakBefore()),H.setChecked(t.paraProps.value.get_KeepLines()));var l=null;i.api&&(l=i.api.can_AddHyperlink()),j.setVisible(!o&&!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),q.setVisible(!o&&!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),q.setDisabled(t.paraProps&&!0===t.paraProps.locked),Y.setVisible(void 0===t.hyperProps&&!1!==l),Z.setVisible(void 0!==t.hyperProps),K.setVisible(Y.isVisible()||Z.isVisible()),X.hyperProps=t.hyperProps,!1!==l&&(Y.hyperProps={},Y.hyperProps.value=new Asc.CHyperlinkProperty,Y.hyperProps.value.put_Text(l));var c=t.paraProps.locked||void 0!==t.headerProps&&t.headerProps.locked;i._currentParaObjDisabled=c,Y.setDisabled(c),Z.setDisabled(c||void 0!==t.hyperProps&&!0===t.hyperProps.isSeveralLinks),L.setDisabled(c||!e.isUndefined(t.headerProps)||!e.isUndefined(t.imgProps)),H.setDisabled(c),W.setDisabled(c),G.setDisabled(c),O.setDisabled(c),$.setDisabled(c);var d=i.api&&i.api.can_CopyCut();st.setDisabled(!d),rt.setDisabled(c||!d),at.setDisabled(c),i.menuSpellPara.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),ot.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),et.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),it.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langParaMenu.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langParaMenu.setDisabled(c),nt.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!0):(i.menuSpellPara.setCaption(i.loadSpellText,!0),i.clearWordVariants(!0),i.menuSpellMorePara.setVisible(!1)),i.langParaMenu.isVisible()&&i._currLang.id!==i._currLang.paraid&&(i.changeLanguageMenu(i.langParaMenu.menu),i._currLang.paraid=i._currLang.id);var h=0;s?h=i.addEquationMenu(!0,11):i.clearEquationMenu(!0,11),lt.setVisible(s&&h>0),G.setVisible(void 0!==t.paraProps.value.get_FramePr()),Q.setVisible(i.mode.canEditStyles&&!o),tt.setVisible(i.mode.canEditStyles&&!o)},items:[i.menuSpellPara,i.menuSpellMorePara,ot,et,it,i.langParaMenu,nt,rt,st,at,{caption:"--"},lt,L,H,O,$,W,G,j,q,K,Y,Z,Q,tt]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var ct=new Common.UI.MenuItem({caption:i.editHeaderText});this.hdrMenu=new Common.UI.Menu({initMenu:function(t){ct.setCaption(t.Header?i.editHeaderText:i.editFooterText,!0),ct.off("click").on("click",function(e){i.api&&(t.Header?i.api.GoToHeader(t.PageNum):i.api.GoToFooter(t.PageNum),i.fireEvent("editcomplete",i))})},items:[ct]}).on("hide:after",function(t,e,n){n||i.fireEvent("editcomplete",i),i.currentMenu=null});var dt=t("#id_buttonNextPage");dt.attr("data-toggle","tooltip"),dt.tooltip({title:i.textNextPage+Common.Utils.String.platformKey("Alt+PgDn"),placement:"top-right"});var ht=t("#id_buttonPrevPage");ht.attr("data-toggle","tooltip"),ht.tooltip({title:i.textPrevPage+Common.Utils.String.platformKey("Alt+PgUp"),placement:"top-right"})},setLanguages:function(t){var i=this;t&&t.length>0&&(e.each(t,function(t,n){i.langParaMenu.menu.addItem(new Common.UI.MenuItem({caption:t.title,checkable:!0,toggleGroup:"popupparalang",langid:t.code}).on("click",function(t,n){i.api&&(e.isUndefined(t.options.langid)||i.api.put_TextPrLang(t.options.langid),i._currLang.paraid=t.options.langid,i.langParaMenu.menu.currentCheckedItem=t,i.fireEvent("editcomplete",i))})),i.langTableMenu.menu.addItem(new Common.UI.MenuItem({caption:t.title,checkable:!0,toggleGroup:"popuptablelang",langid:t.code}).on("click",function(t,n){i.api&&(e.isUndefined(t.options.langid)||i.api.put_TextPrLang(t.options.langid),i._currLang.tableid=t.options.langid,i.langTableMenu.menu.currentCheckedItem=t,i.fireEvent("editcomplete",i))}))}),i.langTableMenu.menu.doLayout(),i.langParaMenu.menu.doLayout())},focus:function(){var t=this;e.defer(function(){t.cmpEl.focus()},50)},alignmentText:"Alignment",leftText:"Left",rightText:"Right",centerText:"Center",selectRowText:"Select Row",selectColumnText:"Select Column",selectCellText:"Select Cell",selectTableText:"Select Table",insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteText:"Delete",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",mergeCellsText:"Merge Cells",splitCellsText:"Split Cell...",splitCellTitleText:"Split Cell",flowoverText:"Wrapping Style - Flow",inlineText:"Wrapping Style - Inline",originalSizeText:"Default Size",advancedText:"Advanced Settings",breakBeforeText:"Page break before",keepLinesText:"Keep lines together",editHeaderText:"Edit header",editFooterText:"Edit footer",hyperlinkText:"Hyperlink",editHyperlinkText:"Edit Hyperlink",removeHyperlinkText:"Remove Hyperlink",styleText:"Formatting as Style",saveStyleText:"Create new style",updateStyleText:"Update %1 style",txtPressLink:"Press CTRL and click link",selectText:"Select",insertRowText:"Insert Row",insertColumnText:"Insert Column",rowText:"Row",columnText:"Column",cellText:"Cell",tableText:"Table",aboveText:"Above",belowText:"Below",advancedTableText:"Table Advanced Settings",advancedParagraphText:"Paragraph Advanced Settings",paragraphText:"Paragraph",guestText:"Guest",editChartText:"Edit Data",addCommentText:"Add Comment",topCellText:"Align Top",centerCellText:"Align Center",bottomCellText:"Align Bottom",cellAlignText:"Cell Vertical Alignment",txtInline:"Inline",txtSquare:"Square",txtTight:"Tight",txtThrough:"Through",txtTopAndBottom:"Top and bottom",txtBehind:"Behind",txtInFront:"In front",textWrap:"Wrapping Style",textAlign:"Align",textArrange:"Arrange",textShapeAlignLeft:"Align Left",textShapeAlignRight:"Align Right",textShapeAlignCenter:"Align Center",textShapeAlignTop:"Align Top",textShapeAlignBottom:"Align Bottom",textShapeAlignMiddle:"Align Middle",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtGroup:"Group",txtUngroup:"Ungroup",textEditWrapBoundary:"Edit Wrap Boundary",vertAlignText:"Vertical Alignment",loadSpellText:"Loading variants...",ignoreAllSpellText:"Ignore All",ignoreSpellText:"Ignore",noSpellVariantsText:"No variants",moreText:"More variants...",spellcheckText:"Spellcheck",langText:"Select Language",advancedFrameText:"Frame Advanced Settings",tipIsLocked:"This element is being edited by another user.",textNextPage:"Next Page",textPrevPage:"Previous Page",imageText:"Image Advanced Settings",shapeText:"Shape Advanced Settings",chartText:"Chart Advanced Settings",insertText:"Insert",textCopy:"Copy",textPaste:"Paste",textCut:"Cut",directionText:"Text Direction",directHText:"Horizontal",direct90Text:"Rotate at 90°",direct270Text:"Rotate at 270°",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"},DE.Views.DocumentHolder||{}))});var c_paragraphLinerule={LINERULE_LEAST:0,LINERULE_AUTO:1,LINERULE_EXACT:2},c_pageNumPosition={PAGE_NUM_POSITION_TOP:1,PAGE_NUM_POSITION_BOTTOM:2,PAGE_NUM_POSITION_RIGHT:0,PAGE_NUM_POSITION_LEFT:1,PAGE_NUM_POSITION_CENTER:2},c_tableWrap={TABLE_WRAP_NONE:0,TABLE_WRAP_PARALLEL:1},c_tableAlign={TABLE_ALIGN_LEFT:0,TABLE_ALIGN_CENTER:1,TABLE_ALIGN_RIGHT:2},c_tableBorder={BORDER_VERTICAL_LEFT:0,BORDER_HORIZONTAL_TOP:1,BORDER_VERTICAL_RIGHT:2,BORDER_HORIZONTAL_BOTTOM:3,BORDER_VERTICAL_CENTER:4,BORDER_HORIZONTAL_CENTER:5,BORDER_INNER:6,BORDER_OUTER:7,BORDER_ALL:8,BORDER_NONE:9,BORDER_ALL_TABLE:10,BORDER_NONE_TABLE:11,BORDER_INNER_TABLE:12,BORDER_OUTER_TABLE:13};if(define("documenteditor/main/app/controller/DocumentHolder",["core","documenteditor/main/app/view/DocumentHolder"],function(){"use strict";DE.Controllers.DocumentHolder=Backbone.Controller.extend({models:[],collections:[],views:["DocumentHolder"],initialize:function(){},onLaunch:function(){this.documentHolder=this.createView("DocumentHolder").render(),this.documentHolder.el.tabIndex=-1},setApi:function(t){this.api=t},createDelayedElements:function(){var t=this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");t&&(t.on("internalmessage",_.bind(function(e,i){var n=(i.data.command,i.data.data);this.api&&(t.isEditMode()?this.api.asc_editChartDrawingObject(n):this.api.asc_addChartDrawingObject(n))},this)),t.on("hide",_.bind(function(t,e){this.documentHolder.fireEvent("editcomplete",this.documentHolder),this.api&&(this.api.asc_onCloseChartFrame(),this.api.asc_enableKeyEvents(!0))},this)));var e=this.getApplication().getController("Common.Controllers.ExternalMergeEditor").getView("Common.Views.ExternalMergeEditor");e&&(e.on("internalmessage",_.bind(function(t,e){var i=(e.data.command,e.data.data);this.api&&this.api.asc_setMailMergeData(i)},this)),e.on("hide",_.bind(function(t,e){this.documentHolder.fireEvent("editcomplete",this.documentHolder),this.api&&this.api.asc_enableKeyEvents(!0)},this)))}})}),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}});var e=this.getChild();e.find(".btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},500)},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.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/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!documenteditor/main/app/template/Toolbar.template",[],function(){return'<div class="toolbar" style="<%= isCompactView ? \'height: 41px;\' : \'height: 67px;\' %>">\n \x3c!----------------------\x3e\n \x3c!--Short view toolbar--\x3e\n \x3c!----------------------\x3e\n <div id="id-toolbar-short" style="<%= isCompactView ? \'display: table;\' : \'display: none;\' %> width: 100%;" >\n <div class="toolbar-group no-mask">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-print"></span>\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-save"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-undo"></span>\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-redo"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row" style="width: 140px; margin-top: -1px;">\n <span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-short-placeholder-field-fontname"></span>\n <span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-short-placeholder-field-fontsize"></span>\n </div>\n </div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-bold"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-italic"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-underline"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-highlight"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fontcolor"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-halign"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-markers"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-numbering"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-multilevels"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-decoffset"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-incoffset"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-linespace"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidenchars"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertimage"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserttable"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertchart"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserthyperlink"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertshape"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-pagebreak"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-editheader"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group" style="padding-left: 10px;">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-copystyle"></span>\n </div>\n </div>\n <div class="toolbar-group" style="width: 100%; padding-left: 6px;"></div>\n <div class="toolbar-group no-mask" style="padding-left:0;">\n <div class="toolbar-row">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidebars"></span>\n </div>\n </div>\n </div>\n </div>\n \x3c!----------------------\x3e\n \x3c!--Fully view toolbar--\x3e\n \x3c!----------------------\x3e\n <div id="id-toolbar-full" style="<%= isCompactView ? \'display: none;\' : \'display: table;\' %> width: 100%;" >\n <div class="toolbar-group toolbar-group-native">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-newdocument"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-opendocument"></span>\n </div>\n </div>\n <div class="toolbar-group no-mask">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-print"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-save"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-copy"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-paste"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-undo"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-redo"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row" style="width:265px;">\n <span class="btn-placeholder" style="float: left; width: 165px;" id="id-toolbar-full-placeholder-field-fontname"></span>\n <span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-full-placeholder-field-fontsize"></span>\n <span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-incfont" style="margin-left: 2px;"></span>\n <span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-decfont" style="margin-left: 2px;"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bold"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-italic"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-underline"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-strikeout"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-superscript"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-subscript"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-highlight"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fontcolor"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-paracolor"></span>\n </div>\n </div>\n <div class="separator long" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-markers"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-numbering"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-multilevels"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-decoffset"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-incoffset"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-linespace"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-left"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-center"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-right"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-just"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidenchars"></span>\n </div>\n </div>\n <div class="separator long" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-pagebreak"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertimage"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertchart"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserttext"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertequation"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-dropcap"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-editheader"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserttable"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserthyperlink"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertshape"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-notes"></span>\n </div>\n </div>\n <div class="separator long" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-pageorient"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-pagemargins"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-pagesize"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-columns"></span>\n </div>\n </div>\n <div class="separator long" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clearstyle"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-copystyle"></span>\n </div>\n </div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-colorschemas"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-mailrecepients"></span>\n </div>\n </div>\n <div class="toolbar-group" id="id-toolbar-full-placeholder-field-styles" style="width: 100%; min-width: 160px;">\n </div>\n <div class="toolbar-group no-mask">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidebars"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-settings"></span>\n </div>\n </div>\n </div>\n</div>'}),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/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))}}})}),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,r=0,l=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)},d=function(e){t.trigger("select",t,a,r,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(h){Common.UI.BaseView.prototype.initialize.call(this,h),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 "+r),s.width(n.width())),i.on("mousemove",l),o.on("mousemove",l),n.on("mousemove",l),i.on("mouseleave",c),o.on("mouseleave",c),n.on("mouseleave",c),i.on("click",d),o.on("click",d),n.on("click",d)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(i,l,c){i>this.maxColumns&&(i=this.maxColumns),l>this.maxRows&&(l=this.maxRows),a==i&&r==l||(a=i,r=l,o.width(a+"em").height(r+"em"),n.width((a<t.minColumns?t.minColumns:a+1>t.maxColumns?t.maxColumns:a+1)+"em").height((r<t.minRows?t.minRows:r+1>t.maxRows?t.maxRows:r+1)+"em"),e.width(n.width()),s.html(a+" x "+r),s.width(n.width()),t.trigger("change",t,a,r,c))},getColumnsCount:function(){return a},getRowsCount:function(){return r}}}())}),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},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.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,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();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();i&&(i=i[0],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()[0],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();i&&(i=i[0],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=!1;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")))}n.fieldPicker.store.reset([]);var r=o.indexOf(t),l=o.length,c=Math.floor(s.width()/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),d=[];if(s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),r<0)return;r=Math.floor(r/c)*c,l-r<c&&(r=Math.max(l-c,0));for(var h=r,p=0;h<l&&p<c;h++,p++)d.push(o.at(h));n.fieldPicker.store.add(d)}if(e){var m=n.fieldPicker.store.findWhere({id:t.get("id")});m&&(n.suspendEvents(),n.fieldPicker.selectRecord(m,!0),n.resumeEvents())}}}},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(){var t;return{options:{
|
|
|
target:$(document.body),text:"",placement:"right"},template:_.template(['<div class="synch-tip-root <%= scope.placement %>">','<div class="asc-synchronizetip">','<div class="tip-arrow <%= scope.placement %>"></div>',"<div>",'<div class="tip-text" style="width: 260px;"><%= scope.text %></div>','<div class="close img-commonctrl"></div>',"</div>",'<div class="show-link"><label><%= scope.textDontShow %></label></div>',"</div>","</div>"].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.placement=this.options.placement},render:function(){return t=$(this.template({scope:this})),t.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),t.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this)),$(document.body).append(t),this.applyPlacement(),this},show:function(){t?(this.applyPlacement(),t.show()):this.render()},hide:function(){t&&t.hide()},applyPlacement:function(){var e=this.target.offset();"top"==this.placement?t.css({bottom:Common.Utils.innerHeight()-e.top+"px",right:Common.Utils.innerWidth()-e.left-this.target.width()/2+"px"}):t.css({top:e.top+this.target.height()/2+"px",left:e.left+this.target.width()+"px"})},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.<br/>Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("documenteditor/main/app/view/Toolbar",["jquery","underscore","backbone","text!documenteditor/main/app/template/Toolbar.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip"],function(t,e,i,n){"use strict";DE.Views.Toolbar=i.View.extend(e.extend({el:"#toolbar",template:e.template(n),events:{},initialize:function(){var i=this;this.SchemeNames=[this.txtScheme1,this.txtScheme2,this.txtScheme3,this.txtScheme4,this.txtScheme5,this.txtScheme6,this.txtScheme7,this.txtScheme8,this.txtScheme9,this.txtScheme10,this.txtScheme11,this.txtScheme12,this.txtScheme13,this.txtScheme14,this.txtScheme15,this.txtScheme16,this.txtScheme17,this.txtScheme18,this.txtScheme19,this.txtScheme20,this.txtScheme21],this.paragraphControls=[],this.toolbarControls=[],this.textOnlyControls=[],this._state={hasCollaborativeChanges:void 0},this.btnSaveCls="btn-save",this.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),this.btnNewDocument=new Common.UI.Button({id:"id-toolbar-btn-newdocument",cls:"btn-toolbar",iconCls:"btn-newdocument"}),this.toolbarControls.push(this.btnNewDocument),this.btnOpenDocument=new Common.UI.Button({id:"id-toolbar-btn-opendocument",cls:"btn-toolbar",iconCls:"btn-opendocument"}),this.toolbarControls.push(this.btnOpenDocument),this.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print no-mask"}),this.toolbarControls.push(this.btnPrint),this.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"no-mask "+this.btnSaveCls}),this.toolbarControls.push(this.btnSave),this.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo"}),this.toolbarControls.push(this.btnUndo),this.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo"}),this.toolbarControls.push(this.btnRedo),this.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),this.toolbarControls.push(this.btnCopy),this.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste"}),this.paragraphControls.push(this.btnPaste),this.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"btn-incfont"}),this.paragraphControls.push(this.btnIncFontSize),this.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"btn-decfont"}),this.paragraphControls.push(this.btnDecFontSize),this.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0}),this.paragraphControls.push(this.btnBold),this.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0}),this.paragraphControls.push(this.btnItalic),this.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0}),this.paragraphControls.push(this.btnUnderline),this.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0}),this.paragraphControls.push(this.btnStrikeout),this.btnSuperscript=new Common.UI.Button({id:"id-toolbar-btn-superscript",cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptGroup"}),this.paragraphControls.push(this.btnSuperscript),this.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptGroup"}),this.paragraphControls.push(this.btnSubscript),this.btnHighlightColor=new Common.UI.Button({id:"id-toolbar-btn-highlight",cls:"btn-toolbar",iconCls:"btn-highlight",enableToggle:!0,allowDepress:!0,split:!0,menu:new Common.UI.Menu({style:"min-width: 100px;",items:[{template:e.template('<div id="id-toolbar-menu-highlight" style="width: 120px; height: 120px; margin: 10px;"></div>')},{caption:"--"},this.mnuHighlightTransparent=new Common.UI.MenuItem({caption:this.strMenuNoFill,checkable:!0})]})}),this.paragraphControls.push(this.btnHighlightColor),this.textOnlyControls.push(this.btnHighlightColor),this.btnFontColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",split:!0,menu:new Common.UI.Menu({items:[{id:"id-toolbar-menu-auto-fontcolor",caption:this.textAutoColor,template:e.template('<a tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 12px; height: 12px; margin: 1px 7px 0 -7px; background-color: #000;"></span><%= caption %></a>')},{caption:"--"},{template:e.template('<div id="id-toolbar-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:e.template('<a id="id-toolbar-menu-new-fontcolor" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.paragraphControls.push(this.btnFontColor),this.btnParagraphColor=new Common.UI.Button({id:"id-toolbar-btn-paracolor",cls:"btn-toolbar",iconCls:"btn-paracolor",split:!0,menu:new Common.UI.Menu({items:[{template:e.template('<div id="id-toolbar-menu-paracolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:e.template('<a id="id-toolbar-menu-new-paracolor" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.paragraphControls.push(this.btnParagraphColor),this.textOnlyControls.push(this.btnParagraphColor),this.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"btn-align-left",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignLeft),this.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"btn-align-center",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignCenter),this.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"btn-align-right",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignRight),this.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"btn-align-just",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignJust),this.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.tipAlignLeft+Common.Utils.String.platformKey("Ctrl+L"),iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,toggleGroup:"halignGroup",checked:!0,value:1},{caption:this.tipAlignCenter+Common.Utils.String.platformKey("Ctrl+E"),iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,toggleGroup:"halignGroup",value:2},{caption:this.tipAlignRight+Common.Utils.String.platformKey("Ctrl+R"),iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,toggleGroup:"halignGroup",value:0},{caption:this.tipAlignJust+Common.Utils.String.platformKey("Ctrl+J"),iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,toggleGroup:"halignGroup",value:3}]})}),this.paragraphControls.push(this.btnHorizontalAlign),this.btnDecLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-decoffset",cls:"btn-toolbar",iconCls:"btn-decoffset"}),this.paragraphControls.push(this.btnDecLeftOffset),this.btnIncLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-incoffset",cls:"btn-toolbar",iconCls:"btn-incoffset"}),this.paragraphControls.push(this.btnIncLeftOffset),this.btnLineSpace=new Common.UI.Button({id:"id-toolbar-btn-linespace",cls:"btn-toolbar",iconCls:"btn-linespace",menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:"1.0",value:1,checkable:!0,toggleGroup:"linesize"},{caption:"1.15",value:1.15,checkable:!0,toggleGroup:"linesize"},{caption:"1.5",value:1.5,checkable:!0,toggleGroup:"linesize"},{caption:"2.0",value:2,checkable:!0,toggleGroup:"linesize"},{caption:"2.5",value:2.5,checkable:!0,toggleGroup:"linesize"},{caption:"3.0",value:3,checkable:!0,toggleGroup:"linesize"}]})}),this.paragraphControls.push(this.btnLineSpace),this.btnShowHidenChars=new Common.UI.Button({id:"id-toolbar-btn-hidenchars",cls:"btn-toolbar",iconCls:"btn-hidenchars",enableToggle:!0,split:!0,menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:this.mniHiddenChars,value:"characters",checkable:!0},{caption:this.mniHiddenBorders,value:"table",checkable:!0}]})}),this.toolbarControls.push(this.btnShowHidenChars),this.btnMarkers=new Common.UI.Button({id:"id-toolbar-btn-markers",cls:"btn-toolbar",iconCls:"btn-setmarkers",enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),this.paragraphControls.push(this.btnMarkers),this.textOnlyControls.push(this.btnMarkers),this.btnNumbers=new Common.UI.Button({id:"id-toolbar-btn-numbering",cls:"btn-toolbar",iconCls:"btn-numbering",enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),this.paragraphControls.push(this.btnNumbers),this.textOnlyControls.push(this.btnNumbers),this.btnMultilevels=new Common.UI.Button({id:"id-toolbar-btn-multilevels",cls:"btn-toolbar",iconCls:"btn-multilevels",menu:!0}),this.paragraphControls.push(this.btnMultilevels),this.textOnlyControls.push(this.btnMultilevels);var n=function(t){var e={};for(var i in t)e[i]="object"==typeof t[i]?n(t[i]):t[i];return e};this.mnuMarkersPicker={conf:{index:0},selectByIndex:function(t){this.conf.index=t}},this.mnuNumbersPicker=n(this.mnuMarkersPicker),this.mnuMultilevelPicker=n(this.mnuMarkersPicker),this.btnInsertTable=new Common.UI.Button({id:"id-toolbar-btn-inserttable",cls:"btn-toolbar",iconCls:"btn-inserttable",menu:new Common.UI.Menu({items:[{template:e.template('<div id="id-toolbar-menu-tablepicker" class="dimension-picker" style="margin: 5px 10px;"></div>')},{caption:this.mniCustomTable,value:"custom"}]})}),this.paragraphControls.push(this.btnInsertTable),this.btnInsertImage=new Common.UI.Button({id:"id-toolbar-btn-insertimage",cls:"btn-toolbar",iconCls:"btn-insertimage",menu:new Common.UI.Menu({items:[{caption:this.mniImageFromFile,value:"file"},{caption:this.mniImageFromUrl,value:"url"}]})}),this.paragraphControls.push(this.btnInsertImage),this.btnInsertChart=new Common.UI.Button({id:"id-toolbar-btn-insertchart",cls:"btn-toolbar",iconCls:"btn-insertchart",menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:e.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),this.paragraphControls.push(this.btnInsertChart),this.btnInsertText=new Common.UI.Button({id:"id-toolbar-btn-inserttext",cls:"btn-toolbar",iconCls:"btn-text",enableToggle:!0,split:!0,menu:new Common.UI.Menu({items:[{caption:this.textInsText,value:"text"},this.mnuInsertTextArt=new Common.UI.MenuItem({caption:this.textInsTextArt,value:"art",menu:new Common.UI.Menu({menuAlign:"tl-tr",cls:"menu-shapes",items:[{template:e.template('<div id="id-toolbar-menu-insart" style="width: 239px; margin-left: 5px;"></div>')}]})})]})}),this.paragraphControls.push(this.btnInsertText),this.btnInsertPageBreak=new Common.UI.Button({id:"id-toolbar-btn-pagebreak",cls:"btn-toolbar",iconCls:"btn-pagebreak",split:!0,menu:!0}),this.paragraphControls.push(this.btnInsertPageBreak),this.btnInsertHyperlink=new Common.UI.Button({id:"id-toolbar-btn-inserthyperlink",cls:"btn-toolbar",iconCls:"btn-inserthyperlink"}),this.paragraphControls.push(this.btnInsertHyperlink),this.btnEditHeader=new Common.UI.Button({id:"id-toolbar-btn-editheader",cls:"btn-toolbar",iconCls:"btn-editheader",menu:!0}),this.mnuPageNumberPosPicker={conf:{disabled:!1},isDisabled:function(){return this.conf.disabled},setDisabled:function(t){this.conf.disabled=t}},this.mnuPageNumCurrentPos=n(this.mnuPageNumberPosPicker),this.mnuInsertPageNum=n(this.mnuPageNumberPosPicker),this.mnuInsertPageCount=n(this.mnuPageNumberPosPicker),this.paragraphControls.push(this.mnuPageNumCurrentPos),this.paragraphControls.push(this.mnuInsertPageCount),this.toolbarControls.push(this.btnEditHeader),this.btnInsertShape=new Common.UI.Button({id:"id-toolbar-btn-insertshape",cls:"btn-toolbar",iconCls:"btn-insertshape",enableToggle:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.paragraphControls.push(this.btnInsertShape),this.btnInsertEquation=new Common.UI.Button({id:"id-toolbar-btn-insertequation",cls:"btn-toolbar",iconCls:"btn-insertequation",split:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.paragraphControls.push(this.btnInsertEquation),this.btnDropCap=new Common.UI.Button({id:"id-toolbar-btn-dropcap",cls:"btn-toolbar",iconCls:"btn-dropcap",menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textNone,iconCls:"mnu-dropcap-none",checkable:!0,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.None,checked:!0},{caption:this.textInText,iconCls:"mnu-dropcap-intext",checkable:!0,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.Drop},{caption:this.textInMargin,iconCls:"mnu-dropcap-inmargin",checkable:!0,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.Margin},{caption:"--"},this.mnuDropCapAdvanced=new Common.UI.MenuItem({caption:this.mniEditDropCap})]})}),this.paragraphControls.push(this.btnDropCap),this.btnColumns=new Common.UI.Button({id:"id-toolbar-btn-columns",cls:"btn-toolbar",iconCls:"btn-columns",menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textColumnsOne,iconCls:"mnu-columns-one",checkable:!0,toggleGroup:"menuColumns",value:0},{caption:this.textColumnsTwo,iconCls:"mnu-columns-two",checkable:!0,toggleGroup:"menuColumns",value:1},{caption:this.textColumnsThree,iconCls:"mnu-columns-three",checkable:!0,toggleGroup:"menuColumns",value:2},{caption:this.textColumnsLeft,iconCls:"mnu-columns-left",checkable:!0,toggleGroup:"menuColumns",value:3},{caption:this.textColumnsRight,iconCls:"mnu-columns-right",checkable:!0,toggleGroup:"menuColumns",value:4}]})}),this.paragraphControls.push(this.btnColumns),this.btnPageOrient=new Common.UI.Button({id:"id-toolbar-btn-pageorient",cls:"btn-toolbar",iconCls:"btn-pageorient",menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textPortrait,iconCls:"mnu-orient-portrait",checkable:!0,toggleGroup:"menuOrient",value:!0},{caption:this.textLandscape,iconCls:"mnu-orient-landscape",checkable:!0,toggleGroup:"menuOrient",value:!1}]})}),this.toolbarControls.push(this.btnPageOrient);var o=e.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>");this.btnPageMargins=new Common.UI.Button({id:"id-toolbar-btn-pagemargins",cls:"btn-toolbar",iconCls:"btn-pagemargins",menu:new Common.UI.Menu({items:[{caption:this.textMarginsLast,checkable:!0,template:o,toggleGroup:"menuPageMargins"},{caption:this.textMarginsNormal,checkable:!0,template:o,toggleGroup:"menuPageMargins",value:[20,30,20,15]},{caption:this.textMarginsUsNormal,checkable:!0,template:o,toggleGroup:"menuPageMargins",value:[25.4,25.4,25.4,25.4]},{caption:this.textMarginsNarrow,checkable:!0,template:o,toggleGroup:"menuPageMargins",value:[12.7,12.7,12.7,12.7]},{caption:this.textMarginsModerate,checkable:!0,template:o,toggleGroup:"menuPageMargins",value:[25.4,19.1,25.4,19.1]},{caption:this.textMarginsWide,checkable:!0,template:o,toggleGroup:"menuPageMargins",value:[25.4,50.8,25.4,50.8]},{caption:"--"},{caption:this.textPageMarginsCustom,value:"advanced"}]})}),this.toolbarControls.push(this.btnPageMargins);var s=e.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>');this.btnPageSize=new Common.UI.Button({id:"id-toolbar-btn-pagesize",cls:"btn-toolbar",iconCls:"btn-pagesize",menu:new Common.UI.Menu({items:[{caption:"US Letter",subtitle:"21,59cm x 27,94cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,279.4]},{caption:"US Legal",subtitle:"21,59cm x 35,56cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,355.6]},{caption:"A4",subtitle:"21cm x 29,7cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[210,297],checked:!0},{caption:"A5",subtitle:"14,81cm x 20,99cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[148.1,209.9]},{caption:"B5",subtitle:"17,6cm x 25,01cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[176,250.1]},{caption:"Envelope #10",subtitle:"10,48cm x 24,13cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[104.8,241.3]},{caption:"Envelope DL",subtitle:"11,01cm x 22,01cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[110.1,220.1]},{caption:"Tabloid",subtitle:"27,94cm x 43,17cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[279.4,431.7]},{caption:"A3",subtitle:"29,7cm x 42,01cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[297,420.1]},{caption:"Tabloid Oversize",subtitle:"30,48cm x 45,71cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[304.8,457.1]},{caption:"ROC 16K",subtitle:"19,68cm x 27,3cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[196.8,273]},{caption:"Envelope Choukei 3",subtitle:"11,99cm x 23,49cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[119.9,234.9]},{caption:"Super B/A3",subtitle:"33,02cm x 48,25cm",template:s,checkable:!0,toggleGroup:"menuPageSize",value:[330.2,482.5]},{caption:"--"},{caption:this.textPageSizeCustom,value:"advanced"}]})}),this.toolbarControls.push(this.btnPageSize),this.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clearstyle",cls:"btn-toolbar",iconCls:"btn-clearstyle"}),this.toolbarControls.push(this.btnClearStyle),this.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",enableToggle:!0}),this.toolbarControls.push(this.btnCopyStyle),this.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",menu:new Common.UI.Menu({items:[],maxHeight:600,restoreHeight:600}).on("show:before",function(e){this.scroller||(this.scroller=new Common.UI.Scroller({el:t(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0}))}).on("show:after",function(e,i){var n=t(this.el).find(".dropdown-menu "),o=t(document).height(),s=n.outerHeight(),a=parseInt(n.css("top"));s>o?(n.css("max-height",o-parseInt(n.css("padding-top"))-parseInt(n.css("padding-bottom"))-5+"px"),this.scroller.update({minScrollbarLength:40})):n.height()<this.options.restoreHeight&&(n.css("max-height",Math.min(o-parseInt(n.css("padding-top"))-parseInt(n.css("padding-bottom"))-5,this.options.restoreHeight)+"px"),s=n.outerHeight(),a+s>o&&n.css("top",0),this.scroller.update({minScrollbarLength:40}))})}),this.toolbarControls.push(this.btnColorSchemas),this.btnNotes=new Common.UI.Button({id:"id-toolbar-btn-notes",cls:"btn-toolbar",iconCls:"btn-notes",split:!0,menu:!0}),this.paragraphControls.push(this.btnNotes),this.btnMailRecepients=new Common.UI.Button({id:"id-toolbar-btn-mailrecepients",cls:"btn-toolbar",iconCls:"btn-mailrecepients"}),this.btnHide=new Common.UI.Button({id:"id-toolbar-btn-hidebars",cls:"btn-toolbar",iconCls:"btn-hidebars no-mask",menu:!0}),this.toolbarControls.push(this.btnHide),this.btnFitPage={conf:{checked:!1},setChecked:function(t){this.conf.checked=t},isChecked:function(){return this.conf.checked}},this.btnFitWidth=n(this.btnFitPage),this.mnuZoom={options:{value:100}},this.btnAdvSettings=new Common.UI.Button({id:"id-toolbar-btn-settings",cls:"btn-toolbar",iconCls:"btn-settings no-mask"}),this.toolbarControls.push(this.btnAdvSettings),this.mnuLineSpace=this.btnLineSpace.menu,this.mnuNonPrinting=this.btnShowHidenChars.menu,this.mnuInsertTable=this.btnInsertTable.menu,this.mnuInsertImage=this.btnInsertImage.menu,this.mnuPageSize=this.btnPageSize.menu,this.mnuColorSchema=this.btnColorSchemas.menu,this.btnHighlightColor.on("render:after",function(e){var n=t('<div class="btn-color-value-line"></div>');t("button:first-child",e.cmpEl).append(n),e.currentColor="FFFF00",n.css("background-color","#"+e.currentColor),i.mnuHighlightColorPicker=new Common.UI.ColorPalette({el:t("#id-toolbar-menu-highlight"),value:"FFFF00",colors:["FFFF00","00FF00","00FFFF","FF00FF","0000FF","FF0000","00008B","008B8B","006400","800080","8B0000","808000","FFFFFF","D3D3D3","A9A9A9","000000"]}),i.mnuHighlightColorPicker.select("FFFF00")}),this.btnFontColor.on("render:after",function(e){var n=t('<div class="btn-color-value-line"></div>');t("button:first-child",e.cmpEl).append(n),n.css("background-color",e.currentColor||"transparent"),i.mnuFontColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-fontcolor")})}),this.btnParagraphColor.on("render:after",function(e){var n=t('<div class="btn-color-value-line"></div>');t("button:first-child",e.cmpEl).append(n),n.css("background-color",e.currentColor||"transparent"),i.mnuParagraphColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-paracolor"),transparent:!0})}),this.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",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"}]}),this.paragraphControls.push(this.cmbFontSize),this.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:this.tipFontName,store:new Common.Collections.Fonts}),this.paragraphControls.push(this.cmbFontName),this.listStylesAdditionalMenuItem=new Common.UI.MenuItem({template:e.template('<div id="id-save-style-container" class = "save-style-container"><span id="id-save-style-plus" class="plus img-commonctrl" ></span><label id="id-save-style-link" class="save-style-link" >'+i.textStyleMenuNew+"</label></div>")}),this.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",itemWidth:104,itemHeight:38,enableKeyEvents:!0,additionalMenuItems:[this.listStylesAdditionalMenuItem],beforeOpenHandler:function(e){var i=this,n=i.openButton.menu;if(n.cmpEl){var o=t(i.cmpEl.find(".dataview.inner .style").get(0)).parent(),s=o.is(":visible")?parseInt(o.css("width")):i.itemWidth+parseInt(o.css("padding-left"))+parseInt(o.css("padding-right"))+parseInt(o.css("border-left-width"))+parseInt(o.css("border-right-width")),a=i.menuPicker.store.length>=6?6:i.menuPicker.store.length,r=Math.min(i.menuPicker.store.length,Math.round(t(".dataview",t(i.fieldPicker.el)).width()/(-1+s)+.5));r=r<a?a:r,n.menuAlignEl=i.cmpEl,n.menuAlign="tl-tl";var l=i.cmpEl.width()-i.openButton.$el.width()-r*(-1+s)-1;n.setOffset(Math.min(l,0)),n.cmpEl.css({width:r*(s+-1),"min-height":i.cmpEl.height()})}i.menuPicker.scroller&&i.menuPicker.scroller.update({includePadding:!0,suppressScrollX:!0}),i.removeTips()}}),this.listStyles.fieldPicker.itemTemplate=e.template(['<div class="style" id="<%= id %>">','<div style="background-image: url(<%= imageUrl %>); width: '+this.listStyles.itemWidth+"px; height: "+this.listStyles.itemHeight+'px;"/>',"</div>"].join("")),this.listStyles.menuPicker.itemTemplate=e.template(['<div class="style" id="<%= id %>">','<div style="background-image: url(<%= imageUrl %>); width: '+this.listStyles.itemWidth+"px; height: "+this.listStyles.itemHeight+'px;"/>',"</div>"].join("")),this.paragraphControls.push(this.listStyles),this.textOnlyControls.push(this.listStyles),e.each(this.toolbarControls.concat(this.paragraphControls),function(t){e.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.btnMailRecepients.setDisabled(!0);var a=new Common.UI.MenuItem({caption:i.textStyleMenuUpdate}).on("click",e.bind(i.onStyleMenuUpdate,i)),r=new Common.UI.MenuItem({caption:i.textStyleMenuDelete}).on("click",e.bind(i.onStyleMenuDelete,i)),l=new Common.UI.MenuItem({caption:i.textStyleMenuRestore}).on("click",e.bind(i.onStyleMenuDelete,i)),c=new Common.UI.MenuItem({caption:i.textStyleMenuRestoreAll}).on("click",e.bind(i.onStyleMenuRestoreAll,i)),d=new Common.UI.MenuItem({caption:i.textStyleMenuDeleteAll}).on("click",e.bind(i.onStyleMenuDeleteAll,i));return null==this.styleMenu&&(this.styleMenu=new Common.UI.Menu({items:[a,r,l,c,d]})),this},render:function(e){var i=this;this.trigger("render:before",this);var n=Common.localStorage.getItem("de-pgmargins-top"),o=Common.localStorage.getItem("de-pgmargins-left"),s=Common.localStorage.getItem("de-pgmargins-bottom"),a=Common.localStorage.getItem("de-pgmargins-right");if(null!==n&&null!==o&&null!==s&&null!==a){var r=this.btnPageMargins.menu.items[0];r.options.value=r.value=[parseFloat(n),parseFloat(o),parseFloat(s),parseFloat(a)],r.setVisible(!0),t(r.el).html(r.template({id:Common.UI.getId(),caption:r.caption,options:r.options}))}else this.btnPageMargins.menu.items[0].setVisible(!1);var l=Common.localStorage.getItem("de-compact-toolbar"),c=!!(null!==l&&1==parseInt(l)||null===l&&e.customization&&e.customization.compactToolbar);return i.$el.html(this.template({isCompactView:c})),i.rendererComponents(c?"short":"full"),i.isCompactView=c,this.trigger("render:after",this),l=Common.localStorage.getItem("de-hide-synch"),this.showSynchTip=!(l&&1==parseInt(l)),this.needShowSynchTip=!1,this},rendererComponents:function(e){var i="short"===e?"short":"full",n=function(e,i){var n=t(e),o=n.get(0);o&&(i.rendered?(i.el=document.getElementById(i.id),o.appendChild(document.getElementById(i.id))):i.render(n))};n("#id-toolbar-"+i+"-placeholder-btn-newdocument",this.btnNewDocument),n("#id-toolbar-"+i+"-placeholder-btn-opendocument",this.btnOpenDocument),n("#id-toolbar-"+i+"-placeholder-field-fontname",this.cmbFontName),n("#id-toolbar-"+i+"-placeholder-field-fontsize",this.cmbFontSize),n("#id-toolbar-"+i+"-placeholder-btn-print",this.btnPrint),n("#id-toolbar-"+i+"-placeholder-btn-save",this.btnSave),n("#id-toolbar-"+i+"-placeholder-btn-undo",this.btnUndo),n("#id-toolbar-"+i+"-placeholder-btn-redo",this.btnRedo),n("#id-toolbar-"+i+"-placeholder-btn-copy",this.btnCopy),n("#id-toolbar-"+i+"-placeholder-btn-paste",this.btnPaste),n("#id-toolbar-"+i+"-placeholder-btn-incfont",this.btnIncFontSize),n("#id-toolbar-"+i+"-placeholder-btn-decfont",this.btnDecFontSize),n("#id-toolbar-"+i+"-placeholder-btn-bold",this.btnBold),n("#id-toolbar-"+i+"-placeholder-btn-italic",this.btnItalic),n("#id-toolbar-"+i+"-placeholder-btn-underline",this.btnUnderline),n("#id-toolbar-"+i+"-placeholder-btn-strikeout",this.btnStrikeout),n("#id-toolbar-"+i+"-placeholder-btn-superscript",this.btnSuperscript),n("#id-toolbar-"+i+"-placeholder-btn-subscript",this.btnSubscript),n("#id-toolbar-"+i+"-placeholder-btn-highlight",this.btnHighlightColor),n("#id-toolbar-"+i+"-placeholder-btn-fontcolor",this.btnFontColor),n("#id-toolbar-"+i+"-placeholder-btn-align-left",this.btnAlignLeft),n("#id-toolbar-"+i+"-placeholder-btn-align-center",this.btnAlignCenter),n("#id-toolbar-"+i+"-placeholder-btn-align-right",this.btnAlignRight),n("#id-toolbar-"+i+"-placeholder-btn-align-just",this.btnAlignJust),n("#id-toolbar-"+i+"-placeholder-btn-incoffset",this.btnIncLeftOffset),n("#id-toolbar-"+i+"-placeholder-btn-decoffset",this.btnDecLeftOffset),n("#id-toolbar-"+i+"-placeholder-btn-linespace",this.btnLineSpace),n("#id-toolbar-"+i+"-placeholder-btn-hidenchars",this.btnShowHidenChars),n("#id-toolbar-"+i+"-placeholder-btn-markers",this.btnMarkers),n("#id-toolbar-"+i+"-placeholder-btn-numbering",this.btnNumbers),n("#id-toolbar-"+i+"-placeholder-btn-multilevels",this.btnMultilevels),n("#id-toolbar-"+i+"-placeholder-btn-inserttable",this.btnInsertTable),n("#id-toolbar-"+i+"-placeholder-btn-insertimage",this.btnInsertImage),n("#id-toolbar-"+i+"-placeholder-btn-insertchart",this.btnInsertChart),n("#id-toolbar-"+i+"-placeholder-btn-inserttext",this.btnInsertText),n("#id-toolbar-"+i+"-placeholder-btn-dropcap",this.btnDropCap),n("#id-toolbar-"+i+"-placeholder-btn-columns",this.btnColumns),n("#id-toolbar-"+i+"-placeholder-btn-pagebreak",this.btnInsertPageBreak),n("#id-toolbar-"+i+"-placeholder-btn-inserthyperlink",this.btnInsertHyperlink),n("#id-toolbar-"+i+"-placeholder-btn-editheader",this.btnEditHeader),n("#id-toolbar-"+i+"-placeholder-btn-insertshape",this.btnInsertShape),n("#id-toolbar-"+i+"-placeholder-btn-insertequation",this.btnInsertEquation),n("#id-toolbar-"+i+"-placeholder-btn-pageorient",this.btnPageOrient),n("#id-toolbar-"+i+"-placeholder-btn-pagemargins",this.btnPageMargins),n("#id-toolbar-"+i+"-placeholder-btn-pagesize",this.btnPageSize),n("#id-toolbar-"+i+"-placeholder-btn-clearstyle",this.btnClearStyle),n("#id-toolbar-"+i+"-placeholder-btn-copystyle",this.btnCopyStyle),n("#id-toolbar-"+i+"-placeholder-btn-colorschemas",this.btnColorSchemas),
|
|
|
n("#id-toolbar-"+i+"-placeholder-btn-hidebars",this.btnHide),n("#id-toolbar-"+i+"-placeholder-btn-settings",this.btnAdvSettings),n("#id-toolbar-full-placeholder-btn-paracolor",this.btnParagraphColor),n("#id-toolbar-full-placeholder-field-styles",this.listStyles),n("#id-toolbar-short-placeholder-btn-halign",this.btnHorizontalAlign),n("#id-toolbar-full-placeholder-btn-mailrecepients",this.btnMailRecepients),n("#id-toolbar-"+i+"-placeholder-btn-notes",this.btnNotes)},createDelayedElements:function(){this.api&&(this.mnuNonPrinting.items[0].setChecked(this.api.get_ShowParaMarks(),!0),this.mnuNonPrinting.items[1].setChecked(this.api.get_ShowTableEmptyLine(),!0),this.btnShowHidenChars.toggle(this.mnuNonPrinting.items[0].checked,!0),this.updateMetricUnit()),this.btnNewDocument.updateHint(this.tipNewDocument),this.btnOpenDocument.updateHint(this.tipOpenDocument),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnStrikeout.updateHint(this.textStrikeout),this.btnSuperscript.updateHint(this.textSuperscript),this.btnSubscript.updateHint(this.textSubscript),this.btnHighlightColor.updateHint(this.tipHighlightColor),this.btnFontColor.updateHint(this.tipFontColor),this.btnParagraphColor.updateHint(this.tipPrColor),this.btnAlignLeft.updateHint(this.tipAlignLeft+Common.Utils.String.platformKey("Ctrl+L")),this.btnAlignCenter.updateHint(this.tipAlignCenter+Common.Utils.String.platformKey("Ctrl+E")),this.btnAlignRight.updateHint(this.tipAlignRight+Common.Utils.String.platformKey("Ctrl+R")),this.btnAlignJust.updateHint(this.tipAlignJust+Common.Utils.String.platformKey("Ctrl+J")),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft+Common.Utils.String.platformKey("Ctrl+M")),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnShowHidenChars.updateHint(this.tipShowHiddenChars),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnMultilevels.updateHint(this.tipMultilevels),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertPageBreak.updateHint(this.tipPageBreak),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnEditHeader.updateHint(this.tipEditHeader),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnDropCap.updateHint(this.tipDropCap),this.btnColumns.updateHint(this.tipColumns),this.btnPageOrient.updateHint(this.tipPageOrient),this.btnPageSize.updateHint(this.tipPageSize),this.btnPageMargins.updateHint(this.tipPageMargins),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnMailRecepients.updateHint(this.tipMailRecepients),this.btnHide.updateHint(this.tipViewSettings),this.btnAdvSettings.updateHint(this.tipAdvSettings),this.btnNotes.updateHint(this.tipNotes);var i=this;this.btnHide.setMenu(new Common.UI.Menu({cls:"pull-right",style:"min-width: 180px;",items:[this.mnuitemCompactToolbar=new Common.UI.MenuItem({caption:this.textCompactView,checkable:!0}),this.mnuitemHideTitleBar=new Common.UI.MenuItem({caption:this.textHideTitleBar,checkable:!0}),this.mnuitemHideStatusBar=new Common.UI.MenuItem({caption:this.textHideStatusBar,checkable:!0}),this.mnuitemHideRulers=new Common.UI.MenuItem({caption:this.textHideLines,checkable:!0}),{caption:"--"},this.btnFitPage=new Common.UI.MenuItem({caption:this.textFitPage,checkable:!0,checked:this.btnFitPage.isChecked()}),this.btnFitWidth=new Common.UI.MenuItem({caption:this.textFitWidth,checkable:!0,checked:this.btnFitWidth.isChecked()}),this.mnuZoom=new Common.UI.MenuItem({template:e.template(['<div id="id-toolbar-menu-zoom" class="menu-zoom" style="height: 25px;" ',"<% if(!_.isUndefined(options.stopPropagation)) { %>",'data-stopPropagation="true"',"<% } %>",">",'<label class="title">'+this.textZoom+"</label>",'<button id="id-menu-zoom-in" type="button" style="float:right; margin: 2px 5px 0 0;" class="btn small btn-toolbar"><span class="btn-icon btn-zoomin"> </span></button>','<label class="zoom"><%= options.value %>%</label>','<button id="id-menu-zoom-out" type="button" style="float:right; margin-top: 2px;" class="btn small btn-toolbar"><span class="btn-icon btn-zoomout"> </span></button>',"</div>"].join("")),stopPropagation:!0,value:this.mnuZoom.options.value})]})),(this.mode.isDesktopApp||this.mode.canBrandingExt&&this.mode.customization&&!1===this.mode.customization.header)&&this.mnuitemHideTitleBar.hide(),this.mode.canBrandingExt&&this.mode.customization&&!1===this.mode.customization.statusBar&&this.mnuitemHideStatusBar.hide(),this.btnMarkers.setMenu(new Common.UI.Menu({items:[{template:e.template('<div id="id-toolbar-menu-markers" class="menu-markers" style="width: 185px; margin: 0 5px;"></div>')}]})),this.btnNumbers.setMenu(new Common.UI.Menu({items:[{template:e.template('<div id="id-toolbar-menu-numbering" class="menu-markers" style="width: 330px; margin: 0 5px;"></div>')}]})),this.btnMultilevels.setMenu(new Common.UI.Menu({items:[{template:e.template('<div id="id-toolbar-menu-multilevels" class="menu-markers" style="width: 165px; margin: 0 5px;"></div>')}]})),this.btnInsertPageBreak.setMenu(new Common.UI.Menu({items:[{caption:this.textInsPageBreak},{caption:this.textInsColumnBreak,value:"column"},this.mnuInsertSectionBreak=new Common.UI.MenuItem({caption:this.textInsSectionBreak,value:"section",menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textNextPage,value:Asc.c_oAscSectionBreakType.NextPage},{caption:this.textContPage,value:Asc.c_oAscSectionBreakType.Continuous},{caption:this.textEvenPage,value:Asc.c_oAscSectionBreakType.EvenPage},{caption:this.textOddPage,value:Asc.c_oAscSectionBreakType.OddPage}]})})]})),this.btnEditHeader.setMenu(new Common.UI.Menu({items:[{caption:this.mniEditHeader,value:"header"},{caption:this.mniEditFooter,value:"footer"},{caption:"--"},this.mnuInsertPageNum=new Common.UI.MenuItem({caption:this.textInsertPageNumber,disabled:this.mnuInsertPageNum.isDisabled(),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:e.template('<div id="id-toolbar-menu-pageposition" class="menu-pageposition"></div>')},this.mnuPageNumCurrentPos=new Common.UI.MenuItem({caption:this.textToCurrent,disabled:this.mnuPageNumCurrentPos.isDisabled(),value:"current"})]})}),this.mnuInsertPageCount=new Common.UI.MenuItem({caption:this.textInsertPageCount,disabled:this.mnuInsertPageCount.isDisabled()})]})),this.paragraphControls.push(this.mnuPageNumCurrentPos),this.paragraphControls.push(this.mnuInsertPageCount),this.mnuZoomOut=new Common.UI.Button({el:t("#id-menu-zoom-out"),cls:"btn-toolbar"}),this.mnuZoomIn=new Common.UI.Button({el:t("#id-menu-zoom-in"),cls:"btn-toolbar"}),this.btnNotes.setMenu(new Common.UI.Menu({items:[{caption:this.mniInsFootnote,value:"ins_footnote"},{caption:"--"},this.mnuGotoFootnote=new Common.UI.MenuItem({template:e.template(['<div id="id-toolbar-menu-goto-footnote" class="menu-zoom" style="height: 25px;" ',"<% if(!_.isUndefined(options.stopPropagation)) { %>",'data-stopPropagation="true"',"<% } %>",">",'<label class="title">'+this.textGotoFootnote+"</label>",'<button id="id-menu-goto-footnote-next" type="button" style="float:right; margin: 2px 5px 0 0;" class="btn small btn-toolbar"><span class="btn-icon mmerge-next"> </span></button>','<button id="id-menu-goto-footnote-prev" type="button" style="float:right; margin-top: 2px;" class="btn small btn-toolbar"><span class="btn-icon mmerge-prev"> </span></button>',"</div>"].join("")),stopPropagation:!0}),{caption:"--"},{caption:this.mniDelFootnote,value:"delele"},{caption:this.mniNoteSettings,value:"settings"}]})),this.mnuGotoFootPrev=new Common.UI.Button({el:t("#id-menu-goto-footnote-prev"),cls:"btn-toolbar"}),this.mnuGotoFootNext=new Common.UI.Button({el:t("#id-menu-goto-footnote-next"),cls:"btn-toolbar"});var n=this.mnuMarkersPicker.conf;this.mnuMarkersPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-markers"),parentMenu:this.btnMarkers.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:0,subtype:-1}},{offsety:38,data:{type:0,subtype:1}},{offsety:76,data:{type:0,subtype:2}},{offsety:114,data:{type:0,subtype:3}},{offsety:152,data:{type:0,subtype:4}},{offsety:190,data:{type:0,subtype:5}},{offsety:228,data:{type:0,subtype:6}},{offsety:266,data:{type:0,subtype:7}}]),itemTemplate:e.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')}),n&&this.mnuMarkersPicker.selectByIndex(n.index,!0),n=this.mnuNumbersPicker.conf,this.mnuNumbersPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-numbering"),parentMenu:this.btnNumbers.menu,restoreHeight:164,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:1,subtype:-1}},{offsety:518,data:{type:1,subtype:4}},{offsety:592,data:{type:1,subtype:5}},{offsety:666,data:{type:1,subtype:6}},{offsety:296,data:{type:1,subtype:1}},{offsety:370,data:{type:1,subtype:2}},{offsety:444,data:{type:1,subtype:3}},{offsety:740,data:{type:1,subtype:7}}]),itemTemplate:e.template('<div id="<%= id %>" class="item-numberlist" style="background-position: 0 -<%= offsety %>px;"></div>')}),n&&this.mnuNumbersPicker.selectByIndex(n.index,!0),n=this.mnuMultilevelPicker.conf,this.mnuMultilevelPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-multilevels"),parentMenu:this.btnMultilevels.menu,restoreHeight:164,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:2,subtype:-1}},{offsety:74,data:{type:2,subtype:1}},{offsety:148,data:{type:2,subtype:2}},{offsety:222,data:{type:2,subtype:3}}]),itemTemplate:e.template('<div id="<%= id %>" class="item-multilevellist" style="background-position: 0 -<%= offsety %>px;"></div>')}),n&&this.mnuMultilevelPicker.selectByIndex(n.index,!0),n=this.mnuPageNumberPosPicker?this.mnuPageNumberPosPicker.conf:void 0,this.mnuPageNumberPosPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-pageposition"),allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:132,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_LEFT}},{offsety:99,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_CENTER}},{offsety:66,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT}},{offsety:33,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_LEFT}},{offsety:0,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_CENTER}},{offsety:165,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT}}]),itemTemplate:e.template('<div id="<%= id %>" class="item-pagenumber" style="background-position: 0 -<%= offsety %>px"></div>')}),n&&this.mnuPageNumberPosPicker.setDisabled(n.disabled),this.mnuInsertChartPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-insertchart"),parentMenu:this.btnInsertChart.menu,showLast:!1,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:i.textColumn,headername:i.textCharts},{id:"menu-chart-group-line",caption:i.textLine},{id:"menu-chart-group-pie",caption:i.textPie},{id:"menu-chart-group-hbar",caption:i.textBar},{id:"menu-chart-group-area",caption:i.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:i.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:i.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:e.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')}),this.mnuTablePicker=new Common.UI.DimensionPicker({el:t("#id-toolbar-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10});var o=(this.mode,Common.localStorage.getItem("de-compact-toolbar")),s=!!(null!==o&&1==parseInt(o)||null===o&&this.mode.customization&&this.mode.customization.compactToolbar);o=Common.localStorage.getItem("de-hidden-title");var a=null!==o&&1==parseInt(o);o=Common.localStorage.getItem("de-hidden-status");var r=null!==o&&1==parseInt(o);o=Common.localStorage.getItem("de-hidden-rulers");var l=null!==o&&1==parseInt(o);this.mnuitemCompactToolbar.setChecked(s,!0),this.mnuitemCompactToolbar.on("toggle",e.bind(this.changeViewMode,this)),this.mnuitemHideTitleBar.setChecked(a,!0),this.mnuitemHideStatusBar.setChecked(r,!0),this.mnuitemHideRulers.setChecked(l,!0)},updateMetricUnit:function(){for(var e=this.btnPageMargins.menu.items,i=0;i<e.length;i++){var n=e[i];if(n.checkable){var o=n.checked;t(n.el).html(n.template({id:Common.UI.getId(),caption:n.caption,options:n.options})),o&&n.setChecked(o)}}e=this.btnPageSize.menu.items;for(var i=0;i<e.length;i++){var n=e[i];if(n.checkable){var o=n.checked;t(n.el).html(n.template({id:Common.UI.getId(),caption:n.caption,options:n.options})),o&&n.setChecked(o)}}},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onSendThemeColorSchemes",e.bind(this.onSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onCollaborativeChanges",e.bind(this.onCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",e.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",e.bind(this.onApiUsersChanged,this)),this},setMode:function(e){if(e.isDisconnected&&(this.btnNewDocument.setDisabled(!0),this.btnOpenDocument.setDisabled(!0),this.btnSave.setDisabled(!0),this.btnCopy.setDisabled(!0),this.btnPaste.setDisabled(!0),this.btnUndo.setDisabled(!0),this.btnRedo.setDisabled(!0),this.btnIncFontSize.setDisabled(!0),this.btnDecFontSize.setDisabled(!0),this.btnBold.setDisabled(!0),this.btnItalic.setDisabled(!0),this.btnUnderline.setDisabled(!0),this.btnStrikeout.setDisabled(!0),this.btnSuperscript.setDisabled(!0),this.btnSubscript.setDisabled(!0),this.btnHighlightColor.setDisabled(!0),this.btnFontColor.setDisabled(!0),this.btnParagraphColor.setDisabled(!0),this.btnMarkers.setDisabled(!0),this.btnNumbers.setDisabled(!0),this.btnMultilevels.setDisabled(!0),this.btnAlignLeft.setDisabled(!0),this.btnAlignCenter.setDisabled(!0),this.btnAlignRight.setDisabled(!0),this.btnAlignJust.setDisabled(!0),this.btnDecLeftOffset.setDisabled(!0),this.btnIncLeftOffset.setDisabled(!0),this.btnLineSpace.setDisabled(!0),this.btnShowHidenChars.setDisabled(!0),this.btnInsertTable.setDisabled(!0),this.btnInsertImage.setDisabled(!0),this.btnInsertChart.setDisabled(!0),this.btnInsertText.setDisabled(!0),this.btnDropCap.setDisabled(!0),this.btnColumns.setDisabled(!0),this.btnInsertPageBreak.setDisabled(!0),this.btnInsertHyperlink.setDisabled(!0),this.btnEditHeader.setDisabled(!0),this.btnInsertShape.setDisabled(!0),this.btnInsertEquation.setDisabled(!0),this.btnPageOrient.setDisabled(!0),this.btnPageMargins.setDisabled(!0),this.btnPageSize.setDisabled(!0),this.btnClearStyle.setDisabled(!0),this.btnCopyStyle.setDisabled(!0),this.btnColorSchemas.setDisabled(!0),this.btnMailRecepients.setDisabled(!0),this.btnHorizontalAlign.setDisabled(!0),this.cmbFontName.setDisabled(!0),this.cmbFontSize.setDisabled(!0),this.listStyles.setDisabled(!0),this.btnNotes.setDisabled(!0),e.disableDownload&&this.btnPrint.setDisabled(!0)),this.mode=e,!e.nativeApp){var i=t(".toolbar-group-native");i&&i.hide()}e.isDesktopApp&&t(".toolbar-group-native").hide(),this.btnMailRecepients.setVisible(1==e.canCoAuthoring&&e.canUseMailMerge),this.listStylesAdditionalMenuItem.setVisible(e.canEditStyles)},changeViewMode:function(i,n){var o=this,s=t("#id-toolbar-full"),a=t("#id-toolbar-short");o.isCompactView=n,s&&a&&(n?(a.css({display:"table"}),s.css({display:"none"}),a.parent().css({height:"41px"}),this.rendererComponents("short")):(a.css({display:"none"}),s.css({display:"table"}),a.parent().css({height:"67px"}),this.rendererComponents("full"),e.defer(function(){var t=o.listStyles.rendered;o.listStyles.menuPicker.store.length>0&&t&&o.listStyles.fillComboView(o.listStyles.menuPicker.getSelectedRec(),!0),o.btnInsertText.rendered&&DE.getController("Toolbar").fillTextArt(),o.btnInsertEquation.rendered&&DE.getController("Toolbar").fillEquations()},100)),this.fireEvent("changecompact",[this,n]))},onSendThemeColorSchemes:function(i){var n=this;this.mnuColorSchema&&this.mnuColorSchema.items.length>0&&e.each(this.mnuColorSchema.items,function(t){t.remove()}),null==this.mnuColorSchema&&(this.mnuColorSchema=new Common.UI.Menu({maxHeight:600,restoreHeight:600}).on("show:before",function(e){this.scroller=new Common.UI.Scroller({el:t(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40})})),this.mnuColorSchema.items=[];var o=e.template(['<a id="<%= id %>" tabindex="-1" type="menuitem" class="<%= options.cls %>">','<span class="colors">',"<% _.each(options.colors, function(color) { %>",'<span class="color" style="background: <%= color %>;"></span>',"<% }) %>","</span>",'<span class="text"><%= caption %></span>',"</a>"].join(""));e.each(i,function(t,e){for(var i=t.get_colors(),s=[],a=2;a<7;a++){var r="#"+Common.Utils.ThemeColor.getHexColor(i[a].get_r(),i[a].get_g(),i[a].get_b());s.push(r)}21==e?this.mnuColorSchema.addItem({caption:"--"}):this.mnuColorSchema.addItem({template:o,cls:"color-schemas-menu",colors:s,caption:e<21?n.SchemeNames[e]||t.get_name():t.get_name(),value:e})},this)},onCollaborativeChanges:function(){if(!this._state.hasCollaborativeChanges){if(!this.btnSave.rendered)return void(this.needShowSynchTip=!0);this._state.hasCollaborativeChanges=!0;var e=t(".btn-icon",this.btnSave.cmpEl);e.removeClass(this.btnSaveCls),e.addClass("btn-synch"),this.showSynchTip?(this.btnSave.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()}},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({target:t("#id-toolbar-btn-save")}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("de-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnSave.rendered){var e=t(".btn-icon",this.btnSave.cmpEl);e.hasClass("btn-synch")&&(e.removeClass("btn-synch"),e.addClass(this.btnSaveCls),this.synchTooltip&&this.synchTooltip.hide(),this.btnSave.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!this.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(i){var n=[];e.each(i,function(t){t.asc_getView()||n.push(t)});var o=e.size(n),s=o>1?"btn-save-coauth":"btn-save";if(s!==this.btnSaveCls&&this.btnSave.rendered){this.btnSaveTip=(o>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S");var a=t(".btn-icon",this.btnSave.cmpEl);a.hasClass("btn-synch")||(a.removeClass(this.btnSaveCls),a.addClass(s),this.btnSave.updateHint(this.btnSaveTip)),this.btnSaveCls=s}},onStyleMenuUpdate:function(t,e,i){var n=this;if(n.api){var o=n.api.asc_GetStyleFromFormatting(),s=t.styleTitle,a=o.get_Link();o.put_Name(s),a.put_Name(s+"_character"),n.api.asc_AddNewStyle(o),setTimeout(function(){n.listStyles.openButton.menu.hide()},100)}},onStyleMenuDelete:function(t,e,i){this.api&&this.api.asc_RemoveStyle(t.styleTitle)},onStyleMenuRestoreAll:function(t,i,n){var o=this;o.api&&e.each(window.styles.get_MergedStyles(),function(t){o.api.asc_IsStyleDefault(t.get_Name())&&o.api.asc_RemoveStyle(t.get_Name())})},onStyleMenuDeleteAll:function(t,e,i){this.api&&this.api.asc_RemoveAllCustomStyles()},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",strMenuNoFill:"No Fill",tipFontName:"Font Name",tipFontSize:"Font Size",tipParagraphStyle:"Paragraph Style",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipIncFont:"Increment font size",tipDecFont:"Decrement font size",tipHighlightColor:"Highlight color",tipFontColor:"Font color",tipMarkers:"Bullets",tipNumbers:"Numbering",tipMultilevels:"Outline",tipAlignLeft:"Align Left",tipAlignRight:"Align Right",tipAlignCenter:"Align Center",tipAlignJust:"Justified",tipDecPrLeft:"Decrease Indent",tipIncPrLeft:"Increase Indent",tipShowHiddenChars:"Nonprinting Characters",tipLineSpace:"Paragraph Line Spacing",tipPrColor:"Background color",tipInsertTable:"Insert Table",tipInsertImage:"Insert Picture",tipPageBreak:"Insert Page or Section break",tipInsertNum:"Insert Page Number",tipClearStyle:"Clear Style",tipCopyStyle:"Copy Style",tipPageSize:"Page Size",tipPageOrient:"Page Orientation",tipBack:"Back",tipInsertShape:"Insert Autoshape",tipInsertEquation:"Insert Equation",mniImageFromFile:"Picture from file",mniImageFromUrl:"Picture from url",mniCustomTable:"Insert Custom Table",textTitleError:"Error",textInsertPageNumber:"Insert page number",textToCurrent:"To Current Position",tipEditHeader:"Edit Document Header or Footer",mniEditHeader:"Edit Document Header",mniEditFooter:"Edit Document Footer",tipInsertHyperlink:"Add Hyperlink",mniHiddenChars:"Nonprinting Characters",mniHiddenBorders:"Hidden Table Borders",tipNewDocument:"New Document",tipOpenDocument:"Open Document",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",textNewColor:"Add New Custom Color",textAutoColor:"Automatic",tipInsertChart:"Insert Chart",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",tipColorSchemas:"Change Color Scheme",tipInsertText:"Insert Text",tipHAligh:"Horizontal Align",tipViewSettings:"View Settings",tipAdvSettings:"Advanced Settings",textCompactView:"View Compact Toolbar",textHideTitleBar:"Hide Title Bar",textHideStatusBar:"Hide Status Bar",textHideLines:"Hide Rulers",textFitPage:"Fit to Page",textFitWidth:"Fit to Width",textZoom:"Zoom",mniEditDropCap:"Drop Cap Settings",textNone:"None",textInText:"In Text",textInMargin:"In Margin",tipDropCap:"Insert drop cap",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",textInsPageBreak:"Insert Page Break",textInsColumnBreak:"Insert Column Break",textInsSectionBreak:"Insert Section Break",textNextPage:"Next Page",textContPage:"Continuous Page",textEvenPage:"Even Page",textOddPage:"Odd Page",tipSaveCoauth:"Save your changes for the other users to see them.",tipMailRecepients:"Mail Merge",textStyleMenuUpdate:"Update from select",textStyleMenuRestore:"Restore to default",textStyleMenuDelete:"Delete style",textStyleMenuRestoreAll:"Restore all to default styles",textStyleMenuDeleteAll:"Delete all custom styles",textStyleMenuNew:"New style from selection",textInsText:"Insert text box",textInsTextArt:"Insert Text Art",tipColumns:"Insert columns",textColumnsOne:"One",textColumnsTwo:"Two",textColumnsThree:"Three",textColumnsLeft:"Left",textColumnsRight:"Right",tipPageMargins:"Page Margins",textMarginsLast:"Last Custom",textMarginsNormal:"Normal",textMarginsUsNormal:"US Normal",textMarginsNarrow:"Narrow",textMarginsModerate:"Moderate",textMarginsWide:"Wide",textPageMarginsCustom:"Custom margins",textTop:"Top: ",textLeft:"Left: ",textBottom:"Bottom: ",textRight:"Right: ",textPageSizeCustom:"Custom Page Size",textPortrait:"Portrait",textLandscape:"Landscape",textInsertPageCount:"Insert number of pages",textCharts:"Charts",tipNotes:"Footnotes",mniInsFootnote:"Insert Footnote",mniDelFootnote:"Delete All Footnotes",mniNoteSettings:"Notes Settings",textGotoFootnote:"Go to Footnotes",tipChangeChart:"Change Chart Type"},DE.Views.Toolbar||{}))}),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"}),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)}}}())}),define("documenteditor/main/app/view/MailMergeRecepients",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";DE.Views.MailMergeRecepients=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-mail-recepients-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-mail-recepients-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-mail-recepients-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&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("mailmergerecepients",e,t.file)},50)}},_onLoad:function(){
|
|
|
this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},DE.Views.MailMergeRecepients||{}))}),void 0===Common)var Common={};if(define("documenteditor/main/app/view/StyleTitleDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";DE.Views.StyleTitleDialog=Common.UI.Window.extend(_.extend({options:{width:350,height:200,style:"min-width: 230px;",cls:"modal-dlg"},initialize:function(t){_.extend(this.options,{title:this.textHeader},t||{}),this.template=['<div class="box">','<label class="input-row" style="margin-bottom: -5px;">'+this.textTitle+" </label>",'<div id="id-dlg-style-title" class="input-row" style="margin-bottom: 5px;"></div>','<label class="input-row" style="margin-bottom: -5px; margin-top: 5px;">'+this.textNextStyle+"</label>",'<div id="id-dlg-style-next-par" class="input-group-nr" style="margin-bottom: 5px;" ></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-style-title"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!(""==e)||t.txtNotEmpty}}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.cmbNextStyle=new Common.UI.ComboBox({el:$("#id-dlg-style-next-par"),style:"width: 100%;",menuStyle:"width: 100%; max-height: 290px;",editable:!1,cls:"input-group-nr",data:this.options.formats}),this.cmbNextStyle.setValue(this.options.formats[0].value)},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.inputTitle.cmpEl.find("input").focus()},500)},getTitle:function(){return this.inputTitle.getValue()},getNextStyle:function(){return this.cmbNextStyle.getValue()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){if(t.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){if(!0!==this.inputTitle.checkValidate())return void this.inputTitle.cmpEl.find("input").focus()}this.options.handler.call(this,this,t)}this.close()},textTitle:"Title",textHeader:"Create New Style",txtEmpty:"This field is required",txtNotEmpty:"Field must not be empty",textNextStyle:"Next paragraph style"},DE.Views.StyleTitleDialog||{}))}),define("documenteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";DE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:215,header:!0,style:"min-width: 216px;",cls:"modal-dlg",id:"window-page-margins"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box" style="height: 85px;">','<table cols="2" style="width: 100%;margin-bottom: 10px;">',"<tr>",'<td style="padding-right: 10px;padding-bottom: 8px;">','<label class="input-label">'+this.textTop+"</label>",'<div id="page-margins-spin-top"></div>',"</td>",'<td style="padding-bottom: 8px;">','<label class="input-label">'+this.textBottom+"</label>",'<div id="page-margins-spin-bottom"></div>',"</td>","</tr>","<tr>",'<td class="padding-small" style="padding-right: 10px;">','<label class="input-label">'+this.textLeft+"</label>",'<div id="page-margins-spin-left"></div>',"</td>",'<td class="padding-small">','<label class="input-label">'+this.textRight+"</label>",'<div id="page-margins-spin-right"></div>',"</td>","</tr>","</table>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn 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:"1 cm",maxValue:55.88,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:"1 cm",maxValue:55.88,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:"1 cm",maxValue:55.88,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:"1 cm",maxValue:55.88,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){if(this.options.handler){if("ok"==t){var e=null;if(this.spnLeft.getNumberValue()+this.spnRight.getNumberValue()>this.maxMarginsW?e=this.txtMarginsW:this.spnTop.getNumberValue()+this.spnBottom.getNumberValue()>this.maxMarginsH&&(e=this.txtMarginsH),e)return void Common.UI.warning({title:this.notcriticalErrorTitle,msg:e})}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){t&&(this.maxMarginsH=Common.Utils.Metric.fnRecalcFromMM(t.get_H()-2.6),this.maxMarginsW=Common.Utils.Metric.fnRecalcFromMM(t.get_W()-12.7),this.spnTop.setMaxValue(this.maxMarginsH),this.spnBottom.setMaxValue(this.maxMarginsH),this.spnLeft.setMaxValue(this.maxMarginsW),this.spnRight.setMaxValue(this.maxMarginsW),this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_TopMargin()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_BottomMargin()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_LeftMargin()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_RightMargin()),!0))},getSettings:function(){var t=new Asc.CDocumentSectionProps;return t.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())),t.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())),t.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())),t.put_RightMargin(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()),e.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},textTitle:"Margins",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",cancelButtonText:"Cancel",okButtonText:"Ok",notcriticalErrorTitle:"Warning",txtMarginsW:"Left and right margins are too high for a given page wight",txtMarginsH:"Top and bottom margins are too high for a given page height"},DE.Views.PageMarginsDialog||{}))}),define("documenteditor/main/app/view/PageSizeDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";DE.Views.PageSizeDialog=Common.UI.Window.extend(_.extend({options:{width:215,header:!0,style:"min-width: 216px;",cls:"modal-dlg",id:"window-page-size"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['<div class="box" style="height: 40px;">','<table cols="2" style="width: 100%;margin-bottom: 10px;">',"<tr>",'<td class="padding-small" style="padding-right: 10px;">','<label class="input-label">'+this.textWidth+"</label>",'<div id="page-size-spin-width"></div>',"</td>",'<td class="padding-small">','<label class="input-label">'+this.textHeight+"</label>",'<div id="page-size-spin-height"></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,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnWidth=new Common.UI.MetricSpinner({el:$("#page-size-spin-width"),step:.1,width:86,defaultUnit:"cm",value:"10 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#page-size-spin-height"),step:.1,width:86,defaultUnit:"cm",value:"20 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight);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){t&&(this.spnWidth.setMinValue(Common.Utils.Metric.fnRecalcFromMM(t.get_LeftMargin()+t.get_RightMargin()+12.7)),this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_W()),!0),this.spnHeight.setMinValue(Common.Utils.Metric.fnRecalcFromMM(t.get_TopMargin()+t.get_BottomMargin()+2.6)),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_H()),!0))},getSettings:function(){return[Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()),Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())]},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)}},textTitle:"Page Size",textWidth:"Width",textHeight:"Height",cancelButtonText:"Cancel",okButtonText:"Ok"},DE.Views.PageSizeDialog||{}))}),define("documenteditor/main/app/view/NoteSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/MetricSpinner","common/main/lib/component/ComboBox","common/main/lib/view/AdvancedSettingsWindow"],function(){"use strict";DE.Views.NoteSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:380},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 5px;"><div class="inner-content">','<div class="settings-panel active">','<table cols="1" style="width: 100%;">',"<tr>",'<td class="padding-small">','<label class="header">',e.textLocation,"</label>","</td>","</tr>","<tr>",'<td class="padding-large">','<label class="input-label" style="margin-top: 4px;">',e.textFootnote,"</label>",'<div id="note-settings-combo-footnote" class="input-group-nr" style="display: inline-block; width:150px;float:right;"></div>',"</td>","</tr>","<tr>","<td>",'<div class="padding-large"></div>',"</td>","</tr>","<tr>",'<td class="padding-small">','<label class="header">',e.textFormat,"</label>","</td>","</tr>","<tr>",'<td class="padding-small">','<div style="display: inline-block; margin-right: 10px; vertical-align: middle;">','<label class="input-label">',e.textNumFormat,"</label>",'<div id="note-settings-combo-format" class="input-group-nr" style="width:150px;"></div>',"</div>",'<div style="display: inline-block; vertical-align: middle;">','<label class="input-label">',e.textStart,"</label>",'<div id="note-settings-spin-start"></div>',"</div>","</td>","</tr>","<tr>",'<td class="padding-small">','<label class="input-label">',e.textNumbering,"</label>",'<div id="note-settings-combo-numbering" class="input-group-nr" style="width:150px;"></div>',"</td>","</tr>","<tr>",'<td class="padding-large">','<label class="input-label">',e.textCustom,"</label>",'<div id="note-settings-txt-custom"></div>',"</td>","</tr>","<tr>","<td>",'<div class="padding-large"></div>',"</td>","</tr>","<tr>",'<td class="padding-small">','<label class="header" style="margin-top: 4px;">',e.textApplyTo,"</label>",'<div id="note-settings-combo-apply" class="input-group-nr" style="display: inline-block; width:150px;float:right;"></div>',"</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="insert" style="margin-right: 10px; width: 86px;">'+e.textInsert+"</button>",'<button id="note-settings-btn-apply" class="btn normal dlg-btn primary" result="apply" style="margin-right: 10px; width: 86px;">'+e.textApply+"</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,Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.FormatType=1,this.StartValue=1},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbFootnote=new Common.UI.ComboBox({el:$("#note-settings-combo-footnote"),cls:"input-group-nr",menuStyle:"min-width: 150px;",editable:!1,data:[{displayValue:this.textPageBottom,value:Asc.c_oAscFootnotePos.PageBottom},{displayValue:this.textTextBottom,value:Asc.c_oAscFootnotePos.BeneathText}]}),this.cmbFootnote.setValue(Asc.c_oAscFootnotePos.PageBottom),this.cmbFormat=new Common.UI.ComboBox({el:$("#note-settings-combo-format"),cls:"input-group-nr",menuStyle:"min-width: 150px;",editable:!1,data:[{displayValue:"1, 2, 3,...",value:Asc.c_oAscNumberingFormat.Decimal,maskExp:/[0-9]/,defValue:1},{displayValue:"a, b, c,...",value:Asc.c_oAscNumberingFormat.LowerLetter,maskExp:/[a-z]/,defValue:"a"},{displayValue:"A, B, C,...",value:Asc.c_oAscNumberingFormat.UpperLetter,maskExp:/[A-Z]/,defValue:"A"},{displayValue:"i, ii, iii,...",value:Asc.c_oAscNumberingFormat.LowerRoman,maskExp:/[ivxlcdm]/,defValue:"i"},{displayValue:"I, II, III,...",value:Asc.c_oAscNumberingFormat.UpperRoman,maskExp:/[IVXLCDM]/,defValue:"I"}]}),this.cmbFormat.setValue(this.FormatType),this.cmbFormat.on("selected",_.bind(this.onFormatSelect,this)),this.spnStart=new Common.UI.CustomSpinner({el:$("#note-settings-spin-start"),step:1,width:85,defaultUnit:"",value:1,maxValue:16383,minValue:1,allowDecimal:!1,maskExp:/[0-9]/}),this.cmbNumbering=new Common.UI.ComboBox({el:$("#note-settings-combo-numbering"),cls:"input-group-nr",menuStyle:"min-width: 150px;",editable:!1,data:[{displayValue:this.textContinue,value:Asc.c_oAscFootnoteRestart.Continuous},{displayValue:this.textEachSection,value:Asc.c_oAscFootnoteRestart.EachSect},{displayValue:this.textEachPage,value:Asc.c_oAscFootnoteRestart.EachPage}]}),this.cmbNumbering.setValue(Asc.c_oAscFootnoteRestart.Continuous),this.txtCustom=new Common.UI.InputField({el:$("#note-settings-txt-custom"),allowBlank:!0,validateOnChange:!0,validateOnBlur:!1,style:"width: 85px; vertical-align: middle;",value:""}).on("changing",function(e,i){t.cmbFormat.setDisabled(i.length>0),t.spnStart.setDisabled(i.length>0),t.btnApply.setDisabled(i.length>0)}),this.cmbApply=new Common.UI.ComboBox({el:$("#note-settings-combo-apply"),cls:"input-group-nr",menuStyle:"min-width: 150px;",editable:!1,data:[{displayValue:this.textDocument,value:1},{displayValue:this.textSection,value:0}]}),this.cmbApply.setValue(1),this.btnApply=new Common.UI.Button({el:$("#note-settings-btn-apply")}),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=t.get_Pos();this.cmbFootnote.setValue(e),e=t.get_NumFormat(),this.cmbFormat.setValue(e),this.onFormatSelect(this.cmbFormat,this.cmbFormat.getSelectedRecord()),e=t.get_NumStart(),this.spnStart.setValue(e),e=t.get_NumRestart(),this.cmbNumbering.setValue(e)}},getSettings:function(){var t=new Asc.CAscFootnotePr;t.put_Pos(this.cmbFootnote.getValue()),t.put_NumRestart(this.cmbNumbering.getValue());var e=this.txtCustom.getValue();return _.isEmpty(e)&&(e=this.cmbFormat.getValue(),t.put_NumFormat(e),t.put_NumStart(this.spnStart.getNumberValue())),{props:t,applyToAll:1==this.cmbApply.getValue(),custom:_.isEmpty(e)?void 0:e}},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"insert"!=e&&"apply"!=e||this.handler&&this.handler.call(this,e,"insert"==e||"apply"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return!0},onFormatSelect:function(t,e){if(e){this.spnStart.setMask(e.maskExp);var i=this;switch(e.value){case Asc.c_oAscNumberingFormat.UpperRoman:this.spnStart.options.toCustomFormat=this._10toRome,this.spnStart.options.fromCustomFormat=this._Rometo10;break;case Asc.c_oAscNumberingFormat.LowerRoman:this.spnStart.options.toCustomFormat=function(t){return i._10toRome(t).toLocaleLowerCase()},this.spnStart.options.fromCustomFormat=function(t){return i._Rometo10(t.toLocaleUpperCase())};break;case Asc.c_oAscNumberingFormat.UpperLetter:this.spnStart.options.toCustomFormat=this._10toS,this.spnStart.options.fromCustomFormat=this._Sto10;break;case Asc.c_oAscNumberingFormat.LowerLetter:this.spnStart.options.toCustomFormat=function(t){return i._10toS(t).toLocaleLowerCase()},this.spnStart.options.fromCustomFormat=function(t){return i._Sto10(t.toLocaleUpperCase())};break;default:this.spnStart.options.toCustomFormat=function(t){return t},this.spnStart.options.fromCustomFormat=function(t){return t}}this.spnStart.setValue(this.spnStart.getValue()),this.FormatType=e.value}},_10toS:function(t){t=parseInt(t);for(var e=Math.ceil(t/26),i=String.fromCharCode((t-1)%26+"A".charCodeAt(0)),n="",o=0;o<e;o++)n+=i;return n},_Sto10:function(t){if(t.length<1||new RegExp("[^"+t.charAt(0)+"]").test(t)||!/[A-Z]/.test(t))return 1;var e=t.length-1,i=t.charCodeAt(0)-"A".charCodeAt(0)+1;return i+=26*e},_10toRome:function(t){t=parseInt(t);for(var e="",i=[["M",1e3],["CM",900],["D",500],["CD",400],["C",100],["XC",90],["L",50],["XL",40],["X",10],["IX",9],["V",5],["IV",4],["I",1]],n=i[0][1],o=Math.floor(t/n),s=0,a=0;a<o;a++)e+=i[s][0];for(t-=o*n,s++;t>0;)n=i[s][1],o=t-n,o>=0?(e+=i[s][0],t=o):s++;return e},_Rometo10:function(t){if(!/[IVXLCDM]/.test(t)||t.length<1)return 1;for(var e={I:1,V:5,X:10,L:50,C:100,D:500,M:1e3},i=t.length-1,n=e[t.charAt(i)],o=n,s=i-1;s>=0;s--){var a=e[t.charAt(s)];if(a<o){if(o/a>10)return 1;a*=-1}n+=a}return n},textTitle:"Notes Settings",textLocation:"Location",textFootnote:"Footnote",textPageBottom:"Bottom of page",textTextBottom:"Below text",textFormat:"Format",textNumFormat:"Number Format",textStart:"Start at",textNumbering:"Numbering",textContinue:"Continuous",textEachPage:"Restart each page",textEachSection:"Restart each section",textApplyTo:"Apply changes to",textDocument:"Whole document",textSection:"Current section",textApply:"Apply",textInsert:"Insert",textCancel:"Cancel",textCustom:"Custom Mark"},DE.Views.NoteSettingsDialog||{}))}),define("documenteditor/main/app/controller/Toolbar",["core","common/main/lib/component/Window","common/main/lib/view/CopyWarningDialog","common/main/lib/view/ImageFromUrlDialog","common/main/lib/view/InsertTableDialog","common/main/lib/util/define","documenteditor/main/app/view/Toolbar","documenteditor/main/app/view/HyperlinkSettingsDialog","documenteditor/main/app/view/DropcapSettingsAdvanced","documenteditor/main/app/view/MailMergeRecepients","documenteditor/main/app/view/StyleTitleDialog","documenteditor/main/app/view/PageMarginsDialog","documenteditor/main/app/view/PageSizeDialog","documenteditor/main/app/view/NoteSettingsDialog"],function(){"use strict";DE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){this._state={activated:!1,bullets:{type:void 0,subtype:void 0},prstyle:void 0,prcontrolsdisable:void 0,dropcap:Asc.c_oAscDropCap.None,clrhighlight:void 0,clrtext:void 0,pgsize:[0,0],linespace: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,strike:void 0,underline:void 0,pgorient:void 0,lock_doc:void 0,can_copycut:void 0,pgmargins:void 0,fontsize:void 0,in_equation:!1,in_chart:!1},this.flg={},this.diagramEditor=null,this._isAddingShape=!1,this.editMode=!0,this.addListeners({Toolbar:{changecompact:this.onChangeCompactView}});var t=this,e=function(e){var i=$(e.target),n=i.closest("#editor_sdk"),o=i.closest("button").attr("id");void 0===o&&(o=i.closest(".btn-group").attr("id")),"editor_sdk"!=i.attr("id")&&n.length<=0&&(t.toolbar.btnInsertText.pressed&&o!=t.toolbar.btnInsertText.id||t.toolbar.btnInsertShape.pressed&&o!=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&&o==t.toolbar.btnInsertShape.id&&_.defer(function(){t.api.StartAddShape("",!1),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},100))};this.onApiEndAddShape=function(){this.toolbar.fireEvent("insertshape",this.toolbar),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)},this._addAutoshape=function(t,i){this.api&&(t?(this.api.StartAddShape(i,!0),$(document.body).on("mouseup",e)):(this.api.StartAddShape("",!1),$(document.body).off("mouseup",e)))},Common.NotificationCenter.on("style:commitsave",_.bind(this.onSaveStyle,this)),Common.NotificationCenter.on("style:commitchange",_.bind(this.onUpdateStyle,this))},onLaunch:function(){this.toolbar=this.createView("Toolbar")},onToolbarAfterRender:function(t){t.btnNewDocument.on("click",_.bind(this.onNewDocument,this)),t.btnOpenDocument.on("click",_.bind(this.onOpenDocument,this)),t.btnPrint.on("click",_.bind(this.onPrint,this)),t.btnSave.on("click",_.bind(this.onSave,this)),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.btnIncFontSize.on("click",_.bind(this.onIncrease,this)),t.btnDecFontSize.on("click",_.bind(this.onDecrease,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.btnSuperscript.on("click",_.bind(this.onSuperscript,this)),t.btnSubscript.on("click",_.bind(this.onSubscript,this)),t.btnAlignLeft.on("click",_.bind(this.onHorizontalAlign,this,1)),t.btnAlignCenter.on("click",_.bind(this.onHorizontalAlign,this,2)),t.btnAlignRight.on("click",_.bind(this.onHorizontalAlign,this,0)),t.btnAlignJust.on("click",_.bind(this.onHorizontalAlign,this,3)),t.btnHorizontalAlign.menu.on("item:click",_.bind(this.onMenuHorizontalAlignSelect,this)),t.btnDecLeftOffset.on("click",_.bind(this.onDecOffset,this)),t.btnIncLeftOffset.on("click",_.bind(this.onIncOffset,this)),t.btnMarkers.on("click",_.bind(this.onMarkers,this)),t.btnNumbers.on("click",_.bind(this.onNumbers,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("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),t.mnuMarkersPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnMarkers)),t.mnuNumbersPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnNumbers)),t.mnuMultilevelPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnMultilevels)),t.btnHighlightColor.on("click",_.bind(this.onBtnHighlightColor,this)),t.btnFontColor.on("click",_.bind(this.onBtnFontColor,this)),t.btnParagraphColor.on("click",_.bind(this.onBtnParagraphColor,this)),t.mnuHighlightColorPicker.on("select",_.bind(this.onSelectHighlightColor,this)),t.mnuFontColorPicker.on("select",_.bind(this.onSelectFontColor,this)),t.mnuParagraphColorPicker.on("select",_.bind(this.onParagraphColorPickerSelect,this)),t.mnuHighlightTransparent.on("click",_.bind(this.onHighlightTransparentClick,this)),$("#id-toolbar-menu-auto-fontcolor").on("click",_.bind(this.onAutoFontColor,this)),$("#id-toolbar-menu-new-fontcolor").on("click",_.bind(this.onNewFontColor,this)),$("#id-toolbar-menu-new-paracolor").on("click",_.bind(this.onNewParagraphColor,this)),t.mnuLineSpace.on("item:toggle",_.bind(this.onLineSpaceToggle,this)),t.mnuNonPrinting.on("item:toggle",_.bind(this.onMenuNonPrintingToggle,this)),t.btnShowHidenChars.on("toggle",_.bind(this.onNonPrintingToggle,this)),t.btnInsertPageBreak.on("click",_.bind(this.onPageBreakClick,this)),t.btnInsertPageBreak.menu.on("item:click",_.bind(this.onPageBreakClick,this)),t.mnuInsertSectionBreak.menu.on("item:click",_.bind(this.onSectionBreakClick,this)),t.btnInsertHyperlink.on("click",_.bind(this.onHyperlinkClick,this)),t.mnuTablePicker.on("select",_.bind(this.onTablePickerSelect,this)),t.mnuInsertTable.on("item:click",_.bind(this.onInsertTableClick,this)),t.mnuInsertImage.on("item:click",_.bind(this.onInsertImageClick,this)),t.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),t.btnInsertText.menu.on("item:click",_.bind(this.onInsertTextClick,this)),t.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),t.btnDropCap.menu.on("item:click",_.bind(this.onDropCapSelect,this)),t.mnuDropCapAdvanced.on("click",_.bind(this.onDropCapAdvancedClick,this)),t.btnColumns.menu.on("item:click",_.bind(this.onColumnsSelect,this)),t.btnPageOrient.menu.on("item:click",_.bind(this.onPageOrientSelect,this)),t.btnPageMargins.menu.on("item:click",_.bind(this.onPageMarginsSelect,this)),t.btnClearStyle.on("click",_.bind(this.onClearStyleClick,this)),t.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),t.btnAdvSettings.on("click",_.bind(this.onAdvSettingsClick,this)),t.mnuPageSize.on("item:click",_.bind(this.onPageSizeClick,this)),t.mnuColorSchema.on("item:click",_.bind(this.onColorSchemaClick,this)),t.btnMailRecepients.on("click",_.bind(this.onSelectRecepientsClick,this)),t.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),t.mnuPageNumberPosPicker.on("item:click",_.bind(this.onInsertPageNumberClick,this)),t.btnEditHeader.menu.on("item:click",_.bind(this.onEditHeaderFooterClick,this)),t.mnuPageNumCurrentPos.on("click",_.bind(this.onPageNumCurrentPosClick,this)),t.mnuInsertPageCount.on("click",_.bind(this.onInsertPageCountClick,this)),t.listStyles.on("click",_.bind(this.onListStyleSelect,this)),t.listStyles.on("contextmenu",_.bind(this.onListStyleContextMenu,this)),t.styleMenu.on("hide:before",_.bind(this.onListStyleBeforeHide,this)),t.mnuitemHideTitleBar.on("toggle",_.bind(this.onHideTitleBar,this)),t.mnuitemHideStatusBar.on("toggle",_.bind(this.onHideStatusBar,this)),t.mnuitemHideRulers.on("toggle",_.bind(this.onHideRulers,this)),t.btnFitPage.on("toggle",_.bind(this.onZoomToPageToggle,this)),t.btnFitWidth.on("toggle",_.bind(this.onZoomToWidthToggle,this)),t.mnuZoomIn.on("click",_.bind(this.onZoomInClick,this)),t.mnuZoomOut.on("click",_.bind(this.onZoomOutClick,this)),t.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),t.btnNotes.on("click",_.bind(this.onNotesClick,this)),t.btnNotes.menu.on("item:click",_.bind(this.onNotesMenuClick,this)),t.mnuGotoFootPrev.on("click",_.bind(this.onFootnotePrevClick,this)),t.mnuGotoFootNext.on("click",_.bind(this.onFootnoteNextClick,this)),$("#id-save-style-plus, #id-save-style-link",t.$el).on("click",this.onMenuSaveStyle.bind(this)),this.onSetupCopyStyleButton()},setApi:function(t){this.api=t,this.toolbar.setApi(t),this.api.asc_registerCallback("asc_onFontSize",_.bind(this.onApiFontSize,this)),this.api.asc_registerCallback("asc_onBold",_.bind(this.onApiBold,this)),this.api.asc_registerCallback("asc_onItalic",_.bind(this.onApiItalic,this)),this.api.asc_registerCallback("asc_onUnderline",_.bind(this.onApiUnderline,this)),this.api.asc_registerCallback("asc_onStrikeout",_.bind(this.onApiStrikeout,this)),this.api.asc_registerCallback("asc_onVerticalAlign",_.bind(this.onApiVerticalAlign,this)),this.api.asc_registerCallback("asc_onCanUndo",_.bind(this.onApiCanRevert,this,"undo")),this.api.asc_registerCallback("asc_onCanRedo",_.bind(this.onApiCanRevert,this,"redo")),this.api.asc_registerCallback("asc_onListType",_.bind(this.onApiBullets,this)),this.api.asc_registerCallback("asc_onPrAlign",_.bind(this.onApiParagraphAlign,this)),this.api.asc_registerCallback("asc_onTextColor",_.bind(this.onApiTextColor,this)),this.api.asc_registerCallback("asc_onParaSpacingLine",_.bind(this.onApiLineSpacing,this)),this.api.asc_registerCallback("asc_onCanAddHyperlink",_.bind(this.onApiCanAddHyperlink,this)),this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onApiFocusObject,this)),this.api.asc_registerCallback("asc_onDocSize",_.bind(this.onApiPageSize,this)),this.api.asc_registerCallback("asc_onPaintFormatChanged",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onParaStyleName",_.bind(this.onApiParagraphStyleChange,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onPageOrient",_.bind(this.onApiPageOrient,this)),this.api.asc_registerCallback("asc_onLockDocumentProps",_.bind(this.onApiLockDocumentProps,this)),this.api.asc_registerCallback("asc_onUnLockDocumentProps",_.bind(this.onApiUnLockDocumentProps,this)),this.api.asc_registerCallback("asc_onLockDocumentSchema",_.bind(this.onApiLockDocumentSchema,this)),this.api.asc_registerCallback("asc_onUnLockDocumentSchema",_.bind(this.onApiUnLockDocumentSchema,this)),this.api.asc_registerCallback("asc_onLockHeaderFooters",_.bind(this.onApiLockHeaderFooters,this)),this.api.asc_registerCallback("asc_onUnLockHeaderFooters",_.bind(this.onApiUnLockHeaderFooters,this)),this.api.asc_registerCallback("asc_onZoomChange",_.bind(this.onApiZoomChange,this)),this.api.asc_registerCallback("asc_onMarkerFormatChanged",_.bind(this.onApiStartHighlight,this)),this.api.asc_registerCallback("asc_onTextHighLight",_.bind(this.onApiHighlightColor,this)),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this,!0)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onCanCopyCut",_.bind(this.onApiCanCopyCut,this)),
|
|
|
this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this)),this.api.asc_registerCallback("asc_onColumnsProps",_.bind(this.onColumnsProps,this)),this.api.asc_registerCallback("asc_onSectionProps",_.bind(this.onSectionProps,this))},onChangeCompactView:function(t,e){Common.localStorage.setItem("de-compact-toolbar",e?1:0),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onApiFontSize:function(t){this._state.fontsize!==t&&(this.toolbar.cmbFontSize.setValue(t),this._state.fontsize=t)},onApiBold:function(t){this._state.bold!==t&&(this.toolbar.btnBold.toggle(!0===t,!0),this._state.bold=t)},onApiItalic:function(t){this._state.italic!==t&&(this.toolbar.btnItalic.toggle(!0===t,!0),this._state.italic=t)},onApiUnderline:function(t){this._state.underline!==t&&(this.toolbar.btnUnderline.toggle(!0===t,!0),this._state.underline=t)},onApiStrikeout:function(t){this._state.strike!==t&&(this.toolbar.btnStrikeout.toggle(!0===t,!0),this._state.strike=t)},onApiVerticalAlign:function(t){this._state.valign!==t&&(this.toolbar.btnSuperscript.toggle(1==t,!0),this.toolbar.btnSubscript.toggle(2==t,!0),this._state.valign=t)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.btnUndo.setDisabled(!e),this._state.can_undo=e):this._state.can_redo!==e&&(this.toolbar.btnRedo.setDisabled(!e),this._state.can_redo=e)},onApiCanCopyCut:function(t){this._state.can_copycut!==t&&(this.toolbar.btnCopy.setDisabled(!t),this._state.can_copycut=t)},onApiBullets:function(t){var e=t.get_ListType();if(this._state.bullets.type!=e||this._state.bullets.subtype!=t.get_ListSubType()||this.toolbar.btnMarkers.pressed&&0!==e||this.toolbar.btnNumbers.pressed&&1!==e||this.toolbar.btnMultilevels.pressed&&2!==e)switch(this._state.bullets.type=e,this._state.bullets.subtype=t.get_ListSubType(),this._clearBullets(),this._state.bullets.type){case 0:this.toolbar.btnMarkers.toggle(!0,!0),this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype,!0);break;case 1:var i=0;switch(this._state.bullets.subtype){case 1:i=4;break;case 2:i=5;break;case 3:i=6;break;case 4:i=1;break;case 5:i=2;break;case 6:i=3;break;case 7:i=7}this.toolbar.btnNumbers.toggle(!0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(i,!0);break;case 2:this.toolbar.btnMultilevels.toggle(!0,!0),this.toolbar.mnuMultilevelPicker.selectByIndex(this._state.bullets.subtype,!0)}},onApiParagraphAlign:function(t){if(this._state.pralign!==t){this._state.pralign=t;var e,i=-1,n=this.toolbar;switch(t){case 0:i=2,e="btn-align-right";break;case 1:i=0,e="btn-align-left";break;case 2:i=1,e="btn-align-center";break;case 3:i=3,e="btn-align-just";break;default:i=-255,e="btn-align-left"}i<0?-255==i&&this._clearChecked(this.toolbar.btnHorizontalAlign.menu):this.toolbar.btnHorizontalAlign.menu.items[i].setChecked(!0);var o=this.toolbar.btnHorizontalAlign;if(o.rendered){var s=$(".btn-icon",o.cmpEl);s&&(s.removeClass(o.options.icls),o.options.icls=e,s.addClass(o.options.icls))}if(null===t||void 0===t)return n.btnAlignRight.toggle(!1,!0),n.btnAlignLeft.toggle(!1,!0),n.btnAlignCenter.toggle(!1,!0),void n.btnAlignJust.toggle(!1,!0);n.btnAlignRight.toggle(0===t,!0),n.btnAlignLeft.toggle(1===t,!0),n.btnAlignCenter.toggle(2===t,!0),n.btnAlignJust.toggle(3===t,!0)}},onApiLineSpacing:function(t){var e=null===t.get_Line()||null===t.get_LineRule()||1!=t.get_LineRule()?-1:t.get_Line();if(this._state.linespace!==e){if(this._state.linespace=e,_.each(this.toolbar.mnuLineSpace.items,function(t){t.setChecked(!1,!0)}),e<0)return;Math.abs(e-1)<1e-4?this.toolbar.mnuLineSpace.items[0].setChecked(!0,!0):Math.abs(e-1.15)<1e-4?this.toolbar.mnuLineSpace.items[1].setChecked(!0,!0):Math.abs(e-1.5)<1e-4?this.toolbar.mnuLineSpace.items[2].setChecked(!0,!0):Math.abs(e-2)<1e-4?this.toolbar.mnuLineSpace.items[3].setChecked(!0,!0):Math.abs(e-2.5)<1e-4?this.toolbar.mnuLineSpace.items[4].setChecked(!0,!0):Math.abs(e-3)<1e-4&&this.toolbar.mnuLineSpace.items[5].setChecked(!0,!0)}},onApiCanAddHyperlink:function(t){var e=!t||this._state.prcontrolsdisable;e!=this.toolbar.btnInsertHyperlink.isDisabled()&&this.editMode&&this.toolbar.btnInsertHyperlink.setDisabled(e)},onApiPageSize:function(t,e){(Math.abs(this._state.pgsize[0]-t)>.01||Math.abs(this._state.pgsize[1]-e)>.01)&&(this._state.pgsize=[t,e],this.toolbar.mnuPageSize&&(this._clearChecked(this.toolbar.mnuPageSize),_.each(this.toolbar.mnuPageSize.items,function(i){if(i.value&&"object"==typeof i.value&&Math.abs(i.value[0]-t)<.01&&Math.abs(i.value[1]-e)<.01)return i.setChecked(!0),!1},this)))},onSectionProps:function(t){if(t){var e=t.get_LeftMargin(),i=t.get_TopMargin(),n=t.get_RightMargin(),o=t.get_BottomMargin();(!this._state.pgmargins||Math.abs(this._state.pgmargins[0]-i)>.01||Math.abs(this._state.pgmargins[1]-e)>.01||Math.abs(this._state.pgmargins[2]-o)>.01||Math.abs(this._state.pgmargins[3]-n)>.01)&&(this._state.pgmargins=[i,e,o,n],this.toolbar.btnPageMargins.menu&&(this._clearChecked(this.toolbar.btnPageMargins.menu),_.each(this.toolbar.btnPageMargins.menu.items,function(t){if(t.value&&"object"==typeof t.value&&Math.abs(t.value[0]-i)<.01&&Math.abs(t.value[1]-e)<.01&&Math.abs(t.value[2]-o)<.01&&Math.abs(t.value[3]-n)<.01)return t.setChecked(!0),!1},this)))}},onApiFocusObject:function(t){if(this.editMode){for(var e,i,n,o=-1,s=!1,a=!1,r=!1,l=!1,c=!1,d=void 0,h=!0,p=void 0,m=this.toolbar,u=!1,g=!1,b=!1,f=!1,C=!1;++o<t.length;)n=t[o].get_ObjectType(),e=t[o].get_ObjectValue(),n===Asc.c_oAscTypeSelectElement.Paragraph?(s=e.get_Locked(),l=e.get_CanAddTable(),c=e.get_CanAddImage(),p=e,i=e.get_Shade()):n===Asc.c_oAscTypeSelectElement.Header?(a=e.get_Locked(),u=!0):n===Asc.c_oAscTypeSelectElement.Image?(C=u=!0,r=e.get_Locked(),e&&e.get_ChartProperties()&&(g=!0)):n===Asc.c_oAscTypeSelectElement.Math&&(b=!0,Asc.c_oAscMathInterfaceType.Common===e.get_Type()&&(f=!0)),n!==Asc.c_oAscTypeSelectElement.Table&&n!==Asc.c_oAscTypeSelectElement.Header&&n!==Asc.c_oAscTypeSelectElement.Image||(d=!1),!1!==d&&n==Asc.c_oAscTypeSelectElement.Paragraph&&(d=!0);i&&this.onParagraphColor(i);var v=s||a;this._state.prcontrolsdisable!=v&&(this._state.activated&&(this._state.prcontrolsdisable=v),_.each(m.paragraphControls,function(t){t.setDisabled(v)},this));var y=s||a||g;if(this._state.textonlycontrolsdisable!=y&&(this._state.activated&&(this._state.textonlycontrolsdisable=y),v||_.each(m.textOnlyControls,function(t){t.setDisabled(y)},this),m.btnCopyStyle.setDisabled(y),m.btnClearStyle.setDisabled(y)),d&&p){var w=p.get_FramePr(),x=Asc.c_oAscDropCap.None;void 0!==w?(x=w.get_DropCap(),d=x===Asc.c_oAscDropCap.Drop||x===Asc.c_oAscDropCap.Margin,h=!1):d=p.get_CanAddDropCap(),d&&this.onDropCap(x)}v=v||!d||b,v!==m.btnDropCap.isDisabled()&&m.btnDropCap.setDisabled(v),m.btnDropCap.isDisabled()||h===m.mnuDropCapAdvanced.isDisabled()||m.mnuDropCapAdvanced.setDisabled(h),v=!l||a||b,v!=m.btnInsertTable.isDisabled()&&m.btnInsertTable.setDisabled(v),v=m.mnuPageNumCurrentPos.isDisabled()&&m.mnuPageNumberPosPicker.isDisabled(),v!=m.mnuInsertPageNum.isDisabled()&&m.mnuInsertPageNum.setDisabled(v),v=s||a||u||b&&!f||this.api.asc_IsCursorInFootnote(),v!=m.btnInsertPageBreak.isDisabled()&&m.btnInsertPageBreak.setDisabled(v),v=s||a||!c||b,v!=m.btnInsertImage.isDisabled()&&(m.btnInsertImage.setDisabled(v),m.btnInsertShape.setDisabled(v),m.btnInsertText.setDisabled(v)),(v||C)!=m.mnuInsertTextArt.isDisabled()&&m.mnuInsertTextArt.setDisabled(v||C),g!==this._state.in_chart&&(m.btnInsertChart.updateHint(g?m.tipChangeChart:m.tipInsertChart),this._state.in_chart=g),v=g&&r||!g&&v,v!=m.btnInsertChart.isDisabled()&&m.btnInsertChart.setDisabled(v),v=s||a||g||!c&&!b,v!==m.btnInsertEquation.isDisabled()&&m.btnInsertEquation.setDisabled(v),v=s||a||b,v!==m.btnSuperscript.isDisabled()&&(m.btnSuperscript.setDisabled(v),m.btnSubscript.setDisabled(v)),b!==m.btnEditHeader.isDisabled()&&m.btnEditHeader.setDisabled(b),v=s||b||C||u,v!==m.btnNotes.isDisabled()&&m.btnNotes.setDisabled(v),m.listStylesAdditionalMenuItem&&void 0===p!==m.listStylesAdditionalMenuItem.isDisabled()&&m.listStylesAdditionalMenuItem.setDisabled(void 0===p),this._state.in_equation=b}},onApiStyleChange:function(t){this.toolbar.btnCopyStyle.toggle(t,!0),this.modeAlwaysSetStyle=!1},onApiParagraphStyleChange:function(t){if(this._state.prstyle!=t){var e=this.toolbar.listStyles;if(e.rendered){e.suspendEvents();var i=e.menuPicker.store.findWhere({title:t});this._state.prstyle=e.menuPicker.store.length>0?t:void 0,e.menuPicker.selectRecord(i),e.resumeEvents()}}},onApiPageOrient:function(t){this._state.pgorient!==t&&(this.toolbar.btnPageOrient.menu.items[t?0:1].setChecked(!0),this._state.pgorient=t)},onApiLockDocumentProps:function(){!0!==this._state.lock_doc&&(this.toolbar.btnPageOrient.setDisabled(!0),this.toolbar.btnPageSize.setDisabled(!0),this._state.activated&&(this._state.lock_doc=!0))},onApiUnLockDocumentProps:function(){!1!==this._state.lock_doc&&(this.toolbar.btnPageOrient.setDisabled(!1),this.toolbar.btnPageSize.setDisabled(!1),this._state.activated&&(this._state.lock_doc=!1))},onApiLockDocumentSchema:function(){this.toolbar.btnColorSchemas.setDisabled(!0)},onApiUnLockDocumentSchema:function(){this.toolbar.btnColorSchemas.setDisabled(!1)},onApiLockHeaderFooters:function(){this.toolbar.mnuPageNumberPosPicker.setDisabled(!0),this.toolbar.mnuInsertPageNum.setDisabled(this.toolbar.mnuPageNumCurrentPos.isDisabled())},onApiUnLockHeaderFooters:function(){this.toolbar.mnuPageNumberPosPicker.setDisabled(!1),this.toolbar.mnuInsertPageNum.setDisabled(!1)},onApiZoomChange:function(t,e){this.toolbar.btnFitPage.setChecked(2==e,!0),this.toolbar.btnFitWidth.setChecked(1==e,!0),this.toolbar.mnuZoom.options.value=t,$(".menu-zoom .zoom",this.toolbar.el).html(t+"%")},onApiStartHighlight:function(t){this.toolbar.btnHighlightColor.toggle(t,!0)},onApiHighlightColor:function(t){var e=this.api.get_TextProps().get_TextPr();e&&(t=e.get_HighLight(),-1==t?-1!=this._state.clrhighlight&&(this.toolbar.mnuHighlightTransparent.setChecked(!0,!0),this.toolbar.mnuHighlightColorPicker.cmpEl&&(this._state.clrhighlight=-1,this.toolbar.mnuHighlightColorPicker.select(null,!0))):null!==t?this._state.clrhighlight!=t.get_hex().toUpperCase()&&(this.toolbar.mnuHighlightTransparent.setChecked(!1),this._state.clrhighlight=t.get_hex().toUpperCase(),_.contains(this.toolbar.mnuHighlightColorPicker.colors,this._state.clrhighlight)&&this.toolbar.mnuHighlightColorPicker.select(this._state.clrhighlight,!0)):this._state.clrhighlight!==t&&(this.toolbar.mnuHighlightTransparent.setChecked(!1,!0),this.toolbar.mnuHighlightColorPicker.select(null,!0),this._state.clrhighlight=t))},onApiInitEditorStyles:function(t){this._onInitEditorStyles(t)},onNewDocument:function(t,e){this.api&&this.api.OpenNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(t,e){this.api&&this.api.LoadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onPrint:function(t){this.api&&this.api.asc_Print(Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("Print"),Common.component.Analytics.trackEvent("ToolBar","Print")},onSave:function(t){if(this.api){var e=this.api.asc_isDocumentCanSave(),i=$(".btn-icon",this.toolbar.btnSave.cmpEl).hasClass("btn-synch");if(!e&&!i&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}this.toolbar.btnSave.setDisabled(!this.toolbar.mode.forcesave),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onUndo:function(t,e){this.api&&this.api.Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(t,e){this.api&&this.api.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.Copy():i.api.Paste())Common.component.Analytics.trackEvent("ToolBar","Copy Warning");else{var n=Common.localStorage.getItem("de-hide-copywarning");n&&1==parseInt(n)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("de-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",i.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},onIncrease:function(t){this.api&&this.api.FontSizeIn(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecrease:function(t){this.api&&this.api.FontSizeOut(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(t,e){this._state.bold=void 0,this.api&&this.api.put_TextPrBold(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(t,e){this._state.italic=void 0,this.api&&this.api.put_TextPrItalic(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(t,e){this._state.underline=void 0,this.api&&this.api.put_TextPrUnderline(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Underline")},onStrikeout:function(t,e){this._state.strike=void 0,this.api&&this.api.put_TextPrStrikeout(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Strikeout")},onSuperscript:function(t,e){this.toolbar.btnSubscript.pressed||(this._state.valign=void 0,this.api&&this.api.put_TextPrBaseline(t.pressed?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Superscript"))},onSubscript:function(t,e){this.toolbar.btnSuperscript.pressed||(this._state.valign=void 0,this.api&&this.api.put_TextPrBaseline(t.pressed?2:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Subscript"))},onDecOffset:function(t,e){this.api&&this.api.DecreaseIndent(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Indent")},onIncOffset:function(t,e){this.api&&this.api.IncreaseIndent(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Indent")},onHorizontalAlign:function(t,e,i){this._state.pralign=void 0,this.api&&this.api.put_PrAlign(t),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Align")},onMenuHorizontalAlignSelect:function(t,e){this._state.pralign=void 0;var i=this.toolbar.btnHorizontalAlign,n=$(".btn-icon",i.cmpEl);n&&(n.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-align-left",n.addClass(i.options.icls)),this.api&&e.checked&&this.api.put_PrAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onMarkers:function(t,e){var i={data:{type:0,subtype:t.pressed?0:-1}};this.onSelectBullets(null,null,null,i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onNumbers:function(t,e){var i={data:{type:1,subtype:t.pressed?0:-1}};this.onSelectBullets(null,null,null,i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onFontNameSelect:function(t,e){this.api&&(e.isNewFont?Common.UI.warning({width:500,closable:!1,msg:this.confirmAddFontName,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){"yes"==t?(this.api.put_TextPrFontName(e.name),Common.component.Analytics.trackEvent("ToolBar","Font Name")):this.toolbar.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},this)}):(this.api.put_TextPrFontName(e.name),Common.component.Analytics.trackEvent("ToolBar","Font Name"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},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.put_TextPrFontSize(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),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>100?100:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.put_TextPrFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSelectBullets:function(t,e,i,n){var o={};if(_.isFunction(n.toJSON)){if(!n.get("selected"))return;o=n.toJSON()}else o=n;t&&t.toggle(o.data.subtype>-1,!0),this._state.bullets.type=o.data.type,this._state.bullets.subtype=o.data.subtype,this.api&&this.api.put_ListType(o.data.type,o.data.subtype),Common.component.Analytics.trackEvent("ToolBar","List Type"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onLineSpaceToggle:function(t,e,i,n){i&&(this._state.linespace=void 0,this.api&&this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO,e.value),Common.component.Analytics.trackEvent("ToolBar","Line Spacing"),Common.NotificationCenter.trigger("edit:complete",this.toolbar))},onMenuNonPrintingToggle:function(t,e,i,n){var o=this;"characters"===e.value?(Common.localStorage.setItem("de-show-hiddenchars",i),o.toolbar.btnShowHidenChars.toggle(i,!0),o.api&&o.api.put_ShowParaMarks(i),Common.NotificationCenter.trigger("edit:complete",o),Common.component.Analytics.trackEvent("ToolBar","Hidden Characters")):"table"===e.value&&(Common.localStorage.setItem("de-show-tableline",i),o.api&&o.api.put_ShowTableEmptyLine(i),Common.NotificationCenter.trigger("edit:complete",o))},onNonPrintingToggle:function(t,e){var i=this;e?(i.toolbar.mnuNonPrinting.items[0].setChecked(!0,!0),Common.component.Analytics.trackEvent("ToolBar","Hidden Characters")):i.toolbar.mnuNonPrinting.items[0].setChecked(!1,!0),i.api&&i.api.put_ShowParaMarks(e),Common.localStorage.setItem("de-show-hiddenchars",e),Common.NotificationCenter.trigger("edit:complete",i)},onPageBreakClick:function(t,e,i){this.api&&("section"===e.value||("column"===e.value?(this.api.put_AddColumnBreak(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Column Break")):(this.api.put_AddPageBreak(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Page Break"))))},onSectionBreakClick:function(t,e,i){this.api&&(this.api.add_SectionBreak(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Section Break"))},onHyperlinkClick:function(t){var e,i,n,o=this;if(o.api){var s=function(t,e){"ok"==e&&(i=t.getSettings(),!1!==n?o.api.add_Hyperlink(i):o.api.change_Hyperlink(i)),Common.NotificationCenter.trigger("edit:complete",o.toolbar)};if(!1!==(n=o.api.can_AddHyperlink()))e=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:s}),i=new Asc.CHyperlinkProperty,i.put_Text(n),e.show(),e.setSettings(i);else{var a=o.api.getSelectedElements();a&&_.isArray(a)&&_.each(a,function(t,e){a[e].get_ObjectType()==Asc.c_oAscTypeSelectElement.Hyperlink&&(i=a[e].get_ObjectValue())}),i&&(e=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:s}),e.show(),e.setSettings(i))}}Common.component.Analytics.trackEvent("ToolBar","Add Hyperlink")},onTablePickerSelect:function(t,e,i,n){this.api&&(this.toolbar.fireEvent("inserttable",this.toolbar),this.api.put_Table(e,i)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table")},onInsertTableClick:function(t,e,i){if("custom"===e.value){var n=this;new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&(n.api&&(n.toolbar.fireEvent("inserttable",n.toolbar),n.api.put_Table(e.columns,e.rows)),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table"))}}).show()}},onInsertImageClick: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",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Image")):new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t){if(n.api){var i=e.replace(/ /g,"");_.isEmpty(i)?Common.UI.warning({msg:this.textEmptyImgUrl}):(n.toolbar.fireEvent("insertimage",n.toolbar),n.api.AddImageUrl(i),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",n.toolbar)}}}).show()},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")},onInsertTextClick:function(t,e,i){"text"===e.value&&(this.api&&this._addAutoshape(!0,"textRect"),this.toolbar.btnInsertText.toggle(!0,!0),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,this.toolbar.btnInsertShape)},onPageOrientSelect:function(t,e){this._state.pgorient=void 0,this.api&&e.checked&&this.api.change_PageOrient(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Page Orientation")},onClearStyleClick:function(t,e){this.api&&this.api.ClearFormating(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onCopyStyleToggle:function(t,e,i){this.api&&this.api.SetPaintFormat(e?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),this.modeAlwaysSetStyle=e},onAdvSettingsClick:function(t,e){this.toolbar.fireEvent("file:settings",this),t.cmpEl.blur()},onPageSizeClick:function(t,e,i){if(this.api&&i){if(this._state.pgsize=[0,0],"advanced"!==e.value)this.api.change_DocSize(e.value[0],e.value[1]);else{var n,o=this.api.asc_GetSectionProps(),s=this;n=new DE.Views.PageSizeDialog({handler:function(t,e){"ok"==e&&(o=t.getSettings(),s.api.change_DocSize(o[0],o[1]),Common.NotificationCenter.trigger("edit:complete",s.toolbar))}}),n.show(),n.setSettings(s.api.asc_GetSectionProps())}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){var i=this.api.asc_GetSectionProps(),n=null,o=this;if(e.value[1]+e.value[3]>parseFloat(i.get_W().toFixed(4))-12.7?n=this.txtMarginsW:e.value[0]+e.value[2]>parseFloat(i.get_H().toFixed(4))-2.6&&(n=this.txtMarginsH),n)return Common.UI.warning({title:this.notcriticalErrorTitle,msg:n,callback:function(){Common.NotificationCenter.trigger("edit:complete",o.toolbar)}}),void this.onSectionProps(i);var s=new Asc.CDocumentSectionProps;s.put_TopMargin(e.value[0]),s.put_LeftMargin(e.value[1]),s.put_BottomMargin(e.value[2]),s.put_RightMargin(e.value[3]),this.api.asc_SetSectionProps(s)}else{var a,s,o=this;a=new DE.Views.PageMarginsDialog({handler:function(t,e){if("ok"==e){s=t.getSettings();var i=o.toolbar.btnPageMargins.menu.items[0];i.setVisible(!0),i.setChecked(!0),i.options.value=i.value=[s.get_TopMargin(),s.get_LeftMargin(),s.get_BottomMargin(),s.get_RightMargin()],$(i.el).html(i.template({id:Common.UI.getId(),caption:i.caption,options:i.options})),Common.localStorage.setItem("de-pgmargins-top",s.get_TopMargin()),Common.localStorage.setItem("de-pgmargins-left",s.get_LeftMargin()),Common.localStorage.setItem("de-pgmargins-bottom",s.get_BottomMargin()),Common.localStorage.setItem("de-pgmargins-right",s.get_RightMargin()),o.api.asc_SetSectionProps(s),Common.NotificationCenter.trigger("edit:complete",o.toolbar)}}}),a.show(),a.setSettings(o.api.asc_GetSectionProps())}Common.component.Analytics.trackEvent("ToolBar","Page Margins")}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onColorSchemaClick:function(t,e){this.api&&(this.api.ChangeColorScheme(e.value),Common.component.Analytics.trackEvent("ToolBar","Color Scheme")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onDropCapSelect:function(t,e){if(!_.isUndefined(e.value)){if(this._state.dropcap=void 0,this.api&&e.checked)if(e.value===Asc.c_oAscDropCap.None)this.api.removeDropcap(!0);else for(var i=this.api.getSelectedElements(),n=-1;++n<i.length;)if(i[n].get_ObjectType()==Asc.c_oAscTypeSelectElement.Paragraph){var o=i[n].get_ObjectValue(),s=o.get_FramePr();_.isUndefined(s)?this.api.asc_addDropCap(e.value===Asc.c_oAscDropCap.Drop):(s=new Asc.asc_CParagraphFrame,s.put_FromDropCapMenu(!0),s.put_DropCap(e.value),this.api.put_FramePr(s));break}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Drop Cap")}},onDropCap:function(t){if(this._state.dropcap!==t){var e=-1;switch(t){case Asc.c_oAscDropCap.None:e=0;break;case Asc.c_oAscDropCap.Drop:e=1;break;case Asc.c_oAscDropCap.Margin:e=2}e<0?this._clearChecked(this.toolbar.btnDropCap.menu):this.toolbar.btnDropCap.menu.items[e].setChecked(!0),this._state.dropcap=t}},onDropCapAdvancedClick:function(){var t,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)}if(e.api){var o=e.api.getSelectedElements(),s=o.length;if(o&&_.isArray(o))for(var a=0;a<s;a++)if(o[a].get_ObjectType()==Asc.c_oAscTypeSelectElement.Paragraph){t=o[a].get_ObjectValue();break}t&&new DE.Views.DropcapSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,fontStore:e.fontstore,paragraphProps:t,borderProps:e.borderAdvancedProps,api:e.api,isFrame:!1,handler:function(t,i){"ok"==t&&(e.borderAdvancedProps=i.borderProps,i.paragraphProps&&i.paragraphProps.get_DropCap()===Asc.c_oAscDropCap.None?e.api.removeDropcap(!0):e.api.put_FramePr(i.paragraphProps)),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show()}},onColumnsSelect:function(t,e){if(!_.isUndefined(e.value)){if(this._state.columns=void 0,this.api&&e.checked){var i=new Asc.CDocumentColumnsProps,n=e.value;if(i.put_EqualWidth(n<3),n<3)i.put_Num(n+1),i.put_Space(12.5);else{var o=this.api.asc_GetColumnsProps().get_TotalWidth(),s=(o-25)/3,a=o-12.5-s;i.put_ColByValue(0,3==n?s:a,12.5),i.put_ColByValue(1,3==n?a:s,0)}this.api.asc_SetColumnsProps(i)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Insert Columns")}},onColumnsProps:function(t){if(t){var e=t.get_EqualWidth(),i=e?t.get_Num():t.get_ColsCount(),n=-1;if(e&&i<4&&(1==i||Math.abs(t.get_Space()-12.5)<.1))n=i-1;else if(!e&&2==i){var o=t.get_Col(0).get_W(),s=t.get_Col(0).get_Space(),a=t.get_Col(1).get_W(),r=t.get_TotalWidth();if(Math.abs(s-12.5)<.1){var l=(r-2*s)/3;o<a&&Math.abs(o-l)<.1?n=3:o>a&&Math.abs(a-l)<.1&&(n=4)}}if(this._state.columns===n)return;n<0?this._clearChecked(this.toolbar.btnColumns.menu):this.toolbar.btnColumns.menu.items[n].setChecked(!0),this._state.columns=n}},onSelectChart:function(t,e,i){var n=this,o=i.get("type"),s=!1,a=n.api.getSelectedElements();if(a&&_.isArray(a))for(var r=0;r<a.length;r++)if(Asc.c_oAscTypeSelectElement.Image==a[r].get_ObjectType()){var l=a[r].get_ObjectValue().get_ChartProperties();if(l){s=l;break}}if(s){var c=new Asc.asc_CImgProperty;s.changeType(o),c.put_ChartProperties(s),this.api.ImgApply(c),Common.NotificationCenter.trigger("edit:complete",this.toolbar)}else this.diagramEditor||(this.diagramEditor=this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor")),this.diagramEditor&&n.api&&(this.diagramEditor.setEditMode(!1),this.diagramEditor.show(),s=n.api.asc_getChartObject(o),s&&this.diagramEditor.setChartData(new Asc.asc_CChartBinary(s)),n.toolbar.fireEvent("insertchart",n.toolbar))},onInsertPageNumberClick:function(t,e,i){this.api&&this.api.put_PageNum(i.get("data").type,i.get("data").subtype),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Page Number")},onInsertPageCountClick:function(t,e){this.api&&this.api.asc_AddPageCount(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Pages Count")},onEditHeaderFooterClick:function(t,e){if(this.api){if("header"==e.value)this.api.GoToHeader(this.api.getCurrentPage());else{if("footer"!=e.value)return;this.api.GoToFooter(this.api.getCurrentPage())}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Edit "+e.value)}},onPageNumCurrentPosClick:function(t,e){this.api&&this.api.put_PageNum(-1),"click"!==e.type&&this.toolbar.btnEditHeader.menu.hide(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Page Number")},onListStyleSelect:function(t,e){this._state.prstyle=void 0,this.api&&this.api.put_Style(e.get("title")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style")},onListStyleBeforeHide:function(t,e){this.toolbar.listStyles.isStylesNotClosable=!1},onListStyleContextMenu:function(t,e,i){if(this.toolbar.mode.canEditStyles){var n,o=this.toolbar.styleMenu,s=this.api,a=!0,r=!0;_.each(window.styles.get_MergedStyles(),function(t){s.asc_IsStyleDefault(t.get_Name())?s.asc_IsDefaultStyleChanged(t.get_Name())&&(r=!1):a=!1}),o.items[3].setDisabled(r),o.items[4].setDisabled(a);var l=i.clientY*Common.Utils.zoom();if($("#header-container").is(":visible")&&(l-=$("#header-container").height()),n=[i.clientX*Common.Utils.zoom(),l],void 0!=e){var c=this.api.asc_IsStyleDefault(e.get("title"));o.items[0].setVisible(!0),o.items[1].setVisible(!c),o.items[2].setVisible(c),o.items[3].setVisible(c),o.items[4].setVisible(!c),o.items[2].setDisabled(!this.api.asc_IsDefaultStyleChanged(e.get("title")));for(var d in o.items)o.items[d].styleTitle=e.get("title");var h=s.getSelectedElements(),p=!1;if(h&&_.isArray(h))for(var d=0;d<h.length;d++)if(Asc.c_oAscTypeSelectElement.Paragraph==h[d].get_ObjectType()){p=!0;break}o.items[0].setDisabled(!p)}else o.items[0].setVisible(!1),o.items[1].setVisible(!1),o.items[2].setVisible(!1),o.items[3].setVisible(!0),o.items[4].setVisible(!0);if(void 0!=n){var m=this.toolbar.$el.find("#menu-style-container");o.rendered||(m.length<1&&(m=$('<div id="menu-style-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',o.id),$(this.toolbar.el).append(m)),
|
|
|
o.render(m),o.cmpEl.attr({tabindex:"-1"})),m.css({left:n[0],top:n[1]});var u=$(o.el);u.trigger($.Event("show.bs.dropdown")),u.trigger($.Event("hide.bs.dropdown")),o.isVisible()&&$(o).toggleClass("open").trigger("shown.bs.dropdown"),this.toolbar.listStyles.isStylesNotClosable=!0,o.show()}}},onSaveStyle:function(t){window.styles_loaded=!1;var e,i=this;if(i.api){var n=function(e,n){if("ok"==n){var o=e.getTitle(),s=e.getNextStyle(),a=t.get_Link();i._state.prstyle=o,t.put_Name(o),a.put_Name(o+"_character"),t.put_Next(s.asc_getName()),i.api.asc_AddNewStyle(t)}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},o=[];_.each(window.styles.get_MergedStyles(),function(t){o.push({value:t,displayValue:t.get_Name()})}),e=new DE.Views.StyleTitleDialog({handler:n,formats:o}),e.show()}Common.component.Analytics.trackEvent("ToolBar","Save as Style")},onMenuSaveStyle:function(t,e){var i=this;i.api&&!i.toolbar.listStylesAdditionalMenuItem.isDisabled()&&i.onSaveStyle(i.api.asc_GetStyleFromFormatting())},onUpdateStyle:function(t){this.api&&(t.put_Name(this._state.prstyle),this.api.asc_AddNewStyle(t))},onHideTitleBar:function(t,e){var i=this.getApplication().getController("Viewport").getView("Common.Views.Header");i&&i.setVisible(!e),Common.localStorage.setItem("de-hidden-title",e?1:0),Common.NotificationCenter.trigger("layout:changed","header"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideStatusBar:function(t,e){var i=this.getApplication().getController("Statusbar").getView("Statusbar");i&&i.setVisible(!e),Common.localStorage.setItem("de-hidden-status",e?1:0),Common.NotificationCenter.trigger("layout:changed","status"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideRulers:function(t,e){this.api&&this.api.asc_SetViewRulers(!e),Common.localStorage.setItem("de-hidden-rulers",e?1:0),Common.NotificationCenter.trigger("layout:changed","rulers"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomToPageToggle:function(t,e){this.api&&(e?this.api.zoomFitToPage():this.api.zoomCustomMode()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomToWidthToggle:function(t,e){this.api&&(e?this.api.zoomFitToWidth():this.api.zoomCustomMode()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomInClick:function(t){this.api&&this.api.zoomIn(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomOutClick:function(t){this.api&&this.api.zoomOut(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onNotesClick:function(){this.api&&this.api.asc_AddFootnote()},onNotesMenuClick:function(t,e){if(this.api){if("ins_footnote"==e.value)this.api.asc_AddFootnote();else if("delele"==e.value)Common.UI.warning({msg:this.confirmDeleteFootnotes,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){"yes"==t&&this.api.asc_RemoveAllFootnotes(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},this)});else{if("settings"!=e.value)return;var i=this;new DE.Views.NoteSettingsDialog({api:i.api,handler:function(t,e){e&&(i.api.asc_SetFootnoteProps(e.props,e.applyToAll),"insert"==t&&i.api.asc_AddFootnote(e.custom)),Common.NotificationCenter.trigger("edit:complete",i.toolbar)},props:i.api.asc_GetFootnoteProps()}).show()}Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onFootnotePrevClick:function(t){this.api&&this.api.asc_GotoFootnote(!1);var e=this;setTimeout(function(){Common.NotificationCenter.trigger("edit:complete",e.toolbar)},50)},onFootnoteNextClick:function(t){this.api&&this.api.asc_GotoFootnote(!0);var e=this;setTimeout(function(){Common.NotificationCenter.trigger("edit:complete",e.toolbar)},50)},_clearBullets:function(){this.toolbar.btnMarkers.toggle(!1,!0),this.toolbar.btnNumbers.toggle(!1,!0),this.toolbar.btnMultilevels.toggle(!1,!0),this.toolbar.mnuMarkersPicker.selectByIndex(0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(0,!0),this.toolbar.mnuMultilevelPicker.selectByIndex(0,!0)},_getApiTextSize:function(){var t=12,e=this.api.get_TextProps();return e&&e.get_TextPr&&(t=e.get_TextPr().get_FontSize()),t},onNewFontColor:function(t,e){this.toolbar.mnuFontColorPicker.addNewColor()},onAutoFontColor:function(t){this._state.clrtext=this._state.clrtext_asccolor=void 0;var e=new Asc.asc_CColor;e.put_auto(!0),this.api.put_TextColor(e),this.toolbar.btnFontColor.currentColor={color:e,isAuto:!0},$(".btn-color-value-line",this.toolbar.btnFontColor.cmpEl).css("background-color","#000"),this.toolbar.mnuFontColorPicker.clearSelection(),this.toolbar.mnuFontColorPicker.currentColor={color:e,isAuto:!0}},onNewParagraphColor:function(t,e){this.toolbar.mnuParagraphColorPicker.addNewColor()},onSelectHighlightColor:function(t,e){this._setMarkerColor(e,"menu")},onSelectFontColor:function(t,e){this._state.clrtext=this._state.clrtext_asccolor=void 0;var i="object"==typeof e?e.isAuto?"#000":e.color:e;this.toolbar.btnFontColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnFontColor.cmpEl).css("background-color","#"+i),this.toolbar.mnuFontColorPicker.currentColor=e,this.api&&this.api.put_TextColor(e.isAuto?e.color:Common.Utils.ThemeColor.getRgbColor(e)),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onParagraphColorPickerSelect:function(t,e){this._state.clrback=this._state.clrshd_asccolor=void 0;var i="object"==typeof e?e.color:e;this.toolbar.btnParagraphColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnParagraphColor.cmpEl).css("background-color","transparent"!=e?"#"+i:i),this.toolbar.mnuParagraphColorPicker.currentColor=e,this.api&&("transparent"==e?this.api.put_ParagraphShade(!1):this.api.put_ParagraphShade(!0,Common.Utils.ThemeColor.getRgbColor(e))),Common.NotificationCenter.trigger("edit:complete",this)},onBtnHighlightColor:function(t){t.pressed?(this._setMarkerColor(t.currentColor),Common.component.Analytics.trackEvent("ToolBar","Highlight Color")):this.api.SetMarkerFormat(!1)},onBtnFontColor:function(){this.toolbar.mnuFontColorPicker.trigger("select",this.toolbar.mnuFontColorPicker,this.toolbar.mnuFontColorPicker.currentColor)},onBtnParagraphColor:function(){this.toolbar.mnuParagraphColorPicker.trigger("select",this.toolbar.mnuParagraphColorPicker,this.toolbar.mnuParagraphColorPicker.currentColor)},onHighlightTransparentClick:function(t,e){this._setMarkerColor("transparent","menu"),t.setChecked(!0,!0),this.toolbar.btnHighlightColor.currentColor="transparent",$(".btn-color-value-line",this.toolbar.btnHighlightColor.cmpEl).css("background-color","transparent")},onParagraphColor:function(t){var e,i=this.toolbar.mnuParagraphColorPicker;if(null!==t&&void 0!==t&&t.get_Value()===Asc.c_oAscShdClear){var n=t.get_Color();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"}else e="transparent";var o=typeof e;if(o!==typeof this._state.clrback||"object"==o&&(e.effectValue!==this._state.clrback.effectValue||this._state.clrback.color.indexOf(e.color)<0)||"object"!=o&&this._state.clrback.indexOf(e)<0){if("object"==typeof e){for(var s=!1,a=0;a<10;a++)if(Common.Utils.ThemeColor.ThemeValues[a]==e.effectValue){i.select(e,!0),s=!0;break}s||i.clearSelection()}else i.select(e,!0);this._state.clrback=e}this._state.clrshd_asccolor=t},onApiTextColor:function(t){if(t.get_auto()){if("auto"!==this._state.clrtext){this.toolbar.mnuFontColorPicker.clearSelection();var e=this.toolbar.btnFontColor.menu.$el.find("#id-toolbar-menu-auto-fontcolor > a");!e.hasClass("selected")&&e.addClass("selected"),this._state.clrtext="auto"}}else{var i,n=this.toolbar.mnuFontColorPicker;t&&(i=t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()}:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()));var o=typeof i,s=typeof this._state.clrtext;if("auto"==this._state.clrtext||o!==s||"object"==o&&(i.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(i.color)<0)||"object"!=o&&this._state.clrtext.indexOf(i)<0){var e=this.toolbar.btnFontColor.menu.$el.find("#id-toolbar-menu-auto-fontcolor > a");if(e.hasClass("selected")&&e.removeClass("selected"),"object"==typeof i){for(var a=!1,r=0;r<10;r++)if(Common.Utils.ThemeColor.ThemeValues[r]==i.effectValue){n.select(i,!0),a=!0;break}a||n.clearSelection()}else n.select(i,!0);this._state.clrtext=i}}this._state.clrtext_asccolor=t},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"><img src="<%= imageUrl %>" id="<%= id %>"></div>')}).on("item:click",function(e,i,n,o){t.api&&(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"))})}},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&&(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._state.in_equation&&(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 r=s.split("_");a=2==r.length&&"Symbol"==r[0]?"txt"+r[0]+"_"+r[1].toLocaleLowerCase():"txt"+s,o[Common.define.c_oAscMathType[s]]=this[a]}var l,c=0,d=0,h=0,p=0,m=0,u=null,g=null,b=null;if(t&&(d=t.get_Data().length)){for(var f=0;f<d;++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:DE.Models.EquationModel})){var C=0,v=0,_=0;for(h=t.get_Data()[f].get_Data().length,l=0;l<h;++l){g=t.get_Data()[f].get_Data()[l],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 w=parseInt(370/(m+10))*(m+10);e.push({groupName:n[c][0],groupStore:u,groupWidth:p,groupHeight:n[c][2]?" height:"+w+"px!important; ":""})}i.add(e),this.fillEquations()}},fillTextArt:function(){if(this.toolbar.btnInsertText.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.mnuInsertTextArt.menu,showLast:!1,itemTemplate:_.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>"></div>')}),this.toolbar.mnuTextArtPicker.on("item:click",function(e,i,n,o){t.api&&(t.toolbar.fireEvent("inserttextart",t.toolbar),t.api.AddTextArt(n.get("data")),t.toolbar.btnInsertShape.pressed&&t.toolbar.btnInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertText.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertText),Common.component.Analytics.trackEvent("ToolBar","Add Text Art"))})}},activateControls:function(){_.each(this.toolbar.toolbarControls,function(t){t.setDisabled(!1)},this),this.toolbar.btnUndo.setDisabled(!0!==this._state.can_undo),this.toolbar.btnRedo.setDisabled(!0!==this._state.can_redo),this.toolbar.btnCopy.setDisabled(!0!==this._state.can_copycut),this.toolbar.btnPrint.setDisabled(!this.toolbar.mode.canPrint),this.toolbar.mode.fileChoiceUrl&&this.toolbar.btnMailRecepients.setDisabled(!1),this._state.activated=!0;var t=this.api.asc_GetSectionProps();this.onApiPageSize(t.get_W(),t.get_H())},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=n[e]:void 0!==i&&(t.currentColor=i)}};t(this.toolbar.mnuFontColorPicker,1),void 0!==this.toolbar.btnFontColor.currentColor&&this.toolbar.btnFontColor.currentColor.isAuto||(this.toolbar.btnFontColor.currentColor=this.toolbar.mnuFontColorPicker.currentColor.color||this.toolbar.mnuFontColorPicker.currentColor,$(".btn-color-value-line",this.toolbar.btnFontColor.cmpEl).css("background-color","#"+this.toolbar.btnFontColor.currentColor)),void 0!==this._state.clrtext_asccolor&&(this._state.clrtext=void 0,this.onApiTextColor(this._state.clrtext_asccolor)),this._state.clrtext_asccolor=void 0,t(this.toolbar.mnuParagraphColorPicker,0),this.toolbar.btnParagraphColor.currentColor=this.toolbar.mnuParagraphColorPicker.currentColor.color||this.toolbar.mnuParagraphColorPicker.currentColor,$(".btn-color-value-line",this.toolbar.btnParagraphColor.cmpEl).css("background-color","#"+this.toolbar.btnParagraphColor.currentColor),void 0!==this._state.clrshd_asccolor&&(this._state.clrback=void 0,this.onParagraphColor(this._state.clrshd_asccolor)),this._state.clrshd_asccolor=void 0},_clearChecked:function(t){_.each(t.items,function(t){t.setChecked&&t.setChecked(!1,!0)})},_onInitEditorStyles:function(t){window.styles_loaded=!1;var e=this,i=e.toolbar.listStyles;if(window.styles=t,!i)return void(e.styles=t);if(i.menuPicker.store.reset([]),_.each(t.get_MergedStyles(),function(t){i.menuPicker.store.add({imageUrl:t.asc_getImage(),title:t.get_Name(),tip:t.get_Name(),id:Common.UI.getId()})}),i.menuPicker.store.length>0&&i.rendered){var n;e._state.prstyle&&(n=i.menuPicker.store.findWhere({title:e._state.prstyle})),i.fillComboView(n||i.menuPicker.store.at(0),!0),Common.NotificationCenter.trigger("edit:complete",this)}window.styles_loaded=!0},_setMarkerColor:function(t,e){var i=this;if("menu"===e&&(i.toolbar.mnuHighlightTransparent.setChecked(!1),i.toolbar.btnHighlightColor.currentColor=t,$(".btn-color-value-line",i.toolbar.btnHighlightColor.cmpEl).css("background-color","#"+t),i.toolbar.btnHighlightColor.toggle(!0,!0),i.toolbar.btnHighlightColor.cmpEl.removeClass("open")),"transparent"==(t=t||"transparent"))i.api.SetMarkerFormat(!0,!1);else{var n=t[0]+t[1],o=t[2]+t[3],s=t[4]+t[5];i.api.SetMarkerFormat(!0,!0,parseInt(n,16),parseInt(o,16),parseInt(s,16))}Common.NotificationCenter.trigger("edit:complete",i.toolbar,i.toolbar.btnHighlightColor),Common.component.Analytics.trackEvent("ToolBar","Highlight Color")},onHideMenus:function(t){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSetupCopyStyleButton:function(){this.modeAlwaysSetStyle=!1;var t={kOff:0,kOn:1,kMultiple:2},e=this;Common.NotificationCenter.on({"edit:complete":function(){e.api&&e.modeAlwaysSetStyle&&(e.api.SetPaintFormat(t.kOff),e.toolbar.btnCopyStyle.toggle(!1,!0),e.modeAlwaysSetStyle=!1)}}),$(e.toolbar.btnCopyStyle.cmpEl).dblclick(function(){e.api&&(e.modeAlwaysSetStyle=!0,e.toolbar.btnCopyStyle.toggle(!0,!0),e.api.SetPaintFormat(t.kMultiple))})},onApiCoAuthoringDisconnect:function(t){this.toolbar.setMode({isDisconnected:!0,disableDownload:!!t}),this.editMode=!1},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;if(n.$el.find(".toolbar").toggleClass("masked",t),n.btnHide.setDisabled(t),t){i=$("<div class='toolbar-mask'>").appendTo(n.$el);var o=n.isCompactView?75:n.mode.nativeApp?80:48;i.css("left",o+"px"),i.css("right",(n.isCompactView?0:45)+"px"),Common.util.Shortcuts.suspendEvents("alt+h")}else i.remove(),Common.util.Shortcuts.resumeEvents("alt+h")}},onSelectRecepientsClick:function(){if(!this._mailMergeDlg){var t=this;t._mailMergeDlg=new DE.Views.MailMergeRecepients({fileChoiceUrl:this.toolbar.mode.fileChoiceUrl}),t._mailMergeDlg.on("mailmergerecepients",function(e,i){t.api.asc_StartMailMerge(i),t.mergeEditor||(t.mergeEditor=t.getApplication().getController("Common.Controllers.ExternalMergeEditor").getView("Common.Views.ExternalMergeEditor")),t.mergeEditor&&t.mergeEditor.setEditMode(!1)}).on("close",function(e){t._mailMergeDlg=void 0}),t._mailMergeDlg.show()}},createDelayedElements:function(){this.toolbar.createDelayedElements(),this.onToolbarAfterRender(this.toolbar)},textEmptyImgUrl:"You need to specify image URL.",textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.<br>Please enter a numeric value between 1 and 100",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",confirmAddFontName:"The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?",notcriticalErrorTitle:"Warning",txtMarginsW:"Left and right margins are too high for a given page wight",txtMarginsH:"Top and bottom margins are too high for a given page height",confirmDeleteFootnotes:"Do you want to delete all footnotes?"},DE.Controllers.Toolbar||{}))}),define("text!documenteditor/main/app/template/StatusBar.template",[],function(){return'\r\n<div class="statusbar" style="display:table;">\r\n <div class="status-group dropup">\r\n <label id="label-pages" class="status-label dropdown-toggle" style="margin-left: 40px;" data-toggle="dropdown"><%= Common.Utils.String.format(scope.pageIndexText, 1, 1) %></label>\r\n <div id="status-goto-box" class="dropdown-menu">\r\n <label style="float:left;line-height:22px;"><%= scope.goToPageText %></label>\r\n <div id="status-goto-page" style="display:inline-block;"></div>\r\n </div>\r\n </div>\r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n <div id="status-users-ct" class="status-group dropup" style="display:none;">\r\n <div class="separator short" style="margin-right: 12px; margin-left: 40px;" />\r\n <div id="status-users-block" style="display:inline-block; cursor:pointer;">\r\n <span id="users-icon" class="img-commonctrl" style="margin-bottom: 2px;"/>\r\n <label id="status-users-count" class="status-label" style="font-size: 14px; font-weight: normal; margin-top: -1px;">+</label>\r\n </div>\r\n <div id="status-users-menu" class="dropdown-menu">\r\n <label style="display: block;margin-right: 14px;"><%= scope.tipUsers %></label>\r\n <div id="status-users-list"></div>\r\n <label id="status-change-rights" class="link" style="margin-top: 15px;"><%= scope.txAccessRights %></label>\r\n </div>\r\n <div class="separator short" style="margin-left: 10px;" />\r\n </div>\r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n <div class="status-group" style="width:100%; text-align:center;">\r\n <label id="label-action" class="status-label"></label>\r\n </div>\r\n <div class="status-group" style="">\r\n <div class="separator short el-edit"></div>\r\n <div class="cnt-lang el-edit">\r\n <div class="dropdown-toggle" data-toggle="dropdown" style="margin-right: 6px;">\r\n <span class="icon-lang-flag img-toolbarmenu lang-flag" data-vertical-offset="10" />\r\n <label id="status-label-lang" class="status-label">English (United States)</label>\r\n <div class="caret up img-commonctrl" />\r\n </div>\r\n </div>\r\n <button id="btn-doc-lang" type="button" class="btn small btn-toolbar el-edit"><span class="btn-icon btn-ic-doclang"> </span></button>\r\n <button id="btn-doc-spell" type="button" class="btn small btn-toolbar el-edit"><span class="btn-icon btn-ic-docspell"> </span></button>\r\n <div class="separator short el-edit"></div>\r\n <div id="btn-doc-review" class="el-edit el-review" style="display: inline-block;"></div>\r\n <div class="separator short el-edit el-review"></div>\r\n <button id="btn-zoom-topage" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-ic-zoomtopage"> </span></button>\r\n <button id="btn-zoom-towidth" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-ic-zoomtowidth"> </span></button>\r\n <button id="btn-zoom-down" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-ic-zoomdown"> </span></button>\r\n <div class="cnt-zoom">\r\n <div class="dropdown-toggle" data-toggle="dropdown">\r\n <label id="label-zoom" class="status-label">Zoom 100%</label>\r\n </div>\r\n </div>\r\n <button id="btn-zoom-up" type="button" class="btn small btn-toolbar" style="margin-right:40px;"><span class="btn-icon btn-ic-zoomup"> </span></button>\r\n </div>\r\n</div>\r\n'}),define("documenteditor/main/app/model/Pages",["underscore","backbone"],function(t,e){"use strict";DE.Models=DE.Models||{},DE.Models.Pages=e.Model.extend({defaults:{current:0,count:0}})}),define("documenteditor/main/app/view/Statusbar",["text!documenteditor/main/app/template/StatusBar.template","jquery","underscore","backbone","tip","common/main/lib/component/Menu","common/main/lib/component/Window","documenteditor/main/app/model/Pages"],function(t,e,i,n){"use strict";function o(t){this.pages.set("count",t)}function s(t){this.pages.set("current",t+1)}function a(t,i,n){e(".statusbar #label-pages",this.$el).text(Common.Utils.String.format(this.pageIndexText,t.get("current"),t.get("count")))}function r(t,i,n){var o=e(t.el.parentNode,this.$el);o.find("#status-label-lang").text(i.caption),o.find(".icon-lang-flag").removeClass(this.langMenu.prevTip).addClass(i.value.tip),this.langMenu.prevTip=i.value.tip,this.fireEvent("langchanged",[this,i.value.code,i.caption])}i.template("Page <%= current %> of <%= count %>");if(DE.Views.Statusbar)var l=DE.Views.Statusbar.LanguageDialog||{};DE.Views.Statusbar=n.View.extend(i.extend({el:"#statusbar",template:i.template(t),storeUsers:void 0,tplUser:['<li id="status-chat-user-<%= user.get("id") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">','<div class="color" style="background-color: <%= user.get("color") %>;" >','<label class="name"><%= scope.getUserName(user.get("username")) %></label>',"</div>","</li>"].join(""),templateUserList:i.template("<ul><% _.each(users, function(item) { %><%= _.template(usertpl, {user: item, scope: scope}) %><% }); %></ul>"),events:{},api:void 0,pages:void 0,initialize:function(t){i.extend(this,t),this.pages=new DE.Models.Pages({current:1,count:1}),this.pages.on("change",i.bind(a,this)),this.state={}},render:function(){var t=this;this.$el.html(this.template({scope:this})),this.btnZoomToPage=new Common.UI.Button({el:e("#btn-zoom-topage",this.el),hint:this.tipFitPage,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomToWidth=new Common.UI.Button({el:e("#btn-zoom-towidth",this.el),hint:this.tipFitWidth,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomDown=new Common.UI.Button({el:e("#btn-zoom-down",this.el),hint:this.tipZoomOut+Common.Utils.String.platformKey("Ctrl+-"),hintAnchor:"top"}),this.btnZoomUp=new Common.UI.Button({el:e("#btn-zoom-up",this.el),hint:this.tipZoomIn+Common.Utils.String.platformKey("Ctrl++"),hintAnchor:"top-right"}),this.btnDocLanguage=new Common.UI.Button({el:e("#btn-doc-lang",this.el),hint:this.tipSetDocLang,hintAnchor:"top",disabled:!0}),this.btnSetSpelling=new Common.UI.Button({el:e("#btn-doc-spell",this.el),enableToggle:!0,hint:this.tipSetSpelling,hintAnchor:"top"}),this.btnReview=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-ic-review",hint:this.tipReview,hintAnchor:"top",enableToggle:!0,split:!0,menu:new Common.UI.Menu({menuAlign:"bl-tl",style:"margin-top:-5px;",items:[this.mnuTrackChanges=new Common.UI.MenuItem({caption:this.textTrackChanges,checkable:!0,value:"track"}),this.mnuChangesPanel=new Common.UI.MenuItem({caption:this.textChangesPanel,checkable:!0,value:"panel"})]})}),this.btnReview.render(e("#btn-doc-review")),this.btnReviewCls="btn-ic-review";var n=e(".cnt-lang",this.el);this.langMenu=new Common.UI.Menu({style:"margin-top:-5px;",maxHeight:300,itemTemplate:i.template(['<a id="<%= id %>" tabindex="-1" type="menuitem">','<span class="lang-item-icon img-toolbarmenu lang-flag <%= iconCls %>"></span>',"<%= caption %>","</a>"].join("")),menuAlign:"bl-tl"}),this.btnLanguage=new Common.UI.Button({el:n,hint:this.tipSetLang,hintAnchor:"top-left",disabled:!0}),this.btnLanguage.cmpEl.on({"show.bs.dropdown":function(){i.defer(function(){t.btnLanguage.cmpEl.find("ul").focus()},100)},"hide.bs.dropdown":function(){i.defer(function(){t.api.asc_enableKeyEvents(!0)},100)},click:function(e){if(t.btnLanguage.isDisabled())return!1}}),this.langMenu.render(n),this.langMenu.cmpEl.attr({tabindex:-1}),this.cntZoom=new Common.UI.Button({el:e(".cnt-zoom",this.el),hint:this.tipZoomFactor,hintAnchor:"top"}),this.cntZoom.cmpEl.on("show.bs.dropdown",function(){i.defer(function(){t.cntZoom.cmpEl.find("ul").focus()},100)}),this.cntZoom.cmpEl.on("hide.bs.dropdown",function(){i.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(e(".cnt-zoom",this.el)),this.zoomMenu.cmpEl.attr({tabindex:-1}),this.langMenu.prevTip="en",this.langMenu.on("item:click",i.bind(r,this)),this.panelUsersList=e("#status-users-list",this.el),this.storeUsers.bind({add:i.bind(this._onAddUser,this),change:i.bind(this._onUsersChanged,this),reset:i.bind(this._onResetUsers,this)}),this.panelUsers=e("#status-users-ct",this.el),this.panelUsers.on("shown.bs.dropdown",function(){t.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0});var e=t.panelUsersBlock.data("bs.tooltip");e&&e.hide()}),this.panelUsersBlock=this.panelUsers.find("#status-users-block"),this.panelUsersBlock.tooltip({title:this.tipAccessRights,html:!0,placement:"top"}),this.panelUsersBlock.on("click",i.bind(this.onUsersClick,this)),this.lblUserCount=this.panelUsers.find("#status-users-count"),this.lblChangeRights=this.panelUsers.find("#status-change-rights"),this.lblChangeRights.on("click",i.bind(this.onUsersClick,this)),this.$el.find("#status-users-menu").on("click",function(){return!1}),this.txtGoToPage=new Common.UI.InputField({el:e("#status-goto-page",t.$el),allowBlank:!0,validateOnChange:!0,style:"width: 60px;",maskExp:/[0-9]/,validation:function(e){return!!(/(^[0-9]+$)/.test(e)&&void 0!==(e=parseInt(e))&&e>0&&e<=t.pages.get("count"))||t.txtPageNumInvalid}}).on("keypress:after",function(e,i){if(i.keyCode===Common.UI.Keys.RETURN){var n=t.$el.find("#status-goto-box"),o=n.find("input[type=text]"),s=parseInt(o.val());return!s||s-- >t.pages.get("count")||s<0?(o.select(),!1):(n.focus(),n.parent().removeClass("open"),t.api.goToPage(s),t.api.asc_enableKeyEvents(!0),!1)}}).on("keyup:after",function(e,i){if(i.keyCode===Common.UI.Keys.ESC){var n=t.$el.find("#status-goto-box");return n.focus(),n.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0),!1}});var o=this.$el.find("#status-goto-box");return o.on("click",function(){return!1}),o.parent().on("show.bs.dropdown",function(){t.txtGoToPage.setValue(t.api.getCurrentPage()+1),t.txtGoToPage.checkValidate();var e=t.txtGoToPage.$el.find("input");i.defer(function(){e.focus(),e.select()},100)}),o.parent().on("hide.bs.dropdown",function(){var e=t.$el.find("#status-goto-box");t.api&&e&&(e.focus(),e.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0))}),this},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onCountPages",i.bind(o,this)),this.api.asc_registerCallback("asc_onCurrentPage",i.bind(s,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",i.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",i.bind(this.onApiUsersChanged,this))),this},setMode:function(t){this.mode=t,this.$el.find(".el-edit")[t.isEdit?"show":"hide"](),this.$el.find(".el-review")[t.canReview&&!t.isLightVersion?"show":"hide"](),this.lblChangeRights[!this.mode.isOffline&&!this.mode.isReviewOnly&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.panelUsers[!this.mode.isOffline&&!this.mode.isReviewOnly&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"]()},setVisible:function(t){t?this.show():this.hide()},onUsersClick:function(){this.panelUsers.removeClass("open"),this.fireEvent("click:users",this)},onApiUsersChanged:function(t){var n=0;i.each(t,function(t){t.asc_getView()||n++}),this.panelUsers[n>1||!this.mode.isReviewOnly&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.lblUserCount.css({"font-size":n>1?"11px":"14px","font-weight":n>1?"bold":"normal","margin-top":n>1?"0":"-1px"}),this.lblUserCount.text(n>1?n:"+"),e("#users-icon").css("margin-bottom",n>1?"0":"2px");var o=this.panelUsersBlock.data("bs.tooltip");o&&(o.options.title=n>1?this.tipViewUsers:this.tipAccessRights,o.setContent()),n>1?this.panelUsersBlock.attr("data-toggle","dropdown"):this.panelUsersBlock.removeAttr("data-toggle"),this.panelUsersBlock.toggleClass("dropdown-toggle",n>1),n>1?this.panelUsersBlock.off("click"):this.panelUsersBlock.on("click",i.bind(this.onUsersClick,this))},_onAddUser:function(t,e,n){this.panelUsersList&&(this.panelUsersList.find("ul").append(i.template(this.tplUser,{user:t,scope:this})),this.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},_onUsersChanged:function(t){void 0!=t.changed.online&&this.panelUsersList&&(this.panelUsersList.find("#status-chat-user-"+t.get("id"))[t.changed.online?"removeClass":"addClass"]("offline"),this.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},_onResetUsers:function(t,i){this.panelUsersList&&(this.panelUsersList.html(this.templateUserList({users:t.models,usertpl:this.tplUser,scope:this})),this.panelUsersList.scroller=new Common.UI.Scroller({el:e("#status-users-list ul"),useKeyboard:!0,minScrollbarLength:40,alwaysVisibleY:!0}))},getUserName:function(t){return Common.Utils.String.htmlEncode(t)},reloadLanguages:function(t){i.each(t,function(t){this.langMenu.addItem({iconCls:t.tip,caption:t.title,value:{tip:t.tip,code:t.code},checkable:!0,checked:this.langMenu.saved==t.title,toggleGroup:"language"})},this),this.langMenu.doLayout(),this.langMenu.items.length>0&&(this.btnLanguage.setDisabled(!1),this.btnDocLanguage.setDisabled(!1))},setLanguage:function(t){if(this.langMenu.prevTip!=t.tip){var i=e(this.langMenu.el.parentNode,this.$el);i.find(".icon-lang-flag").removeClass(this.langMenu.prevTip).addClass(t.tip),this.langMenu.prevTip=t.tip,i.find("#status-label-lang").text(t.title);var n=i.find('ul li a:contains("'+t.title+'")').parent().index();n<0?this.langMenu.saved=t.title:this.langMenu.items[n-1].setChecked(!0)}},showStatusMessage:function(t){e(".statusbar #label-action").text(t)},clearStatusMessage:function(){e(".statusbar #label-action").text("")},SetDisabled:function(t){var e=this.langMenu.items.length>0;this.btnLanguage.setDisabled(t||!e),this.btnDocLanguage.setDisabled(t||!e),t&&(this.state.changespanel=this.mnuChangesPanel.checked),this.mnuChangesPanel.setChecked(!t&&1==this.state.changespanel),this.btnReview.setDisabled(t)},pageIndexText:"Page {0} of {1}",goToPageText:"Go to Page",tipUsers:"Document is currently being edited by several users.",tipMoreUsers:"and %1 users.",tipShowUsers:"To see all users click the icon below.",tipFitPage:"Fit to Page",tipFitWidth:"Fit to Width",tipZoomIn:"Zoom In",tipZoomOut:"Zoom Out",tipZoomFactor:"Magnification",tipSetLang:"Set Text Language",tipSetDocLang:"Set Document Language",tipSetSpelling:"Turn on spell checking option",txtPageNumInvalid:"Page number invalid",tipReview:"Review",textTrackChanges:"Track Changes",textChangesPanel:"Changes panel",tipAccessRights:"Manage document access rights",tipViewUsers:"View users and manage document access rights",txAccessRights:"Change access rights"},DE.Views.Statusbar||{})),DE.Views.Statusbar.LanguageDialog=Common.UI.Window.extend(i.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){i.extend(this.options,t||{},{label:this.labelSelect,btns:{ok:this.btnOk,cancel:this.btnCancel}}),this.options.tpl=i.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",i.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: 300px;",editable:!1,template:i.template(['<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control">','<span class="input-lang-icon img-toolbarmenu lang-flag" style="position: absolute;"></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;">','<span class="lang-item-icon img-toolbarmenu lang-flag <%= item.value %>" style="position: absolute;margin-left:-21px;"></span>',"<%= scope.getDisplayValue(item) %>","</a>","</li>","<% }); %>","</ul>","</span>"].join("")),data:this.options.languages}),this.cmbLanguage.scroller&&this.cmbLanguage.scroller.update({alwaysVisibleY:!0}),this.cmbLanguage.on("selected",i.bind(this.onLangSelect,this)),this.cmbLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(this.options.current)[0]),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){var n=t.$el.find(".input-lang-icon"),o=n.attr("lang");o&&n.removeClass(o),n.addClass(e.value).attr("lang",e.value)},labelSelect:"Select document language",btnCancel:"Cancel",btnOk:"Ok"},l||{}))}),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)"],28:["sq","Shqipe"],1052:["sq-AL","Shqipe (Shqipëria)"],132:["gsw","Elsässisch"],1156:["gsw-FR","Elsässisch (Frànkrisch)"],94:["am","አማርኛ"],1118:["am-ET","አማርኛ (ኢትዮጵያ)"],1:["ar","العربية"],5121:["ar-DZ","العربية (الجزائر)"],15361:["ar-BH","العربية (البحرين)"],3073:["ar-EG","العربية (مصر)"],2049:["ar-IQ","العربية (العراق)"],11265:["ar-JO","العربية (الأردن)"],13313:["ar-KW","العربية (الكويت)"],12289:["ar-LB","العربية (لبنان)"],4097:["ar-LY","العربية (ليبيا)"],6145:["ar-MA","العربية (المملكة المغربية)"],8193:["ar-OM","العربية (عمان)"],16385:["ar-QA","العربية (قطر)"],1025:["ar-SA","العربية (المملكة العربية السعودية)"],10241:["ar-SY","العربية (سوريا)"],7169:["ar-TN","العربية (تونس)"],14337:["ar-AE","العربية (الإمارات العربية المتحدة)"],9217:["ar-YE","العربية (اليمن)"],43:["hy","Հայերեն"],1067:["hy-AM","Հայերեն (Հայաստան)"],77:["as","অসমীয়া"],1101:["as-IN","অসমীয়া (ভাৰত)"],44:["az","Azərbaycanılı"],29740:["az-Cyrl","Азәрбајҹан дили"],2092:["az-Cyrl-AZ","Азәрбајҹан (Азәрбајҹан)"],30764:["az-Latn","Azərbaycanılı"],1068:["az-Latn-AZ","Azərbaycanılı (Azərbaycan)"],109:["ba","Башҡорт"],1133:["ba-RU","Башҡорт (Россия)"],45:["eu","Euskara"],1069:["eu-ES","Euskara (Euskara)"],35:["be","Беларускі"],1059:["be-BY","Беларускі (Беларусь)"],69:["bn","বাংলা"],2117:["bn-BD","বাংলা (বাংলাদেশ)"],1093:["bn-IN","বাংলা (ভারত)"],30746:["bs","bosanski"],25626:["bs-Cyrl","Босански (Ћирилица)"],8218:["bs-Cyrl-BA","Босански (Босна и Херцеговина)"],26650:["bs-Latn","Bosanski (Latinica)"],5146:["bs-Latn-BA","Bosanski (Bosna i Hercegovina)"],126:["br","Brezhoneg"],1150:["br-FR","Brezhoneg (Frañs)"],2:["bg","Български"],1026:["bg-BG","Български (България)"],3:["ca","Català"],1027:["ca-ES","Català (Català)"],2051:["ca-ES-valencia","Català (Valencià)"],30724:["zh","中文"],4:["zh-Hans","中文(简体)"],2052:["zh-CN","中文(中华人民共和国)"],4100:["zh-SG","中文(新加坡)"],31748:["zh-Hant","中文(繁體)"],3076:["zh-HK","中文(香港特別行政區)"],5124:["zh-MO","中文(澳門特別行政區)"],1028:["zh-TW","中文(台灣)"],131:["co","Corsu"],1155:["co-FR","Corsu (France)"],26:["hr","Hrvatski"],1050:["hr-HR","Hrvatski (Hrvatska)"],4122:["hr-BA","Hrvatski (Bosna i Hercegovina)"],5:["cs","Čeština"],1029:["cs-CZ","Čeština (Česká republika)"],6:["da","Dansk"],1030:["da-DK","Dansk (Danmark)"],140:["prs","درى"],1164:["prs-AF","درى (افغانستان)"],101:["dv","ދިވެހިބަސް"],1125:["dv-MV","ދިވެހިބަސް (ދިވެހި ރާއްޖެ)"],19:["nl","Nederlands"],2067:["nl-BE","Nederlands (België)"],1043:["nl-NL","Nederlands (Nederland)"],9:["en","English"],3081:["en-AU","English (Australia)"],10249:["en-BZ","English (Belize)"],4105:["en-CA","English (Canada)"],9225:["en-029","English (Caribbean)"],16393:["en-IN","English (India)"],6153:["en-IE","English (Ireland)"],8201:["en-JM","English (Jamaica)"],17417:["en-MY","English (Malaysia)"],5129:["en-NZ","English (New Zealand)"],13321:["en-PH","English (Philippines)"],18441:["en-SG","English (Singapore)"],7177:["en-ZA","English (South Africa)"],11273:["en-TT","English (Trinidad y Tobago)"],2057:["en-GB","English (United Kingdom)"],1033:["en-US","English (United States)"],12297:["en-ZW","English (Zimbabwe)"],37:["et","Eesti"],1061:["et-EE","Eesti (Eesti)"],56:["fo","Føroyskt"],1080:["fo-FO","Føroyskt (Føroyar)"],100:["fil","Filipino"],1124:["fil-PH","Filipino (Pilipinas)"],11:["fi","Suomi"],1035:["fi-FI","Suomi (Suomi)"],12:["fr","Français"],2060:["fr-BE","Français (Belgique)"],3084:["fr-CA","Français (Canada)"],1036:["fr-FR","Français (France)"],5132:["fr-LU","Français (Luxembourg)"],6156:["fr-MC","Français (Principauté de Monaco)"],4108:["fr-CH","Français (Suisse)"],98:["fy","Frysk"],1122:["fy-NL","Frysk (Nederlân)"],86:["gl","Galego"],1110:["gl-ES","Galego (Galego)"],55:["ka","ქართული"],1079:["ka-GE","ქართული (საქართველო)"],7:["de","Deutsch"],3079:["de-AT","Deutsch (Österreich)"],1031:["de-DE","Deutsch (Deutschland)"],5127:["de-LI","Deutsch (Liechtenstein)"],4103:["de-LU","Deutsch (Luxemburg)"],2055:["de-CH","Deutsch (Schweiz)"],8:["el","Ελληνικά"],1032:["el-GR","Ελληνικά (Ελλάδα)"],111:["kl","Kalaallisut"],1135:["kl-GL","Kalaallisut (Kalaallit Nunaat)"],71:["gu","ગુજરાતી"],1095:["gu-IN","ગુજરાતી (ભારત)"],104:["ha","Hausa"],31848:["ha-Latn","Hausa (Latin)"],1128:["ha-Latn-NG","Hausa (Nigeria)"],13:["he","עברית"],1037:["he-IL","עברית (ישראל)"],57:["hi","हिंदी"],1081:["hi-IN","हिंदी (भारत)"],14:["hu","Magyar"],1038:["hu-HU","Magyar (Magyarország)"],15:["is","Íslenska"],1039:["is-IS","Íslenska (Ísland)"],112:["ig","Igbo"],1136:["ig-NG","Igbo (Nigeria)"],33:["id","Bahasa Indonesia"],1057:["id-ID","Bahasa Indonesia (Indonesia)"],93:["iu","Inuktitut"],31837:["iu-Latn","Inuktitut (Qaliujaaqpait)"],2141:["iu-Latn-CA","Inuktitut"],30813:["iu-Cans","ᐃᓄᒃᑎᑐᑦ (ᖃᓂᐅᔮᖅᐸᐃᑦ)"],1117:["iu-Cans-CA","ᐃᓄᒃᑎᑐᑦ (ᑲᓇᑕᒥ)"],60:["ga","Gaeilge"],2108:["ga-IE","Gaeilge (Éire)"],52:["xh","isiXhosa"],1076:["xh-ZA","isiXhosa (uMzantsi Afrika)"],53:["zu","isiZulu"],1077:["zu-ZA","isiZulu (iNingizimu Afrika)"],16:["it","Italiano"],1040:["it-IT","Italiano (Italia)"],2064:["it-CH","Italiano (Svizzera)"],17:["ja","日本語"],1041:["ja-JP","日本語 (日本)"],75:["kn","ಕನ್ನಡ"],1099:["kn-IN","ಕನ್ನಡ (ಭಾರತ)"],63:["kk","Қазақ"],1087:["kk-KZ","Қазақ (Қазақстан)"],83:["km","ខ្មែរ"],1107:["km-KH","ខ្មែរ (កម្ពុជា)"],134:["qut","K'iche"],1158:["qut-GT","K'iche (Guatemala)"],135:["rw","Kinyarwanda"],1159:["rw-RW","Kinyarwanda (Rwanda)"],65:["sw","Kiswahili"],1089:["sw-KE","Kiswahili (Kenya)"],87:["kok","कोंकणी"],1111:["kok-IN","कोंकणी (भारत)"],18:["ko","한국어"],1042:["ko-KR","한국어 (대한민국)"],64:["ky","Кыргыз"],1088:["ky-KG","Кыргыз (Кыргызстан)"],84:["lo","ລາວ"],1108:["lo-LA","ລາວ (ສ.ປ.ປ. ລາວ)"],38:["lv","Latviešu"],1062:["lv-LV","Latviešu (Latvija)"],39:["lt","Lietuvių"],1063:["lt-LT","Lietuvių (Lietuva)"],31790:["dsb","Dolnoserbšćina"],2094:["dsb-DE","Dolnoserbšćina (Nimska)"],110:["lb","Lëtzebuergesch"],1134:["lb-LU","Lëtzebuergesch (Luxembourg)"],1071:["mk-MK","Македонски јазик (Македонија)"],47:["mk","Македонски јазик"],62:["ms","Bahasa Melayu"],2110:["ms-BN","Bahasa Melayu (Brunei Darussalam)"],1086:["ms-MY","Bahasa Melayu (Malaysia)"],76:["ml","മലയാളം"],1100:["ml-IN","മലയാളം (ഭാരതം)"],58:["mt","Malti"],1082:["mt-MT","Malti (Malta)"],129:["mi","Reo Māori"],1153:["mi-NZ","Reo Māori (Aotearoa)"],122:["arn","Mapudungun"],1146:["arn-CL","Mapudungun (Chile)"],78:["mr","मराठी"],1102:["mr-IN","मराठी (भारत)"],124:["moh","Kanien'kéha"],1148:["moh-CA","Kanien'kéha"],80:["mn","Монгол хэл"],30800:["mn-Cyrl","Монгол хэл"],1104:["mn-MN","Монгол хэл (Монгол улс)"],31824:["mn-Mong","ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ"],2128:["mn-Mong-CN","ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ (ᠪᠦᠭᠦᠳᠡ ᠨᠠᠢᠷᠠᠮᠳᠠᠬᠤ ᠳᠤᠮᠳᠠᠳᠤ ᠠᠷᠠᠳ ᠣᠯᠣᠰ)"],97:["ne","नेपाली"],1121:["ne-NP","नेपाली (नेपाल)"],20:["no","Norsk"],31764:["nb","Norsk (bokmål)"],30740:["nn","Norsk (Nynorsk)"],1044:["nb-NO","Norsk, bokmål (Norge)"],2068:["nn-NO","Norsk, nynorsk (Noreg)"],130:["oc","Occitan"],1154:["oc-FR","Occitan (França)"],72:["or","ଓଡ଼ିଆ"],1096:["or-IN","ଓଡ଼ିଆ (ଭାରତ)"],99:["ps","پښتو"],1123:["ps-AF","پښتو (افغانستان)"],41:["fa","فارسى"],1065:["fa-IR","فارسى (ایران)"],21:["pl","Polski"],1045:["pl-PL","Polski (Polska)"],22:["pt","Português"],1046:["pt-BR","Português (Brasil)"],2070:["pt-PT","Português (Portugal)"],70:["pa","ਪੰਜਾਬੀ"],1094:["pa-IN","ਪੰਜਾਬੀ (ਭਾਰਤ)"],107:["quz","Runasimi"],1131:["quz-BO","Runasimi (Qullasuyu)"],2155:["quz-EC","Runasimi (Ecuador)"],3179:["quz-PE","Runasimi (Piruw)"],24:["ro","Română"],1048:["ro-RO","Română (România)"],23:["rm","Rumantsch"],1047:["rm-CH","Rumantsch (Svizra)"],25:["ru","Русский"],1049:["ru-RU","Русский (Россия)"],28731:["smn","Sämikielâ"],31803:["smj","Julevusámegiella"],59:["se","Davvisámegiella"],29755:["sms","Sääm´ǩiõll"],30779:["sma","åarjelsaemiengiele"],9275:["smn-FI","Sämikielâ (Suomâ)"],4155:["smj-NO","Julevusámegiella (Vuodna)"],5179:["smj-SE","Julevusámegiella (Svierik)"],3131:["se-FI","Davvisámegiella (Suopma)"],1083:["se-NO","Davvisámegiella (Norga)"],2107:["se-SE","Davvisámegiella (Ruoŧŧa)"],8251:["sms-FI","Sääm´ǩiõll (Lää´ddjânnam)"],6203:["sma-NO","åarjelsaemiengiele (Nöörje)"],7227:["sma-SE","åarjelsaemiengiele (Sveerje)"],79:["sa","संस्कृत"],1103:["sa-IN","संस्कृत (भारतम्)"],145:["gd","Gàidhlig"],1169:["gd-GB","Gàidhlig (An Rìoghachd Aonaichte)"],31770:["sr","Srpski"],27674:["sr-Cyrl","Српски (Ћирилица)"],7194:["sr-Cyrl-BA","Српски (Босна и Херцеговина)"],12314:["sr-Cyrl-ME","Српски (Црна Гора)"],3098:["sr-Cyrl-CS","Српски (Србија и Црна Гора (Претходно))"],10266:["sr-Cyrl-RS","Српски (Србија)"],28698:["sr-Latn","Srpski (Latinica)"],6170:["sr-Latn-BA","Srpski (Bosna i Hercegovina)"],11290:["sr-Latn-ME","Srpski (Crna Gora)"],2074:["sr-Latn-CS","Srpski (Srbija i Crna Gora (Prethodno))"],9242:["sr-Latn-RS","Srpski (Srbija, Latinica)"],108:["nso","Sesotho sa Leboa"],1132:["nso-ZA","Sesotho sa Leboa (Afrika Borwa)"],50:["tn","Setswana"],1074:["tn-ZA","Setswana (Aforika Borwa)"],91:["si","සිංහ"],1115:["si-LK","සිංහ (ශ්රී ලංකා)"],27:["sk","Slovenčina"],1051:["sk-SK","Slovenčina (Slovenská republika)"],36:["sl","Slovenski"],1060:["sl-SI","Slovenski (Slovenija)"],10:["es","Español"],11274:["es-AR","Español (Argentina)"],16394:["es-BO","Español (Bolivia)"],13322:["es-CL","Español (Chile)"],9226:["es-CO","Español (Colombia)"],5130:["es-CR","Español (Costa Rica)"],7178:["es-DO","Español (República Dominicana)"],12298:["es-EC","Español (Ecuador)"],17418:["es-SV","Español (El Salvador)"],4106:["es-GT","Español (Guatemala)"],18442:["es-HN","Español (Honduras)"],2058:["es-MX","Español (México)"],19466:["es-NI","Español (Nicaragua)"],6154:["es-PA","Español (Panamá)"],15370:["es-PY","Español (Paraguay)"],10250:["es-PE","Español (Perú)"],20490:["es-PR","Español (Puerto Rico)"],3082:["es-ES","Español (España, alfabetización internacional)"],21514:["es-US","Español (Estados Unidos)"],14346:["es-UY","Español (Uruguay)"],8202:["es-VE","Español (Republica Bolivariana de Venezuela)"],29:["sv","Svenska"],2077:["sv-FI","Svenska (Finland)"],1053:["sv-SE","Svenska (Sverige)"],90:["syr","ܣܘܪܝܝܐ"],1114:["syr-SY","ܣܘܪܝܝܐ (سوريا)"],40:["tg","Тоҷикӣ"],31784:["tg-Cyrl","Тоҷикӣ"],1064:["tg-Cyrl-TJ","Тоҷикӣ (Тоҷикистон)"],95:["tzm","Tamazight"],31839:["tzm-Latn","Tamazight (Latin)"],2143:["tzm-Latn-DZ","Tamazight (Djazaïr)"],73:["ta","தமிழ்"],1097:["ta-IN","தமிழ் (இந்தியா)"],68:["tt","Татар"],1092:["tt-RU","Татар (Россия)"],74:["te","తెలుగు"],1098:["te-IN","తెలుగు (భారత దేశం)"],30:["th","ไทย"],1054:["th-TH","ไทย (ไทย)"],81:["bo","བོད་ཡིག"],1105:["bo-CN","བོད་ཡིག (ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།)"],31:["tr","Türkçe"],1055:["tr-TR","Türkçe (Türkiye)"],66:["tk","Türkmençe"],1090:["tk-TM","Türkmençe (Türkmenistan)"],34:["uk","Українська"],1058:["uk-UA","Українська (Україна)"],46:["hsb","Hornjoserbšćina"],1070:["hsb-DE","Hornjoserbšćina (Němska)"],32:["ur","اُردو"],1056:["ur-PK","اُردو (پاکستان)"],128:["ug","ئۇيغۇر يېزىقى"],1152:["ug-CN","(ئۇيغۇر يېزىقى (جۇڭخۇا خەلق جۇمھۇرىيىتى"],30787:["uz-Cyrl","Ўзбек"],2115:["uz-Cyrl-UZ","Ўзбек (Ўзбекистон)"],67:["uz","U'zbek"],31811:["uz-Latn","U'zbek"],1091:["uz-Latn-UZ","U'zbek (U'zbekiston Respublikasi)"],42:["vi","Tiếng Việt"],1066:["vi-VN","Tiếng Việt (Việt Nam)"],82:["cy","Cymraeg"],1106:["cy-GB","Cymraeg (y Deyrnas Unedig)"],136:["wo","Wolof"],1160:["wo-SN","Wolof (Sénégal)"],133:["sah","Саха"],1157:["sah-RU","Саха (Россия)"],120:["ii","ꆈꌠꁱꂷ"],1144:["ii-CN","ꆈꌠꁱꂷ (ꍏꉸꏓꂱꇭꉼꇩ)"],106:["yo","Yoruba"],1130:["yo-NG","Yoruba (Nigeria)"],2129:["bo-BT","Tibetan, Bhutan"],1126:["bin-NG","Bini, Nigeria"],1116:["chr-US","Cherokee, United States"],15369:["en-HK","English, Hong Kong"],14345:["en-ID","English, Indonesia"],1034:["es-ES_tradnl","Spanish"],15372:["fr-HT","French, Haiti"],9228:["fr-CG","French, Congo"],12300:["fr-CI","French, Cote d'Ivoire"],11276:["fr-CM","French, Cameroon"],14348:["fr-MA","French, Morocco"],13324:["fr-ML","French, Mali"],8204:["fr-RE","French, Reunion"],10252:["fr-SN","French, Senegal"],7180:["fr-West","French"],1127:["fuv-NG","Nigerian Fulfulde, Nigeria"],1138:["gaz-ET","West Central Oromo, Ethiopia"],1140:["gn-PY","Guarani, Paraguay"],1141:["haw-US","Hawaiian, UnitedStates"],1129:["ibb-NG","Ibibio, Nigeria"],1137:["kr-NG","Kanuri, Nigeria"],1112:["mni","Manipuri"],1109:["my-MM","Burmese, Myanmar"],2145:["ne-IN","Nepali, India"],1145:["pap-AN","Papiamento, Netherlands Antilles"],2118:["pa-PK","Panjabi, Pakistan"],1165:["plt-MG","Plateau Malagasy, Madagascar"],2072:["ro-MO","Romanian, Macao"],2073:["ru-MO","Russian, Macao"],1113:["sd-IN","Sindhi, India"],2137:["sd-PK","Sindhi, Pakistan"],1143:["so-SO","Somali, Somalia"],1072:["st-ZA","Southern Sotho, South Africa"],1139:["ti-ER","Tigrinya, Eritrea"],2163:["ti-ET","Tigrinya, Ethiopia"],1119:["tmz","Tamanaku"],3167:["tmz-MA","Tamanaku, Morocco"],1073:["ts-ZA","Tsonga, South Africa"],2080:["ur-IN","Urdu, India"],1075:["ven-ZA","South Africa"]};return{getLocalLanguageName:function(e){return t[e]||["",e]},getLocalLanguageCode:function(e){for(var i in t)if(t[i][0].toLowerCase()===e.toLowerCase())return i;return null}}},define("common/main/lib/util/LanguageInfo",function(){}),define("text!common/main/lib/template/ReviewChangesPopover.template",[],function(){
|
|
|
return'<div id="<%=id%>" class="user-comment-item">\r\n <div class="user-name-colored"><span style="background-color:<%=usercolor%>;"><%=scope.getUserName(username)%></span></div>\r\n <div class="user-date"><%=date%></div>\r\n <div class="user-message limit-height"><%=changetext%></div>\r\n <div class="edit-ct">\r\n <% if (scope.isReviewOnly) { %>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% } else { %>\r\n <div class="btn-accept img-commonctrl"></div>\r\n <div class="btn-reject img-commonctrl"></div>\r\n <% } %>\r\n </div>\r\n</div>'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewChanges",["text!common/main/lib/template/ReviewChangesPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.ReviewChangesPopover=Common.UI.Window.extend({initialize:function(t){var e={};_.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1},t),this.template=t.template||['<div class="box">','<div id="id-review-popover" class="comments-popover dataview-ct"></div>','<div id="id-review-arrow" class="comments-arrow review"></div>',"</div>"].join(""),this.store=t.store,this.delegate=t.delegate,e.tpl=_.template(this.template,e),this.arrow={margin:20,width:12,height:34},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,i=this.delegate,n=this.$window;n.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"991"});var o=n.find(".body");o&&o.css("position","relative"),n.on("click",function(){n.css({zIndex:"991"}),Common.NotificationCenter.trigger("review:click")}),Common.NotificationCenter.on("comments:click",function(){n.css({zIndex:"990"})});var s=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,template:_.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></div><div class="lock-area" style="cursor: default;"></div><div class="lock-author" style="cursor: default;"></div>')}}}());s&&(this.reviewChangesView?(this.reviewChangesView.render($("#id-review-popover")),this.reviewChangesView.onResetItems()):(this.reviewChangesView=new s({el:$("#id-review-popover"),store:e.store,itemTemplate:_.template(t)}),this.reviewChangesView.on("item:click",function(t,e,n,o){var s=$(o.target);s&&(s.hasClass("btn-accept")?i.fireEvent("reviewchange:accept",[n.get("changedata")]):s.hasClass("btn-reject")?i.fireEvent("reviewchange:reject",[n.get("changedata")]):s.hasClass("btn-delete")&&i.fireEvent("reviewchange:delete",[n.get("changedata")]))})))},show:function(t,e,i){this.options.animate=t;Common.UI.Window.prototype.show.call(this),this.reviewChangesView.scroller&&this.reviewChangesView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.reviewChangesView.cmpEl.find(".lock-area").toggleClass("hidden",!e),this.reviewChangesView.cmpEl.find(".lock-author").toggleClass("hidden",!e||_.isEmpty(i)).text(i)},hide:function(){this.handlerHide&&this.handlerHide(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(){this.reviewChangesView&&this.reviewChangesView.scroller&&this.reviewChangesView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var o=$("#id-review-popover"),s=$("#id-review-arrow"),a=$("#editor_sdk"),r=null,l=0,c="",d=0,h="",p=0,m="",u=0,g="",b=0,f=0,C=0,v=0,y=0,w=0;o&&s&&a&&a.get(0)&&(r=a.get(0).getBoundingClientRect())&&(l=r.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:l+"px"}),this.sdkBounds.width=r.width,this.sdkBounds.height=r.height,_.isUndefined(t)||(c=$("#id_vertical_scroll"),c.length?d="none"!==c.css("display")?c.width():0:(c=$("#ws-v-scrollbar"),c.length&&(d="none"!==c.css("display")?c.width():0)),this.sdkBounds.width-=d,h=$("#id_panel_left"),h.length&&(p="none"!==h.css("display")?h.width():0),m=$("#id_panel_thumbnails"),m.length&&(u="none"!==m.css("display")?m.width():0,this.sdkBounds.width-=u),f=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()),f=Math.max(0+p+this.arrow.width,f),s.removeClass("right").addClass("left"),_.isUndefined(i)||(C=this.$window.outerWidth())&&(t+C>this.sdkBounds.width-this.arrow.width+5&&this.leftX>C?(f=this.leftX-C+0-this.arrow.width,s.removeClass("left").addClass("right")):f=0+t+this.arrow.width),this.$window.css("left",f+"px")),_.isUndefined(e)||(g=$("#id_panel_top"),w=0,g.length?(b="none"!==g.css("display")?g.height():0,w+=this.sdkBounds.paddingTop):(g=$("#ws-h-scrollbar"),g.length&&(b="none"!==g.css("display")?g.height():0,w-=this.sdkBounds.paddingTop)),this.sdkBounds.height-=b,v=this.$window.outerHeight(),y=Math.min(0+l-v,this.arrowPosY+0-this.arrow.height),y=Math.max(y,w),this.$window.css("top",y+"px"))),this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-review-arrow"),i=$("#id-review-popover"),n=null,o=null,s=null,a=0,r="",l=0,c=0,d=0,h=0,p=0,m=0;i&&e&&i.get(0)&&(i.css({height:"100%"}),(n=i.get(0).getBoundingClientRect())&&(o=$("#editor_sdk"))&&o.get(0)&&(s=o.get(0).getBoundingClientRect())&&(a=s.height-2*this.sdkBounds.padding,m=0,d=this.$window.outerHeight(),r=$("#id_panel_top"),r.length?(l="none"!==r.css("display")?r.height():0,m+=this.sdkBounds.paddingTop):(r=$("#ws-h-scrollbar"),r.length&&(l="none"!==r.css("display")?r.height():0,m-=this.sdkBounds.paddingTop)),h=Math.max(i.outerHeight(),this.$window.outerHeight()),a<=h?(this.$window.css({maxHeight:a-l+"px",top:0+l+"px"}),i.css({height:a-l-3+"px"}),c=Math.min(c,a-(l+this.arrow.margin+this.arrow.width)),e.css({top:c+"px"})):(h=d,h>0&&(n.top+h>a+0||0===n.height)&&(p=Math.min(0+a-h,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-h)-this.arrow.width),c=Math.min(c,h-this.arrow.margin-this.arrow.width),e.css({top:c+"px"})))),this.$window.css({overflow:""})}}}),Common.Views.ReviewChanges=Common.UI.BaseView.extend(_.extend({el:"#review-changes-panel",options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=['<div class="review-group" style="">','<div id="id-review-button-prev" style=""></div>','<div id="id-review-button-next" style=""></div>','<div class="separator"/>',"</div>",'<div class="review-group" style="">','<div id="id-review-button-accept" style=""></div>','<div id="id-review-button-reject" style=""></div>','<div class="separator"/>',"</div>",'<div class="review-group">','<div id="id-review-button-close" style=""></div>',"</div>"].join(""),this.store=this.options.store,this.popoverChanges=this.options.popoverChanges},render:function(){var t=$(this.el);t.addClass("review-changes"),t.html(_.template(this.template,{scope:this})),this.btnPrev=new Common.UI.Button({cls:"btn-toolbar",iconCls:"img-commonctrl review-prev",value:1,hint:this.txtPrev,hintAnchor:"top"}),this.btnPrev.render($("#id-review-button-prev")),this.btnNext=new Common.UI.Button({cls:"btn-toolbar",iconCls:"img-commonctrl review-next",value:2,hint:this.txtNext,hintAnchor:"top"}),this.btnNext.render($("#id-review-button-next")),this.btnAccept=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtAccept,split:!0,menu:new Common.UI.Menu({menuAlign:"bl-tl",style:"margin-top:-5px;",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($("#id-review-button-accept")),this.btnReject=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtReject,split:!0,menu:new Common.UI.Menu({menuAlign:"bl-tl",style:"margin-top:-5px;",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($("#id-review-button-reject")),this.btnClose=new Common.UI.Button({cls:"btn-toolbar",iconCls:"img-commonctrl review-close",hint:this.txtClose,hintAnchor:"top"}),this.btnClose.render($("#id-review-button-close")),this.btnClose.on("click",_.bind(this.onClose,this)),this.boxSdk=$("#editor_sdk"),Common.NotificationCenter.on("layout:changed",_.bind(this.onLayoutChanged,this))},onClose:function(t){this.hide(),this.fireEvent("hide",this)},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},onLayoutChanged:function(t){"rightmenu"==t&&this.boxSdk&&this.$el.css("right",$("body").width()-this.boxSdk.offset().left-this.boxSdk.width()+15+"px")},getPopover:function(t){return _.isUndefined(this.popover)&&(this.popover=new Common.Views.ReviewChangesPopover({store:this.popoverChanges,delegate:this,renderTo:t})),this.popover},getUserName:function(t){return Common.Utils.String.htmlEncode(t)},txtPrev:"To previous change",txtNext:"To next change",txtAccept:"Accept",txtAcceptCurrent:"Accept current Changes",txtAcceptAll:"Accept all Changes",txtReject:"Reject",txtRejectCurrent:"Reject current Changes",txtRejectAll:"Reject all Changes",txtClose:"Close"},Common.Views.ReviewChanges||{}))}),define("documenteditor/main/app/controller/Statusbar",["core","documenteditor/main/app/view/Statusbar","common/main/lib/util/LanguageInfo","common/main/lib/view/ReviewChanges"],function(){"use strict";DE.Controllers.Statusbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Statusbar"],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)},Statusbar:{langchanged:this.onLangMenu}})},events:function(){return{"click #btn-zoom-down":_.bind(this.zoomDocument,this,"down"),"click #btn-zoom-up":_.bind(this.zoomDocument,this,"up"),"click #btn-doc-lang":_.bind(this.onBtnLanguage,this)}},onLaunch:function(){this.statusbar=this.createView("Statusbar",{storeUsers:this.getApplication().getCollection("Common.Collections.Users")}).render(),this.statusbar.$el.css("z-index",1),this.bindViewEvents(this.statusbar,this.events),$(".statusbar #label-zoom").css("min-width",70),this.statusbar.btnSetSpelling.on("click",_.bind(this.onBtnSpelling,this)),this.statusbar.btnZoomToPage.on("click",_.bind(this.onBtnZoomTo,this,"topage")),this.statusbar.btnZoomToWidth.on("click",_.bind(this.onBtnZoomTo,this,"towidth")),this.statusbar.zoomMenu.on("item:click",_.bind(this.menuZoomClick,this)),this.statusbar.btnReview.menu.on("item:toggle",_.bind(this.onMenuReviewToggle,this)),this.statusbar.btnReview.on("toggle",_.bind(this.onReviewToggle,this))},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onZoomChange",_.bind(this._onZoomChange,this)),this.api.asc_registerCallback("asc_onTextLanguage",_.bind(this._onTextLanguage,this)),this.statusbar.setApi(t)},onBtnZoomTo:function(t,e,i){e.pressed?this.api["topage"==t?"zoomFitToPage":"zoomFitToWidth"]():this.api.zoomCustomMode(),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},zoomDocument:function(t,e){switch(t){case"up":this.api.zoomIn();break;case"down":this.api.zoomOut()}Common.NotificationCenter.trigger("edit:complete",this.statusbar)},menuZoomClick:function(t,e){this.api.zoom(e.value),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},_onZoomChange:function(t,e){this.statusbar.btnZoomToPage.toggle(2==e,!0),this.statusbar.btnZoomToWidth.toggle(1==e,!0),$(".statusbar #label-zoom").text(Common.Utils.String.format(this.zoomText,t))},_onTextLanguage:function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t);this.statusbar.setLanguage({tip:e[0],title:e[1],code:t})},setLanguages:function(t){this.langs=t,this.statusbar.reloadLanguages(t)},setStatusCaption:function(t,e,i){this.timerCaption&&(new Date<this.timerCaption||0==t.length)&&!e||(this.timerCaption=void 0,t.length?(this.statusbar.showStatusMessage(t),i>0&&(this.timerCaption=(new Date).getTime()+i)):this.statusbar.clearStatusMessage())},createDelayedElements:function(){this.statusbar.$el.css("z-index","");var t=Common.localStorage.getItem("de-hidden-status"),e=null!==t&&1==parseInt(t);if(t=Common.localStorage.getItem("de-settings-spellcheck"),this.statusbar.btnSetSpelling.toggle(null===t||1==parseInt(t),!0),this.statusbar.mode.canReview){var i=this;if(this.reviewChangesPanel=this.getApplication().getController("Common.Controllers.ReviewChanges").getView("Common.Views.ReviewChanges"),this.reviewChangesPanel.on("hide",function(){i.statusbar.mnuChangesPanel.setChecked(!1,!0)}),t=Common.localStorage.getItem("de-track-changes-tip"),this.showTrackChangesTip=!(t&&1==parseInt(t)||this.statusbar.mode.isLightVersion),t=Common.localStorage.getItem("de-new-changes"),this.showNewChangesTip=!(t&&1==parseInt(t)||this.statusbar.mode.isLightVersion),this.statusbar.mode.isReviewOnly){var n=$(".btn-icon",this.statusbar.btnReview.cmpEl);this.api.asc_HaveRevisionsChanges()?n.removeClass(this.statusbar.btnReviewCls).addClass("btn-ic-changes"):n.removeClass("btn-ic-changes").addClass(this.statusbar.btnReviewCls),this.statusbar.mnuTrackChanges.setDisabled(!0),this.changeReviewStatus(!0),this.showTrackChangesTip&&!e?(this.statusbar.btnReview.updateHint(""),void 0===this.changesTooltip&&(this.changesTooltip=this.createChangesTip(this.textTrackChanges,"de-track-changes-tip",!1)),this.changesTooltip.show()):this.statusbar.btnReview.updateHint(this.statusbar.tipReview)}else{t=Common.localStorage.getItem("de-track-changes");if(this.api.asc_IsTrackRevisions()){var n=$(".btn-icon",this.statusbar.btnReview.cmpEl);this.api.asc_HaveRevisionsChanges()?n.removeClass(this.statusbar.btnReviewCls).addClass("btn-ic-changes"):n.removeClass("btn-ic-changes").addClass(this.statusbar.btnReviewCls),null!==t&&1==parseInt(t)?(this.changeReviewStatus(!this.statusbar.mode.isLightVersion),this.showTrackChangesTip&&!e?(this.statusbar.btnReview.updateHint(""),void 0===this.changesTooltip&&(this.changesTooltip=this.createChangesTip(this.textTrackChanges,"de-track-changes-tip",!1)),this.changesTooltip.show()):this.statusbar.btnReview.updateHint(this.statusbar.tipReview)):(this.changeReviewStatus(!1),this.api.asc_HaveRevisionsChanges()&&this.showNewChangesTip&&!e?(this.statusbar.btnReview.updateHint(""),void 0===this.newChangesTooltip&&(this.newChangesTooltip=this.createChangesTip(this.textHasChanges,"de-new-changes",!0)),this.newChangesTooltip.show()):this.statusbar.btnReview.updateHint(this.statusbar.tipReview))}else this.changeReviewStatus(!1)}}},onBtnLanguage:function(){var t=_.map(this.langs,function(t){return{displayValue:t.title,value:t.tip,code:t.code}}),e=this;new DE.Views.Statusbar.LanguageDialog({languages:t,current:e.api.asc_getDefaultLanguage(),handler:function(i,n){if("ok"==i){var o=_.findWhere(t,{value:n});o&&e.api.asc_setDefaultLanguage(o.code)}}}).show()},onLangMenu:function(t,e,i){this.api.put_TextPrLang(e)},onBtnSpelling:function(t,e,i){Common.localStorage.setItem("de-settings-spellcheck",t.pressed?1:0),this.api.asc_setSpellCheck(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},applySettings:function(t){var e=Common.localStorage.getItem("de-settings-spellcheck");this.statusbar.btnSetSpelling.toggle(null===e||1==parseInt(e),!0)},onMenuReviewToggle:function(t,e,i,n){if(this.statusbar.mode.canReview){"track"===e.value?this.statusbar.btnReview.toggle(i):"panel"===e.value&&this.showHideReviewChangesPanel(i),Common.NotificationCenter.trigger("edit:complete",this.statusbar)}},onReviewToggle:function(t,e){this.statusbar.mode.canReview&&(this.statusbar.mode.isReviewOnly?this.statusbar.btnReview.toggle(!0,!0):(this.changeReviewStatus(e),Common.localStorage.setItem("de-track-changes",e?1:0)),Common.NotificationCenter.trigger("edit:complete",this.statusbar))},changeReviewStatus:function(t){this.statusbar.btnReview.toggle(t,!0),this.statusbar.mnuTrackChanges.setChecked(t,!0),this.statusbar.mnuChangesPanel.setChecked(t,!0),this.api&&this.api.asc_SetTrackRevisions(t),this.showHideReviewChangesPanel(t&&!this.statusbar.mode.isLightVersion)},showHideReviewChangesPanel:function(t){this.reviewChangesPanel[t?"show":"hide"]()},synchronizeChanges:function(){if(this.setStatusCaption(""),this.statusbar.mode.canReview){var t=$(".btn-icon",this.statusbar.btnReview.cmpEl);this.api.asc_HaveRevisionsChanges()?t.removeClass(this.statusbar.btnReviewCls).addClass("btn-ic-changes"):t.removeClass("btn-ic-changes").addClass(this.statusbar.btnReviewCls)}},createChangesTip:function(t,e,i){var n=new Common.UI.SynchronizeTip({target:$("#btn-doc-review"),text:t,placement:"top"});return n.on("dontshowclick",function(){i?this.showNewChangesTip=!1:this.showTrackChangesTip=!1,n.hide(),Common.localStorage.setItem(e,1),this.statusbar.btnReview.updateHint(this.statusbar.tipReview)},this),n.on("closeclick",function(){n.hide(),this.statusbar.btnReview.updateHint(this.statusbar.tipReview)},this),n},zoomText:"Zoom {0}%",textHasChanges:"New changes have been tracked",textTrackChanges:"The document is opened with the Track Changes mode enabled"},DE.Controllers.Statusbar||{}))}),define("text!documenteditor/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-paragraph-settings" class="settings-panel">\n </div>\n <div id="id-table-settings" class="settings-panel">\n </div>\n <div id="id-image-settings" class="settings-panel">\n </div>\n <div id="id-header-settings" class="settings-panel">\n </div>\n <div id="id-shape-settings" class="settings-panel">\n </div>\n <div id="id-chart-settings" class="settings-panel">\n </div>\n <div id="id-mail-merge-settings" class="settings-panel">\n </div>\n <div id="id-textart-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-text" class="btn btn-category arrow-left" content-target="id-paragraph-settings"><span class="btn-icon img-toolbarmenu btn-menu-text"> </span></button>\n <button id="id-right-menu-table" class="btn btn-category arrow-left" content-target="id-table-settings"><span class="btn-icon img-toolbarmenu btn-menu-table"> </span></button>\n <button id="id-right-menu-image" class="btn btn-category arrow-left" content-target="id-image-settings"><span class="btn-icon img-toolbarmenu btn-menu-image"> </span></button>\n <button id="id-right-menu-header" class="btn btn-category arrow-left" content-target="id-header-settings"><span class="btn-icon img-toolbarmenu btn-menu-header"> </span></button>\n <button id="id-right-menu-shape" class="btn btn-category arrow-left" content-target="id-shape-settings"><span class="btn-icon img-toolbarmenu btn-menu-shape"> </span></button>\n <button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><span class="btn-icon img-toolbarmenu btn-menu-chart"> </span></button>\n <button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><span class="btn-icon img-toolbarmenu btn-menu-textart"> </span></button>\n <button id="id-right-menu-mail-merge" class="btn btn-category arrow-left hidden" content-target="id-mail-merge-settings"><span class="btn-icon img-toolbarmenu btn-menu-mail-merge"> </span></button>\n </div>\n</div>'}),define("text!documenteditor/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 class="text-only">\r\n <td class="padding-small" colspan=2>\r\n <div id="paragraph-checkbox-add-interval"></div>\r\n </td>\r\n </tr>\r\n <tr class="text-only">\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr class="text-only">\r\n <td class="padding-small" colspan=2>\r\n <div id="paragraph-color-btn" style="display: inline-block;"></div>\r\n <label class="input-label" style="margin-left: 5px;"><%= scope.textBackColor %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td 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>'}),define("documenteditor/main/app/view/ParagraphSettings",["text!documenteditor/main/app/template/ParagraphSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","documenteditor/main/app/view/ParagraphSettingsAdvanced"],function(t,e,i,n){"use strict";DE.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={LineRuleIdx:null,LineHeight:null,LineSpacingBefore:null,LineSpacingAfter:null,AddInterval:!1,BackColor:"#000000",DisabledControls:!0,HideTextOnlySettings:!1},this.spinners=[],this.lockedControls=[],this._locked=!0,this.isChart=!1,this.render(),this._arrLineRule=[{displayValue:this.textAtLeast,defaultValue:5,value:c_paragraphLinerule.LINERULE_LEAST,minValue:.03,step:.01,defaultUnit:"cm"},{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,disabled:this._locked}),this.cmbLineRule.setValue(""),this.lockedControls.push(this.cmbLineRule),this.numLineHeight=new Common.UI.MetricSpinner({el:e("#paragraph-spin-line-height"),step:.01,width:85,value:"",defaultUnit:"",maxValue:132,minValue:.5,disabled:this._locked}),this.lockedControls.push(this.numLineHeight),this.numSpacingBefore=new Common.UI.MetricSpinner({el:e("#paragraph-spin-spacing-before"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText,disabled:this._locked}),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:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText,disabled:this._locked}),this.spinners.push(this.numSpacingAfter),this.lockedControls.push(this.numSpacingAfter),this.chAddInterval=new Common.UI.CheckBox({el:e("#paragraph-checkbox-add-interval"),labelText:this.strSomeParagraphSpace,disabled:this._locked}),this.lockedControls.push(this.chAddInterval),this.btnColor=new Common.UI.ColorButton({style:"width:45px;",disabled:this._locked,menu:!0}),this.btnColor.render(e("#paragraph-color-btn")),this.lockedControls.push(this.btnColor),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.chAddInterval.on("change",i.bind(this.onAddIntervalChange,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)),e(this.el).on("click","#paragraph-color-new",i.bind(this.addNewColor,this)),this.TextOnlySettings=e(".text-only")},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#paragraph-advanced-link"),this.linkAdvanced.toggleClass("disabled",this._locked)},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){if(""!==this.cmbLineRule.getRawValue()){c_paragraphLinerule.LINERULE_AUTO;this.api&&this.api.put_PrLineSpacing(this.cmbLineRule.getValue(),this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.fireEvent("editcomplete",this)}},onNumSpacingBeforeChange:function(t,e,i,n){if(this.api){var o=t.getNumberValue();this._state.LineSpacingBefore=o<0?-1:Common.Utils.Metric.fnRecalcToMM(o),this.api.put_LineSpacingBeforeAfter(0,this._state.LineSpacingBefore)}this.fireEvent("editcomplete",this)},onNumSpacingAfterChange:function(t,e,i,n){if(this.api){var o=t.getNumberValue();this._state.LineSpacingAfter=o<0?-1:Common.Utils.Metric.fnRecalcToMM(o),this.api.put_LineSpacingBeforeAfter(1,this._state.LineSpacingAfter)}this.fireEvent("editcomplete",this)},onAddIntervalChange:function(t,e,i,n){this.api&&this.api.put_AddSpaceBetweenPrg("checked"==t.getValue()),this.fireEvent("editcomplete",this)},onLineRuleSelect:function(t,e){this.api&&this.api.put_PrLineSpacing(e.value,e.defaultValue),this.numLineHeight.setDefaultUnit(this._arrLineRule[e.value].defaultUnit),this.numLineHeight.setMinValue(this._arrLineRule[e.value].minValue),this.numLineHeight.setStep(this._arrLineRule[e.value].step),this.fireEvent("editcomplete",this)},_onLineSpacing:function(t){var e=t.get_LineRule(),i=t.get_Line();if(this._state.LineRuleIdx!==e&&(this.cmbLineRule.setValue(null!==e?this._arrLineRule[e].value:""),this.numLineHeight.setMinValue(this._arrLineRule[null!==e?e:1].minValue),this.numLineHeight.setDefaultUnit(this._arrLineRule[null!==e?e:1].defaultUnit),this.numLineHeight.setStep(this._arrLineRule[null!==e?e:1].step),this._state.LineRuleIdx=e),Math.abs(this._state.LineHeight-i)>.001||(null===this._state.LineHeight||null===i)&&this._state.LineHeight!==i){var n="";e==c_paragraphLinerule.LINERULE_AUTO?n=i:null!==e&&null!==i&&(n=Common.Utils.Metric.fnRecalcFromMM(i)),this.numLineHeight.setValue(null!==n?n:"",!0),this._state.LineHeight=i}},onColorPickerSelect:function(t,e){this.btnColor.setColor(e),this.BackColor=e,this._state.BackColor=this.BackColor,this.api&&("transparent"==e?this.api.put_ParagraphShade(!1):this.api.put_ParagraphShade(!0,Common.Utils.ThemeColor.getRgbColor(e))),this.fireEvent("editcomplete",this)},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),this.hideTextOnlySettings(this.isChart),t){var e={Line:t.get_Spacing().get_Line(),Before:t.get_Spacing().get_Before(),After:t.get_Spacing().get_After(),LineRule:t.get_Spacing().get_LineRule()},i={ContextualSpacing:t.get_ContextualSpacing()};if(this._state.LineRuleIdx!==e.LineRule&&(this.cmbLineRule.setValue(null!==e.LineRule?this._arrLineRule[e.LineRule].value:""),this.numLineHeight.setMinValue(this._arrLineRule[null!==e.LineRule?e.LineRule:1].minValue),this.numLineHeight.setDefaultUnit(this._arrLineRule[null!==e.LineRule?e.LineRule:1].defaultUnit),this.numLineHeight.setStep(this._arrLineRule[null!==e.LineRule?e.LineRule:1].step),this._state.LineRuleIdx=e.LineRule),Math.abs(this._state.LineHeight-e.Line)>.001||(null===this._state.LineHeight||null===e.Line)&&this._state.LineHeight!==e.Line){var n="";e.LineRule==c_paragraphLinerule.LINERULE_AUTO?n=e.Line:null!==e.LineRule&&null!==e.Line&&(n=Common.Utils.Metric.fnRecalcFromMM(e.Line)),this.numLineHeight.setValue(null!==n?n:"",!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),this._state.AddInterval!==i.ContextualSpacing&&(this.chAddInterval.setValue(null!==i.ContextualSpacing&&void 0!==i.ContextualSpacing?i.ContextualSpacing:"indeterminate",!0),this._state.AddInterval=i.ContextualSpacing);var o=t.get_Shade();if(null!==o&&void 0!==o&&o.get_Value()===Asc.c_oAscShdClear){var s=o.get_Color();s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BackColor={color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}:this.BackColor=Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()):this.BackColor="transparent"}else this.BackColor="transparent";var a=typeof this.BackColor;if(a!==typeof this._state.BackColor||"object"==a&&(this.BackColor.effectValue!==this._state.BackColor.effectValue||this._state.BackColor.color.indexOf(this.BackColor.color)<0)||"object"!=a&&this._state.BackColor.indexOf(this.BackColor)<0){if(this.btnColor.setColor(this.BackColor),"object"==typeof this.BackColor){for(var r=!1,l=0;l<10;l++)if(Common.Utils.ThemeColor.ThemeValues[l]==this.BackColor.effectValue){this.mnuColorPicker.select(this.BackColor,!0),r=!0;break}r||this.mnuColorPicker.clearSelection()}else this.mnuColorPicker.select(this.BackColor,!0);this._state.BackColor=this.BackColor}}},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._arrLineRule[2].defaultUnit=this._arrLineRule[0].defaultUnit=Common.Utils.Metric.getCurrentMetricName(),this._arrLineRule[2].minValue=this._arrLineRule[0].minValue=parseFloat(Common.Utils.Metric.fnRecalcFromMM(.3).toFixed(2)),this._arrLineRule[2].step=this._arrLineRule[0].step=Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01,
|
|
|
null!==this._state.LineRuleIdx&&(this.numLineHeight.setDefaultUnit(this._arrLineRule[this._state.LineRuleIdx].defaultUnit),this.numLineHeight.setStep(this._arrLineRule[this._state.LineRuleIdx].step))},createDelayedElements:function(){this.UpdateThemeColors(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new DE.Views.ParagraphSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,paragraphProps:o,borderProps:e.borderAdvancedProps,isChart:e.isChart,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.borderAdvancedProps=i.borderProps,e.api.paraApply(i.paragraphProps)),e.fireEvent("editcomplete",e)}}).show();break}}}},addNewColor:function(){this.mnuColorPicker.addNewColor("object"==typeof this.btnColor.color?this.btnColor.color.color:this.btnColor.color)},UpdateThemeColors:function(){this.mnuColorPicker||(this.btnColor.setMenu(new Common.UI.Menu({items:[{template:i.template('<div id="paragraph-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="paragraph-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})),this.mnuColorPicker=new Common.UI.ThemeColorPalette({el:e("#paragraph-color-menu"),transparent:!0}),this.mnuColorPicker.on("select",i.bind(this.onColorPickerSelect,this))),this.mnuColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},onHideMenus:function(t,e,i){i||this.fireEvent("editcomplete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},hideTextOnlySettings:function(t){this._state.HideTextOnlySettings!==t&&(this._state.HideTextOnlySettings=t,this.TextOnlySettings.toggleClass("hidden",1==t))},strParagraphSpacing:"Paragraph Spacing",strSomeParagraphSpace:"Don't add interval between paragraphs of the same style",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto",textBackColor:"Background color",textNewColor:"Add New Custom Color"},DE.Views.ParagraphSettings||{}))}),define("text!documenteditor/main/app/template/HeaderFooterSettings.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textPageNum %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="headerfooter-button-top-left" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-top-center" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-top-right" style="display: inline-block; margin-right:5px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="headerfooter-button-bottom-left" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-bottom-center" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="headerfooter-button-bottom-right" style="display: inline-block; margin-right:5px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textPosition %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label id="headerfooter-label-position" class="input-label"><%= scope.textHeaderFromTop %></label>\r\n <div id="headerfooter-spin-position"></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.textOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="headerfooter-check-diff-first"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="headerfooter-check-diff-odd"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="headerfooter-check-same-as"></div>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("documenteditor/main/app/view/HeaderFooterSettings",["text!documenteditor/main/app/template/HeaderFooterSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t,e,i,n){"use strict";DE.Views.HeaderFooterSettings=n.View.extend(i.extend({el:"#id-header-settings",template:i.template(t),events:{},options:{alias:"HeaderFooterSettings"},initialize:function(){this._initSettings=!0,this._state={PositionType:c_pageNumPosition.PAGE_NUM_POSITION_TOP,Position:12.5,DiffFirst:!1,DiffOdd:!1,SameAs:!1,DisabledControls:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this.render()},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){var e=t.get_Type();this._state.PositionType!==e&&(e==c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM?this.lblPosition[0].innerHTML=this.textHeaderFromBottom:this.lblPosition[0].innerHTML=this.textHeaderFromTop,this._state.PositionType=e),e=t.get_Position(),Math.abs(this._state.Position-e)>.001&&(this.numPosition.setValue(Common.Utils.Metric.fnRecalcFromMM(e),!0),this._state.Position=e),e=t.get_DifferentFirst(),this._state.DiffFirst!==e&&(this.chDiffFirst.setValue(e,!0),this._state.DiffFirst=e),e=t.get_DifferentEvenOdd(),this._state.DiffOdd!==e&&(this.chDiffOdd.setValue(e,!0),this._state.DiffOdd=e),e=t.get_LinkToPrevious(),this._state.SameAs!==e&&(this.chSameAs.setDisabled(null===e),this.chSameAs.setValue(1==e,!0),this._state.SameAs=e)}},onBtnPositionClick:function(t,e){this.api&&this.api.put_PageNum(t.options.posWhere,t.options.posAlign),this.fireEvent("editcomplete",this)},onNumPositionChange:function(t,e,i,n){this.api&&this.api.put_HeadersAndFootersDistance(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.fireEvent("editcomplete",this)},onDiffFirstChange:function(t,e,i,n){this.api&&this.api.HeadersAndFooters_DifferentFirstPage("checked"==t.getValue()),this.fireEvent("editcomplete",this)},onDiffOddChange:function(t,e,i,n){this.api&&this.api.HeadersAndFooters_DifferentOddandEvenPage("checked"==t.getValue()),this.fireEvent("editcomplete",this)},onSameAsChange:function(t,e,i,n){this.api&&this.api.HeadersAndFooters_LinkToPrevious("checked"==t.getValue()),this.fireEvent("editcomplete",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:.01)}},createDelayedControls:function(){var t=[[c_pageNumPosition.PAGE_NUM_POSITION_TOP,c_pageNumPosition.PAGE_NUM_POSITION_LEFT,"icon-right-panel btn-colontitul-tl","headerfooter-button-top-left",this.textTopLeft],[c_pageNumPosition.PAGE_NUM_POSITION_TOP,c_pageNumPosition.PAGE_NUM_POSITION_CENTER,"icon-right-panel btn-colontitul-tc","headerfooter-button-top-center",this.textTopCenter],[c_pageNumPosition.PAGE_NUM_POSITION_TOP,c_pageNumPosition.PAGE_NUM_POSITION_RIGHT,"icon-right-panel btn-colontitul-tr","headerfooter-button-top-right",this.textTopRight],[c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,c_pageNumPosition.PAGE_NUM_POSITION_LEFT,"icon-right-panel btn-colontitul-bl","headerfooter-button-bottom-left",this.textBottomLeft],[c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,c_pageNumPosition.PAGE_NUM_POSITION_CENTER,"icon-right-panel btn-colontitul-bc","headerfooter-button-bottom-center",this.textBottomCenter],[c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,c_pageNumPosition.PAGE_NUM_POSITION_RIGHT,"icon-right-panel btn-colontitul-br","headerfooter-button-bottom-right",this.textBottomRight]];this._btnsPosition=[],i.each(t,function(t,n,o){var s=new Common.UI.Button({cls:"btn-options huge",iconCls:t[2],posWhere:t[0],posAlign:t[1],hint:t[4]});s.render(e("#"+t[3])),s.on("click",i.bind(this.onBtnPositionClick,this)),this._btnsPosition.push(s),this.lockedControls.push(s)},this),this.numPosition=new Common.UI.MetricSpinner({el:e("#headerfooter-spin-position"),step:.1,width:85,value:"1.25 cm",defaultUnit:"cm",maxValue:55.88,minValue:0}),this.spinners.push(this.numPosition),this.lockedControls.push(this.numPosition),this.lblPosition=e(this.el).find("#headerfooter-label-position"),this.chDiffFirst=new Common.UI.CheckBox({el:e("#headerfooter-check-diff-first"),labelText:this.textDiffFirst}),this.lockedControls.push(this.chDiffFirst),this.chDiffOdd=new Common.UI.CheckBox({el:e("#headerfooter-check-diff-odd"),labelText:this.textDiffOdd}),this.lockedControls.push(this.chDiffOdd),this.chSameAs=new Common.UI.CheckBox({el:e("#headerfooter-check-same-as"),labelText:this.textSameAs}),this.lockedControls.push(this.chSameAs),this.numPosition.on("change",i.bind(this.onNumPositionChange,this)),this.chDiffFirst.on("change",i.bind(this.onDiffFirstChange,this)),this.chDiffOdd.on("change",i.bind(this.onDiffOddChange,this)),this.chSameAs.on("change",i.bind(this.onSameAsChange,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},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)}))},textHeaderFromTop:"Header from Top",textHeaderFromBottom:"Header from Bottom",textPosition:"Position",textOptions:"Options",textDiffFirst:"Different first page",textDiffOdd:"Different odd and even pages",textPageNum:"Insert Page Number",textTopLeft:"Top Left",textTopRight:"Top Right",textTopCenter:"Top Center",textBottomLeft:"Bottom Left",textBottomRight:"Bottom Right",textBottomCenter:"Bottom Center",textSameAs:"Link to Previous"},DE.Views.HeaderFooterSettings||{}))}),define("text!documenteditor/main/app/template/ImageSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label id="image-label-width" class="input-label"><%= scope.textWidth %></label>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label id="image-label-height" class="input-label"><%= scope.textHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <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 class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textWrap %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="image-button-wrap" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header" 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("text!documenteditor/main/app/template/ImageSettingsAdvanced.template",[],function(){return'<div id="id-adv-image-width" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="4" width="100%">\r\n <tr>\r\n <td width="88px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="image-advanced-spin-width"></div>\r\n </td>\r\n <td width="28px" style="vertical-align: bottom;">\r\n <div id="image-advanced-button-ratio"></div>\r\n </td>\r\n <td width="88px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="image-advanced-spin-height"></div>\r\n </td>\r\n <td style="vertical-align: bottom;">\r\n <button type="button" class="btn btn-text-default" id="image-advanced-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-size" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header"><%= scope.textWidth %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="shape-radio-hsize"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textAbsoluteWH %></label>\r\n <div id="shape-advanced-spin-width"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="shape-radio-hsizepc"></div>\r\n </td>\r\n <td class="padding-large" style="padding-right: 15px;">\r\n <label class="input-label"><%= scope.textRelativeWH %></label>\r\n <div id="shape-advanced-spin-width-rel"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="shape-combo-width-rel" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="3">\r\n <label class="header"><%= scope.textHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="shape-radio-vsize"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textAbsoluteWH %></label>\r\n <div id="shape-advanced-spin-height"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="shape-radio-vsizepc"></div>\r\n </td>\r\n <td class="padding-large" style="padding-right: 15px;">\r\n <label class="input-label"><%= scope.textRelativeWH %></label>\r\n <div id="shape-advanced-spin-height-rel"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="shape-combo-height-rel" style="width: 115px;"></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="1" style="width: 100%;">\r\n <tr>\r\n <td>\r\n <div id="shape-checkbox-ratio"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-image-wrap" class="settings-panel">\r\n <div class="inner-content padding-large">\r\n <label class="header padding-small"><%= scope.textWrap %></label>\r\n <div class="padding-small">\r\n <div id="image-advanced-button-wrap-inline" style="display: inline-block; margin-right:7px;"></div>\r\n <div id="image-advanced-button-wrap-square" style="display: inline-block; margin-right:7px;"></div>\r\n <div id="image-advanced-button-wrap-tight" style="display: inline-block; margin-right:7px;"></div>\r\n <div id="image-advanced-button-wrap-through" style="display: inline-block; margin-right:7px;"></div>\r\n </div>\r\n <div class="padding-small">\r\n <div id="image-advanced-button-wrap-topbottom" style="display: inline-block; margin-right:7px;"></div>\r\n <div id="image-advanced-button-wrap-infront" style="display: inline-block; margin-right:7px;"></div>\r\n <div id="image-advanced-button-wrap-behind" style="display: inline-block;"></div>\r\n </div>\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.textDistance %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="image-advanced-distance-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="image-advanced-distance-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="image-advanced-distance-bottom"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="image-advanced-distance-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-image-position" 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"><%= scope.textHorizontal %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="image-radio-halign"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textAlignment %></label>\r\n <div id="image-combo-halign" style="width: 115px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="image-combo-hrelative" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="image-radio-hposition"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textPosition %></label>\r\n <div id="image-spin-x"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRightOf %></label>\r\n <div id="image-combo-hposition" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="image-radio-hpositionpc"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textPositionPc %></label>\r\n <div id="image-spin-xpc"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="image-combo-hpositionpc" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="3">\r\n <label class="header"><%= scope.textVertical %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="image-radio-valign"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textAlignment %></label>\r\n <div id="image-combo-valign" style="width: 115px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="image-combo-vrelative" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 12px;">\r\n <div id="image-radio-vposition"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textPosition %></label>\r\n <div id="image-spin-y"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBelow %></label>\r\n <div id="image-combo-vposition" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom; padding-bottom: 19px;">\r\n <div id="image-radio-vpositionpc"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textPositionPc %></label>\r\n <div id="image-spin-ypc"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textRelative %></label>\r\n <div id="image-combo-vpositionpc" style="width: 115px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-small"></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.textOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="image-checkbox-move"></div>\r\n </td>\r\n <td>\r\n <div id="image-checkbox-overlap"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-image-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-image-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="image-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="image-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="image-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="image-margin-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-image-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="image-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="image-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>'}),define("documenteditor/main/app/view/ImageSettingsAdvanced",["text!documenteditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox"],function(t){"use strict";DE.Views.ImageSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:340,height:485,toggleGroup:"image-adv-settings-group",sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},properties:null,storageName:"de-img-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-width",panelCaption:this.textSize},{panelId:"id-adv-shape-size",panelCaption:this.textSize},{panelId:"id-adv-image-wrap",panelCaption:this.textBtnWrap},{panelId:"id-adv-image-position",panelCaption:this.textPosition},{panelId:"id-adv-image-shape",panelCaption:this.textShape},{panelId:"id-adv-image-margins",panelCaption:this.strMargins},{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._state={HAlignType:Asc.c_oAscAlignH.Left,HAlignFrom:Asc.c_oAscRelativeFromH.Character,HPositionFrom:Asc.c_oAscRelativeFromH.Character,HPositionPcFrom:Asc.c_oAscRelativeFromH.Page,ShapeWidthPcFrom:Asc.c_oAscRelativeFromH.Margin,VAlignType:Asc.c_oAscAlignV.Top,VAlignFrom:Asc.c_oAscRelativeFromV.Paragraph,VPositionFrom:Asc.c_oAscRelativeFromV.Paragraph,VPositionPcFrom:Asc.c_oAscRelativeFromV.Page,ShapeHeightPcFrom:Asc.c_oAscRelativeFromV.Margin,spnXChanged:!1,spnYChanged:!1,spnXPcChanged:!1,spnYPcChanged:!1},this._objectType=Asc.c_oAscTypeSelectElement.Image,this.Margins=void 0,this._nRatio=1,this._originalProps=this.options.imageProps,this.sectionProps=this.options.sectionProps,this.pageWidth=this.options.sectionProps?this.options.sectionProps.get_W():210,this.pageHeight=this.options.sectionProps?this.options.sectionProps.get_H():297,this._changedProps=null,this._changedShapeProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-width"),step:.1,width:80,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.sizeMax.height&&(s=this.sizeMax.height,o=s*this._nRatio,
|
|
|
this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-height"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;this.btnRatio.pressed&&(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.spinners.push(this.spnHeight),this.btnOriginalSize=new Common.UI.Button({el:$("#image-advanced-button-original-size")}),this.btnOriginalSize.on("click",_.bind(function(t,e){this.spnWidth.setValue(this.sizeOriginal.width,!0),this.spnHeight.setValue(this.sizeOriginal.height,!0),this._nRatio=this.sizeOriginal.width/this.sizeOriginal.height,this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())),this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render($("#image-advanced-button-ratio")),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect(t.pressed)},this)),this.radioHSize=new Common.UI.RadioBox({el:$("#shape-radio-hsize"),name:"asc-radio-width",checked:!0}),this.radioHSize.on("change",_.bind(this.onRadioHSizeChange,this)),this.radioHSizePc=new Common.UI.RadioBox({el:$("#shape-radio-hsizepc"),name:"asc-radio-width"}),this.radioHSizePc.on("change",_.bind(this.onRadioHSizePcChange,this)),this.radioVSize=new Common.UI.RadioBox({el:$("#shape-radio-vsize"),name:"asc-radio-height",checked:!0}),this.radioVSize.on("change",_.bind(this.onRadioVSizeChange,this)),this.radioVSizePc=new Common.UI.RadioBox({el:$("#shape-radio-vsizepc"),name:"asc-radio-height"}),this.radioVSizePc.on("change",_.bind(this.onRadioVSizePcChange,this)),this.chRatio=new Common.UI.CheckBox({el:$("#shape-checkbox-ratio"),labelText:this.textAspectRatio}),this.chRatio.on("change",_.bind(function(t,e,i,n){"checked"==t.getValue()&&this.spnShapeHeight.getNumberValue()>0&&(this._nRatio=this.spnShapeWidth.getNumberValue()/this.spnShapeHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect("checked"==t.getValue())},this)),this.spnShapeWidth=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnShapeWidth.on("change",_.bind(function(t,e,i,n){if("checked"==this.chRatio.getValue()&&!this.chRatio.isDisabled()){var o=t.getNumberValue(),s=o/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,o=s*this._nRatio,this.spnShapeWidth.setValue(o,!0)),this.spnShapeHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.fillShapeHeight())},this)),this.spinners.push(this.spnShapeWidth),this.spnShapeHeight=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-height"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnShapeHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;"checked"!=this.chRatio.getValue()||this.chRatio.isDisabled()||(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnShapeHeight.setValue(o,!0)),this.spnShapeWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.fillShapeWidth())},this)),this.spinners.push(this.spnShapeHeight),this.spnShapeWidthPc=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width-rel"),disabled:!0,step:1,width:80,defaultUnit:"%",value:"1 %",maxValue:1e3,minValue:1}),this.spnShapeWidthPc.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_SizeRelH()&&void 0!==this._changedProps.get_SizeRelH()||this._changedProps.put_SizeRelH(new Asc.CImagePositionH),this._changedProps.get_SizeRelH().put_Value(t.getNumberValue()),this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom),this.fillShapeHeight())},this)),this.spnShapeHeightPc=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-height-rel"),disabled:!0,step:1,width:80,defaultUnit:"%",value:"1 %",maxValue:1e3,minValue:1}),this.spnShapeHeightPc.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_SizeRelV()&&void 0!==this._changedProps.get_SizeRelV()||this._changedProps.put_SizeRelV(new Asc.CImagePositionV),this._changedProps.get_SizeRelV().put_Value(t.getNumberValue()),this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom),this.fillShapeWidth())},this)),this._arrHRelativePc=[{displayValue:this.textLeftMargin,value:Asc.c_oAscRelativeFromH.LeftMargin,size:this.sectionProps.get_LeftMargin()},{displayValue:this.textMargin,value:Asc.c_oAscRelativeFromH.Margin,size:this.sectionProps.get_W()-this.sectionProps.get_LeftMargin()-this.sectionProps.get_RightMargin()},{displayValue:this.textPage,value:Asc.c_oAscRelativeFromH.Page,size:this.sectionProps.get_W()},{displayValue:this.textRightMargin,value:Asc.c_oAscRelativeFromH.RightMargin,size:this.sectionProps.get_RightMargin()}],this.cmbWidthPc=new Common.UI.ComboBox({el:$("#shape-combo-width-rel"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHRelativePc}),this.cmbWidthPc.setDisabled(!0),this.cmbWidthPc.setValue(this._state.ShapeWidthPcFrom),this.cmbWidthPc.on("selected",_.bind(this.onCmbWidthPcSelect,this)),this._arrVRelativePc=[{displayValue:this.textMargin,value:Asc.c_oAscRelativeFromV.Margin,size:this.sectionProps.get_H()-this.sectionProps.get_TopMargin()-this.sectionProps.get_BottomMargin()},{displayValue:this.textBottomMargin,value:Asc.c_oAscRelativeFromV.BottomMargin,size:this.sectionProps.get_BottomMargin()},{displayValue:this.textPage,value:Asc.c_oAscRelativeFromV.Page,size:this.sectionProps.get_H()},{displayValue:this.textTopMargin,value:Asc.c_oAscRelativeFromV.TopMargin,size:this.sectionProps.get_TopMargin()}],this.cmbHeightPc=new Common.UI.ComboBox({el:$("#shape-combo-height-rel"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVRelativePc}),this.cmbHeightPc.setDisabled(!0),this.cmbHeightPc.setValue(this._state.ShapeHeightPcFrom),this.cmbHeightPc.on("selected",_.bind(this.onCmbHeightPcSelect,this)),this.btnWrapInline=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-inline",posId:Asc.c_oAscWrapStyle2.Inline,hint:this.textWrapInlineTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapInline.render($("#image-advanced-button-wrap-inline")),this.btnWrapInline.on("click",_.bind(this.onBtnWrapClick,this)),this.btnWrapSquare=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-square",posId:Asc.c_oAscWrapStyle2.Square,hint:this.textWrapSquareTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapSquare.render($("#image-advanced-button-wrap-square")),this.btnWrapSquare.on("click",_.bind(this.onBtnWrapClick,this)),this.btnWrapTight=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-tight",posId:Asc.c_oAscWrapStyle2.Tight,hint:this.textWrapTightTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapTight.render($("#image-advanced-button-wrap-tight")),this.btnWrapTight.on("click",_.bind(this.onBtnWrapClick,this)),this.btnWrapThrough=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-through",posId:Asc.c_oAscWrapStyle2.Through,hint:this.textWrapThroughTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapThrough.render($("#image-advanced-button-wrap-through")),this.btnWrapThrough.on("click",_.bind(this.onBtnWrapClick,this)),this.btnWrapTopBottom=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-topbottom",posId:Asc.c_oAscWrapStyle2.TopAndBottom,hint:this.textWrapTopbottomTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapTopBottom.render($("#image-advanced-button-wrap-topbottom")),this.btnWrapTopBottom.on("click",_.bind(this.onBtnWrapClick,this)),this.btnWrapBehind=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-behind",posId:Asc.c_oAscWrapStyle2.Behind,hint:this.textWrapBehindTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapBehind.render($("#image-advanced-button-wrap-behind")),this.btnWrapBehind.on("click",_.bind(this.onBtnWrapClick,this)),this.btnWrapInFront=new Common.UI.Button({cls:"btn-options x-huge",iconCls:"icon-advanced-wrap btn-wrap-infront",posId:Asc.c_oAscWrapStyle2.InFront,hint:this.textWrapInFrontTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"imgAdvWrapGroup"}),this.btnWrapInFront.render($("#image-advanced-button-wrap-infront")),this.btnWrapInFront.on("click",_.bind(this.onBtnWrapClick,this)),this.spnTop=new Common.UI.MetricSpinner({el:$("#image-advanced-distance-top"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnTop.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Paddings()&&void 0!==this._changedProps.get_Paddings()||this._changedProps.put_Paddings(new Asc.asc_CPaddings),this._changedProps.get_Paddings().put_Top(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnTop),this.spnBottom=new Common.UI.MetricSpinner({el:$("#image-advanced-distance-bottom"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnBottom.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Paddings()&&void 0!==this._changedProps.get_Paddings()||this._changedProps.put_Paddings(new Asc.asc_CPaddings),this._changedProps.get_Paddings().put_Bottom(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnBottom),this.spnLeft=new Common.UI.MetricSpinner({el:$("#image-advanced-distance-left"),step:.1,width:85,defaultUnit:"cm",value:"0.32 cm",maxValue:55.87,minValue:0}),this.spnLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Paddings()&&void 0!==this._changedProps.get_Paddings()||this._changedProps.put_Paddings(new Asc.asc_CPaddings),this._changedProps.get_Paddings().put_Left(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnLeft),this.spnRight=new Common.UI.MetricSpinner({el:$("#image-advanced-distance-right"),step:.1,width:85,defaultUnit:"cm",value:"0.32 cm",maxValue:55.87,minValue:0}),this.spnRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Paddings()&&void 0!==this._changedProps.get_Paddings()||this._changedProps.put_Paddings(new Asc.asc_CPaddings),this._changedProps.get_Paddings().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnRight),this.spnX=new Common.UI.MetricSpinner({el:$("#image-spin-x"),step:.1,width:115,disabled:!0,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spnX.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_Percent(!1),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom),this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._state.spnXChanged=!0)},this)),this.spinners.push(this.spnX),this.spnY=new Common.UI.MetricSpinner({el:$("#image-spin-y"),step:.1,width:115,disabled:!0,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spnY.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_Percent(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom),this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._state.spnYChanged=!0)},this)),this.spinners.push(this.spnY),this._arrHAlign=[{displayValue:this.textLeft,value:Asc.c_oAscAlignH.Left},{displayValue:this.textCenter,value:Asc.c_oAscAlignH.Center},{displayValue:this.textRight,value:Asc.c_oAscAlignH.Right}],this.cmbHAlign=new Common.UI.ComboBox({el:$("#image-combo-halign"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHAlign}),this.cmbHAlign.setValue(this._state.HAlignType),this.cmbHAlign.on("selected",_.bind(this.onHAlignSelect,this)),this._arrHRelative=[{displayValue:this.textCharacter,value:Asc.c_oAscRelativeFromH.Character},{displayValue:this.textColumn,value:Asc.c_oAscRelativeFromH.Column},{displayValue:this.textLeftMargin,value:Asc.c_oAscRelativeFromH.LeftMargin},{displayValue:this.textMargin,value:Asc.c_oAscRelativeFromH.Margin},{displayValue:this.textPage,value:Asc.c_oAscRelativeFromH.Page},{displayValue:this.textRightMargin,value:Asc.c_oAscRelativeFromH.RightMargin}],this.cmbHRelative=new Common.UI.ComboBox({el:$("#image-combo-hrelative"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHRelative}),this.cmbHRelative.setValue(this._state.HAlignFrom),this.cmbHRelative.on("selected",_.bind(this.onHRelativeSelect,this)),this.cmbHPosition=new Common.UI.ComboBox({el:$("#image-combo-hposition"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHRelative}),this.cmbHPosition.setDisabled(!0),this.cmbHPosition.setValue(this._state.HPositionFrom),this.cmbHPosition.on("selected",_.bind(this.onHPositionSelect,this)),this.spnXPc=new Common.UI.MetricSpinner({el:$("#image-spin-xpc"),step:1,width:115,disabled:!0,defaultUnit:"%",defaultValue:0,value:"0 %",maxValue:1e3,minValue:-1e3}),this.spnXPc.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_Percent(!0),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionPcFrom),this._changedProps.get_PositionH().put_Value(t.getNumberValue()),this._state.spnXPcChanged=!0)},this)),this.cmbHPositionPc=new Common.UI.ComboBox({el:$("#image-combo-hpositionpc"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrHRelativePc}),this.cmbHPositionPc.setDisabled(!0),this.cmbHPositionPc.setValue(this._state.HPositionPcFrom),this.cmbHPositionPc.on("selected",_.bind(this.onHPositionPcSelect,this)),this._arrVAlign=[{displayValue:this.textTop,value:Asc.c_oAscAlignV.Top},{displayValue:this.textCenter,value:Asc.c_oAscAlignV.Center},{displayValue:this.textBottom,value:Asc.c_oAscAlignV.Bottom}],this.cmbVAlign=new Common.UI.ComboBox({el:$("#image-combo-valign"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVAlign}),this.cmbVAlign.setValue(this._state.VAlignType),this.cmbVAlign.on("selected",_.bind(this.onVAlignSelect,this)),this._arrVRelative=[{displayValue:this.textLine,value:Asc.c_oAscRelativeFromV.Line},{displayValue:this.textMargin,value:Asc.c_oAscRelativeFromV.Margin},{displayValue:this.textBottomMargin,value:Asc.c_oAscRelativeFromV.BottomMargin},{displayValue:this.textParagraph,value:Asc.c_oAscRelativeFromV.Paragraph},{displayValue:this.textPage,value:Asc.c_oAscRelativeFromV.Page},{displayValue:this.textTopMargin,value:Asc.c_oAscRelativeFromV.TopMargin}],this.cmbVRelative=new Common.UI.ComboBox({el:$("#image-combo-vrelative"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVRelative}),this.cmbVRelative.setValue(this._state.VAlignFrom),this.cmbVRelative.on("selected",_.bind(this.onVRelativeSelect,this)),this.cmbVPosition=new Common.UI.ComboBox({el:$("#image-combo-vposition"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVRelative}),this.cmbVPosition.setDisabled(!0),this.cmbVPosition.setValue(this._state.VPositionFrom),this.cmbVPosition.on("selected",_.bind(this.onVPositionSelect,this)),this.spnYPc=new Common.UI.MetricSpinner({el:$("#image-spin-ypc"),step:1,width:115,disabled:!0,defaultUnit:"%",defaultValue:0,value:"0 %",maxValue:1e3,minValue:-1e3}),this.spnYPc.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_Percent(!0),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionPcFrom),this._changedProps.get_PositionV().put_Value(t.getNumberValue()),this._state.spnYPcChanged=!0)},this)),this.cmbVPositionPc=new Common.UI.ComboBox({el:$("#image-combo-vpositionpc"),cls:"input-group-nr",menuStyle:"min-width: 115px;",editable:!1,data:this._arrVRelativePc}),this.cmbVPositionPc.setDisabled(!0),this.cmbVPositionPc.setValue(this._state.VPositionPcFrom),this.cmbVPositionPc.on("selected",_.bind(this.onVPositionPcSelect,this)),this.radioHAlign=new Common.UI.RadioBox({el:$("#image-radio-halign"),name:"asc-radio-horizontal",checked:!0}),this.radioHAlign.on("change",_.bind(this.onRadioHAlignChange,this)),this.radioHPosition=new Common.UI.RadioBox({el:$("#image-radio-hposition"),name:"asc-radio-horizontal"}),this.radioHPosition.on("change",_.bind(this.onRadioHPositionChange,this)),this.radioHPositionPc=new Common.UI.RadioBox({el:$("#image-radio-hpositionpc"),name:"asc-radio-horizontal"}),this.radioHPositionPc.on("change",_.bind(this.onRadioHPositionPcChange,this)),this.radioVAlign=new Common.UI.RadioBox({el:$("#image-radio-valign"),name:"asc-radio-vertical",checked:!0}),this.radioVAlign.on("change",_.bind(this.onRadioVAlignChange,this)),this.radioVPosition=new Common.UI.RadioBox({el:$("#image-radio-vposition"),name:"asc-radio-vertical"}),this.radioVPosition.on("change",_.bind(this.onRadioVPositionChange,this)),this.radioVPositionPc=new Common.UI.RadioBox({el:$("#image-radio-vpositionpc"),name:"asc-radio-vertical"}),this.radioVPositionPc.on("change",_.bind(this.onRadioVPositionPcChange,this)),this.chMove=new Common.UI.CheckBox({el:$("#image-checkbox-move"),labelText:this.textMove}),this.chMove.on("change",_.bind(function(t,e,i,n){if(this._changedProps){var o=this._arrVRelative["checked"==t.getValue()?3:4].value;if(this.cmbVRelative.isDisabled()){this.cmbVPosition.setValue(o);var s=this.cmbVPosition.getSelectedRecord();s&&this.onVPositionSelect(this.cmbVPosition,s)}else{this.cmbVRelative.setValue(o);var s=this.cmbVRelative.getSelectedRecord();s&&this.onVRelativeSelect(this.cmbVRelative,s)}}},this)),this.chOverlap=new Common.UI.CheckBox({el:$("#image-checkbox-overlap"),labelText:this.textOverlap}),this.chOverlap.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_AllowOverlap("checked"==t.getValue())},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#image-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&&(void 0===this.Margins&&(this.Margins=new Asc.asc_CPaddings),this.Margins.put_Top(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#image-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&&(void 0===this.Margins&&(this.Margins=new Asc.asc_CPaddings),this.Margins.put_Bottom(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#image-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&&(void 0===this.Margins&&(this.Margins=new Asc.asc_CPaddings),this.Margins.put_Left(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#image-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&&(void 0===this.Margins&&(this.Margins=new Asc.asc_CPaddings),this.Margins.put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginRight),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._changedShapeProps&&(null===this._changedShapeProps.get_stroke()&&this._changedShapeProps.put_stroke(new Asc.asc_CStroke),this._changedShapeProps.get_stroke().put_linecap(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._changedShapeProps&&(null===this._changedShapeProps.get_stroke()&&this._changedShapeProps.put_stroke(new Asc.asc_CStroke),this._changedShapeProps.get_stroke().put_linejoin(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="img-arrows 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;",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 img-arrows" 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="img-arrows 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;",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 img-arrows" 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="img-arrows 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;",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 img-arrows" 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="img-arrows 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;",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 img-arrows" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndSizePicker.on("item:click",_.bind(this.onSelectEndSize,this)),this._selectStyleItem(this.btnEndSize,null),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.updateMetricUnit(),this._setDefaults(this._originalProps),this.btnsCategory[this._objectType==Asc.c_oAscTypeSelectElement.Shape?0:1].setVisible(!1),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){this._objectType=Asc.c_oAscTypeSelectElement.Image;var e=t.get_WrappingStyle();if(t.get_CanBeFlow()){switch(e){case Asc.c_oAscWrapStyle2.Inline:this.btnWrapInline.toggle(!0);break;case Asc.c_oAscWrapStyle2.Square:this.btnWrapSquare.toggle(!0);break;case Asc.c_oAscWrapStyle2.Tight:this.btnWrapTight.toggle(!0);break;case Asc.c_oAscWrapStyle2.Through:this.btnWrapThrough.toggle(!0);break;case Asc.c_oAscWrapStyle2.TopAndBottom:this.btnWrapTopBottom.toggle(!0);break;case Asc.c_oAscWrapStyle2.Behind:this.btnWrapBehind.toggle(!0);break;case Asc.c_oAscWrapStyle2.InFront:this.btnWrapInFront.toggle(!0);break;default:this.btnWrapInline.toggle(!1),this.btnWrapSquare.toggle(!1),this.btnWrapTight.toggle(!1),this.btnWrapThrough.toggle(!1),this.btnWrapTopBottom.toggle(!1),this.btnWrapBehind.toggle(!1),this.btnWrapInFront.toggle(!1)}this._DisableElem(e)}else this.btnWrapInline.toggle(!0),this.btnWrapSquare.setDisabled(!0),this.btnWrapTight.setDisabled(!0),this.btnWrapThrough.setDisabled(!0),this.btnWrapTopBottom.setDisabled(!0),this.btnWrapBehind.setDisabled(!0),this.btnWrapInFront.setDisabled(!0),this._DisableElem(Asc.c_oAscWrapStyle2.Inline);if(t.get_Paddings()){var i={Top:t.get_Paddings().get_Top(),Right:t.get_Paddings().get_Right(),Bottom:t.get_Paddings().get_Bottom(),Left:t.get_Paddings().get_Left()};null!==i.Top&&void 0!==i.Top&&this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(i.Top),!0),null!==i.Left&&void 0!==i.Left&&this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(i.Left),!0),null!==i.Bottom&&void 0!==i.Bottom&&this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(i.Bottom),!0),null!==i.Right&&void 0!==i.Right&&this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(i.Right),!0)}var n=t.get_PositionH();if(n)if(n.get_UseAlign()){e=n.get_Align();for(var o=0;o<this._arrHAlign.length;o++)if(e==this._arrHAlign[o].value){this.cmbHAlign.setValue(e),this._state.HAlignType=e;break}e=n.get_RelativeFrom();for(var o=0;o<this._arrHRelative.length;o++)if(e==this._arrHRelative[o].value){this.cmbHRelative.setValue(e),this._state.HAlignFrom=e;break}}else if(n.get_Percent()){for(this.radioHPositionPc.setValue(!0),this.spnXPc.setValue(n.get_Value()),e=n.get_RelativeFrom(),o=0;o<this._arrHRelativePc.length;o++)if(e==this._arrHRelativePc[o].value){this.cmbHPositionPc.setValue(e),this._state.HPositionPcFrom=e;break}}else for(this.radioHPosition.setValue(!0),e=n.get_Value(),this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(e)),e=n.get_RelativeFrom(),o=0;o<this._arrHRelative.length;o++)if(e==this._arrHRelative[o].value){this.cmbHPosition.setValue(e),this._state.HPositionFrom=e;break}if(n=t.get_PositionV()){if(n.get_UseAlign()){for(e=n.get_Align(),o=0;o<this._arrVAlign.length;o++)if(e==this._arrVAlign[o].value){this.cmbVAlign.setValue(e),this._state.VAlignType=e;break}
|
|
|
for(e=n.get_RelativeFrom(),o=0;o<this._arrVRelative.length;o++)if(e==this._arrVRelative[o].value){this.cmbVRelative.setValue(e),this._state.VAlignFrom=e;break}}else if(n.get_Percent()){for(this.radioVPositionPc.setValue(!0),this.spnYPc.setValue(n.get_Value()),e=n.get_RelativeFrom(),o=0;o<this._arrVRelativePc.length;o++)if(e==this._arrVRelativePc[o].value){this.cmbVPositionPc.setValue(e),this._state.VPositionPcFrom=e;break}}else for(this.radioVPosition.setValue(!0),e=n.get_Value(),this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(e)),e=n.get_RelativeFrom(),o=0;o<this._arrVRelative.length;o++)if(e==this._arrVRelative[o].value){this.cmbVPosition.setValue(e),this._state.VPositionFrom=e;break}this.chMove.setValue(e==Asc.c_oAscRelativeFromV.Line||e==Asc.c_oAscRelativeFromV.Paragraph,!0),this.chMove.setDisabled(!n.get_UseAlign()&&n.get_Percent())}this.chOverlap.setValue(null!==t.get_AllowOverlap()&&void 0!==t.get_AllowOverlap()?t.get_AllowOverlap():"indeterminate",!0),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height());var s=t.get_ShapeProperties(),a=t.get_ChartProperties();if(this.btnOriginalSize.setVisible(!(s||a)),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl()),this.btnsCategory[4].setVisible(null!==s&&!s.get_FromChart()),this.btnsCategory[5].setVisible(null!==s&&!s.get_FromChart()),this.btnsCategory[2].setDisabled(t.get_FromGroup()),s){this._objectType=Asc.c_oAscTypeSelectElement.Shape,this._setShapeDefaults(s),this.setTitle(this.textTitleShape),e=t.asc_getLockAspect(),this.chRatio.setValue(e),this.spnShapeWidth.setMaxValue(this.sizeMax.width),this.spnShapeHeight.setMaxValue(this.sizeMax.height);var r=t.get_SizeRelH();if(r){for(this.radioHSizePc.setValue(!0),this.spnShapeWidthPc.setValue(r.get_Value()),e=r.get_RelativeFrom(),o=0;o<this._arrHRelativePc.length;o++)if(e==this._arrHRelativePc[o].value){this.cmbWidthPc.setValue(e),this.spnShapeWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrHRelativePc[o].size*r.get_Value()/100).toFixed(2),!0),this._state.ShapeWidthPcFrom=e;break}}else this.radioHSize.setValue(!0),e=t.get_Width(),this.spnShapeWidth.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0);var l=t.get_SizeRelV();if(l){for(this.radioVSizePc.setValue(!0),this.spnShapeHeightPc.setValue(l.get_Value()),e=l.get_RelativeFrom(),o=0;o<this._arrVRelativePc.length;o++)if(e==this._arrVRelativePc[o].value){this.cmbHeightPc.setValue(e),this.spnShapeHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrVRelativePc[o].size*l.get_Value()/100).toFixed(2),!0),this._state.ShapeHeightPcFrom=e;break}}else this.radioVSize.setValue(!0),e=t.get_Height(),this.spnShapeHeight.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0);this.chRatio.setDisabled(this.radioVSizePc.getValue()||this.radioHSizePc.getValue());var c=s.get_paddings();if(c){var d=c.get_Left();this.spnMarginLeft.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0),d=c.get_Top(),this.spnMarginTop.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0),d=c.get_Right(),this.spnMarginRight.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0),d=c.get_Bottom(),this.spnMarginBottom.setValue(null!==d&&void 0!==d?Common.Utils.Metric.fnRecalcFromMM(d):"",!0)}this.btnsCategory[5].setDisabled(null===c)}else e=t.asc_getLockAspect(),a?(this._objectType=Asc.c_oAscTypeSelectElement.Chart,this.setTitle(this.textTitleChart)):this.setTitle(this.textTitle),this.btnRatio.toggle(e),this.spnWidth.setMaxValue(this.sizeMax.width),this.spnHeight.setMaxValue(this.sizeMax.height),e=t.get_Width(),this.spnWidth.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0),e=t.get_Height(),this.spnHeight.setValue(void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0);e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),this._changedProps=new Asc.asc_CImgProperty}},getSettings:function(){var t=this._changedProps;if(this._objectType==Asc.c_oAscTypeSelectElement.Shape&&(t.put_ShapeProperties(this._changedShapeProps),this.Margins&&(null!==t.get_ShapeProperties()&&void 0!==t.get_ShapeProperties()||t.put_ShapeProperties(new Asc.asc_CShapeProperty),t.get_ShapeProperties().put_paddings(this.Margins))),this._originalProps.get_WrappingStyle()===Asc.c_oAscWrapStyle2.Inline&&void 0!==t.get_WrappingStyle()&&t.get_WrappingStyle()!==Asc.c_oAscWrapStyle2.Inline){if(null===t.get_PositionH()||void 0===t.get_PositionH()){t.put_PositionH(new Asc.CImagePositionH),t.get_PositionH().put_UseAlign(!1),t.get_PositionH().put_Percent(!1),t.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var e=this._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);t.get_PositionH().put_Value(e)}null!==t.get_PositionV()&&void 0!==t.get_PositionV()||(t.put_PositionV(new Asc.CImagePositionV),t.get_PositionV().put_UseAlign(!1),t.get_PositionV().put_Percent(!1),t.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),e=this._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),t.get_PositionV().put_Value(e))}return this.isAltTitleChanged&&t.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&t.asc_putDescription(this.textareaAltDescription.val()),{imageProps:t}},_setShapeDefaults:function(t){if(t){var e=t.get_stroke();if(e){for(var i=e.get_linejoin(),n=0;n<this._arrJoinType.length;n++)if(i==this._arrJoinType[n].value){this.cmbJoinType.setValue(i);break}for(i=e.get_linecap(),n=0;n<this._arrCapType.length;n++)if(i==this._arrCapType[n].value){this.cmbCapType.setValue(i);break}var o=e.get_canChangeArrows();if(this.btnBeginStyle.setDisabled(!o),this.btnEndStyle.setDisabled(!o),this.btnBeginSize.setDisabled(!o),this.btnEndSize.setDisabled(!o),o){i=e.get_linebeginsize();var s=this.mnuBeginSizePicker.store.findWhere({type:i});s?this._beginSizeIdx=s.get("value"):(this._beginSizeIdx=null,this._selectStyleItem(this.btnBeginSize,null)),i=e.get_linebeginstyle(),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.get_lineendsize(),s=this.mnuEndSizePicker.store.findWhere({type:i}),s?this._endSizeIdx=s.get("value"):(this._endSizeIdx=null,this._selectStyleItem(this.btnEndSize,null)),i=e.get_lineendstyle(),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)}}this._changedShapeProps=new Asc.asc_CShapeProperty},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)})},onBtnWrapClick:function(t,e){this._DisableElem(t.options.posId),this._changedProps&&this._changedProps.put_WrappingStyle(t.options.posId)},_DisableElem:function(t){var e=t==Asc.c_oAscWrapStyle2.Inline||t==Asc.c_oAscWrapStyle2.Behind||t==Asc.c_oAscWrapStyle2.InFront||t==Asc.c_oAscWrapStyle2.TopAndBottom,i=t==Asc.c_oAscWrapStyle2.Inline||t==Asc.c_oAscWrapStyle2.Behind||t==Asc.c_oAscWrapStyle2.InFront||t==Asc.c_oAscWrapStyle2.Tight||t==Asc.c_oAscWrapStyle2.Through;this.spnLeft.setDisabled(e),this.spnRight.setDisabled(e),this.spnTop.setDisabled(i),this.spnBottom.setDisabled(i),this.btnsCategory[3].setDisabled(t==Asc.c_oAscWrapStyle2.Inline)},onHAlignSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._state.HAlignType=e.value,this._changedProps.get_PositionH().put_UseAlign(!0),this._changedProps.get_PositionH().put_Percent(!1),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom),this._changedProps.get_PositionH().put_Align(this._state.HAlignType))},onHRelativeSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._state.HAlignFrom=e.value,this._changedProps.get_PositionH().put_UseAlign(!0),this._changedProps.get_PositionH().put_Percent(!1),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom),this._changedProps.get_PositionH().put_Align(this._state.HAlignType))},onHPositionSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._state.HPositionFrom=e.value,this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_Percent(!1),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom),!this._state.spnXChanged){var i=this._originalProps.get_Value_X(this._state.HPositionFrom);this.spnX.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0)}this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()))}},onHPositionPcSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._state.HPositionPcFrom=e.value,this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_Percent(!0),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionPcFrom),!this._state.spnXPcChanged){var i=this._originalProps.get_Value_X(this._state.HPositionPcFrom);this.spnXPc.setValue(parseFloat((100*i/this.pageWidth).toFixed(2)),!0)}this._changedProps.get_PositionH().put_Value(this.spnXPc.getNumberValue())}},onVAlignSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._state.VAlignType=e.value,this._changedProps.get_PositionV().put_UseAlign(!0),this._changedProps.get_PositionV().put_Percent(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._changedProps.get_PositionV().put_Align(this._state.VAlignType))},onVRelativeSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._state.VAlignFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!0),this._changedProps.get_PositionV().put_Percent(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom),this._changedProps.get_PositionV().put_Align(this._state.VAlignType),this.chMove.setValue(this._state.VAlignFrom==Asc.c_oAscRelativeFromV.Line||this._state.VAlignFrom==Asc.c_oAscRelativeFromV.Paragraph,!0))},onVPositionSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._state.VPositionFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_Percent(!1),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom),!this._state.spnYChanged){var i=this._originalProps.get_Value_Y(this._state.VPositionFrom);this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0)}this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),this.chMove.setValue(this._state.VPositionFrom==Asc.c_oAscRelativeFromV.Line||this._state.VPositionFrom==Asc.c_oAscRelativeFromV.Paragraph,!0)}},onVPositionPcSelect:function(t,e){if(this._changedProps){if(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._state.VPositionPcFrom=e.value,this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_Percent(!0),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionPcFrom),!this._state.spnYPcChanged){var i=this._originalProps.get_Value_Y(this._state.VPositionPcFrom);this.spnYPc.setValue(parseFloat((100*i/this.pageHeight).toFixed(2)),!0)}this._changedProps.get_PositionV().put_Value(this.spnYPc.getNumberValue())}},onRadioHAlignChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._changedProps.get_PositionH().put_UseAlign(e),e&&(this._changedProps.get_PositionH().put_Percent(!1),this._changedProps.get_PositionH().put_Align(this._state.HAlignType),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom))),e&&(this.cmbHAlign.setDisabled(!1),this.cmbHRelative.setDisabled(!1),this.spnX.setDisabled(!0),this.cmbHPosition.setDisabled(!0),this.spnXPc.setDisabled(!0),this.cmbHPositionPc.setDisabled(!0))},onRadioHPositionChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),e&&(this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_Percent(!1),this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom))),e&&(this.cmbHAlign.setDisabled(!0),this.cmbHRelative.setDisabled(!0),this.spnX.setDisabled(!1),this.cmbHPosition.setDisabled(!1),this.spnXPc.setDisabled(!0),this.cmbHPositionPc.setDisabled(!0))},onRadioHPositionPcChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionH()&&void 0!==this._changedProps.get_PositionH()||this._changedProps.put_PositionH(new Asc.CImagePositionH),this._changedProps.get_PositionH().put_Percent(e),e&&(this._changedProps.get_PositionH().put_UseAlign(!1),this._changedProps.get_PositionH().put_Value(this.spnXPc.getNumberValue()),this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionPcFrom))),e&&(this.cmbHAlign.setDisabled(!0),this.cmbHRelative.setDisabled(!0),this.spnX.setDisabled(!0),this.cmbHPosition.setDisabled(!0),this.spnXPc.setDisabled(!1),this.cmbHPositionPc.setDisabled(!1))},onRadioVAlignChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._changedProps.get_PositionV().put_UseAlign(e),e&&(this._changedProps.get_PositionV().put_Percent(!1),this._changedProps.get_PositionV().put_Align(this._state.VAlignType),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom))),e&&(this.cmbVAlign.setDisabled(!1),this.cmbVRelative.setDisabled(!1),this.spnY.setDisabled(!0),this.cmbVPosition.setDisabled(!0),this.chMove.setValue(this._state.VAlignFrom==Asc.c_oAscRelativeFromV.Line||this._state.VAlignFrom==Asc.c_oAscRelativeFromV.Paragraph,!0),this.chMove.setDisabled(!1),this.spnYPc.setDisabled(!0),this.cmbVPositionPc.setDisabled(!0))},onRadioVPositionChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),e&&(this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_Percent(!1),this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom))),e&&(this.cmbVAlign.setDisabled(!0),this.cmbVRelative.setDisabled(!0),this.spnY.setDisabled(!1),this.cmbVPosition.setDisabled(!1),this.chMove.setValue(this._state.VPositionFrom==Asc.c_oAscRelativeFromV.Line||this._state.VPositionFrom==Asc.c_oAscRelativeFromV.Paragraph,!0),this.chMove.setDisabled(!1),this.spnYPc.setDisabled(!0),this.cmbVPositionPc.setDisabled(!0))},onRadioVPositionPcChange:function(t,e,i){this._changedProps&&(null!==this._changedProps.get_PositionV()&&void 0!==this._changedProps.get_PositionV()||this._changedProps.put_PositionV(new Asc.CImagePositionV),this._changedProps.get_PositionV().put_Percent(e),e&&(this._changedProps.get_PositionV().put_UseAlign(!1),this._changedProps.get_PositionV().put_Value(this.spnYPc.getNumberValue()),this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionPcFrom))),e&&(this.cmbVAlign.setDisabled(!0),this.cmbVRelative.setDisabled(!0),this.spnY.setDisabled(!0),this.cmbVPosition.setDisabled(!0),this.chMove.setValue(!1,!0),this.chMove.setDisabled(!0),this.spnYPc.setDisabled(!1),this.cmbVPositionPc.setDisabled(!1))},onRadioHSizeChange:function(t,e,i){e&&(this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnShapeWidth.getNumberValue())),this._changedProps.put_SizeRelH(void 0),this.fillShapeHeight()),this.chRatio.setDisabled(this.radioVSizePc.getValue()),this.cmbWidthPc.setDisabled(!0),this.spnShapeWidthPc.setDisabled(!0),this.spnShapeWidth.setDisabled(!1))},onRadioHSizePcChange:function(t,e,i){e&&(this._changedProps&&(null!==this._changedProps.get_SizeRelH()&&void 0!==this._changedProps.get_SizeRelH()||this._changedProps.put_SizeRelH(new Asc.CImagePositionH),this._changedProps.get_SizeRelH().put_Value(this.spnShapeWidthPc.getNumberValue()),this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom),this.fillShapeHeight()),this.chRatio.setDisabled(!0),this.cmbWidthPc.setDisabled(!1),this.spnShapeWidthPc.setDisabled(!1),this.spnShapeWidth.setDisabled(!0))},onRadioVSizeChange:function(t,e,i){e&&(this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnShapeHeight.getNumberValue())),this._changedProps.put_SizeRelV(void 0),this.fillShapeWidth()),this.chRatio.setDisabled(this.radioHSizePc.getValue()),this.cmbHeightPc.setDisabled(!0),this.spnShapeHeightPc.setDisabled(!0),this.spnShapeHeight.setDisabled(!1))},onRadioVSizePcChange:function(t,e,i){e&&(this._changedProps&&(null!==this._changedProps.get_SizeRelV()&&void 0!==this._changedProps.get_SizeRelV()||this._changedProps.put_SizeRelV(new Asc.CImagePositionV),this._changedProps.get_SizeRelV().put_Value(this.spnShapeHeightPc.getNumberValue()),this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom),this.fillShapeWidth()),this.chRatio.setDisabled(!0),this.cmbHeightPc.setDisabled(!1),this.spnShapeHeightPc.setDisabled(!1),this.spnShapeHeight.setDisabled(!0))},onCmbWidthPcSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_SizeRelH()&&void 0!==this._changedProps.get_SizeRelH()||this._changedProps.put_SizeRelH(new Asc.CImagePositionH),this._state.ShapeWidthPcFrom=e.value,this._changedProps.get_SizeRelH().put_Value(this.spnShapeWidthPc.getNumberValue()),this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom),this.fillShapeHeight())},onCmbHeightPcSelect:function(t,e){this._changedProps&&(null!==this._changedProps.get_SizeRelV()&&void 0!==this._changedProps.get_SizeRelV()||this._changedProps.put_SizeRelV(new Asc.CImagePositionV),this._state.ShapeHeightPcFrom=e.value,this._changedProps.get_SizeRelV().put_Value(this.spnShapeHeightPc.getNumberValue()),this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom),this.fillShapeWidth())},fillShapeWidth:function(t,e){this.radioHSize.getValue()?this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnShapeWidth.getNumberValue())):(null!==this._changedProps.get_SizeRelH()&&void 0!==this._changedProps.get_SizeRelH()||this._changedProps.put_SizeRelH(new Asc.CImagePositionH),this._changedProps.get_SizeRelH().put_Value(this.spnShapeWidthPc.getNumberValue()),this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom))},fillShapeHeight:function(t,e){this.radioVSize.getValue()?this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnShapeHeight.getNumberValue())):(null!==this._changedProps.get_SizeRelV()&&void 0!==this._changedProps.get_SizeRelV()||this._changedProps.put_SizeRelV(new Asc.CImagePositionV),this._changedProps.get_SizeRelV().put_Value(this.spnShapeHeightPc.getNumberValue()),this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom))},_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,n){this._changedShapeProps&&(null===this._changedShapeProps.get_stroke()&&this._changedShapeProps.put_stroke(new Asc.asc_CStroke),this._changedShapeProps.get_stroke().put_linebeginstyle(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,n){this._changedShapeProps&&(null===this._changedShapeProps.get_stroke()&&this._changedShapeProps.put_stroke(new Asc.asc_CStroke),this._changedShapeProps.get_stroke().put_linebeginsize(i.get("type"))),this._beginSizeIdx=i.get("value"),this._selectStyleItem(this.btnBeginSize,i)},onSelectEndStyle:function(t,e,i,n){this._changedShapeProps&&(null===this._changedShapeProps.get_stroke()&&this._changedShapeProps.put_stroke(new Asc.asc_CStroke),this._changedShapeProps.get_stroke().put_lineendstyle(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,n){this._changedShapeProps&&(null===this._changedShapeProps.get_stroke()&&this._changedShapeProps.put_stroke(new Asc.asc_CStroke),this._changedShapeProps.get_stroke().put_lineendsize(i.get("type"))),this._endSizeIdx=i.get("value"),this._selectStyleItem(this.btnEndSize,i)},textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",textOriginalSize:"Default Size",textPosition:"Position",textDistance:"Distance From Text",textSize:"Size",textWrap:"Wrapping Style",textWidth:"Width",textHeight:"Height",textWrapInlineTooltip:"Inline",textWrapSquareTooltip:"Square",textWrapTightTooltip:"Tight",textWrapThroughTooltip:"Through",textWrapTopbottomTooltip:"Top and Bottom",textWrapBehindTooltip:"Behind",textWrapInFrontTooltip:"In Front",textTitle:"Image - Advanced Settings",textKeepRatio:"Constant Proportions",cancelButtonText:"Cancel",okButtonText:"Ok",textBtnWrap:"Text Wrapping",textCenter:"Center",textCharacter:"Character",textColumn:"Column",textLeftMargin:"Left Margin",textMargin:"Margin",textPage:"Page",textRightMargin:"Right Margin",textLine:"Line",textBottomMargin:"Bottom Margin",textParagraph:"Paragraph",textTopMargin:"Top Margin",textHorizontal:"Horizontal",textVertical:"Vertical",textAlignment:"Alignment",textRelative:"relative to",textRightOf:"to the right Of",textBelow:"below",textOverlap:"Allow overlap",textMove:"Move object with text",textOptions:"Options",textShape:"Shape Settings",textTitleShape:"Shape - Advanced Settings",textTitleChart:"Chart - 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",textPositionPc:"Relative position",textAspectRatio:"Lock aspect ratio",textAbsoluteWH:"Absolute",textRelativeWH:"Relative",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."},DE.Views.ImageSettingsAdvanced||{}))}),define("documenteditor/main/app/view/ImageSettings",["text!documenteditor/main/app/template/ImageSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/view/ImageFromUrlDialog","documenteditor/main/app/view/ImageSettingsAdvanced"],function(t,e,i,n){"use strict";DE.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._state={WrappingStyle:Asc.c_oAscWrapStyle2.Inline,CanBeFlow:!0,Width:0,Height:0,FromGroup:!1,DisabledControls:!1,isOleObject:!1},this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render(),this.labelWidth=e(this.el).find("#image-label-width"),this.labelHeight=e(this.el).find("#image-label-height")},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onImgWrapStyleChanged",i.bind(this._ImgWrapStyleChanged,this)),this},updateMetricUnit:function(){var t=Common.Utils.Metric.fnRecalcFromMM(this._state.Width);this.labelWidth[0].innerHTML=this.textWidth+": "+t.toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),t=Common.Utils.Metric.fnRecalcFromMM(this._state.Height),this.labelHeight[0].innerHTML=this.textHeight+": "+t.toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName()},createDelayedControls:function(){var t=this,n=[{offsetx:0,data:Asc.c_oAscWrapStyle2.Inline,iconcls:"wrap-inline",tip:this.txtInline,selected:!0},{offsetx:50,data:Asc.c_oAscWrapStyle2.Square,iconcls:"wrap-square",tip:this.txtSquare},{offsetx:100,data:Asc.c_oAscWrapStyle2.Tight,iconcls:"wrap-tight",tip:this.txtTight},{offsetx:150,data:Asc.c_oAscWrapStyle2.Through,iconcls:"wrap-through",tip:this.txtThrough},{offsetx:200,data:Asc.c_oAscWrapStyle2.TopAndBottom,iconcls:"wrap-topAndBottom",tip:this.txtTopAndBottom},{offsetx:250,data:Asc.c_oAscWrapStyle2.InFront,iconcls:"wrap-inFront",tip:this.txtInFront},{offsetx:300,data:Asc.c_oAscWrapStyle2.Behind,iconcls:"wrap-behind",tip:this.txtBehind}];this.btnWrapType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-wrap wrap-inline",menu:new Common.UI.Menu({items:[{template:i.template('<div id="id-image-menu-wrap" style="width: 235px; margin: 0 5px;"></div>')}]})}),this.btnWrapType.on("render:after",function(o){t.mnuWrapPicker=new Common.UI.DataView({el:e("#id-image-menu-wrap"),parentMenu:o.menu,store:new Common.UI.DataViewStore(n),allowScrollbar:!1,itemTemplate:i.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')})}),this.btnWrapType.render(e("#image-button-wrap")),this.mnuWrapPicker.on("item:click",i.bind(this.onSelectWrap,this,this.btnWrapType)),this.lockedControls.push(this.btnWrapType),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.btnOriginalSize.on("click",i.bind(this.setOriginalSize,this)),this.btnInsertFromFile.on("click",i.bind(function(t){this.api&&this.api.ChangeImageFromFile(),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this.btnEditObject.on("click",i.bind(function(t){this.api&&this.api.asc_startEditCurrentOleObject(),this.fireEvent("editcomplete",this)},this)),this.linkAdvanced=e("#image-advanced-link"),this.lblReplace=e("#image-lbl-replace"),e(this.el).on("click","#image-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.asc_CImgProperty(t);var e=t.get_WrappingStyle();if(this._state.WrappingStyle!==e){this._noApply=!0;var i=this.mnuWrapPicker.store.findWhere({data:e});this.mnuWrapPicker.selectRecord(i,!0),i?this.btnWrapType.setIconCls("item-wrap "+i.get("iconcls")):this.btnWrapType.setIconCls(""),this._noApply=!1,this._state.WrappingStyle=e}e=t.get_CanBeFlow()&&!this._locked;var n=t.get_FromGroup()||this._locked;this._state.CanBeFlow===e&&this._state.FromGroup===n||(this.btnWrapType.setDisabled(!e||n),this._state.CanBeFlow=e,this._state.FromGroup=n),e=t.get_Width(),Math.abs(this._state.Width-e)>.001&&(this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Width=e),e=t.get_Height(),Math.abs(this._state.Height-e)>.001&&(this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Height=e),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl()||this._locked);var o=t.asc_getPluginGuid();if(e=null!==o&&void 0!==o,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._state.isOleObject=e),this._state.isOleObject){var s=DE.getCollection("Common.Collections.Plugins").findWhere({guid:o});this.btnEditObject.setDisabled(null===s||void 0===s||this._locked)}else this.btnInsertFromUrl.setDisabled(null===o||this._locked),this.btnInsertFromFile.setDisabled(null===o||this._locked)}},_ImgWrapStyleChanged:function(t){if(this.mnuWrapPicker&&this._state.WrappingStyle!==t){this._noApply=!0;var e=this.mnuWrapPicker.store.findWhere({data:t});this.mnuWrapPicker.selectRecord(e,!0),e&&this.btnWrapType.setIconCls("item-wrap "+e.get("iconcls")),this._state.WrappingStyle=t,this._noApply=!1}},onSelectWrap: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.btnWrapType.setIconCls("item-wrap "+s.iconcls),this.api){var a=new Asc.asc_CImgProperty;if(a.put_WrappingStyle(s.data),this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline&&s.data!==Asc.c_oAscWrapStyle2.Inline){a.put_PositionH(new Asc.CImagePositionH),a.get_PositionH().put_UseAlign(!1),a.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var r=this._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);a.get_PositionH().put_Value(r),a.put_PositionV(new Asc.CImagePositionV),a.get_PositionV().put_UseAlign(!1),
|
|
|
a.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),r=this._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),a.get_PositionV().put_Value(r)}this.api.ImgApply(a)}this.fireEvent("editcomplete",this)}},setOriginalSize:function(){if(this.api){var t=this.api.get_OriginalSizeImage(),e=t.get_ImageWidth(),i=t.get_ImageHeight();this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(i).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName();var n=new Asc.asc_CImgProperty;n.put_Width(e),n.put_Height(i),this.api.ImgApply(n),this.fireEvent("editcomplete",this)}},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)){var s=new Asc.asc_CImgProperty;s.put_ImageUrl(o),t.api.ImgApply(s)}}t.fireEvent("editcomplete",t)}}).show()},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a;e.btnOriginalSize.isDisabled()||(a=e.api.get_OriginalSizeImage())&&(a={width:a.get_ImageWidth(),height:a.get_ImageHeight()});var r=this.api.GetSectionInfo();r={width:r.get_PageWidth()-(r.get_MarginLeft()+r.get_MarginRight()),height:r.get_PageHeight()-(r.get_MarginTop()+r.get_MarginBottom())},new DE.Views.ImageSettingsAdvanced({imageProps:o,sizeOriginal:a,sizeMax:r,sectionProps:e.api.asc_GetSectionProps(),handler:function(t,i){"ok"==t&&e.api&&e.api.ImgApply(i.imageProps),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textSize:"Size",textWrap:"Wraping Style",textWidth:"Width",textHeight:"Height",textOriginalSize:"Default Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textAdvanced:"Show advanced settings",txtInline:"Inline",txtSquare:"Square",txtTight:"Tight",txtThrough:"Through",txtTopAndBottom:"Top and bottom",txtBehind:"Behind",txtInFront:"In front",textEditObject:"Edit Object",textEdit:"Edit"},DE.Views.ImageSettings||{}))}),define("text!documenteditor/main/app/template/ChartSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label id="chart-label-width" class="input-label"><%= scope.textWidth %></label>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label id="chart-label-height" class="input-label"><%= scope.textHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textWrap %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="chart-button-wrap" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textChartType %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="chart-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <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" 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 <button type="button" class="btn btn-text-default" id="chart-button-edit-data" style="width:115px;"><%= scope.textEditData %></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="chart-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("documenteditor/main/app/view/ChartSettings",["text!documenteditor/main/app/template/ChartSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/ComboDataView","documenteditor/main/app/view/ImageSettingsAdvanced"],function(t,e,i,n){"use strict";DE.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._state={WrappingStyle:Asc.c_oAscWrapStyle2.Inline,CanBeFlow:!0,Width:0,Height:0,FromGroup:!1,ChartStyle:1,ChartType:-1,SeveralCharts:!1,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render(),this.labelWidth=e(this.el).find("#chart-label-width"),this.labelHeight=e(this.el).find("#chart-label-height")},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onImgWrapStyleChanged",i.bind(this._ChartWrapStyleChanged,this)),this.api.asc_registerCallback("asc_onUpdateChartStyles",i.bind(this._onUpdateChartStyles,this))),this},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t&&t.get_ChartProperties()){this._originalProps=new Asc.asc_CImgProperty(t),this._noApply=!0;var e=t.get_WrappingStyle();if(this._state.WrappingStyle!==e){var i=this.mnuWrapPicker.store.findWhere({data:e});this.mnuWrapPicker.selectRecord(i,!0),i?this.btnWrapType.setIconCls("item-wrap "+i.get("iconCls")):this.btnWrapType.setIconCls(""),this._state.WrappingStyle=e}if(this.chartProps=t.get_ChartProperties(),e=t.get_SeveralCharts()||this._locked,this._state.SeveralCharts!==e&&(this.btnEditData.setDisabled(e),this._state.SeveralCharts=e),e=t.get_SeveralChartTypes(),this._state.SeveralCharts&&e)this.btnChartType.setIconCls(""),this._state.ChartType=null;else{var n=this.chartProps.getType();if(this._state.ChartType!==n){var i=this.mnuChartTypePicker.store.findWhere({type:n});this.mnuChartTypePicker.selectRecord(i,!0),i&&this.btnChartType.setIconCls("item-chartlist "+i.get("iconCls")),this.updateChartStyles(this.api.asc_getChartPreviews(n)),this._state.ChartType=n}}if(e=t.get_SeveralChartStyles(),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 o=this.cmbChartStyle.menuPicker.store.findWhere({data:e});this.cmbChartStyle.menuPicker.selectRecord(o),this.cmbChartStyle.resumeEvents(),this._isChartStylesChanged&&(o?this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec()[0],!0):this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0),!0)),this._state.ChartStyle=e}this._isChartStylesChanged=!1,this._noApply=!1,e=t.get_CanBeFlow()&&!this._locked;var s=t.get_FromGroup()||this._locked;this._state.CanBeFlow===e&&this._state.FromGroup===s||(this.btnWrapType.setDisabled(!e||s),this._state.CanBeFlow=e,this._state.FromGroup=s),e=t.get_Width(),Math.abs(this._state.Width-e)>.001&&(this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Width=e),e=t.get_Height(),Math.abs(this._state.Height-e)>.001&&(this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Height=e)}},updateMetricUnit:function(){var t=Common.Utils.Metric.fnRecalcFromMM(this._state.Width);this.labelWidth[0].innerHTML=this.textWidth+": "+t.toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),t=Common.Utils.Metric.fnRecalcFromMM(this._state.Height),this.labelHeight[0].innerHTML=this.textHeight+": "+t.toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName()},createDelayedControls:function(){var t=this,n=[{offsetx:0,data:Asc.c_oAscWrapStyle2.Inline,iconCls:"wrap-inline",tip:this.txtInline,selected:!0},{offsetx:50,data:Asc.c_oAscWrapStyle2.Square,iconCls:"wrap-square",tip:this.txtSquare},{offsetx:100,data:Asc.c_oAscWrapStyle2.Tight,iconCls:"wrap-tight",tip:this.txtTight},{offsetx:150,data:Asc.c_oAscWrapStyle2.Through,iconCls:"wrap-through",tip:this.txtThrough},{offsetx:200,data:Asc.c_oAscWrapStyle2.TopAndBottom,iconCls:"wrap-topAndBottom",tip:this.txtTopAndBottom},{offsetx:250,data:Asc.c_oAscWrapStyle2.InFront,iconCls:"wrap-inFront",tip:this.txtInFront},{offsetx:300,data:Asc.c_oAscWrapStyle2.Behind,iconCls:"wrap-behind",tip:this.txtBehind}];this.btnWrapType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-wrap wrap-inline",menu:new Common.UI.Menu({items:[{template:i.template('<div id="id-chart-menu-wrap" style="width: 235px; margin: 0 5px;"></div>')}]})}),this.btnWrapType.on("render:after",function(o){t.mnuWrapPicker=new Common.UI.DataView({el:e("#id-chart-menu-wrap"),parentMenu:o.menu,store:new Common.UI.DataViewStore(n),itemTemplate:i.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')})}),this.btnWrapType.render(e("#chart-button-wrap")),this.mnuWrapPicker.on("item:click",i.bind(this.onSelectWrap,this,this.btnWrapType)),this.lockedControls.push(this.btnWrapType),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.btnEditData=new Common.UI.Button({el:e("#chart-button-edit-data")}),this.lockedControls.push(this.btnEditData),this.btnEditData.on("click",i.bind(this.setEditData,this)),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._initSettings=!1},_ChartWrapStyleChanged:function(t){if(this.mnuWrapPicker&&this._state.WrappingStyle!==t){this._noApply=!0;var e=this.mnuWrapPicker.store.findWhere({data:t});this.mnuWrapPicker.selectRecord(e,!0),e&&this.btnWrapType.setIconCls("item-wrap "+e.get("iconCls")),this._state.WrappingStyle=t,this._noApply=!1}},onSelectWrap: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.btnWrapType.setIconCls("item-wrap "+s.iconCls),this.api){var a=new Asc.asc_CImgProperty;if(a.put_WrappingStyle(s.data),this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline&&s.data!==Asc.c_oAscWrapStyle2.Inline){a.put_PositionH(new Asc.CImagePositionH),a.get_PositionH().put_UseAlign(!1),a.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var r=this._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);a.get_PositionH().put_Value(r),a.put_PositionV(new Asc.CImagePositionV),a.get_PositionV().put_UseAlign(!1),a.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),r=this._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),a.get_PositionV().put_Value(r)}this.api.ImgApply(a)}this.fireEvent("editcomplete",this)}},setEditData:function(){var t=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(t){t.setEditMode(!0),t.show();var e=this.api.asc_getChartObject();e&&t.setChartData(new Asc.asc_CChartBinary(e))}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a=this.api.GetSectionInfo();a={width:a.get_PageWidth()-(a.get_MarginLeft()+a.get_MarginRight()),height:a.get_PageHeight()-(a.get_MarginTop()+a.get_MarginBottom())},new DE.Views.ImageSettingsAdvanced({imageProps:o,sizeMax:a,sectionProps:e.api.asc_GetSectionProps(),handler:function(t,i){"ok"==t&&e.api&&e.api.ImgApply(i.imageProps),e.fireEvent("editcomplete",e)}}).show();break}}}},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.put_ChartProperties(this.chartProps),this.api.ImgApply(a)}this.fireEvent("editcomplete",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.put_ChartProperties(this.chartProps),this.api.ImgApply(i)}this.fireEvent("editcomplete",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_getImageUrl())})}else{var r=[];i.each(t,function(t,e){r.push({imageUrl:t.asc_getImageUrl(),data:t.asc_getStyle(),tip:n.textStyle+" "+t.asc_getStyle()})}),o.reset(r,{silent:!1})}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textSize:"Size",textWrap:"Wrapping Style",textWidth:"Width",textHeight:"Height",textAdvanced:"Show advanced settings",txtInline:"Inline",txtSquare:"Square",txtTight:"Tight",txtThrough:"Through",txtTopAndBottom:"Top and bottom",txtBehind:"Behind",txtInFront:"In front",textEditData:"Edit Data",textChartType:"Change Chart Type",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textStyle:"Style"},DE.Views.ChartSettings||{}))}),define("text!documenteditor/main/app/template/TableSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td width="50%">\r\n <label class="header"><%= scope.textRows %></label>\r\n </td>\r\n <td width="50%">\r\n <label class="header"><%= scope.textColumns %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="table-checkbox-header"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="table-checkbox-first"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="table-checkbox-total"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="table-checkbox-last"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="table-checkbox-banded"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="table-checkbox-col-banded"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textTemplate %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <div class="" id="table-combo-template" style="width: 100%; height: 64px;"></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.textBorders %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div id="table-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>\r\n <div style="display: inline-block; float:right;vertical-align: middle;">\r\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBorderColor %></label>\r\n <div id="table-border-color-btn" 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 <label class="input-label"><%= scope.textSelectBorders %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <div id="table-button-border-all" style="display: inline-block;"></div>\r\n <div id="table-button-border-none" style="display: inline-block;"></div>\r\n <div id="table-button-border-inner" style="display: inline-block;"></div>\r\n <div id="table-button-border-outer" style="display: inline-block;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <div id="table-button-border-left" style="display: inline-block;"></div>\r\n <div id="table-button-border-inner-vert" style="display: inline-block;"></div>\r\n <div id="table-button-border-right" style="display: inline-block;"></div>\r\n <div id="table-button-border-top" style="display: inline-block;"></div>\r\n <div id="table-button-border-inner-hor" style="display: inline-block;"></div>\r\n <div id="table-button-border-bottom" style="display: inline-block;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2 align="right">\r\n <label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>\r\n <div id="table-back-color-btn" style="display: inline-block;text-align:left;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.textWrap %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="table-button-wrap-none" style="display: inline-block; margin-right:5px;"></div>\r\n <div id="table-button-wrap-parallel" style="display: inline-block; margin-right:5px;"></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 <label class="header" style="margin-top: 3px;"><%= scope.textEdit %></label>\r\n <div id="table-btn-edit" 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="table-checkbox-repeat-row"></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="table-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="<%= 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: 150px;"},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: 150px;"},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||{}))}),
|
|
|
define("documenteditor/main/app/view/TableSettings",["text!documenteditor/main/app/template/TableSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboBorderSize","common/main/lib/component/ComboDataView","common/main/lib/view/InsertTableDialog","documenteditor/main/app/view/TableSettingsAdvanced"],function(t,e,i,n){"use strict";DE.Views.TableSettings=n.View.extend(i.extend({el:"#id-table-settings",template:i.template(t),events:{},options:{alias:"TableSettings"},initialize:function(){this._initSettings=!0,this._state={TemplateId:0,CheckHeader:!1,CheckTotal:!1,CheckBanded:!1,CheckFirst:!1,CheckLast:!1,CheckColBanded:!1,WrapStyle:-1,CanBeFlow:!0,TableAlignment:-1,TableIndent:0,BackColor:"#000000",RepeatRow:!1,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this._originalLook=new Asc.CTablePropLook,this._originalProps=null,this.CellBorders={},this.CellColor={Value:1,Color:"transparent"},this.BorderSize=1,this._noApply=!1,this._wrapHandled=!1,this.render()},onCheckTemplateChange:function(t,e,i,n,o){if(this.api){var s=new Asc.CTableProp,a=this._originalLook?this._originalLook:new Asc.CTablePropLook;switch(t){case 0:a.put_FirstRow("checked"==e.getValue());break;case 1:a.put_LastRow("checked"==e.getValue());break;case 2:a.put_BandHor("checked"==e.getValue());break;case 3:a.put_FirstCol("checked"==e.getValue());break;case 4:a.put_LastCol("checked"==e.getValue());break;case 5:a.put_BandVer("checked"==e.getValue())}s.put_TableLook(a),this.api.tblApply(s)}this.fireEvent("editcomplete",this)},onTableTemplateSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.CTableProp;i.put_TableStyle(e.get("templateId")),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBtnWrapClick:function(t,e){if(this.api&&t.pressed&&!this._noApply){var i=new Asc.CTableProp;i.put_TableWrap(t.options.posId),t.options.posId==c_tableWrap.TABLE_WRAP_NONE&&(this._state.TableAlignment<0&&(this._state.TableAlignment=c_tableAlign.TABLE_ALIGN_LEFT),i.put_TableAlignment(this._state.TableAlignment),i.put_TableIndent(this._state.TableIndent)),i.put_CellSelect(!0),this.api.tblApply(i)}if(this._wrapHandled)return void(this._wrapHandled=!1);this._wrapHandled=!0,this.fireEvent("editcomplete",this)},onCheckRepeatRowChange:function(t,e,i,n){if(this.api){var o=new Asc.CTableProp;o.put_RowsInHeader("checked"==t.getValue()?1:0),this.api.tblApply(o)}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.btnBackColor.setColor(e),this.CellColor={Value:1,Color:e},this.api){var i=new Asc.CTableProp,n=new Asc.CBackground;i.put_CellsBackground(n),"transparent"==this.CellColor.Color?n.put_Value(1):(n.put_Value(0),n.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color))),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onColorsBorderSelect:function(t,e){this.btnBorderColor.setColor(e)},onBtnBordersClick:function(t,e){if(this._UpdateBordersStyle(t.options.strId,!0),this.api){var i=new Asc.CTableProp;i.put_CellBorders(this.CellBorders),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBorderSizeSelect:function(t,e){this.BorderSize=e.value},onEditClick:function(t,e,i){if(this.api)switch(e.value){case 0:this.api.selectRow();break;case 1:this.api.selectColumn();break;case 2:this.api.selectCell();break;case 3:this.api.selectTable();break;case 4:this.api.addRowAbove();break;case 5:this.api.addRowBelow();break;case 6:this.api.addColumnLeft();break;case 7:this.api.addColumnRight();break;case 8:this.api.remRow();break;case 9:this.api.remColumn();break;case 10:this.api.remTable();break;case 11:this.api.MergeCells();break;case 12:this.splitCells(t,e,i)}this.fireEvent("editcomplete",this)},splitCells:function(t,e,i){var n=this;new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&(n.api&&n.api.SplitCell(e.columns,e.rows),n.fireEvent("editcomplete",n))}}).show()},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,t&&(this.api.asc_registerCallback("asc_onTblWrapStyleChanged",i.bind(this._TblWrapStyleChanged,this)),this.api.asc_registerCallback("asc_onTblAlignChanged",i.bind(this._TblAlignChanged,this)),this.api.asc_registerCallback("asc_onInitTableTemplates",i.bind(this._onInitTemplates,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.chHeader.on("change",i.bind(this.onCheckTemplateChange,this,0)),this.chTotal.on("change",i.bind(this.onCheckTemplateChange,this,1)),this.chBanded.on("change",i.bind(this.onCheckTemplateChange,this,2)),this.chFirst.on("change",i.bind(this.onCheckTemplateChange,this,3)),this.chLast.on("change",i.bind(this.onCheckTemplateChange,this,4)),this.chColBanded.on("change",i.bind(this.onCheckTemplateChange,this,5)),this.btnWrapNone=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-wrap-none",posId:c_tableWrap.TABLE_WRAP_NONE,hint:this.textWrapNoneTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"tablewrapGroup"}),this.btnWrapNone.render(e("#table-button-wrap-none")),this.btnWrapNone.on("click",i.bind(this.onBtnWrapClick,this)),this.lockedControls.push(this.btnWrapNone),this.btnWrapParallel=new Common.UI.Button({cls:"btn-options huge",iconCls:"icon-right-panel btn-wrap-parallel",posId:c_tableWrap.TABLE_WRAP_PARALLEL,hint:this.textWrapParallelTooltip,enableToggle:!0,allowDepress:!1,toggleGroup:"tablewrapGroup"}),this.btnWrapParallel.render(e("#table-button-wrap-parallel")),this.btnWrapParallel.on("click",i.bind(this.onBtnWrapClick,this)),this.lockedControls.push(this.btnWrapParallel);var t=[["l","btn-borders-small btn-position-left","table-button-border-left",this.tipLeft],["c","btn-borders-small btn-position-inner-vert","table-button-border-inner-vert",this.tipInnerVert],["r","btn-borders-small btn-position-right","table-button-border-right",this.tipRight],["t","btn-borders-small btn-position-top","table-button-border-top",this.tipTop],["m","btn-borders-small btn-position-inner-hor","table-button-border-inner-hor",this.tipInnerHor],["b","btn-borders-small btn-position-bottom","table-button-border-bottom",this.tipBottom],["cm","btn-borders-small btn-position-inner","table-button-border-inner",this.tipInner],["lrtb","btn-borders-small btn-position-outer","table-button-border-outer",this.tipOuter],["lrtbcm","btn-borders-small btn-position-all","table-button-border-all",this.tipAll],["","btn-borders-small btn-position-none","table-button-border-none",this.tipNone]];this._btnsBorderPosition=[],i.each(t,function(t,n,o){var s=new Common.UI.Button({cls:"btn-toolbar",iconCls:t[1],strId:t[0],hint:t[3]});s.render(e("#"+t[2])),s.on("click",i.bind(this.onBtnBordersClick,this)),this._btnsBorderPosition.push(s),this.lockedControls.push(s)},this),this.cmbBorderSize=new Common.UI.ComboBorderSize({el:e("#table-combo-border-size"),style:"width: 93px;"}),this.BorderSize=this.cmbBorderSize.store.at(1).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.cmbBorderSize.on("selected",i.bind(this.onBorderSizeSelect,this)),this.lockedControls.push(this.cmbBorderSize),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:0},{caption:this.selectColumnText,value:1},{caption:this.selectCellText,value:2},{caption:this.selectTableText,value:3},{caption:"--"},{caption:this.insertRowAboveText,value:4},{caption:this.insertRowBelowText,value:5},{caption:this.insertColumnLeftText,value:6},{caption:this.insertColumnRightText,value:7},{caption:"--"},{caption:this.deleteRowText,value:8},{caption:this.deleteColumnText,value:9},{caption:this.deleteTableText,value:10},{caption:"--"},{caption:this.mergeCellsText,value:11},{caption:this.splitCellsText,value:12}]})}),this.btnEdit.render(e("#table-btn-edit")),this.mnuMerge=this.btnEdit.menu.items[this.btnEdit.menu.items.length-2],this.mnuSplit=this.btnEdit.menu.items[this.btnEdit.menu.items.length-1],this.btnEdit.menu.on("show:after",i.bind(function(){this.api&&(this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()),this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()))},this)),this.btnEdit.menu.on("item:click",i.bind(this.onEditClick,this)),this.lockedControls.push(this.btnEdit),this.chRepeatRow=new Common.UI.CheckBox({el:e("#table-checkbox-repeat-row"),labelText:this.strRepeatRow}),this.chRepeatRow.on("change",i.bind(this.onCheckRepeatRowChange,this)),this.lockedControls.push(this.chRepeatRow),this.linkAdvanced=e("#table-advanced-link"),e(this.el).on("click","#table-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.UpdateThemeColors(),this._initSettings=!1},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.CTableProp(t),this._originalProps.put_CellSelect(!0),this._TblWrapStyleChanged(t.get_TableWrap());var e=t.get_CanBeFlow()&&!this._locked;if(this._state.CanBeFlow!==e&&(this.btnWrapParallel.setDisabled(!e),this._state.CanBeFlow=e),this._TblAlignChanged(t.get_TableAlignment()),this._state.TableIndent=t.get_TableAlignment()!==c_tableAlign.TABLE_ALIGN_LEFT?0:t.get_TableIndent(),e=t.get_TableStyle(),this._state.TemplateId!==e||this._isTemplatesChanged){this.cmbTableTemplate.suspendEvents();var i=this.cmbTableTemplate.menuPicker.store.findWhere({templateId:e});this.cmbTableTemplate.menuPicker.selectRecord(i),this.cmbTableTemplate.resumeEvents(),this._isTemplatesChanged&&(i?this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec()[0],!0):this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0),!0)),this._state.TemplateId=e}this._isTemplatesChanged=!1;var n=t.get_TableLook();n&&(e=n.get_FirstRow(),this._state.CheckHeader!==e&&(this.chHeader.setValue(e,!0),this._state.CheckHeader=e,this._originalLook.put_FirstRow(e)),e=n.get_LastRow(),this._state.CheckTotal!==e&&(this.chTotal.setValue(e,!0),this._state.CheckTotal=e,this._originalLook.put_LastRow(e)),e=n.get_BandHor(),this._state.CheckBanded!==e&&(this.chBanded.setValue(e,!0),this._state.CheckBanded=e,this._originalLook.put_BandHor(e)),e=n.get_FirstCol(),this._state.CheckFirst!==e&&(this.chFirst.setValue(e,!0),this._state.CheckFirst=e,this._originalLook.put_FirstCol(e)),e=n.get_LastCol(),this._state.CheckLast!==e&&(this.chLast.setValue(e,!0),this._state.CheckLast=e,this._originalLook.put_LastCol(e)),e=n.get_BandVer(),this._state.CheckColBanded!==e&&(this.chColBanded.setValue(e,!0),this._state.CheckColBanded=e,this._originalLook.put_BandVer(e)));var o=t.get_CellsBackground();if(o)if(0==o.get_Value()){var s=o.get_Color();s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.CellColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}}:this.CellColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}:this.CellColor={Value:1,Color:"transparent"}}else this.CellColor={Value:1,Color:"transparent"};else this.CellColor={Value:0,Color:"transparent"};var a=typeof this.CellColor.Color;if(a!==typeof this._state.BackColor||"object"==a&&(this.CellColor.Color.effectValue!==this._state.BackColor.effectValue||this._state.BackColor.color.indexOf(this.CellColor.Color.color)<0)||"object"!=a&&this._state.BackColor.indexOf(this.CellColor.Color)<0){if(this.btnBackColor.setColor(this.CellColor.Color),"object"==typeof this.CellColor.Color){for(var r=!1,l=0;l<10;l++)if(Common.Utils.ThemeColor.ThemeValues[l]==this.CellColor.Color.effectValue){this.colorsBack.select(this.CellColor.Color,!0),r=!0;break}r||this.colorsBack.clearSelection()}else this.colorsBack.select(this.CellColor.Color,!0);this._state.BackColor=this.CellColor.Color}e=t.get_RowsInHeader(),this._state.RepeatRow!==e&&(null!==e?this.chRepeatRow.setValue(e>0?1:0,!0):this.chRepeatRow.setValue("indeterminate",!0),this._state.RepeatRow=e)}},_UpdateBordersStyle:function(t){this.CellBorders=new Asc.CBorders;var e=this.CellBorders,i=""!=t;(t.indexOf("l")>-1||!i)&&(null!==e.get_Left()&&void 0!==e.get_Left()||e.put_Left(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Left(),i)),(t.indexOf("t")>-1||!i)&&(null!==e.get_Top()&&void 0!==e.get_Top()||e.put_Top(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Top(),i)),(t.indexOf("r")>-1||!i)&&(null!==e.get_Right()&&void 0!==e.get_Right()||e.put_Right(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Right(),i)),(t.indexOf("b")>-1||!i)&&(null!==e.get_Bottom()&&void 0!==e.get_Bottom()||e.put_Bottom(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Bottom(),i)),(t.indexOf("c")>-1||!i)&&(null!==e.get_InsideV()&&void 0!==e.get_InsideV()||e.put_InsideV(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_InsideV(),i)),(t.indexOf("m")>-1||!i)&&(null!==e.get_InsideH()&&void 0!==e.get_InsideH()||e.put_InsideH(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_InsideH(),i))},_UpdateBorderStyle:function(t,e){if(null==t&&(t=new Asc.asc_CTextBorder),e&&this.BorderSize>0){var i=parseFloat(this.BorderSize);t.put_Value(1),t.put_Size(25.4*i/72);var n=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);t.put_Color(n)}else t.put_Value(0)},_TblWrapStyleChanged:function(t){this.btnWrapNone&&this.btnWrapParallel&&this._state.WrapStyle!==t&&(this._noApply=!0,this.btnWrapNone.toggle(t==c_tableWrap.TABLE_WRAP_NONE,!0),this.btnWrapParallel.toggle(t==c_tableWrap.TABLE_WRAP_PARALLEL,!0),this._noApply=!1,this._state.WrapStyle=t)},_TblAlignChanged:function(t){this._state.TableAlignment=t},UpdateThemeColors:function(){this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="table-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="table-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(e("#table-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.borderColor=new Common.UI.ThemeColorPalette({el:e("#table-border-color-menu")}),this.borderColor.on("select",i.bind(this.onColorsBorderSelect,this)),e(this.el).on("click","#table-border-color-new",i.bind(this.addNewColor,this,this.borderColor,this.btnBorderColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="table-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="table-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(e("#table-back-color-btn")),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:e("#table-back-color-menu"),transparent:!0}),this.colorsBack.on("select",i.bind(this.onColorsBackSelect,this)),e(this.el).on("click","#table-back-color-new",i.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor,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())},_onInitTemplates:function(t){var n=this;this._isTemplatesChanged=!0,this.cmbTableTemplate||(this.cmbTableTemplate=new Common.UI.ComboDataView({itemWidth:70,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-template"}),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));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.get_Image())})}else{n.cmbTableTemplate.menuPicker.store.reset([]);var a=[];i.each(t,function(t){a.push({imageUrl:t.get_Image(),id:Common.UI.getId(),templateId:t.get_Id()})}),n.cmbTableTemplate.menuPicker.store.add(a)}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==n){new DE.Views.TableSettingsAdvanced({tableStylerRows:null===o.get_CellBorders().get_InsideH()&&1==o.get_CellSelect()?1:2,tableStylerColumns:null===o.get_CellBorders().get_InsideV()&&1==o.get_CellSelect()?1:2,tableProps:o,borderProps:e.borderAdvancedProps,sectionProps:e.api.asc_GetSectionProps(),handler:function(t,i){"ok"==t&&e.api&&(e.borderAdvancedProps=i.borderProps,e.api.tblApply(i.tableProps)),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textWrap:"Text Wrapping",textBorders:"Border's Style",textBorderColor:"Color",textBackColor:"Background color",textWrapParallelTooltip:"Flow table",textWrapNoneTooltip:"Inline table",textEdit:"Rows & Columns",selectRowText:"Select Row",selectColumnText:"Select Column",selectCellText:"Select Cell",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",mergeCellsText:"Merge Cells",splitCellsText:"Split Cell...",splitCellTitleText:"Split Cell",textSelectBorders:"Select borders that you want to change",textAdvanced:"Show advanced settings",txtNoBorders:"No borders",textOK:"OK",textCancel:"Cancel",textNewColor:"Add New Custom Color",textTemplate:"Select From Template",textRows:"Rows",textColumns:"Columns",textHeader:"Header",textTotal:"Total",textBanded:"Banded",textFirst:"First",textLast:"Last",textEmptyTemplate:"No templates",strRepeatRow:"Repeat as header row at the top of each page",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"},DE.Views.TableSettings||{}))}),define("text!documenteditor/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>\r\n <label class="header"><%= scope.textWrap %></label>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td>\r\n <div id="shape-button-wrap" style=""></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td class="padding-small"></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 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 class="shape-only 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="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/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))},r=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100)));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)}},l=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(),h.off("keydown","input",c),n=setInterval(e.bind(l,i,t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),100))},d=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),l(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),h.on("keydown","input",c),i.trigger("changecomplete",i,i.value,i.lastValue))};if(!i.rendered){var h=i.cmpEl;h.on("mousedown",".thumb",a),h.on("mousedown",".track",r),this.options.enableKeyEvents&&(h.on("keydown","input",c),h.on("keyup","input",d))}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]},disabled:!1,template:e.template(['<div class="slider multi-slider">','<div class="track">','<div class="track-left"></div>','<div class="track-center""></div>','<div class="track-right" style=""></div>',"</div>","<% _.each(items, function(item) { %>",'<div class="thumb" style=""></div>',"<% }); %>","</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.thumbs=[],e.options.el&&e.render()},render:function(t){var i=this;i.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({items:this.options.values})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl));var n=this.cmpEl;n.find(".track-center").width(i.options.width-14),n.width(i.options.width);var o=function(t){t.preventDefault(),t.stopPropagation();var e=t.data,n=i.thumbs[e].value,a=e-1<0?0:i.thumbs[e-1].position,r=e+1<i.thumbs.length?i.thumbs[e+1].position:100,l=Math.max(a,Math.min(r,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100))),c=l/i.delta+i.minValue;i.setThumbPosition(e,l),i.thumbs[e].value=c,$(document).off("mouseup",o),$(document).off("mousemove",s),i._dragstart=void 0,i.trigger("changecomplete",i,c,n)},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=t.data,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1<i.thumbs.length?i.thumbs[e+1].position:100,a=Math.max(o,Math.min(s,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100))),r=a/i.delta+i.minValue;i.setThumbPosition(e,a),i.thumbs[e].value=r,Math.abs(r-n)>.001&&i.trigger("change",i,r,n)}},a=function(t){if(!i.disabled){var n=t.data,a=i.thumbs[n].thumb;i._dragstart=t.pageX*Common.Utils.zoom()-a.offset().left-a.width()/2,i.setActiveThumb(n),e.each(i.thumbs,function(t,e){n==e?t.thumb.css("z-index",500):t.thumb.css("z-index","")}),$(document).on("mouseup",null,n,o),$(document).on("mousemove",null,n,s)}},r=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100))),n=l(e),o=i.thumbs[n].value,s=e/i.delta+i.minValue;i.setThumbPosition(n,e),i.thumbs[n].value=s,i.trigger("change",i,s,o),i.trigger("changecomplete",i,s,o)}},l=function(t){for(var e,n=100,o=0,s=i.thumbs.length,a=0;a<s;a++)if(e=Math.abs(i.thumbs[a].position-t),Math.abs(e<=n)){var r=i.thumbs[a+1],l=i.thumbs[a-1];if(void 0!==l&&t<l.position)continue;if(void 0!==r&&t>r.position)continue;o=a,n=e}return o};return this.$thumbs=n.find(".thumb"),e.each(this.$thumbs,function(t,e){var n=$(t);i.thumbs.push({thumb:n,index:e}),i.setValue(e,i.options.values[e]),n.on("mousedown",null,e,a)}),i.setActiveThumb(0,!0),i.rendered||n.on("mousedown",".track",r),i.rendered=!0,this},setActiveThumb:function(t,e){this.currentThumb=t,this.$thumbs.removeClass("active"),this.thumbs[t].thumb.addClass("active"),!0!==e&&this.trigger("thumbclick",this,t)},setThumbPosition:function(t,e){this.thumbs[t].position=e,this.thumbs[t].thumb.css({left:e+"%"})},setValue:function(t,e){this.thumbs[t].value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(t,Math.round((e-this.minValue)*this.delta))},getValue:function(t){return this.thumbs[t].value},getValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.value)}),t},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t}})}),void 0===Common)var Common={};if(define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(t,e){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0},disabled:!1,template:e.template(['<div class="slider multi-slider-gradient">','<div class="track"></div>',"<% _.each(items, function(item) { %>",'<div class="thumb img-commonctrl" style="">','<div class="thumb-top"></div>','<div class="thumb-bottom"></div>',"</div>","<% }); %>","</div>"].join("")),initialize:function(t){this.styleStr="",Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr="-webkit-gradient(linear, left top, right top, color-stop({1}%,{0}), color-stop({3}%,{2})); /* Chrome,Safari4+ */":Common.Utils.isChrome||Common.Utils.isSafari?this.styleStr="-webkit-linear-gradient(left, {0} {1}%, {2} {3}%)":Common.Utils.isGecko?this.styleStr="-moz-linear-gradient(left, {0} {1}%, {2} {3}%)":Common.Utils.isOpera&&Common.Utils.operaVersion>11?this.styleStr="-o-linear-gradient(left, {0} {1}%, {2} {3}%)":Common.Utils.isIE&&(this.styleStr="-ms-linear-gradient(left, {0} {1}%, {2} {3}%)"),this.colorValues=this.options.colorValues,Common.UI.MultiSlider.prototype.initialize.call(this,t)},render:function(t){Common.UI.MultiSlider.prototype.render.call(this,t);var i=this,n="";i.trackEl=i.cmpEl.find(".track");for(var o=0;o<i.thumbs.length;o++)i.thumbs[o].thumb.on("dblclick",null,function(){i.trigger("thumbdblclick",i)}),i.thumbs[o].thumbcolor=i.thumbs[o].thumb.find("> div");""!==i.styleStr&&(n=Common.Utils.String.format(i.styleStr,i.colorValues[0],0,i.colorValues[1],100),i.trackEl.css("background",n)),Common.Utils.isIE&&(n=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",i.colorValues[0],i.colorValues[1]),i.trackEl.css("filter",n)),n=Common.Utils.String.format("linear-gradient(to right, {0} {1}%, {2} {3}%)",i.colorValues[0],0,i.colorValues[1],100),i.trackEl.css("background",n),i.on("change",e.bind(i.changeGradientStyle,i))},setColorValue:function(t,e){var i=void 0!==e?e:this.currentThumb;this.colorValues[i]=t,this.thumbs[i].thumbcolor.css("background-color",t),this.changeGradientStyle()},getColorValue:function(t){var e=void 0!==t?t:this.currentThumb;return this.colorValues[e]},setValue:function(t,e){Common.UI.MultiSlider.prototype.setValue.call(this,t,e),this.changeGradientStyle()},changeGradientStyle:function(){if(this.rendered){var t;""!==this.styleStr&&(t=Common.Utils.String.format(this.styleStr,this.colorValues[0],this.getValue(0),this.colorValues[1],this.getValue(1)),this.trackEl.css("background",t)),Common.Utils.isIE&&(t=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.colorValues[0],this.colorValues[1]),this.trackEl.css("filter",t)),t=Common.Utils.String.format("linear-gradient(to right, {0} {1}%, {2} {3}%)",this.colorValues[0],this.getValue(0),this.colorValues[1],this.getValue(1)),this.trackEl.css("background",t)}}})}),define("documenteditor/main/app/view/ShapeSettings",["text!documenteditor/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","documenteditor/main/app/view/ImageSettingsAdvanced"],function(t,e,i,n){"use strict";DE.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,WrappingStyle:Asc.c_oAscWrapStyle2.Inline,CanBeFlow:!0,FromGroup:!1,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_registerCallback("asc_onImgWrapStyleChanged",i.bind(this._ImgWrapStyleChanged,this)),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.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.ShapeColor.Color?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){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.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(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.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_transparent(2.55*o),s.put_fill(a),this.imgprops.put_ShapeProperties(s),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.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.put_transparent(2.55*this._sliderChanged),t.put_fill(e),this.imgprops.put_ShapeProperties(t),this.api.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),r.put_fill(new Asc.asc_CFillGrad),r.get_fill().put_grad_type(this.GradFillType),r.get_fill().put_linear_angle(6e4*s.type),r.get_fill().put_linear_scale(!0),a.put_fill(r),this.imgprops.put_ShapeProperties(a),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]])),i.put_fill(n),this.imgprops.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_CShapeProperty,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType),e.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),e.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),t.put_fill(e),this.imgprops.put_ShapeProperties(t),this.api.ImgApply(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<.01?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.put_stroke(i),this.imgprops.put_ShapeProperties(e),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",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){s.fireEvent("editcomplete",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<.01?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.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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<.01?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.put_ShapeProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},_ImgWrapStyleChanged:function(t){if(this.mnuWrapPicker&&this._state.WrappingStyle!==t){this._noApply=!0;var e=this.mnuWrapPicker.store.findWhere({data:t});this.mnuWrapPicker.selectRecord(e,!0),e&&this.btnWrapType.setIconCls("item-wrap "+e.get("iconcls")),this._state.WrappingStyle=t,this._noApply=!1}},onSelectWrap: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.btnWrapType.setIconCls("item-wrap "+s.iconcls),this.api){var a=new Asc.asc_CImgProperty;if(a.put_WrappingStyle(s.data),this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline&&s.data!==Asc.c_oAscWrapStyle2.Inline){a.put_PositionH(new Asc.CImagePositionH),a.get_PositionH().put_UseAlign(!1),a.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var r=this._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);a.get_PositionH().put_Value(r),a.put_PositionV(new Asc.CImagePositionV),a.get_PositionV().put_UseAlign(!1),a.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),r=this._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),a.get_PositionV().put_Value(r)}this.api.ImgApply(a)}this.fireEvent("editcomplete",this)}},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.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),a.put_fill(new Asc.asc_CFillBlip),a.get_fill().put_type(t.BlipFillType),a.get_fill().put_url(o),s.put_fill(a),t.imgprops.put_ShapeProperties(s),t.api.ImgApply(t.imgprops)}}t.fireEvent("editcomplete",t)}}).show()},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){new DE.Views.ImageSettingsAdvanced({imageProps:o,sectionProps:e.api.asc_GetSectionProps(),handler:function(t,i){"ok"==t&&e.api&&e.api.ImgApply(i.imageProps),e.fireEvent("editcomplete",e)}}).show();break}}}},ChangeSettings:function(t){if(null==this.imgprops?this.imgprops=new Asc.asc_CImgProperty:this.imgprops.put_ImageUrl(null),this._initSettings&&this.createDelayedElements(),t&&t.get_ShapeProperties()){var n=t.get_ShapeProperties(),o=n.asc_getType();this._originalProps=new Asc.asc_CImgProperty(t),this._noApply=!0,this.disableControls(this._locked,!n.get_CanFill()),this.hideShapeOnlySettings(n.get_FromChart()),this.hideChangeTypeSettings("line"==o||"bentConnector2"==o||"bentConnector3"==o||"bentConnector4"==o||"bentConnector5"==o||"curvedConnector2"==o||"curvedConnector3"==o||"curvedConnector4"==o||"curvedConnector5"==o||"straightConnector1"==o);var s=t.get_WrappingStyle();if(this._state.WrappingStyle!==s){var a=this.mnuWrapPicker.store.findWhere({data:s});this.mnuWrapPicker.selectRecord(a,!0),a?this.btnWrapType.setIconCls("item-wrap "+a.get("iconcls")):this.btnWrapType.setIconCls(""),this._state.WrappingStyle=s}s=t.get_CanBeFlow()&&!this._locked;var r=t.get_FromGroup()||this._locked;this._state.CanBeFlow===s&&this._state.FromGroup===r||(this.btnWrapType.setDisabled(!s||r),this._state.CanBeFlow=s,this._state.FromGroup=r);var l=null,c=n.get_fill(),d=c.get_type(),h=null,p=c.get_transparent();if((Math.abs(this._state.Transparency-p)>.001||Math.abs(this.numTransparency.getNumberValue()-p)>.001||(null===this._state.Transparency||null===p)&&(this._state.Transparency!==p||this.numTransparency.getNumberValue()!==p))&&(void 0!==p&&(this.sldrTransparency.setValue(null===p?100:p/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=p),null===c||null===d)this.OriginalFillType=null;else if(d==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(d==Asc.c_oAscFill.FILL_TYPE_SOLID)c=c.get_fill(),h=c.get_color(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b())}: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[1]="ffffff";else if(d==Asc.c_oAscFill.FILL_TYPE_BLIP)c=c.get_fill(),this.BlipFillType=c.get_type(),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(d==Asc.c_oAscFill.FILL_TYPE_PATT){if(c=c.get_fill(),this.PatternFillType=c.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var l=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(l),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}h=c.get_color_fg(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b())}:this.FGColor={Value:1,Color:"000000"},h=c.get_color_bg(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b())}: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[1]="ffffff"}else if(d==Asc.c_oAscFill.FILL_TYPE_GRAD){c=c.get_fill();var m=c.get_grad_type();if(this._state.GradFillType===m&&this.GradFillType===m||(this.GradFillType=m,l=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),l=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,l.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var s=Math.floor(c.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-s)>.001){this.GradLinearDirectionType=s;var a=this.mnuDirectionPicker.store.findWhere({type:s});this.mnuDirectionPicker.selectRecord(a,!0),a?this.btnDirection.setIconCls("item-gradient "+a.get("iconcls")):this.btnDirection.setIconCls("")}}var u=c.get_colors();u&&u.length>0&&(h=u[0],h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()):this.GradColor.colors[0]="000000",h=u[1],h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()):this.GradColor.colors[1]="ffffff");var g=c.get_positions();if(g&&g.length>0){var b=g[0]
|
|
|
;null!==b&&(b/=1e3,this.GradColor.values[0]=b),b=g[1],null!==b&&(b/=1e3,this.GradColor.values[1]=b)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof this.GradColor.colors[0]?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof this.GradColor.colors[1]?this.GradColor.colors[1].color:this.GradColor.colors[1]),1),this.sldrGradient.setValue(0,this.GradColor.values[0]),this.sldrGradient.setValue(1,this.GradColor.values[1]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var f=typeof this.ShapeColor.Color,C=typeof this._state.ShapeColor;if(f!==C||"object"==f&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=f&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),v=!0;break}v||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var y,w=n.get_stroke(),x=w.get_type();if(w?(x==Asc.c_oAscStrokeType.STROKE_COLOR?(h=w.get_color(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},y=w.asc_getPrstDash()):(x=null,this.BorderColor={Value:0,Color:"transparent"}),f=typeof this.BorderColor.Color,C=typeof this._state.StrokeColor,f!==C||"object"==f&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=f&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),v=!0;break}v||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==x||x==Asc.c_oAscStrokeType.STROKE_COLOR){if(x==Asc.c_oAscStrokeType.STROKE_COLOR){var S=w.get_width(),A=Math.abs(this._state.StrokeWidth-S)<.001&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-S)>.001||A||(null===this._state.StrokeWidth||null===S)&&this._state.StrokeWidth!==S){this._state.StrokeWidth=S,null!==S&&(S=this._mm2pt(S));var T=null===S?S:i.find(this.cmbBorderSize.store.models,function(t){if(S<t.attributes.value+.01&&S>t.attributes.value-.01)return!0});T?this.cmbBorderSize.selectRecord(T):this.cmbBorderSize.setValue(null!==S?parseFloat(S.toFixed(2))+" "+this.txtPt:""),this.BorderSize=S}}else x==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=x}if(this._state.StrokeBorderType!==y&&(this.BorderType=this._state.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(h=this.GradColor.colors[this.GradColor.currentIdx],f=typeof h,C=typeof this._state.GradColor,f!==C||"object"==f&&(h.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(h.color)<0)||"object"!=f&&this._state.GradColor.indexOf(h)<0){if(this.btnGradColor.setColor(h),"object"==typeof h){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==h.effectValue){this.colorsGrad.select(h,!0),v=!0;break}v||this.colorsGrad.clearSelection()}else this.colorsGrad.select(h,!0);this._state.GradColor=h}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: 190px;",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.ChangeShapeImageFromFile(),this.fireEvent("editcomplete",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,allowScrollbar:!1,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.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);var n=[{offsetx:0,data:Asc.c_oAscWrapStyle2.Inline,iconcls:"wrap-inline",tip:this.txtInline,selected:!0},{offsetx:50,data:Asc.c_oAscWrapStyle2.Square,iconcls:"wrap-square",tip:this.txtSquare},{offsetx:100,data:Asc.c_oAscWrapStyle2.Tight,iconcls:"wrap-tight",tip:this.txtTight},{offsetx:150,data:Asc.c_oAscWrapStyle2.Through,iconcls:"wrap-through",tip:this.txtThrough},{offsetx:200,data:Asc.c_oAscWrapStyle2.TopAndBottom,iconcls:"wrap-topAndBottom",tip:this.txtTopAndBottom},{offsetx:250,data:Asc.c_oAscWrapStyle2.InFront,iconcls:"wrap-inFront",tip:this.txtInFront},{offsetx:300,data:Asc.c_oAscWrapStyle2.Behind,iconcls:"wrap-behind",tip:this.txtBehind}];this.btnWrapType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-wrap wrap-inline",menu:new Common.UI.Menu({items:[{template:i.template('<div id="id-shape-menu-wrap" style="width: 235px; margin: 0 5px;"></div>')}]})}),this.btnWrapType.on("render:after",function(o){t.mnuWrapPicker=new Common.UI.DataView({el:e("#id-shape-menu-wrap"),parentMenu:o.menu,store:new Common.UI.DataViewStore(n),itemTemplate:i.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')})}),this.btnWrapType.render(e("#shape-button-wrap")),this.mnuWrapPicker.on("item:click",i.bind(this.onSelectWrap,this,this.btnWrapType)),this.lockedControls.push(this.btnWrapType),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.linkAdvanced=e("#shape-advanced-link"),e(this.el).on("click","#shape-advanced-link",i.bind(this.openAdvancedSettings,this))},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.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),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-shape"><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.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.put_fill(s),this.imgprops.put_ShapeProperties(o),this.api.ImgApply(this.imgprops)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillAutoShapes:function(){for(var t=this,n=this.application.getCollection("ShapeGroups"),o=n.length,s=0;s<o-1;s++){var a=n.at(s),r=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+'" class="menu-shape" style="width: '+(a.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});t.btnChangeShape.menu.addItem(r);new Common.UI.DataView({el:e("#id-shape-menu-shapegroup"+s),store:a.get("groupStore"),parentMenu:r.menu,showLast:!1,itemTemplate:i.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')}).on("item:click",function(e,i,n,o){t.api&&(t.api.ChangeShapeType(n.get("data").shapeType),t.fireEvent("editcomplete",t)),"click"!==o.type&&t.btnChangeShape.menu.hide()})}},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)),e(this.el).on("click","#shape-back-color-new",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="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)),e(this.el).on("click","#shape-foreground-color-new",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)),e(this.el).on("click","#shape-background-color-new",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)),e(this.el).on("click","#shape-gradient-color-new",i.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor)),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)),e(this.el).on("click","#shape-border-color-new",i.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor))),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",textWrap:"Wraping Style",txtInline:"Inline",txtSquare:"Square",txtTight:"Tight",txtThrough:"Through",txtTopAndBottom:"Top and bottom",txtBehind:"Behind",txtInFront:"In front",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",strType:"Type"},DE.Views.ShapeSettings||{}))}),define("text!documenteditor/main/app/template/MailMerge.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td class="padding-small">\r\n <button type="button" class="btn btn-text-default" id="mmerge-button-edit-data" style="width:100%;"><%= scope.textEditData %></button>\r\n <label id="mmerge-lbl-add-recipients" style="margin-top: 4px;"><%= scope.textAddRecipients %></label>\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.textMergeFields %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="padding-bottom: 13px;">\r\n <div id="mmerge-btn-ins-field" style="width:100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="padding-bottom: 13px;">\r\n <div id="mmerge-switcher-highlight" style="display: inline-block; vertical-align: top;"></div>\r\n <label style="margin-left: 5px;"><%= scope.textHighlight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="mmerge-switcher-preview" style="display: inline-block; vertical-align: top;"></div>\r\n <label style="margin-left: 5px;"><%= scope.textPreview %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="mmerge-button-first" style="display: inline-block;margin-right: 4px;"></div>\r\n <div id="mmerge-button-prev" style="display: inline-block;margin-right: 4px;"></div>\r\n <div id="mmerge-field-num" style="display:inline-block;vertical-align: middle;"></div>\r\n <div id="mmerge-button-next" style="display: inline-block;margin-left: 4px;"></div>\r\n <div id="mmerge-button-last" style="display: inline-block;margin-left: 4px;"></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.textMergeTo %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="">\r\n <div id="mmerge-combo-merge-to" style="width: 100%;padding-bottom: 2px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-medium">\r\n <label style=""><%= scope.textMaxRecepients %></label>\r\n <label class="link-solid" id="mmerge-readmore-link"><%= scope.textReadMore %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="mmerge-radio-all" style="margin-bottom: 5px;"></div>\r\n <div id="mmerge-radio-current" style="margin-bottom: 5px;"></div>\r\n <div id="mmerge-radio-from-to" style="display: inline-block;vertical-align: middle; margin-right: 2px;"></div>\r\n <div id="mmerge-field-from" style="display: inline-block;vertical-align: middle;"></div>\r\n <label style="width: 30px; text-align: right; vertical-align: middle; margin-right: 2px;"><%= scope.textTo %></label>\r\n <div id="mmerge-field-to" style="display: inline-block;vertical-align: middle;"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="2">\r\n <tr>\r\n <td width="50%">\r\n <button type="button" class="btn btn-text-default" id="mmerge-button-download" style="width:90px;"><%= scope.textDownload %></button>\r\n <button type="button" class="btn btn-text-default hidden" id="mmerge-button-merge" style="width:90px;"><%= scope.textMerge %></button>\r\n </td>\r\n <td width="50%" style="text-align: right;">\r\n <button type="button" class="btn btn-text-default" id="mmerge-button-portal" style="width:90px;"><%= scope.textPortal %></button>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),void 0===Common)var Common={};define("common/main/lib/component/Switcher",["common/main/lib/component/BaseView","underscore"],function(t,e){"use strict";Common.UI.Switcher=Common.UI.BaseView.extend({options:{width:25,thumbWidth:13,value:!1},disabled:!1,template:e.template(['<div class="switcher">','<div class="sw-left"></div>','<div class="sw-right"></div>','<div class="thumb"></div>',"</div>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;$(this.el);e.width=e.options.width,e.thumbWidth=e.options.thumbWidth,e.delta=(e.width-e.thumbWidth-2)/2,e.options.el&&e.render(),this.setValue(e.options.value)},render:function(t){var e=this;e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),this.thumb=this.cmpEl.find(".thumb"),this.cmpEl.width(e.width),this.thumb.width(e.thumbWidth),this.cmpEl.find(".sw-left").width(e.width/2),this.cmpEl.find(".sw-right").width(e.width/2);var i=function(t){if(!e.disabled){t.preventDefault(),t.stopPropagation(),$(document).off("mouseup.switcher",i),$(document).off("mousemove.switcher",n);var o=Math.round(t.pageX*Common.Utils.zoom()-e._dragstart);e.value=e.value?o>-e.delta:o>e.delta,e.cmpEl.toggleClass("on",e.value),e.thumb.css({left:"",right:""}),e.trigger("change",e,e.value),e._dragstart=void 0}},n=function(t){if(!e.disabled&&void 0!==e._dragstart){t.preventDefault(),t.stopPropagation();var i=Math.round(t.pageX*Common.Utils.zoom()-e._dragstart);e.value?e.thumb.css({right:i<1?Math.min(e.width-e.thumbWidth-2,-i):0,left:"auto"}):e.thumb.css({left:i>-1?Math.min(e.width-e.thumbWidth-2,i):0,right:"auto"}),e._isMouseMove||(e._isMouseMove=Math.abs(i)>0)}},o=function(t){e.disabled||(e._dragstart=t.pageX*Common.Utils.zoom(),e._isMouseMove=!1,$(document).on("mouseup.switcher",i),$(document).on("mousemove.switcher",n))},s=function(t){if(e.disabled||e._isMouseMove)return void(e._isMouseMove=!1);e.value=!e.value,e.cmpEl.toggleClass("on",e.value),e.trigger("change",e,e.value)};if(!e.rendered){var a=e.cmpEl;a.on("mousedown",".thumb",o),a.on("click",s)}return e.rendered=!0,this},setThumbPosition:function(t){var e=this.value?t<-this.delta:t>this.delta;this.thumb.css(e?{right:0,left:"auto"}:{left:0,right:"auto"})},setValue:function(t){this.value=!0===t,this.cmpEl.toggleClass("on",this.value)},getValue:function(){return this.value},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t},isDisabled:function(){return this.disabled}})}),define("documenteditor/main/app/view/MailMergeSaveDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";DE.Views.MailMergeSaveDlg=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-mail-merge-folder-placeholder"></div>'].join(""),e.tpl=_.template(this.template,e),this.mergeFolderUrl=t.mergeFolderUrl||"",this.mergedFileUrl=t.mergedFileUrl||"",this.defFileName=t.defFileName||"",this.mergeFolderUrl=this.mergeFolderUrl.replace("{title}",encodeURIComponent(this.defFileName)).replace("{fileuri}",encodeURIComponent(this.mergedFileUrl)),Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=645,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-mail-merge-folder-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-mail-merge-folder-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.mergeFolderUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&(_.isEmpty(t.error)||this.trigger("mailmergeerror",this,t.error),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Folder for save",textLoading:"Loading"},DE.Views.MailMergeSaveDlg||{}))}),define("text!documenteditor/main/app/template/MailMergeEmailDlg.template",[],function(){return'<div id="id-merge-email-dlg" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;" cellpadding="10">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textFrom %></label>\r\n <div id="merge-email-dlg-from"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textTo %></label>\r\n <div id="merge-email-dlg-to"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label class="input-label"><%= scope.textSubject %></label>\r\n <div id="merge-email-dlg-subject" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label class="input-label"><%= scope.textFormat %></label>\r\n <div id="merge-email-dlg-format" style="width: 170px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label id="merge-email-dlg-lbl-filename" class="input-label disabled"><%= scope.textFileName %></label>\r\n <div id="merge-email-dlg-filename" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label id="merge-email-dlg-lbl-message" class="input-label disabled"><%= scope.textMessage %></label>\r\n <textarea id="merge-email-dlg-message" class="disabled form-control" disabled="disabled" style="width: 100%;height: 70px;margin-bottom: 0;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2" class="padding-small">\r\n <label style="font-weight: bold;"><%= scope.textWarning %></label>\r\n <label class=""><%= scope.textWarningMsg %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("documenteditor/main/app/view/MailMergeEmailDlg",["text!documenteditor/main/app/template/MailMergeEmailDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/InputField"],function(t){"use strict";DE.Views.MailMergeEmailDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"MailMergeEmail",contentWidth:500,height:460},initialize:function(e){_.extend(this.options,{title:this.textTitle,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 primary" result="ok" style="margin-right: 10px; width: 86px;">'+this.okButtonText+"</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)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this._arrFrom=[],this.cmbFrom=new Common.UI.ComboBox({el:$("#merge-email-dlg-from"),cls:"input-group-nr",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFrom}),this._arrTo=[],this.cmbTo=new Common.UI.ComboBox({el:$("#merge-email-dlg-to"),cls:"input-group-nr",menuStyle:"min-width: 100%;",editable:!1,data:this._arrTo}),this.inputSubject=new Common.UI.InputField({el:$("#merge-email-dlg-subject"),allowBlank:!0,validateOnBlur:!1,placeHolder:this.subjectPlaceholder,style:"width: 100%;"}),this._arrFormat=[{displayValue:this.textHTML,value:Asc.c_oAscFileType.HTML},{displayValue:this.textAttachDocx,value:Asc.c_oAscFileType.DOCX},{displayValue:this.textAttachPdf,value:Asc.c_oAscFileType.PDF}],this.cmbFormat=new Common.UI.ComboBox({el:$("#merge-email-dlg-format"),cls:"input-group-nr",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFormat}),this.cmbFormat.setValue(Asc.c_oAscFileType.HTML),this.cmbFormat.on("selected",_.bind(this.onCmbFormatSelect,this)),this.inputFileName=new Common.UI.InputField({el:$("#merge-email-dlg-filename"),allowBlank:!0,validateOnBlur:!1,disabled:!0,placeHolder:this.filePlaceholder,style:"width: 100%;"}),this.textareaMessage=this.$window.find("textarea"),this.lblFileName=$("#merge-email-dlg-lbl-filename"),this.lblMessage=$("#merge-email-dlg-lbl-message"),this._eventfunc=function(e){t._onWindowMessage(e)},this.mergeProps=this.options.props,this.mergedFileUrl=this.options.mergedFileUrl||"",this.afterRender()},_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){},afterRender:function(){this._setDefaults(this.mergeProps)},getSettings:function(){var t=this.inputFileName.getValue(),e=this.cmbFormat.getValue();if(e!==Asc.c_oAscFileType.HTML){_.isEmpty(t)&&(t="attach");var i=t.lastIndexOf("."),n=i>0?t.substring(i,t.length).toLowerCase():"";e==Asc.c_oAscFileType.PDF&&".pdf"!==n?t+=".pdf":e==Asc.c_oAscFileType.DOCX&&".docx"!==n&&(t+=".docx")}return{from:this.cmbFrom.getValue(),to:this.cmbTo.getValue(),subject:this.inputSubject.getValue(),mailFormat:e,fileName:t,message:this.textareaMessage.val()}},_setDefaults:function(t){if(t){if(t.fieldsList){var e=[];_.each(t.fieldsList,function(t,i){e.push({displayValue:"<"+t+">",value:t})}),this.cmbTo.setData(e),e.length>0&&this.cmbTo.setValue(e[0].value)}if(t.emailAddresses){var e=[];_.each(t.emailAddresses,function(t,i){e.push({displayValue:t,value:t})}),this.cmbFrom.setData(e),e.length>0&&this.cmbFrom.setValue(e[0].value)}}},onPrimary:function(){return!0},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;"ok"==e&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onCmbFormatSelect:function(t,e){var i=e.value==Asc.c_oAscFileType.HTML;this.inputFileName.setDisabled(i),this.lblFileName.toggleClass("disabled",i),i?this.textareaMessage.attr("disabled","disabled"):this.textareaMessage.removeAttr("disabled"),this.textareaMessage.toggleClass("disabled",i),this.lblMessage.toggleClass("disabled",i)},textTitle:"Send to E-mail",textFrom:"From",textTo:"To",textSubject:"Subject Line",textFormat:"Mail format",textFileName:"File name",textMessage:"Message",textHTML:"HTML",textAttachDocx:"Attach as DOCX",textAttachPdf:"Attach as PDF",subjectPlaceholder:"Theme",filePlaceholder:"PDF",cancelButtonText:"Cancel",okButtonText:"Send",textWarning:"Warning!",textWarningMsg:"Please note that mailing cannot be stopped once your click the 'Send' button."},DE.Views.MailMergeEmailDlg||{}))}),define("documenteditor/main/app/view/MailMergeSettings",["text!documenteditor/main/app/template/MailMerge.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/Switcher","documenteditor/main/app/view/MailMergeRecepients","documenteditor/main/app/view/MailMergeSaveDlg","documenteditor/main/app/view/MailMergeEmailDlg"],function(t,e,i,n){"use strict";DE.enumLockMM={lostConnect:"disconnect",preview:"preview",coAuth:"co-auth",noFields:"no-fields",noRecipients:"no-recipients",radioAllCurr:"radio-all-curr"},DE.Views.MailMergeSettings=n.View.extend(i.extend({el:"#id-mail-merge-settings",template:i.template(t),events:{},options:{alias:"MailMergeSettings"},initialize:function(){var t=this,i=DE.enumLockMM;this._initSettings=!0,this._state={recipientsCount:0,fieldsList:[]},this._locked=!1,this.emptyDBControls=[],this._noApply=!1,this._originalProps=null,this.defFileName="",this.emailAddresses=void 0,this.mergeMailData=void 0,this.render(),this.btnInsField=new Common.UI.Button({cls:"btn-text-menu-default",caption:this.textInsertField,style:"width: 100%;",lock:[i.noFields,i.preview,i.coAuth,i.lostConnect],menu:new Common.UI.Menu({style:"min-width: 190px;max-width: 400px;",maxHeight:200,items:[]}).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:this.$el.find(".dropdown-menu"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,suppressScrollX:!0,minScrollbarLength:40})})}),this.btnInsField.render(e("#mmerge-btn-ins-field",t.$el)),this.txtFieldNum=new Common.UI.InputField({el:e("#mmerge-field-num",t.$el),allowBlank:!0,validateOnChange:!1,style:"width: 80px; vertical-align: middle;",maskExp:/[0-9]/,value:1,validation:function(e){return/(^[0-9]+$)/.test(e)?(e=parseInt(e),void 0===e||null===e||e<1?t.txtFieldNum.setValue(1):e>t._state.recipientsCount&&t.txtFieldNum.setValue(t._state.recipientsCount)):t.txtFieldNum.setValue(1),!0},lock:[i.noRecipients,i.lostConnect]}).on("changed:after",function(e,i,n,o){var s=parseInt(t.txtFieldNum.getValue());s!==parseInt(n)&&(t.api.asc_PreviewMailMergeResult(s-1),t.fireEvent("editcomplete",t))}),this.emptyDBControls.push(this.txtFieldNum)},render:function(){this.$el.html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onPreviewMailMergeResult",i.bind(this.onPreviewMailMergeResult,this)),this.api.asc_registerCallback("asc_onEndPreviewMailMergeResult",i.bind(this.onEndPreviewMailMergeResult,this)),this.api.asc_registerCallback("asc_onStartMailMerge",i.bind(this.onStartMailMerge,this)),this.api.asc_registerCallback("asc_onSaveMailMerge",i.bind(this.onSaveMailMerge,this)),this.api.asc_registerCallback("asc_onEndAction",i.bind(this.onLongActionEnd,this)),Common.Gateway.on("setemailaddresses",i.bind(this.onSetEmailAddresses,this)),Common.Gateway.on("processmailmerge",i.bind(this.onProcessMailMerge,this))),this},createDelayedControls:function(){var t=this,n=DE.enumLockMM;this.btnEditData=new Common.UI.Button({el:t.$el.find("#mmerge-button-edit-data"),lock:[n.preview,n.lostConnect]}),this.btnEditData.on("click",i.bind(this.onEditData,this)),this.lblAddRecipients=e("#mmerge-lbl-add-recipients"),this.chHighlight=new Common.UI.Switcher({el:t.$el.find("#mmerge-switcher-highlight"),lock:[n.noFields,n.lostConnect]}),this.chHighlight.on("change",i.bind(this.onCheckHighlightChange,this)),this.chPreview=new Common.UI.Switcher({el:t.$el.find("#mmerge-switcher-preview"),lock:[n.noRecipients,n.lostConnect]}),this.chPreview.on("change",i.bind(this.onCheckPreviewChange,this)),this.emptyDBControls.push(this.chPreview),this.btnFirst=new Common.UI.Button({cls:"btn-toolbar",iconCls:"mmerge-first",disabled:!0,value:0,hint:this.txtFirst,lock:[n.noRecipients,n.lostConnect]}),this.btnFirst.render(e("#mmerge-button-first",t.$el)),this.btnFirst.on("click",i.bind(this.onBtnPreviewFieldClick,this)),this.emptyDBControls.push(this.btnFirst),this.btnPrev=new Common.UI.Button({cls:"btn-toolbar",iconCls:"mmerge-prev",disabled:!0,value:1,hint:this.txtPrev,lock:[n.noRecipients,n.lostConnect]}),this.btnPrev.render(e("#mmerge-button-prev",t.$el)),this.btnPrev.on("click",i.bind(this.onBtnPreviewFieldClick,this)),this.emptyDBControls.push(this.btnPrev),this.btnNext=new Common.UI.Button({cls:"btn-toolbar",iconCls:"mmerge-next",value:2,hint:this.txtNext,lock:[n.noRecipients,n.lostConnect]}),this.btnNext.render(e("#mmerge-button-next",t.$el)),this.btnNext.on("click",i.bind(this.onBtnPreviewFieldClick,this)),this.emptyDBControls.push(this.btnNext),this.btnLast=new Common.UI.Button({cls:"btn-toolbar",iconCls:"mmerge-last",value:3,hint:this.txtLast,lock:[n.noRecipients,n.lostConnect]}),this.btnLast.render(e("#mmerge-button-last",t.$el)),this.btnLast.on("click",i.bind(this.onBtnPreviewFieldClick,this)),this.emptyDBControls.push(this.btnLast),this._arrMergeSrc=[{displayValue:this.textPdf,value:Asc.c_oAscFileType.PDF},{displayValue:this.textDocx,value:Asc.c_oAscFileType.DOCX},{displayValue:this.textEmail,value:Asc.c_oAscFileType.HTML}],this.cmbMergeTo=new Common.UI.ComboBox({el:e("#mmerge-combo-merge-to",t.$el),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 190px;",editable:!1,data:this._arrMergeSrc,lock:[n.noRecipients,n.lostConnect]}),this.cmbMergeTo.setValue(this._arrMergeSrc[0].value),this.cmbMergeTo.on("selected",i.bind(this.onCmbMergeToSelect,this)),this.emptyDBControls.push(this.cmbMergeTo),this.radioAll=new Common.UI.RadioBox({el:e("#mmerge-radio-all",t.$el),labelText:this.textAll,name:"asc-radio-merge",checked:!0,lock:[n.noRecipients,n.lostConnect]}).on("change",i.bind(this.onRadioAllCurrent,this)),this.emptyDBControls.push(this.radioAll),this.radioCurrent=new Common.UI.RadioBox({el:e("#mmerge-radio-current",t.$el),labelText:this.textCurrent,name:"asc-radio-merge",lock:[n.noRecipients,n.lostConnect]}).on("change",i.bind(this.onRadioAllCurrent,this)),this.emptyDBControls.push(this.radioCurrent),this.radioFromTo=new Common.UI.RadioBox({el:e("#mmerge-radio-from-to",t.$el),labelText:this.textFrom,name:"asc-radio-merge",lock:[n.noRecipients,n.lostConnect]}).on("change",i.bind(this.onRadioFromToChange,this)),this.emptyDBControls.push(this.radioFromTo),this.txtFieldFrom=new Common.UI.InputField({el:e("#mmerge-field-from",t.$el),allowBlank:!0,validateOnChange:!1,style:"width: 50px;",maskExp:/[0-9]/,value:0,disabled:!0,lock:[n.radioAllCurr,n.noRecipients,n.lostConnect],validation:function(e){/(^[0-9]+$)/.test(e)?(e=parseInt(e),void 0===e||null===e||e<1?t.txtFieldFrom.setValue(1):e>t._state.recipientsCount&&t.txtFieldFrom.setValue(t._state.recipientsCount)):t.txtFieldFrom.setValue(1),e=parseInt(t.txtFieldFrom.getValue());var i=Math.min(t._state.recipientsCount,e+99);if(parseInt(t.txtFieldTo.getValue())>i&&t.txtFieldTo.setValue(i),t._checkFromToValues){if(e>parseInt(t.txtFieldTo.getValue()))return t.txtFromToError;t._checkFromToValues=!1,t.txtFieldTo.checkValidate()}return!0}}),this.emptyDBControls.push(this.txtFieldFrom),this.txtFieldTo=new Common.UI.InputField({el:e("#mmerge-field-to",t.$el),allowBlank:!0,validateOnChange:!1,style:"width: 50px;",maskExp:/[0-9]/,value:0,disabled:!0,lock:[n.radioAllCurr,n.noRecipients,n.lostConnect],validation:function(e){if(/(^[0-9]+$)/.test(e))if(void 0===(e=parseInt(e))||null===e||e<1)t.txtFieldTo.setValue(1);else{var i=Math.min(t._state.recipientsCount,parseInt(t.txtFieldFrom.getValue())+99);e>i&&t.txtFieldTo.setValue(i)}else t.txtFieldTo.setValue(1);if(t._checkFromToValues){if(parseInt(t.txtFieldFrom.getValue())>parseInt(t.txtFieldTo.getValue()))return t.txtFromToError;t._checkFromToValues=!1,t.txtFieldFrom.checkValidate()}return!0}}),this.txtFieldTo.on("changed:after",function(){t._isToChanged=!0}),this.emptyDBControls.push(this.txtFieldTo),this.onRadioAllCurrent(this.radioAll,!0),this.btnDownload=new Common.UI.Button({el:e("#mmerge-button-download",t.$el),lock:[n.noRecipients,n.lostConnect]}).on("click",i.bind(this.onDownloadClick,this,!0)),this.emptyDBControls.push(this.btnDownload),this.btnPortal=new Common.UI.Button({el:e("#mmerge-button-portal",t.$el),lock:[n.noRecipients,n.lostConnect]}).on("click",i.bind(this.onDownloadClick,this,!1)),this.btnMerge=new Common.UI.Button({el:e("#mmerge-button-merge",t.$el),lock:[n.noRecipients,n.lostConnect]}).on("click",i.bind(this.onMergeClick,this,!1)),this.emptyDBControls.push(this.btnMerge),this.linkReadMore=e("#mmerge-readmore-link",this.$el),this.$el.on("click","#mmerge-readmore-link",i.bind(this.openHelp,this)),this.mode&&(this.mode.mergeFolderUrl||this.btnPortal.setVisible(!1),this.mode.canSendEmailAddresses||(this._arrMergeSrc.pop(),this.cmbMergeTo.setData(this._arrMergeSrc),this.cmbMergeTo.setValue(this._arrMergeSrc[0].value))),this._initSettings=!1},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedControls(),this.disableInsertControls(this._locked),t){var e=this;this._state.recipientsCount=t.recipientsCount,this._state.fieldsList=t.fieldsList?t.fieldsList:[],this.btnInsField.menu.items.length<1&&i.each(this._state.fieldsList,function(t,i){var n=new Common.UI.MenuItem({caption:"«"+t+"»",field:t}).on("click",function(t,i){e.api&&(e.api.asc_AddMailMergeField(t.options.field),e.fireEvent("editcomplete",e))});e.btnInsField.menu.addItem(n)});var n=parseInt(this.txtFieldFrom.getValue());n=isNaN(n)?0:n-1,(n<0||n>this._state.recipientsCount-1)&&(n=0);var o=this._isToChanged?parseInt(this.txtFieldTo.getValue()):this._state.recipientsCount;o=isNaN(o)?0:o-1,(o<0||o>this._state.recipientsCount-1)&&(o=Math.max(this._state.recipientsCount-1,0)),n>o&&(n=0,o=this._state.recipientsCount-1),this.txtFieldFrom.setValue(n+1),this.txtFieldTo.setValue(Math.min(o+1,n+100));var s=parseInt(this.txtFieldNum.getValue());s=isNaN(s)?0:s-1,s<0&&(s=0),s>this._state.recipientsCount-1&&(s=this._state.recipientsCount-1),this.lockControls(DE.enumLockMM.noRecipients,this._state.recipientsCount<1,{array:this.mode.mergeFolderUrl?[this.btnPortal]:[],merge:!0}),this.lockControls(DE.enumLockMM.noFields,this._state.fieldsList.length<1,{array:[this.btnInsField,this.chHighlight]}),this.lblAddRecipients[this._state.fieldsList.length<1?"show":"hide"](),this.disableFieldBtns(s)}},onEditData:function(){var t=DE.getController("Common.Controllers.ExternalMergeEditor").getView("Common.Views.ExternalMergeEditor");if(t){t.show();var e=this.api.asc_getMailMergeData();e&&t.setMergeData(e)}},onCheckHighlightChange:function(t,e,i){this.api&&this.api.asc_SetHighlightMailMergeFields(t.getValue()),this.fireEvent("editcomplete",this)},onCheckPreviewChange:function(t,e,i){var n=t.getValue(),o=parseInt(this.txtFieldNum.getValue());this.api&&(n?this.api.asc_PreviewMailMergeResult(isNaN(o)?0:o-1):this.api.asc_EndPreviewMailMergeResult()),this.fireEvent("editcomplete",this)},onRadioFromToChange:function(t,e,i){e&&this.lockControls(DE.enumLockMM.radioAllCurr,!1,{array:[this.txtFieldFrom,this.txtFieldTo]})},onRadioAllCurrent:function(t,e,i){e&&this.lockControls(DE.enumLockMM.radioAllCurr,!0,{array:[this.txtFieldFrom,this.txtFieldTo]})},checkFromToValues:function(){this._checkFromToValues=!0;var t=this.txtFieldFrom.checkValidate(),e=this.txtFieldTo.checkValidate();return!0!==t||!0!==e?(this.txtFieldTo.cmpEl.find("input").focus(),!1):(this._checkFromToValues=!1,!0)},onDownloadClick:function(t,n,o){if(this.api){var s=0,a=Math.min(Math.max(this._state.recipientsCount-1,0),99);if(this.radioCurrent.getValue())s=a=parseInt(this.txtFieldNum.getValue())-1;else if(this.radioFromTo.getValue()){if(!this.checkFromToValues())return;s=parseInt(this.txtFieldFrom.getValue())-1,a=parseInt(this.txtFieldTo.getValue())-1,a=Math.min(a,s+99),this.txtFieldTo.setValue(a+1)}if(this.api.asc_DownloadAsMailMerge(this.cmbMergeTo.getValue(),s,a,t)){if(!t){var r=DE.getController("Main");r.loadMask||(r.loadMask=new Common.UI.LoadMask({owner:e("#viewport")})),r.loadMask.setTitle(this.downloadMergeTitle),r.loadMask.show()}}else{var l={closable:!1,title:this.notcriticalErrorTitle,msg:this.errorMailMergeSaveFile,iconCls:"warn",buttons:["ok"],callback:i.bind(function(t){this.fireEvent("editcomplete",this)},this)};Common.UI.alert(l)}}},onSaveMailMerge:function(t){var e=DE.getController("Main").loadMask;if(e&&e.hide(),!this._mailMergeDlg){var i=this;this.cmbMergeTo.getValue()!=Asc.c_oAscFileType.HTML&&(i._mailMergeDlg=new DE.Views.MailMergeSaveDlg({mergeFolderUrl:i.mode.mergeFolderUrl,mergedFileUrl:t,defFileName:i.defFileName+(this.cmbMergeTo.getValue()==Asc.c_oAscFileType.PDF?".pdf":".docx")}),i._mailMergeDlg.on("mailmergefolder",function(t,e){}).on("mailmergeerror",function(t,e){var n={closable:!1,title:this.notcriticalErrorTitle,msg:e,iconCls:"warn",buttons:["ok"],callback:function(t){i.fireEvent("editcomplete",i)}};Common.UI.alert(n)}).on("close",function(t){i._mailMergeDlg=void 0}),i._mailMergeDlg.show())}},onMergeClick:function(t,i,n){var o=0,s=Math.min(Math.max(this._state.recipientsCount-1,0),99);if(this.radioFromTo.getValue()){if(!this.checkFromToValues())return;o=parseInt(this.txtFieldFrom.getValue())-1,s=parseInt(this.txtFieldTo.getValue())-1,s=Math.min(s,o+99),this.txtFieldTo.setValue(s+1)}if(void 0==this.emailAddresses){var a=DE.getController("Main");a.loadMask||(a.loadMask=new Common.UI.LoadMask({owner:e("#viewport")})),a.loadMask.setTitle(this.requestMailsTitle),a.loadMask.show(),Common.Gateway.requestEmailAddresses()}else this.showMergeMailDlg()},onSetEmailAddresses:function(t){var e=DE.getController("Main").loadMask;if(e&&e.hide(),t&&t.data)if(t.data.error){var n={width:500,closable:!1,title:this.notcriticalErrorTitle,msg:t.data.error,iconCls:"warn",buttons:i.isEmpty(t.data.createEmailAccountUrl)?["ok"]:["custom","cancel"],primary:i.isEmpty(t.data.createEmailAccountUrl)?["ok"]:"custom",customButtonText:this.textGoToMail,callback:i.bind(function(e){"custom"==e&&window.open(t.data.createEmailAccountUrl,"_blank"),this.fireEvent("editcomplete",this)},this)};Common.UI.alert(n)}else this.emailAddresses=t.data.emailAddresses,this.showMergeMailDlg()},showMergeMailDlg:function(){if(!this._mailMergeDlg){var t=this;t._mailMergeDlg=new DE.Views.MailMergeEmailDlg({props:{fieldsList:this._state.fieldsList,emailAddresses:this.emailAddresses},handler:function(i,n){if("ok"==i){t.mergeMailData=n;var o=DE.getController("Main");o.loadMask||(o.loadMask=new Common.UI.LoadMask({owner:e("#viewport")})),o.loadMask.setTitle(t.downloadMergeTitle),o.loadMask.show(),Common.Gateway.requestStartMailMerge()}t.fireEvent("editcomplete",t)}}),t._mailMergeDlg.on("close",function(e){t._mailMergeDlg=void 0}),t._mailMergeDlg.show()}},onProcessMailMerge:function(t){var e=DE.getController("Main").loadMask;if(e&&e.hide(),t)if(t.enabled)this.sendMergeDataByEmail();else{var n={closable:!1,title:this.notcriticalErrorTitle,msg:i.isEmpty(t.message)?this.warnProcessMailMerge:t.message,iconCls:"warn",buttons:["ok"],callback:i.bind(function(t){this.fireEvent("editcomplete",this)},this)};Common.UI.alert(n)}},sendMergeDataByEmail:function(){if(this.api){var t=0,e=Math.min(Math.max(this._state.recipientsCount-1,0),99);this.radioCurrent.getValue()?t=e=parseInt(this.txtFieldNum.getValue())-1:this.radioFromTo.getValue()&&(t=parseInt(this.txtFieldFrom.getValue())-1,e=parseInt(this.txtFieldTo.getValue())-1);var i=new Asc.CMailMergeSendData;i.put_RecordFrom(t),i.put_RecordTo(e),i.put_From(this.mergeMailData.from),i.put_To(this.mergeMailData.to),i.put_Subject(this.mergeMailData.subject),i.put_MailFormat(this.mergeMailData.mailFormat),this.mergeMailData.mailFormat!==Asc.c_oAscFileType.HTML&&(i.put_FileName(this.mergeMailData.fileName),i.put_Message(this.mergeMailData.message)),this.api.asc_sendMailMergeData(i),this.fireEvent("editcomplete",this)}},onLongActionEnd:function(t,e){e==Asc.c_oAscAsyncAction.SendMailMerge&&Common.UI.info({closable:!1,width:500,msg:this.textSendMsg,iconCls:"info",buttons:["ok"],callback:i.bind(function(t){this.fireEvent("editcomplete",this)},this)})},onBtnPreviewFieldClick:function(t,e){var i=parseInt(this.txtFieldNum.getValue());switch(i=isNaN(i)?0:i-1,t.options.value){case 0:i=0;break;case 1:i--;break;case 2:i++;break;case 3:i=this._state.recipientsCount-1}i<0&&(i=0),i>this._state.recipientsCount-1&&(i=this._state.recipientsCount-1),this.api.asc_PreviewMailMergeResult(i),this.fireEvent("editcomplete",this)},disableFieldBtns:function(t){var e=this._state.recipientsCount<1||!this.chPreview.getValue(),i=e||t<1;this.btnFirst.isDisabled()!==i&&this.btnFirst.setDisabled(i),this.btnPrev.isDisabled()!==i&&this.btnPrev.setDisabled(i),i=e||t>this._state.recipientsCount-2,this.btnLast.isDisabled()!==i&&this.btnLast.setDisabled(i),this.btnNext.isDisabled()!==i&&this.btnNext.setDisabled(i),i=e||t<0,this.txtFieldNum.isDisabled()!==i&&this.txtFieldNum.setDisabled(i),t>=0&&this.txtFieldNum.setValue(t+1)},onPreviewMailMergeResult:function(t){this.chPreview.getValue()||this.chPreview.setValue(!0),this.disableFieldBtns(t),this.disableEditing(!0)},onEndPreviewMailMergeResult:function(){this.chPreview.getValue()&&this.chPreview.setValue(!1),this.disableFieldBtns(-1),this.disableEditing(!1)},onStartMailMerge:function(){this.btnInsField.menu.removeAll(),this.txtFieldNum.setValue(1),this.ChangeSettings({recipientsCount:this.api.asc_GetReceptionsCount(),fieldsList:this.api.asc_GetMailMergeFieldsNameList()})},onCmbMergeToSelect:function(t,e){var i=e.value==Asc.c_oAscFileType.HTML;this.btnMerge.setVisible(i),this.btnPortal.setVisible(!i&&this.mode.mergeFolderUrl),this.btnDownload.setVisible(!i)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this.lockControls(DE.enumLockMM.lostConnect,t,{array:i.union([this.btnEditData,this.btnInsField,this.chHighlight],this.mode.mergeFolderUrl?[this.btnPortal]:[]),merge:!0})},disableInsertControls:function(t){this.lockControls(DE.enumLockMM.coAuth,t,{array:[this.btnInsField]})},setMode:function(t){this.mode=t},disableEditing:function(t){DE.getController("Toolbar").DisableToolbar(t,t),DE.getController("RightMenu").SetDisabled(t,!0),DE.getController("LeftMenu").SetDisabled(t),DE.getController("Statusbar").getView("Statusbar").SetDisabled(t),this.mode.canComments&&DE.getController("Common.Controllers.Comments").setMode(t?{canComments:!1}:this.mode).onApiHideComment(),this.lockControls(DE.enumLockMM.preview,t,{array:[this.btnInsField,this.btnEditData]})},setDocumentName:function(t){this.defFileName=t||this.txtUntitled;var e=this.defFileName.lastIndexOf(".");e>0&&(this.defFileName=this.defFileName.substring(0,e))},openHelp:function(t){DE.getController("LeftMenu").getView("LeftMenu").showMenu("file:help","UsageInstructions/UseMailMerge.htm")},disablePreviewMode:function(){this.api&&this.chPreview&&this.chPreview.getValue()&&this.api.asc_EndPreviewMailMergeResult()},lockControls:function(t,e,n){function o(t,n){if(i.contains(t.options.lock,n)){var o=t.keepState.indexOf(n);e?o<0&&t.keepState.push(n):o<0||t.keepState.splice(o,1)}}!n&&(n={});var s=n.array||this.emptyDBControls;n.merge&&(s=i.union(this.emptyDBControls,s)),i.each(s,function(e){i.isFunction(e.setDisabled)&&(!e.keepState&&(e.keepState=[]),n.clear&&n.clear.length>0&&e.keepState.length>0&&(e.keepState=i.difference(e.keepState,n.clear)),i.isArray(t)?i.each(t,function(t){o(e,t)}):o(e,t),e.keepState.length>0?!e.isDisabled()&&e.setDisabled(!0):e.isDisabled()&&e.setDisabled(!1))})},textDataSource:"Data Source",textEditData:"Edit recipients list",textInsertField:"Insert Merge Field",textHighlight:"Highlight merge fields",textPreview:"Preview results",textPdf:"PDF",textDocx:"Docx",textEmail:"E-mail",txtFirst:"To first field",txtPrev:"To previous field",txtNext:"To next field",txtLast:"To last field",textMergeTo:"Merge to",textAll:"All records",textCurrent:"Current record",textFrom:"From",textTo:"To",textDownload:"Download",textPortal:"Save",errorMailMergeSaveFile:"Merge failed.",downloadMergeTitle:"Merging",requestMailsTitle:"Requesting e-mails",textMerge:"Merge",sendTitle:"Send e-mail",textSendMsg:"All mail messages are ready and will be sent out within some time.<br>The speed of mailing depends on your mail service.<br>You can continue working with document or close it. After the operation is over the notification will be sent to your registration email address.",notcriticalErrorTitle:"Warning",warnProcessMailMerge:"Starting merge failed",txtUntitled:"Untitled",textMaxRecepients:"Max 100 recipients.",textReadMore:"Read more",txtFromToError:'"From" value must be less than "To" value',textMergeFields:"Merge Fields",textGoToMail:"Go to Mail",textAddRecipients:"Add some recipients to the list first"},DE.Views.MailMergeSettings||{}))}),define("text!documenteditor/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-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("documenteditor/main/app/view/TextArtSettings",["text!documenteditor/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"],function(t,e,i,n){"use strict";DE.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",StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,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.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.render(),this.FillColorContainer=e("#textart-panel-color-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},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.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(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.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){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.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},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.put_transparent(2.55*o),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.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.put_transparent(2.55*this._sliderChanged),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ImgApply(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.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),r.put_fill(new Asc.asc_CFillGrad),r.get_fill().put_grad_type(this.GradFillType),r.get_fill().put_linear_angle(6e4*s.type),r.get_fill().put_linear_scale(!0),a.asc_putFill(r),this.shapeprops.put_TextArtProperties(a),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]])),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType),e.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),e.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ImgApply(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<.01?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.asc_putLine(i),this.shapeprops.put_TextArtProperties(e),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",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){s.fireEvent("editcomplete",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<.01?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.ImgApply(this.imgprops)}this.fireEvent("editcomplete",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<.01?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.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},ChangeSettings:function(t){if(null==this.imgprops?(this.imgprops=new Asc.asc_CImgProperty,this.imgprops.put_ShapeProperties(new Asc.asc_CShapeProperty),this.shapeprops=this.imgprops.get_ShapeProperties()):this.imgprops.put_ImageUrl(null),this._initSettings&&this.createDelayedElements(),t&&t.get_ShapeProperties()&&t.get_ShapeProperties().get_TextArtProperties()){var e=t.get_ShapeProperties().get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var n=null,o=e.asc_getFill(),s=o?o.get_type():null,a=null;if(o){var r=o.get_transparent();(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===o||void 0===o||null===s)this.OriginalFillType=null;else if(s==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(s==Asc.c_oAscFill.FILL_TYPE_SOLID)o=o.get_fill(),a=o.get_color(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[1]="ffffff";else if(s==Asc.c_oAscFill.FILL_TYPE_GRAD){o=o.get_fill();var l=o.get_grad_type();if(this._state.GradFillType===l&&this.GradFillType===l||(this.GradFillType=l,n=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),n=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,n.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var c=Math.floor(o.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-c)>.001){this.GradLinearDirectionType=c;var d=this.mnuDirectionPicker.store.findWhere({type:c});this.mnuDirectionPicker.selectRecord(d,!0),d?this.btnDirection.setIconCls("item-gradient "+d.get("iconcls")):this.btnDirection.setIconCls("")}}var h=o.get_colors();h&&h.length>0&&(a=h[0],a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()):this.GradColor.colors[0]="000000",a=h[1],a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()):this.GradColor.colors[1]="ffffff");var p=o.get_positions();if(p&&p.length>0){var m=p[0];null!==m&&(m/=1e3,this.GradColor.values[0]=m),m=p[1],null!==m&&(m/=1e3,this.GradColor.values[1]=m)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof this.GradColor.colors[0]?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof this.GradColor.colors[1]?this.GradColor.colors[1].color:this.GradColor.colors[1]),1),this.sldrGradient.setValue(0,this.GradColor.values[0]),this.sldrGradient.setValue(1,this.GradColor.values[1]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.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));var u=typeof this.ShapeColor.Color,g=typeof this._state.ShapeColor;if(u!==g||"object"==u&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=u&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var b=!1,f=0;f<10;f++)if(Common.Utils.ThemeColor.ThemeValues[f]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),b=!0;break}b||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var C,v=e.asc_getLine(),_=v?v.get_type():null;if(v?(_==Asc.c_oAscStrokeType.STROKE_COLOR?(a=v.get_color(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},C=v.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},u=typeof this.BorderColor.Color,g=typeof this._state.StrokeColor,u!==g||"object"==u&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=u&&(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 b=!1,f=0;f<10;f++)if(Common.Utils.ThemeColor.ThemeValues[f]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),b=!0;break}b||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==_||_==Asc.c_oAscStrokeType.STROKE_COLOR){if(_==Asc.c_oAscStrokeType.STROKE_COLOR){var y=v.get_width(),w=Math.abs(this._state.StrokeWidth-y)<.001&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-y)>.001||w||(null===this._state.StrokeWidth||null===y)&&this._state.StrokeWidth!==y){this._state.StrokeWidth=y,null!==y&&(y=this._mm2pt(y));var x=null===y?y:i.find(this.cmbBorderSize.store.models,function(t){if(y<t.attributes.value+.01&&y>t.attributes.value-.01)return!0});x?this.cmbBorderSize.selectRecord(x):this.cmbBorderSize.setValue(null!==y?parseFloat(y.toFixed(2))+" "+this.txtPt:""),this.BorderSize=y}}else _==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=_}if(this._state.StrokeBorderType!==C&&(this.BorderType=this._state.StrokeBorderType=C,this.cmbBorderType.setValue(C)),a=this.GradColor.colors[this.GradColor.currentIdx],u=typeof a,g=typeof this._state.GradColor,u!==g||"object"==u&&(a.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(a.color)<0)||"object"!=u&&this._state.GradColor.indexOf(a)<0){if(this.btnGradColor.setColor(a),"object"==typeof a){for(var b=!1,f=0;f<10;f++)if(Common.Utils.ThemeColor.ThemeValues[f]==a.effectValue){this.colorsGrad.select(a,!0),b=!0;break}b||this.colorsGrad.clearSelection()}else this.colorsGrad.select(a,!0);this._state.GradColor=a}var S=e.asc_getForm();if(this._state.FormId!==S){this.cmbTransform.suspendEvents();var n=this.cmbTransform.menuPicker.store.findWhere({type:S});this.cmbTransform.menuPicker.selectRecord(n),this.cmbTransform.resumeEvents(),this._state.FormId=S}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.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: 190px;",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.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.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(),this.UpdateThemeColors(),this.fillTransform(this.api.asc_getPropertyEditorTextArts()),this._initSettings=!1},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.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},fillTransform:function(t){if(t&&t.length>1&&t[1]){for(var e=[],n=t[1],o=0;o<n.length;o++){var s=n[o];s&&s.length>0&&i.each(s,function(t){e.push({imageUrl:t.Image,type:t.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(e),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putForm(e.get("type")),this.shapeprops.put_TextArtProperties(i),this.api.ImgApply(this.imgprops)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(e("#textart-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:e("#textart-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",i.bind(this.onColorsBorderSelect,this)),e(this.el).on("click","#textart-border-color-new",i.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(e("#textart-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.lockedControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:e("#textart-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",i.bind(this.onColorsGradientSelect,this)),e(this.el).on("click","#textart-gradient-color-new",i.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:i.template('<div id="textart-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:i.template('<a id="textart-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(e("#textart-back-color-btn")),this.btnBackColor.setColor("transparent"),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:e("#textart-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",i.bind(this.onColorsBackSelect,this)),e(this.el).on("click","#textart-back-color-new",i.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.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",textNewColor:"Add New Custom Color",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",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"},DE.Views.TextArtSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;if(define("documenteditor/main/app/view/RightMenu",["text!documenteditor/main/app/template/RightMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","documenteditor/main/app/view/ParagraphSettings","documenteditor/main/app/view/HeaderFooterSettings","documenteditor/main/app/view/ImageSettings","documenteditor/main/app/view/ChartSettings","documenteditor/main/app/view/TableSettings","documenteditor/main/app/view/ShapeSettings","documenteditor/main/app/view/MailMergeSettings","documenteditor/main/app/view/TextArtSettings","common/main/lib/component/Scroller"],function(t,e,i,n){"use strict";DE.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.btnTable=new Common.UI.Button({hint:this.txtTableSettings,asctype:Common.Utils.documentSettingsType.Table,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.btnHeaderFooter=new Common.UI.Button({hint:this.txtHeaderFooterSettings,asctype:Common.Utils.documentSettingsType.Header,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._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panel:"id-paragraph-settings",btn:this.btnText},this._settings[Common.Utils.documentSettingsType.Table]={panel:"id-table-settings",btn:this.btnTable},this._settings[Common.Utils.documentSettingsType.Image]={panel:"id-image-settings",btn:this.btnImage},this._settings[Common.Utils.documentSettingsType.Header]={panel:"id-header-settings",btn:this.btnHeaderFooter},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},render:function(t){var n=e(this.el);this.trigger("render:before",this);var o=Common.localStorage.getItem("de-hide-right-settings");return o=null===o||0==parseInt(o),n.css("width",(o?MENU_SCALE_PART:SCALE_MIN)+"px"),n.show(),n.html(this.template({})),this.btnText.el=e("#id-right-menu-text"),this.btnText.render(),this.btnTable.el=e("#id-right-menu-table"),this.btnTable.render(),this.btnImage.el=e("#id-right-menu-image"),this.btnImage.render(),this.btnHeaderFooter.el=e("#id-right-menu-header"),this.btnHeaderFooter.render(),this.btnChart.el=e("#id-right-menu-chart"),this.btnChart.render(),this.btnShape.el=e("#id-right-menu-shape"),this.btnShape.render(),this.btnTextArt.el=e("#id-right-menu-textart"),this.btnTextArt.render(),this.btnText.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",i.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",i.bind(this.onBtnMenuClick,this)),this.btnHeaderFooter.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.paragraphSettings=new DE.Views.ParagraphSettings,this.headerSettings=new DE.Views.HeaderFooterSettings,this.imageSettings=new DE.Views.ImageSettings,this.chartSettings=new DE.Views.ChartSettings,this.tableSettings=new DE.Views.TableSettings,this.shapeSettings=new DE.Views.ShapeSettings,this.textartSettings=new DE.Views.TextArtSettings,t&&t.canCoAuthoring&&t.canUseMailMerge&&(this.btnMailMerge=new Common.UI.Button({hint:this.txtMailMergeSettings,asctype:Common.Utils.documentSettingsType.MailMerge,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup"}),this._settings[Common.Utils.documentSettingsType.MailMerge]={panel:"id-mail-merge-settings",btn:this.btnMailMerge},this.btnMailMerge.el=e("#id-right-menu-mail-merge"),this.btnMailMerge.render().setVisible(!0),this.btnMailMerge.on("click",i.bind(this.onBtnMenuClick,this)),this.mergeSettings=new DE.Views.MailMergeSettings),i.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),o&&(e("#id-paragraph-settings").parent().css("display","inline-block"),e("#id-paragraph-settings").addClass("active")),this.trigger("render:after",this),this},setApi:function(t){this.api=t;var e=function(){this.fireEvent("editcomplete",this)};this.paragraphSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.headerSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.imageSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.chartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.tableSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.shapeSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.textartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.mergeSettings&&this.mergeSettings.setApi(t).on("editcomplete",i.bind(e,this))},setMode:function(t){this.mergeSettings&&this.mergeSettings.setMode(t)},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("de-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("de-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,t.options.asctype,this.minimizedMode])},SetActivePane:function(t,e){if(!(this.minimizedMode&&!0!==e||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 i=this.$el.find("#"+this._settings[t].panel);i.hasClass("active")||(i.parent().find("> .active").removeClass("active"),i.addClass("active"),this.scroller&&this.scroller.update()),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(){this.mergeSettings&&this.mergeSettings.disablePreviewMode();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",txtTableSettings:"Table Settings",txtHeaderFooterSettings:"Header and Footer Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtChartSettings:"Chart Settings",txtMailMergeSettings:"Mail Merge Settings"},DE.Views.RightMenu||{}))}),define("documenteditor/main/app/controller/RightMenu",["core","documenteditor/main/app/view/RightMenu"],function(){"use strict";DE.Controllers.RightMenu=Backbone.Controller.extend({models:[],collections:[],views:["RightMenu"],initialize:function(){this.editMode=!0,this.addListeners({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.Table]={panelId:"id-table-settings",panel:t.tableSettings,btn:t.btnTable,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.Header]={panelId:"id-header-settings",panel:t.headerSettings,btn:t.btnHeaderFooter,hidden:1,locked:!1,needShow:!0},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.MailMerge]={panelId:"id-mail-merge-settings",panel:t.mergeSettings,btn:t.btnMailMerge,hidden:1,props:{},locked:!1}},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,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.MailMerge?void 0:o)}else i&&e==Common.Utils.documentSettingsType.MailMerge&&this.rightmenu.mergeSettings.disablePreviewMode();Common.NotificationCenter.trigger("layout:changed","rightmenu"),this.rightmenu.fireEvent("editcomplete",this.rightmenu)},onFocusObject:function(t,e){if(this.editMode){for(var i=!1,n=!1,o=0;o<this._settings.length;o++)o!=Common.Utils.documentSettingsType.MailMerge&&this._settings[o]&&(this._settings[o].hidden=1,this._settings[o].locked=!1);this._settings[Common.Utils.documentSettingsType.MailMerge].locked=!1;var s=!1;for(o=0;o<t.length;o++){var a=t[o].get_ObjectType(),r=this.getDocumentSettingsType(a);if(a===Asc.c_oAscTypeSelectElement.Math&&(n=!0),!(void 0===r||r>=this._settings.length||void 0===this._settings[r])){var l=t[o].get_ObjectValue();r==Common.Utils.documentSettingsType.Image?null!==l.get_ChartProperties()?(s=!0,r=Common.Utils.documentSettingsType.Chart):null!==l.get_ShapeProperties()&&(s=l.get_ShapeProperties().get_FromChart(),r=Common.Utils.documentSettingsType.Shape,l.get_ShapeProperties().asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=l,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=l.get_Locked())):r==Common.Utils.documentSettingsType.Paragraph&&(this._settings[r].panel.isChart=s,i=l.get_CanAddTable()),this._settings[r].props=l,this._settings[r].hidden=0,this._settings[r].locked=l.get_Locked(),this._settings[Common.Utils.documentSettingsType.MailMerge].locked||(this._settings[Common.Utils.documentSettingsType.MailMerge].locked=l.get_Locked())}}if(this._settings[Common.Utils.documentSettingsType.Header].locked)for(o=0;o<this._settings.length;o++)this._settings[o]&&(this._settings[o].locked=!0);this._settings[Common.Utils.documentSettingsType.MailMerge].locked||(this._settings[Common.Utils.documentSettingsType.MailMerge].locked=!i||n);var c,d=-1,h=-1,p=this.rightmenu.GetActivePane();for(o=0;o<this._settings.length;o++){var m=this._settings[o];void 0!==m&&void 0!==m.btn&&void 0!==m.panel&&(m.hidden?(m.btn.isDisabled()||m.btn.setDisabled(!0),p==m.panelId&&(c=-1)):(m.btn.isDisabled()&&m.btn.setDisabled(!1),o!=Common.Utils.documentSettingsType.MailMerge&&(d=o),m.needShow?(m.needShow=!1,h=o):p==m.panelId&&(c=o),m.panel.setLocked(m.locked)))}if(this._settings[Common.Utils.documentSettingsType.MailMerge].hidden||this._settings[Common.Utils.documentSettingsType.MailMerge].panel.setLocked(this._settings[Common.Utils.documentSettingsType.MailMerge].locked),!this.rightmenu.minimizedMode||e){var u;h>-1?u=h:d>=0&&c<0?u=d:c>=0?u=c:this._settings[Common.Utils.documentSettingsType.MailMerge].hidden||(u=Common.Utils.documentSettingsType.MailMerge),void 0==u&&e&&d>=0&&(u=d),void 0!==u&&(this.rightmenu.SetActivePane(u,e),u!=Common.Utils.documentSettingsType.MailMerge?this._settings[u].panel.ChangeSettings.call(this._settings[u].panel,this._settings[u].props):this._settings[u].panel.ChangeSettings.call(this._settings[u].panel))}this._settings[Common.Utils.documentSettingsType.Image].needShow=!1,this._settings[Common.Utils.documentSettingsType.Chart].needShow=!1}},onCoAuthoringDisconnect:function(){this.SetDisabled(!0,!1)},onInsertTable:function(){this._settings[Common.Utils.documentSettingsType.Table].needShow=!0},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},UpdateThemeColors:function(){this.rightmenu.paragraphSettings.UpdateThemeColors(),this.rightmenu.tableSettings.UpdateThemeColors(),this.rightmenu.shapeSettings.UpdateThemeColors(),this.rightmenu.textartSettings.UpdateThemeColors()},fillTextArt:function(){this.rightmenu.textartSettings.fillTextArt()},updateMetricUnit:function(){this.rightmenu.headerSettings.updateMetricUnit(),this.rightmenu.paragraphSettings.updateMetricUnit(),this.rightmenu.chartSettings.updateMetricUnit(),this.rightmenu.imageSettings.updateMetricUnit()},createDelayedElements:function(){if(this.api&&(this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onFocusObject,this)),this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this)),this.rightmenu.mergeSettings&&(this.rightmenu.mergeSettings.setDocumentName(this.getApplication().getController("Viewport").getView("Common.Views.Header").getDocumentCaption()),this.api.asc_registerCallback("asc_onStartMailMerge",_.bind(this.onStartMailMerge,this))),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this))),this.editMode&&this.api){this.rightmenu.shapeSettings.createDelayedElements();var t=this.api.getSelectedElements();if(t.length>0){var e=Common.localStorage.getItem("de-hide-right-settings");e=null===e||0==parseInt(e),this.onFocusObject(t,e)}}},onDoubleClickOnObject:function(t){if(this.editMode){var e=t.get_ObjectType(),i=this.getDocumentSettingsType(e);if(!(void 0===i||i>=this._settings.length||void 0===this._settings[i])){var n=t.get_ObjectValue();i==Common.Utils.documentSettingsType.Image&&(null!==n.get_ChartProperties()?i=Common.Utils.documentSettingsType.Chart:null!==n.get_ShapeProperties()&&(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))}}},onStartMailMerge:function(){var t=Common.Utils.documentSettingsType.MailMerge;this._settings[t].hidden=0,this._settings[t].btn.setDisabled(!1),this.rightmenu.SetActivePane(t,!0),this._settings[t].panel.setLocked(this._settings[t].locked),this._settings[t].panel.ChangeSettings.call(this._settings[t].panel)},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.MailMergeLoadFile){this._settings[Common.Utils.documentSettingsType.MailMerge].hidden=1,this._settings[Common.Utils.documentSettingsType.MailMerge].btn.setDisabled(!0);var n=this.api.getSelectedElements();n.length>0&&this.onFocusObject(n)}},SetDisabled:function(t,e){if(this.setMode({isEdit:!t}),this.rightmenu)if(this.rightmenu.paragraphSettings.disableControls(t),this.rightmenu.shapeSettings.disableControls(t),this.rightmenu.textartSettings.disableControls(t),this.rightmenu.headerSettings.disableControls(t),this.rightmenu.tableSettings.disableControls(t),this.rightmenu.imageSettings.disableControls(t),!e&&this.rightmenu.mergeSettings&&(this.rightmenu.mergeSettings.disableControls(t),t&&this.rightmenu.btnMailMerge.setDisabled(t)),this.rightmenu.chartSettings.disableControls(t),t)this.rightmenu.btnText.setDisabled(t),this.rightmenu.btnTable.setDisabled(t),this.rightmenu.btnImage.setDisabled(t),this.rightmenu.btnHeaderFooter.setDisabled(t),this.rightmenu.btnShape.setDisabled(t),this.rightmenu.btnTextArt.setDisabled(t),this.rightmenu.btnChart.setDisabled(t);else{var i=this.api.getSelectedElements();i.length>0&&this.onFocusObject(i)}},getDocumentSettingsType:function(t){switch(t){case Asc.c_oAscTypeSelectElement.Paragraph:return Common.Utils.documentSettingsType.Paragraph;case Asc.c_oAscTypeSelectElement.Table:return Common.Utils.documentSettingsType.Table;case Asc.c_oAscTypeSelectElement.Image:return Common.Utils.documentSettingsType.Image;case Asc.c_oAscTypeSelectElement.Header:return Common.Utils.documentSettingsType.Header}}})}),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(w in A)A[w]=t[B[w]]}function o(t){var i,o,s,a,l,c;if(i=t.keyCode,-1==e(M,i)&&M.push(i),93!=i&&224!=i||(i=91),i in A){A[i]=!0;for(s in k)k[s]==i&&(r[s]=!0)}else if(n(t),r.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){l=o.mods.length>0;for(s in A)(!A[s]&&e(o.mods,+s)>-1||A[s]&&-1==e(o.mods,+s))&&(l=!1);(0!=o.mods.length||A[16]||A[18]||A[17]||A[91])&&!l||(!0===x||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(M,n);if(o>=0&&M.splice(o,1),93!=n&&224!=n||(n=91),n in A){A[n]=!1;for(i in k)k[i]==n&&(r[i]=!1)}}function a(){for(w in A)A[w]=!1;for(w in k)r[w]=!1}function r(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=P(t),t in S||(S[t]=[]),S[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:o})}function l(t,e){var n,o,s,a,r,l=[];for(n=g(t),a=0;a<n.length;a++){if(o=n[a].split("+"),o.length>1&&(l=b(o),t=o[o.length-1]),t=P(t),void 0===e&&(e=m()),!S[t])return;for(s in S[t])r=S[t][s],r.scope===e&&i(r.mods,l)&&(S[t][s]={})}}function c(t){return"string"==typeof t&&(t=P(t)),-1!=e(M,t)}function d(){return M.slice(0)}function h(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function p(t){T=t||"all"}function m(){return T||"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]=k[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=U,e}function v(t,e,n,o){for(var s,a,r,l=[],c=g(t),d=c.length;d--;)if(s=c[d].split("+"),s.length>1&&(l=b(s),t=s[s.length-1]),t=P(t),void 0===e&&(e=m()),S[t])for(a in S[t])r=S[t][a],r.scope===e&&i(r.mods,l)&&(S[t][a][n]=o)}function _(t,e){t?v(t,e,"locked",!0):x=!0}function y(t,e){t?v(t,e,"locked",!1):x=!1}var w,x,S={},A={16:!1,18:!1,17:!1,91:!1},T="all",k={"⇧":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},P=function(t){return I[t]||t.toUpperCase().charCodeAt(0)},M=[];for(w=1;w<20;w++)I["f"+w]=111+w;var B={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(w in k)r[w]=!1;f(document,"keydown",function(t){o(t)}),f(document,"keyup",s),f(window,"focus",a);var U=t.key;t.key=r,t.key.setScope=p,t.key.getScope=m,t.key.deleteScope=u,t.key.filter=h,t.key.isPressed=c,t.key.getPressedKeyCodes=d,t.key.noConflict=C,t.key.unbind=l,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,r=[];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),r.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}),define("documenteditor/main/app/controller/LeftMenu",["core","common/main/lib/util/Shortcuts","documenteditor/main/app/view/LeftMenu","documenteditor/main/app/view/FileMenu"],function(){"use strict";DE.Controllers.LeftMenu=Backbone.Controller.extend(_.extend({views:["LeftMenu","FileMenu"],initialize:function(){this.addListeners({"Common.Views.Chat":{hide:_.bind(this.onHideChat,this)},Statusbar:{"click:users":_.bind(this.clickStatusbarUsers,this)},LeftMenu:{"comments:show":_.bind(this.commentsShowHide,this,"show"),"comments:hide":_.bind(this.commentsShowHide,this,"hide")},"Common.Views.About":{show:_.bind(this.aboutShowHide,this,!1),hide:_.bind(this.aboutShowHide,this,!0)},FileMenu:{"filemenu:hide":_.bind(this.menuFilesHide,this),"item:click":_.bind(this.clickMenuFileItem,this),"saveas:format":_.bind(this.clickSaveAsFormat,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)},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.NotificationCenter.on("leftmenu:change",_.bind(this.onMenuChange,this))},onLaunch:function(){this.leftMenu=this.createView("LeftMenu").render(),this.leftMenu.btnSearch.on("toggle",_.bind(this.onMenuSearch,this)),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"),"command+h,ctrl+h":_.bind(this.onShortcut,this,"replace"),"alt+f":_.bind(this.onShortcut,this,"file"),esc:_.bind(this.onShortcut,this,"escape"),"alt+q":_.bind(this.onShortcut,this,"chat"),"command+shift+h,ctrl+shift+h":_.bind(this.onShortcut,this,"comments"),f1:_.bind(this.onShortcut,this,"help")}}),Common.util.Shortcuts.suspendEvents()},setApi:function(t){if(this.api=t,this.api.asc_registerCallback("asc_onReplaceAll",_.bind(this.onApiTextReplaced,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiServerDisconnect,this,!0)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiServerDisconnect,this)),this.mode.canCoAuthoring&&(this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onApiChatMessage,this)),this.mode.canComments)){this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this));for(var e=this.getApplication().getCollection("Common.Collections.Comments"),i=0;i<e.length;++i)if(e.at(i).get("userid")!==this.mode.user.id){this.leftMenu.markCoauthOptions("comments",!0);break}}return this.leftMenu.getMenu("file").setApi(t),this.mode.canUseHistory&&this.getApplication().getController("Common.Controllers.History").setApi(this.api).setMode(this.mode),this},setMode:function(t){return this.mode=t,this.leftMenu.setMode(t),this.leftMenu.getMenu("file").setMode(t),this},createDelayedElements:function(){return this.mode.canCoAuthoring?(this.leftMenu.btnComments[this.mode.isEdit&&this.mode.canComments&&!this.mode.isLightVersion?"show":"hide"](),this.mode.canComments&&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.canUseHistory&&this.leftMenu.setOptionsPanel("history",this.getApplication().getController("Common.Controllers.History").getView("Common.Views.History")),this.mode.isTrial&&this.leftMenu.setDeveloperMode(!0),Common.util.Shortcuts.resumeEvents(),this},enablePlugins:function(){this.mode.canPlugins?(this.leftMenu.btnPlugins.show(),this.leftMenu.setOptionsPanel("plugins",this.getApplication().getController("Common.Controllers.Plugins").getView("Common.Views.Plugins"))):this.leftMenu.btnPlugins.hide(),this.mode.isTrial&&this.leftMenu.setDeveloperMode(!0)},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"saveas":i?n=!1:this.clickSaveAsFormat(void 0);break;case"print":this.api.asc_Print(Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);break;case"exit":
|
|
|
Common.NotificationCenter.trigger("goback");break;case"edit":this.getApplication().getController("Statusbar").setStatusCaption(this.requestEditRightsText),Common.Gateway.requestEditRights();break;case"new":i?n=!1:this.onCreateNew(void 0,"blank");break;case"history":if(!this.leftMenu.panelHistory.isVisible())if(this.api.isDocumentModified()){var o=this;this.api.asc_stopSaving(),Common.UI.warning({closable:!1,width:500,title:this.notcriticalErrorTitle,msg:this.leavePageText,buttons:["ok","cancel"],primary:"ok",callback:function(t){"ok"==t?(o.api.asc_undoAllChanges(),o.showHistory()):o.api.asc_continueSaving()}})}else this.showHistory();break;case"rename":var o=this,s=o.api.asc_getDocumentName();new Common.Views.RenameDialog({filename:s,handler:function(t,e){"ok"!=t||_.isEmpty(e.trim())||s===e.trim()||Common.Gateway.requestRename(e),Common.NotificationCenter.trigger("edit:complete",o)}}).show();break;default:n=!1}n&&(t.hide(),this.leftMenu.btnFile.toggle(!1,!0))},clickSaveAsFormat:function(t,e){t?e==Asc.c_oAscFileType.TXT?Common.UI.warning({closable:!1,title:this.notcriticalErrorTitle,msg:this.warnDownloadAs,buttons:["ok","cancel"],callback:_.bind(function(i){"ok"==i&&(this.api.asc_DownloadAs(e),t.hide(),this.leftMenu.btnFile.toggle(!1,!0))},this)}):(this.api.asc_DownloadAs(e),t.hide(),this.leftMenu.btnFile.toggle(!1,!0)):this.api.asc_DownloadOrigin()},applySettings:function(t){var e=Common.localStorage.getItem("de-settings-inputmode");if(this.api.SetTextBoxInputMode(1==parseInt(e)),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring){e=Common.localStorage.getItem("de-settings-coauthmode");var i=null===e||1==parseInt(e);switch(this.api.asc_SetFastCollaborative(i),e=Common.localStorage.getItem(i?"de-settings-showchanges-fast":"de-settings-showchanges-strict")){case"all":e=Asc.c_oAscCollaborativeMarksShowType.All;break;case"none":e=Asc.c_oAscCollaborativeMarksShowType.None;break;case"last":e=Asc.c_oAscCollaborativeMarksShowType.LastChanges;break;default:e=i?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges}this.api.SetCollaborativeMarksShowType(e)}switch(e=Common.localStorage.getItem("de-settings-livecomment"),null===e||0!=parseInt(e)?this.api.asc_showComments():this.api.asc_hideComments(),e=Common.localStorage.getItem("de-settings-fontrender")){case"1":this.api.SetFontRenderingMode(1);break;case"2":this.api.SetFontRenderingMode(2);break;case"0":this.api.SetFontRenderingMode(3)}e=Common.localStorage.getItem("de-settings-autosave"),this.api.asc_setAutoSaveGap(parseInt(e)),e=Common.localStorage.getItem("de-settings-spellcheck"),this.api.asc_setSpellCheck(null===e||1==parseInt(e)),e=Common.localStorage.getItem("de-settings-showsnaplines"),this.api.put_ShowSnapLines(null===e||1==parseInt(e)),t.hide(),this.leftMenu.btnFile.toggle(!1,!0)},onCreateNew:function(t,e){if(!0===this.mode.nativeApp)this.api.OpenNewDocument("blank"==e?"":e);else{var i=window.open("blank"==e?this.mode.createUrl:e,"_blank");i&&i.focus()}t&&(t.hide(),this.leftMenu.btnFile.toggle(!1,!0))},onOpenRecent:function(t,e){t&&(t.hide(),this.leftMenu.btnFile.toggle(!1,!0));var i=window.open(e);i&&i.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(t){this.leftMenu.btnFile.pressed&&"opts"==this.leftMenu.btnFile.panel.active?this.leftMenu.close():this.leftMenu.showMenu("file:opts")},clickStatusbarUsers:function(){this.leftMenu.btnFile.panel.panels.rights.changeAccessRights()},onHideChat:function(){$(this.leftMenu.btnChat.el).blur(),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onQuerySearch:function(t,e,i){if(i.textsearch&&i.textsearch.length&&!this.api.asc_findText(i.textsearch,"back"!=t,i.matchcase,i.matchword)){var n=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){n.dlgSearch.focus()}})}},onQueryReplace:function(t,e){if(!_.isEmpty(e.textsearch)&&!this.api.asc_replaceText(e.textsearch,e.textreplace,!1,e.matchcase,e.matchword)){var i=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){i.dlgSearch.focus()}})}},onQueryReplaceAll:function(t,e){_.isEmpty(e.textsearch)||this.api.asc_replaceText(e.textsearch,e.textreplace,!0,e.matchcase,e.matchword)},onSearchHighlight:function(t,e){this.api.asc_selectSearchingResults(e)},showSearchDlg:function(t,e){if(this.dlgSearch||(this.dlgSearch=new Common.UI.SearchDialog({matchcase:!0,markresult:{applied:!0}})),t){var i=this.mode.isEdit?e||void 0:"no-replace";this.dlgSearch.isVisible()?(this.dlgSearch.setMode(i),this.dlgSearch.focus()):this.dlgSearch.show(i)}else this.dlgSearch.hide()},onMenuSearch:function(t,e){this.showSearchDlg(e)},onSearchDlgHide:function(){this.leftMenu.btnSearch.toggle(!1,!0),this.api.asc_selectSearchingResults(!1),$(this.leftMenu.btnSearch.el).blur(),this.api.asc_enableKeyEvents(!0)},onApiTextReplaced:function(t,e){t?t-e>0?Common.UI.warning({msg:Common.Utils.String.format(this.textReplaceSkipped,t-e)}):Common.UI.info({msg:Common.Utils.String.format(this.textReplaceSuccess,e)}):Common.UI.info({msg:this.textNoTextFound})},onApiServerDisconnect:function(t){this.mode.isEdit=!1,this.leftMenu.close(),this.leftMenu.btnComments.setDisabled(!0),this.leftMenu.btnChat.setDisabled(!0),this.leftMenu.btnPlugins.setDisabled(!0),this.leftMenu.getMenu("file").setMode({isDisconnected:!0,disableDownload:!!t}),this.dlgSearch&&(this.leftMenu.btnSearch.toggle(!1,!0),this.dlgSearch.hide())},SetDisabled:function(t,e){this.mode.isEdit=!t,t&&this.leftMenu.close(),this.leftMenu.btnComments.setDisabled(t),this.leftMenu.btnChat.setDisabled(t),this.leftMenu.btnPlugins.setDisabled(t),e&&this.leftMenu.getMenu("file").SetDisabled(t)},onApiChatMessage:function(){this.leftMenu.markCoauthOptions("chat")},onApiAddComment:function(t,e){e&&e.asc_getUserId()!==this.mode.user.id&&this.leftMenu.markCoauthOptions("comments")},onApiAddComments:function(t){for(var e=0;e<t.length;++e)if(t[e].asc_getUserId()!==this.mode.user.id){this.leftMenu.markCoauthOptions("comments");break}},commentsShowHide:function(t){var e=Common.localStorage.getItem("de-settings-livecomment");null!==e&&0===parseInt(e)&&("show"===t?this.api.asc_showComments():this.api.asc_hideComments()),"show"===t&&this.getApplication().getController("Common.Controllers.Comments").onAfterShow(),$(this.leftMenu.btnComments.el).blur()},aboutShowHide:function(t){this.api&&this.api.asc_enableKeyEvents(t),t&&$(this.leftMenu.btnAbout.el).blur()},menuFilesHide:function(t){$(this.leftMenu.btnFile.el).blur()},onMenuChange:function(t){"hide"===t&&this.leftMenu.btnComments.isActive()&&this.api&&(this.leftMenu.btnComments.toggle(!1),this.leftMenu.onBtnMenuClick(this.leftMenu.btnComments),this.api.asc_enableKeyEvents(!0))},onShortcut:function(t,e){switch(t){case"replace":case"search":return Common.UI.Menu.Manager.hideAll(),this.showSearchDlg(!0,t),this.leftMenu.btnSearch.toggle(!0,!0),this.leftMenu.btnFile.toggle(!1),this.leftMenu.btnAbout.toggle(!1),!1;case"save":return(this.mode.canDownload||this.mode.canDownloadOrigin)&&(this.mode.isDesktopApp&&this.mode.isOffline?this.api.asc_DownloadAs():this.mode.canDownload?(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file:saveas")):this.api.asc_DownloadOrigin()),!1;case"help":return Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file:help"),!1;case"file":return Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file"),!1;case"escape":var i=DE.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&&(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.btnFile.pressed||this.leftMenu.btnAbout.pressed||this.leftMenu.btnPlugins.pressed||$(e.target).parents("#left-menu").length)return this.leftMenu.close(),Common.NotificationCenter.trigger("layout:changed","leftmenu"),!1;break;case"chat":return this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")),!1;case"comments":return this.mode.canCoAuthoring&&this.mode.isEdit&&this.mode.canComments&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("comments"),this.getApplication().getController("Common.Controllers.Comments").onAfterShow()),!1}},showHistory:function(){var t=DE.getController("Main");t.loadMask||(t.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),t.loadMask.setTitle(this.textLoadHistory),t.loadMask.show(),Common.Gateway.requestHistory()},textNoTextFound:"Text not found",newDocumentTitle:"Unnamed document",requestEditRightsText:"Requesting editing rights...",textReplaceSuccess:"Search has been done. {0} occurrences have been replaced",textReplaceSkipped:"The replacement has been made. {0} occurrences were skipped.",textLoadHistory:"Loading versions history...",notcriticalErrorTitle:"Warning",leavePageText:"All unsaved changes in this document will be lost.<br> Click 'Cancel' then 'Save' to save them. Click 'OK' to discard all the unsaved changes.",warnDownloadAs:"If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?"},DE.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,r=e.get("name");!n&&++s<a&&(i=t.at(s),i.get("type")==o);)n=i.get("name")==r;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}}})})}),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=this,i={};_.extend(i,{closable:!1,width:250,height:t.type==Asc.c_oAscAdvancedOptionsID.CSV?205:155,contentWidth:390,header:!0,cls:"open-dlg",contentTemplate:"",title:t.type==Asc.c_oAscAdvancedOptionsID.DRM?e.txtTitleProtected:e.txtTitle.replace("%1",t.type==Asc.c_oAscAdvancedOptionsID.CSV?"CSV":"TXT")},t),this.template=t.template||['<div class="box" style="height:'+(i.height-85)+'px;">','<div class="content-panel" >',"<% if (type == Asc.c_oAscAdvancedOptionsID.DRM) { %>",'<label class="header">'+e.txtPassword+"</label>",'<div id="id-password-txt" style="margin-bottom:15px;"></div>',"<% } else { %>",'<label class="header">'+e.txtEncoding+"</label>",'<div id="id-codepages-combo" class="input-group-nr" style="margin-bottom:15px;"></div>',"<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>",'<label class="header">'+e.txtDelimiter+"</label>",'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 110px;"></div>',"<% } %>","<% } %>","</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>","</div>"].join(""),this.handler=t.handler,this.type=t.type,this.codepages=t.codepages,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)if(this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.type==Asc.c_oAscAdvancedOptionsID.DRM)this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,validateOnBlur:!1}),this.$window.find("input").on("keypress",_.bind(this.onKeyPress,this));else{var t=this;this.initCodePages(),this.onPrimary=function(){return t.onBtnClick(),!1}}},show:function(){if(Common.UI.Window.prototype.show.apply(this,arguments),this.type==Asc.c_oAscAdvancedOptionsID.DRM){var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus()},500)}},onBtnClick:function(t){this.handler&&(this.cmbEncoding?this.handler.call(this,this.cmbEncoding.getValue(),this.cmbDelimiter?this.cmbDelimiter.getValue():null):this.handler.call(this,this.inputPwd.getValue())),this.close()},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this.onBtnClick()},initCodePages:function(){var t,e,i,n=[],o=[],s=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(),n.push(e);else n=[[37,"IBM EBCDIC (US-Canada)"],[437,"OEM United States"],[500,"IBM EBCDIC (International)"],[708,"Arabic (ASMO 708)"],[720,"Arabic (DOS)"],[737,"Greek (DOS)"],[775,"Baltic (DOS)"],[850,"Western European (DOS)"],[852,"Central European (DOS)"],[855,"OEM Cyrillic"],[857,"Turkish (DOS)"],[858,"OEM Multilingual Latin I"],[860,"Portuguese (DOS)"],[861,"Icelandic (DOS)"],[862,"Hebrew (DOS)"],[863,"French Canadian (DOS)"],[864,"Arabic (864) "],[865,"Nordic (DOS)"],[866,"Cyrillic (DOS)"],[869,"Greek, Modern (DOS)"],[870,"IBM EBCDIC (Multilingual Latin-2)"],[874,"Thai (Windows)"],[875,"IBM EBCDIC (Greek Modern)"],[932,"Japanese (Shift-JIS)"],[936,"Chinese Simplified (GB2312)"],[949,"Korean"],[950,"Chinese Traditional (Big5)"],[1026,"IBM EBCDIC (Turkish Latin-5)"],[1047,"IBM Latin-1"],[1140,"IBM EBCDIC (US-Canada-Euro)"],[1141,"IBM EBCDIC (Germany-Euro)"],[1142,"IBM EBCDIC (Denmark-Norway-Euro)"],[1143,"IBM EBCDIC (Finland-Sweden-Euro)"],[1144,"IBM EBCDIC (Italy-Euro)"],[1145,"IBM EBCDIC (Spain-Euro)"],[1146,"IBM EBCDIC (UK-Euro)"],[1147,"IBM EBCDIC (France-Euro)"],[1148,"IBM EBCDIC (International-Euro)"],[1149,"IBM EBCDIC (Icelandic-Euro)"],[1200,"Unicode"],[1201,"Unicode (Big-Endian)"],[1250,"Central European (Windows)"],[1251,"Cyrillic (Windows)"],[1252,"Western European (Windows)"],[1253,"Greek (Windows)"],[1254,"Turkish (Windows)"],[1255,"Hebrew (Windows) "],[1256,"Arabic (Windows) "],[1257,"Baltic (Windows)"],[1258,"Vietnamese (Windows)"],[1361,"Korean (Johab)"],[1e4,"Western European (Mac)"],[10001,"Japanese (Mac)"],[10002,"Chinese Traditional (Mac)"],[10003,"Korean (Mac)"],[10004,"Arabic (Mac) "],[10005,"Hebrew (Mac)"],[10006,"Greek (Mac) "],[10007,"Cyrillic (Mac)"],[10008,"Chinese Simplified (Mac)"],[10010,"Romanian (Mac)"],[10017,"Ukrainian (Mac)"],[10021,"Thai (Mac)"],[10029,"Central European (Mac) "],[10079,"Icelandic (Mac)"],[10081,"Turkish (Mac)"],[10082,"Croatian (Mac)"],[12e3,"Unicode (UTF-32)"],[12001,"Unicode (UTF-32 Big-Endian)"],[2e4,"Chinese Traditional (CNS)"],[20001,"TCA Taiwan"],[20002,"Chinese Traditional (Eten)"],[20003,"IBM5550 Taiwan"],[20004,"TeleText Taiwan"],[20005,"Wang Taiwan"],[20105,"Western European (IA5)"],[20106,"German (IA5)"],[20107,"Swedish (IA5) "],[20108,"Norwegian (IA5) "],[20127,"US-ASCII"],[20261,"T.61 "],[20269,"ISO-6937"],[20273,"IBM EBCDIC (Germany)"],[20277,"IBM EBCDIC (Denmark-Norway) "],[20278,"IBM EBCDIC (Finland-Sweden)"],[20280,"IBM EBCDIC (Italy)"],[20284,"IBM EBCDIC (Spain)"],[20285,"IBM EBCDIC (UK)"],[20290,"IBM EBCDIC (Japanese katakana)"],[20297,"IBM EBCDIC (France)"],[20420,"IBM EBCDIC (Arabic)"],[20423,"IBM EBCDIC (Greek)"],[20424,"IBM EBCDIC (Hebrew)"],[20833,"IBM EBCDIC (Korean Extended)"],[20838,"IBM EBCDIC (Thai)"],[20866,"Cyrillic (KOI8-R)"],[20871,"IBM EBCDIC (Icelandic) "],[20880,"IBM EBCDIC (Cyrillic Russian)"],[20905,"IBM EBCDIC (Turkish)"],[20924,"IBM Latin-1 "],[20932,"Japanese (JIS 0208-1990 and 0212-1990)"],[20936,"Chinese Simplified (GB2312-80) "],[20949,"Korean Wansung "],[21025,"IBM EBCDIC (Cyrillic Serbian-Bulgarian)"],[21866,"Cyrillic (KOI8-U)"],[28591,"Western European (ISO) "],[28592,"Central European (ISO)"],[28593,"Latin 3 (ISO)"],[28594,"Baltic (ISO)"],[28595,"Cyrillic (ISO) "],[28596,"Arabic (ISO)"],[28597,"Greek (ISO) "],[28598,"Hebrew (ISO-Visual)"],[28599,"Turkish (ISO)"],[28603,"Estonian (ISO)"],[28605,"Latin 9 (ISO)"],[29001,"Europa"],[38598,"Hebrew (ISO-Logical)"],[50220,"Japanese (JIS)"],[50221,"Japanese (JIS-Allow 1 byte Kana) "],[50222,"Japanese (JIS-Allow 1 byte Kana - SO/SI)"],[50225,"Korean (ISO)"],[50227,"Chinese Simplified (ISO-2022)"],[51932,"Japanese (EUC)"],[51936,"Chinese Simplified (EUC) "],[51949,"Korean (EUC)"],[52936,"Chinese Simplified (HZ)"],[54936,"Chinese Simplified (GB18030)"],[57002,"ISCII Devanagari "],[57003,"ISCII Bengali "],[57004,"ISCII Tamil"],[57005,"ISCII Telugu "],[57006,"ISCII Assamese "],[57007,"ISCII Oriya"],[57008,"ISCII Kannada"],[57009,"ISCII Malayalam "],[57010,"ISCII Gujarati"],[57011,"ISCII Punjabi"],[65e3,"Unicode (UTF-7)"],[65001,"Unicode (UTF-8)"]];if(s=n.length){for(t=0;t<s;++t)o.push({value:n[t][0],displayValue:n[t][1]});this.cmbEncoding=new Common.UI.ComboBox({el:$("#id-codepages-combo",this.$window),menuStyle:"min-width: 218px; max-height: 200px;",cls:"input-group-nr",menuCls:"scrollable-menu",data:o,editable:!1}),this.cmbEncoding.setValue(this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():n[0][0]),this.type==Asc.c_oAscAdvancedOptionsID.CSV&&(this.cmbDelimiter=new Common.UI.ComboBox({el:$("#id-delimiters-combo",this.$window),menuStyle:"min-width: 110px;",cls:"input-group-nr",data:[{value:4,displayValue:","},{value:2,displayValue:";"},{value:3,displayValue:":"},{value:1,displayValue:this.txtTab},{value:5,displayValue:this.txtSpace}],editable:!1}),this.cmbDelimiter.setValue(this.settings&&this.settings.asc_getDelimiter()?this.settings.asc_getDelimiter():4))}},okButtonText:"OK",cancelButtonText:"Cancel",txtDelimiter:"Delimiter",txtEncoding:"Encoding ",txtSpace:"Space",txtTab:"Tab",txtTitle:"Choose %1 options",txtPassword:"Password",txtTitleProtected:"Protected File"},Common.Views.OpenDialog||{}))}),define("common/main/lib/util/LocalStorage",["gateway"],function(){Common.localStorage=new function(){var t,e,i={},n=function(t){"localstorage"==t.type&&(i=t.keys)};Common.Gateway.on("internalcommand",n);var o=function(){l||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:e})},s=function(){l||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:i})},a=function(t,e,n){l?localStorage.setItem(t,e):(i[t]=e,!0===n&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:e}}))},r=function(t){return l?localStorage.getItem(t):void 0===i[t]?null:i[t]};try{var l=!!window.localStorage}catch(t){l=!1}return{getId:function(){return t},setId:function(e){t=e},getItem:r,setItem:a,setKeysFilter:function(t){e=t},sync:o,save:s}}}),define("documenteditor/main/app/model/ShapeGroup",["backbone"],function(t){"use strict";DE.Models=DE.Models||{},DE.Models.ShapeModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),DE.Models.ShapeGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("documenteditor/main/app/collection/ShapeGroups",["backbone","documenteditor/main/app/model/ShapeGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},DE.Collections.ShapeGroups=t.Collection.extend({model:DE.Models.ShapeGroup})}),define("documenteditor/main/app/model/EquationGroup",["backbone"],function(t){"use strict";DE.Models=DE.Models||{},DE.Models.EquationModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),DE.Models.EquationGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("documenteditor/main/app/collection/EquationGroups",["backbone","documenteditor/main/app/model/EquationGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},DE.Collections.EquationGroups=t.Collection.extend({model:DE.Models.EquationGroup})}),define("documenteditor/main/app/controller/Main",["core","irregularstack","common/main/lib/component/Window","common/main/lib/component/LoadMask","common/main/lib/component/Tooltip","common/main/lib/controller/Fonts","common/main/lib/collection/TextArt","common/main/lib/view/OpenDialog","common/main/lib/util/LocalStorage","documenteditor/main/app/collection/ShapeGroups","documenteditor/main/app/collection/EquationGroups"],function(){"use strict";DE.Controllers.Main=Backbone.Controller.extend(_.extend(function(){var ApplyEditRights=-255,LoadingDocument=-256,mapCustomizationElements={about:"button#left-btn-about",feedback:"button#left-btn-support",goback:"#fm-btn-back > a, #header-back > div"},mapCustomizationExtElements={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",header:"#viewport #header",statusBar:"#statusbar"};return Common.localStorage.setId("text"),Common.localStorage.setKeysFilter("de-,asc.text"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","EquationGroups","Common.Collections.HistoryUsers","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)}})},onLaunch:function(){var t=this;if(this.stackLongActions=new Common.IrregularStack({strongCompare:function(t,e){return t.id===e.id&&t.type===e.type},weakCompare:function(t,e){return t.type===e.type}}),this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseWarning:!1},!Common.Utils.isBrowserSupported())return Common.Utils.showBrowserRestriction(),void Common.Gateway.reportError(void 0,this.unsupportedBrowserErrorText);var e=Common.localStorage.getItem("de-settings-fontrender");if(null===e&&window.devicePixelRatio>1&&(e="1"),window.flat_desine=!0,this.api=new Asc.asc_docs_api({"id-view":"editor_sdk"}),this.api){switch(e){case"0":this.api.SetFontRenderingMode(3);break;case"1":this.api.SetFontRenderingMode(1);break;case"2":this.api.SetFontRenderingMode(2)}this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onDocumentContentReady",_.bind(this.onDocumentContentReady,this)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,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)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),this.isShowOpenDialog=!1,this.editorConfig={},this.appOptions={},this.plugins=void 0,this.UICustomizePlugins=[],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.ready(),this.getApplication().getController("Viewport").setApi(this.api),this.getApplication().getController("Statusbar").setApi(this.api),this.contComments=this.getApplication().getController("Common.Controllers.Comments"),$(document.body).on("focus","input, textarea",function(e){/area_id/.test(e.target.id)||(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/chat-msg-text/.test(e.target.id)&&(t.dontCloseChat=!0))}),$(document.body).on("blur","input, textarea",function(e){t.isModalShowed||e.relatedTarget&&(/area_id/.test(e.target.id)||!($(e.target).parent().find(e.relatedTarget).length<1)||"input"==e.relatedTarget.localName&&/form-control/.test(e.relatedTarget.className)||"textarea"==e.relatedTarget.localName&&!/area_id/.test(e.relatedTarget.id))||(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}),Common.NotificationCenter.on({"modal:show":function(){t.isModalShowed=!0,t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){e&&e.$lastmodal&&e.$lastmodal.size()<1&&(t.isModalShowed=!1,t.api.asc_enableKeyEvents(!0))},"modal:hide":function(e){e&&e.$lastmodal&&e.$lastmodal.size()<1&&(t.isModalShowed=!1,t.api.asc_enableKeyEvents(!0))},"settings:unitschanged":_.bind(this.unitsChanged,this),"dataview:focus":function(t){},"dataview:blur":function(e){t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"menu:show":function(t){},"menu:hide":function(e,i){t.isModalShowed||i||t.api.asc_enableKeyEvents(!0)},"edit:complete":_.bind(t.onEditComplete,t)}),this.initNames()}},loadConfig:function(t){this.editorConfig=$.extend(this.editorConfig,t.config),this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(this.editorConfig.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.nativeApp=!0===this.editorConfig.nativeApp,this.appOptions.isDesktopApp="desktop"==this.editorConfig.targetApp,this.appOptions.canCreateNew=!_.isEmpty(this.editorConfig.createUrl)&&!this.appOptions.isDesktopApp,this.appOptions.canOpenRecent=!0!==this.editorConfig.nativeApp&&void 0!==this.editorConfig.recent&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location="string"==typeof this.editorConfig.location?this.editorConfig.location.toLowerCase():"",this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.fileChoiceUrl=this.editorConfig.fileChoiceUrl,this.appOptions.mergeFolderUrl=this.editorConfig.mergeFolderUrl,this.appOptions.canAnalytics=!1,this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=!1!==this.editorConfig.canBackToFolder&&"object"==typeof this.editorConfig.customization&&"object"==typeof this.editorConfig.customization.goback&&!_.isEmpty(this.editorConfig.customization.goback.url),this.appOptions.canBack=!0!==this.editorConfig.nativeApp&&!0===this.appOptions.canBackToFolder,this.appOptions.canPlugins=!1,this.plugins=this.editorConfig.plugins,this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanBack(!0===this.appOptions.canBackToFolder),this.editorConfig.lang&&this.api.asc_setLocale(this.editorConfig.lang),"us"!=this.appOptions.location&&"ca"!=this.appOptions.location||Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch)},loadDocument:function(t){this.permissions={},this.document=t.doc;var e={};if(t.doc){this.permissions=$.extend(this.permissions,t.doc.permissions);var i=new Asc.asc_CUserInfo;i.put_Id(this.appOptions.user.id),i.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(t.doc.options),e.put_UserInfo(i),e.put_CallbackUrl(this.editorConfig.callbackUrl),e.put_Token(t.doc.token)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_setDocInfo(e),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId),t.doc&&this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t.doc.title)},onProcessSaveResult:function(t){this.api.asc_OnSaveEnd(t.result),t&&!1===t.result&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(t.message)?this.errorProcessSaveResult:t.message})},onProcessRightsChange:function(t){if(t&&!1===t.enabled){var e=this,i=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),this.getApplication().getController("LeftMenu").leftMenu.getMenu("file").panels.rights.onLostEditRights(),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(){this._state.isFromGatewayDownloadAs=!0;var t=/^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);t&&"string"==typeof t[1]?this.api.asc_DownloadOrigin(!0):this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX,!0)},onProcessMouse:function(t){if("mouseup"==t.type){var e=document.getElementById("editor_sdk");if(e){var i=e.getBoundingClientRect();this.api.OnMouseUp(t.x-i.left,t.y-i.top)}}},onRefreshHistory:function(t){if(this.loadMask&&this.loadMask.hide(),t.data.error||!t.data.history){var e=this.getApplication().getCollection("Common.Collections.HistoryVersions");e&&e.size()>0&&e.each(function(t){t.set("canRestore",!1)}),Common.UI.alert({closable:!1,title:this.notcriticalErrorTitle,msg:t.data.error?t.data.error:this.txtErrorLoadHistory,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.onEditComplete()},this)})}else{this.api.asc_coAuthoringDisconnect(),this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanRename(!1),this.getApplication().getController("LeftMenu").getView("LeftMenu").showHistory(),this.disableEditing(!0);var i=t.data.history,e=this.getApplication().getCollection("Common.Collections.HistoryVersions"),n=null;if(e){var o,s,a=[],r=-1,l=-1,c=[],d="",h=this.getApplication().getCollection("Common.Collections.HistoryUsers"),p=null,m=0;for(o=i.length-1;o>=0;o--)if(s=i[o],void 0!==s.versionGroup&&null!==s.versionGroup||(s.versionGroup=s.version),s){if(s.user||(s.user={}),d=o>0&&i[o-1]?i[o-1].key:s.key+"0",p=h.findUser(s.user.id),p||(p=new Common.Models.User({id:s.user.id,username:s.user.name,colorval:Asc.c_oAscArrUserColors[m],color:this.generateUserColor(Asc.c_oAscArrUserColors[m++])}),h.add(p)),a.push(new Common.Models.HistoryVersion({version:s.versionGroup,revision:s.version,userid:s.user.id,username:s.user.name,usercolor:p.get("color"),created:s.created,docId:s.key,markedAsVersion:r!==s.versionGroup,
|
|
|
selected:t.data.currentVersion==s.version,canRestore:this.appOptions.canHistoryRestore&&o<i.length-1,isExpanded:!0})),t.data.currentVersion==s.version&&(n=a[a.length-1]),r=s.versionGroup,l!==s.version){for(l=s.version,c.reverse(),g=0;g<c.length;g++)a[a.length-g-2].set("arrColors",c);c=[]}c.push(p.get("colorval"));var u,g,b=s.changes;if(b&&b.length>0){if(a[a.length-1].set("docIdPrev",d),!_.isEmpty(s.serverVersion)&&s.serverVersion==this.appOptions.buildVersion)for(a[a.length-1].set("changeid",b.length-1),a[a.length-1].set("hasChanges",b.length>1),g=b.length-2;g>=0;g--)u=b[g],p=h.findUser(u.user.id),p||(p=new Common.Models.User({id:u.user.id,username:u.user.name,colorval:Asc.c_oAscArrUserColors[m],color:this.generateUserColor(Asc.c_oAscArrUserColors[m++])}),h.add(p)),a.push(new Common.Models.HistoryVersion({version:s.versionGroup,revision:s.version,changeid:g,userid:u.user.id,username:u.user.name,usercolor:p.get("color"),created:u.created,docId:s.key,docIdPrev:d,selected:!1,canRestore:this.appOptions.canHistoryRestore,isRevision:!1,isVisible:!0})),c.push(p.get("colorval"))}else 0==o&&1==i.length&&a[a.length-1].set("docId",s.key+"1")}if(c.length>0){for(c.reverse(),g=0;g<c.length;g++)a[a.length-g-1].set("arrColors",c);c=[]}e.reset(a),null===n&&e.size()>0&&(n=e.at(0),n.set("selected",!0)),n&&this.getApplication().getController("Common.Controllers.History").onSelectRevision(null,null,n)}}},generateUserColor:function(t){return"#"+("000000"+t.toString(16)).substr(-6)},disableEditing:function(t){var e=this.getApplication();if(this.appOptions.canEdit&&"view"!==this.editorConfig.mode){e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t,t),e.getController("RightMenu").SetDisabled(t,!1),e.getController("Statusbar").getView("Statusbar").SetDisabled(t);var i=e.getController("Toolbar").getView("Toolbar").synchTooltip;i&&i.hide()}e.getController("LeftMenu").SetDisabled(t,!0)},goBack:function(t){var e=this.appOptions.customization.goback.url;t?window.open(e,"_blank"):parent.location.href=e},onEditComplete:function(t){var e=this.getApplication(),i=e.getController("Toolbar"),n=i.getView("Toolbar");if(!this.appOptions.isEdit||!n||!n.btnInsertShape.pressed&&!n.btnInsertText.pressed||_.isObject(arguments[1])&&"id-toolbar-btn-insertshape"===arguments[1].id||(this.api&&this.api.StartAddShape("",!1),n.btnInsertShape.toggle(!1,!1),n.btnInsertText.toggle(!1,!1)),this.appOptions.isEdit&&n&&n.btnHighlightColor.pressed&&(!_.isObject(arguments[1])||"id-toolbar-btn-highlight"!==arguments[1].id)&&(this.api.SetMarkerFormat(!1),n.btnHighlightColor.toggle(!1,!1)),e.getController("DocumentHolder").getView("DocumentHolder").focus(),this.api){var o=this.api.asc_isDocumentCanSave(),s=this.appOptions.forcesave,a=$(".btn-icon",n.btnSave.cmpEl).hasClass("btn-synch");n.btnSave.isDisabled()!==(!o&&!a&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)&&n.btnSave.setDisabled(!o&&!a&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)}},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(t,e){var i={id:e,type:t};if(this.stackLongActions.pop(i),this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(!0),i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}))this.setLongActionView(i);else if(e==Asc.c_oAscAsyncAction.Save||e==Asc.c_oAscAsyncAction.ForceSaveButton)if(this._state.fastCoauth&&this._state.usersCount>1){var n=this;n._state.timerSave=setTimeout(function(){n.getApplication().getController("Statusbar").setStatusCaption(n.textChangesSaved,!1,3e3)},500)}else this.getApplication().getController("Statusbar").setStatusCaption(this.textChangesSaved,!1,3e3);else this.getApplication().getController("Statusbar").setStatusCaption("");i=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),i?this.setLongActionView(i):this.loadMask&&this.loadMask.hide(),e!=Asc.c_oAscAsyncAction.Save&&e!=Asc.c_oAscAsyncAction.ForceSaveButton||this._state.fastCoauth&&!(this._state.usersCount<2)||this.synchronizeChanges(),t!=Asc.c_oAscAsyncActionType.BlockInteraction||this.getApplication().getController("LeftMenu").dlgSearch&&this.getApplication().getController("LeftMenu").dlgSearch.isVisible()||e==Asc.c_oAscAsyncAction.ApplyChanges&&(this.dontCloseDummyComment||this.dontCloseChat)||this.api.asc_enableKeyEvents(!0)},setLongActionView:function(t){var e="",i="",n=!1;switch(t.id){case Asc.c_oAscAsyncAction.Open:e=this.openTitleText,i=this.openTextText;break;case Asc.c_oAscAsyncAction.Save:case Asc.c_oAscAsyncAction.ForceSaveButton:clearTimeout(this._state.timerSave),n=!0,e=this.saveTitleText,i=this.saveTextText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:e=this.loadFontsTitleText,i=this.loadFontsTextText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:e=this.loadImagesTitleText,i=this.loadImagesTextText;break;case Asc.c_oAscAsyncAction.LoadFont:e=this.loadFontTitleText,i=this.loadFontTextText;break;case Asc.c_oAscAsyncAction.LoadImage:e=this.loadImageTitleText,i=this.loadImageTextText;break;case Asc.c_oAscAsyncAction.DownloadAs:e=this.downloadTitleText,i=this.downloadTextText;break;case Asc.c_oAscAsyncAction.Print:e=this.printTitleText,i=this.printTextText;break;case Asc.c_oAscAsyncAction.UploadImage:e=this.uploadImageTitleText,i=this.uploadImageTextText;break;case Asc.c_oAscAsyncAction.ApplyChanges:e=this.applyChangesTitleText,i=this.applyChangesTextText;break;case Asc.c_oAscAsyncAction.PrepareToSave:e=this.savePreparingText,i=this.savePreparingTitle;break;case Asc.c_oAscAsyncAction.MailMergeLoadFile:e=this.mailMergeLoadFileText,i=this.mailMergeLoadFileTitle;break;case Asc.c_oAscAsyncAction.DownloadMerge:e=this.downloadMergeTitle,i=this.downloadMergeText;break;case Asc.c_oAscAsyncAction.SendMailMerge:e=this.sendMergeTitle,i=this.sendMergeText;break;case ApplyEditRights:e=this.txtEditingMode,i=this.txtEditingMode;break;case LoadingDocument:e=this.loadingDocumentTitleText,i=this.loadingDocumentTextText}t.type==Asc.c_oAscAsyncActionType.BlockInteraction?(this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(e),this.isShowOpenDialog||this.loadMask.show()):this.getApplication().getController("Statusbar").setStatusCaption(i,n)},onApplyEditRights:function(t){this.getApplication().getController("Statusbar").setStatusCaption(""),t&&!t.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:t.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function checkWarns(){if(!window.AscDesktopEditor){var t=[];Common.Utils.isIE9m&&t.push(me.warnBrowserIE9),t.length&&me.showTips(t)}document.removeEventListener("visibilitychange",checkWarns)}if(!this._isDocReady){var me=this,value;me._isDocReady=!0,me.api.SetDrawingFreeze(!1),me.hidePreloader(),me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),value=Common.localStorage.getItem("de-settings-livecomment"),this.isLiveCommenting=!(null!==value&&0==parseInt(value)),this.isLiveCommenting?this.api.asc_showComments():this.api.asc_hideComments(),value=Common.localStorage.getItem("de-settings-zoom");var zf=null!==value?parseInt(value):this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom):100;-1==zf?this.api.zoomFitToPage():-2==zf?this.api.zoomFitToWidth():this.api.zoom(zf>0?zf:100),value=Common.localStorage.getItem("de-show-hiddenchars"),me.api.put_ShowParaMarks(null!==value&&eval(value)),value=Common.localStorage.getItem("de-show-tableline"),me.api.put_ShowTableEmptyLine(null===value||eval(value)),value=Common.localStorage.getItem("de-settings-spellcheck"),me.api.asc_setSpellCheck(null===value||1==parseInt(value)),Common.localStorage.setItem("de-settings-showsnaplines",me.api.get_ShowSnapLines()?1:0),void 0!==document.hidden&&document.hidden?document.addEventListener("visibilitychange",checkWarns):checkWarns(),me.api.asc_registerCallback("asc_onStartAction",_.bind(me.onLongActionBegin,me)),me.api.asc_registerCallback("asc_onEndAction",_.bind(me.onLongActionEnd,me)),me.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(me.onCoAuthoringDisconnect,me)),me.api.asc_registerCallback("asc_onPrint",_.bind(me.onPrint,me));var application=me.getApplication();application.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(me.api.asc_getDocumentName()),me.updateWindowTitle(!0),value=Common.localStorage.getItem("de-settings-inputmode"),me.api.SetTextBoxInputMode(null!==value&&1==parseInt(value)),me.appOptions.isEdit&&!me.appOptions.isOffline&&me.appOptions.canCoAuthoring?(value=Common.localStorage.getItem("de-settings-coauthmode"),null===value&&null===Common.localStorage.getItem("de-settings-autosave")&&me.appOptions.customization&&!1===me.appOptions.customization.autosave&&(value=0),me._state.fastCoauth=null===value||1==parseInt(value),me.api.asc_SetFastCollaborative(me._state.fastCoauth),value=Common.localStorage.getItem(me._state.fastCoauth?"de-settings-showchanges-fast":"de-settings-showchanges-strict"),null!==value?me.api.SetCollaborativeMarksShowType("all"==value?Asc.c_oAscCollaborativeMarksShowType.All:"none"==value?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges):me.api.SetCollaborativeMarksShowType(me._state.fastCoauth?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges)):(me._state.fastCoauth=!1,me.api.asc_SetFastCollaborative(me._state.fastCoauth),me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None));var toolbarController=application.getController("Toolbar"),statusbarController=application.getController("Statusbar"),documentHolderController=application.getController("DocumentHolder"),fontsController=application.getController("Common.Controllers.Fonts"),rightmenuController=application.getController("RightMenu"),leftmenuController=application.getController("LeftMenu"),chatController=application.getController("Common.Controllers.Chat"),pluginsController=application.getController("Common.Controllers.Plugins");if(leftmenuController.getView("LeftMenu").getMenu("file").loadDocument({doc:me.document}),leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api),chatController.setApi(this.api).setMode(this.appOptions),application.getController("Common.Controllers.ExternalDiagramEditor").setApi(this.api).loadConfig({config:this.editorConfig,customization:this.editorConfig.customization}),application.getController("Common.Controllers.ExternalMergeEditor").setApi(this.api).loadConfig({config:this.editorConfig,customization:this.editorConfig.customization}),pluginsController.setApi(me.api),me.updatePlugins(me.plugins,!1),me.requestPlugins("../../../../plugins.json"),me.api.asc_registerCallback("asc_onPluginsInit",_.bind(me.updatePluginsList,me)),documentHolderController.setApi(me.api),documentHolderController.createDelayedElements(),statusbarController.createDelayedElements(),leftmenuController.getView("LeftMenu").disableMenu("all",!1),me.appOptions.canBranding&&me.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(me.editorConfig.customization),documentHolderController.getView("DocumentHolder").setApi(me.api).on("editcomplete",_.bind(me.onEditComplete,me)),me.appOptions.isEdit){value=Common.localStorage.getItem("de-settings-autosave"),null===value&&me.appOptions.customization&&!1===me.appOptions.customization.autosave&&(value=0),value=me._state.fastCoauth||null===value?me.appOptions.canCoAuthoring?1:0:parseInt(value),me.api.asc_setAutoSaveGap(value),me.appOptions.canForcesave&&(value=Common.localStorage.getItem("de-settings-forcesave"),me.appOptions.forcesave=null===value?me.appOptions.canForcesave:1==parseInt(value),me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave)),me.needToUpdateVersion&&Common.NotificationCenter.trigger("api:disconnect");var timer_sl=setInterval(function(){if(window.styles_loaded){clearInterval(timer_sl),toolbarController.createDelayedElements(),documentHolderController.getView("DocumentHolder").createDelayedElements(),me.loadLanguages();var t=me.api.asc_getPropertyEditorShapes();t&&me.fillAutoShapes(t[0],t[1]),rightmenuController.createDelayedElements(),me.updateThemeColors(),toolbarController.activateControls(),me.needToUpdateVersion&&toolbarController.onApiCoAuthoringDisconnect(),me.api.UpdateInterfaceState(),me.fillTextArt(me.api.asc_getTextArtPreviews()),me.appOptions.canBrandingExt&&Common.NotificationCenter.trigger("document:ready","main")}},50)}else me.appOptions.canBrandingExt&&Common.NotificationCenter.trigger("document:ready","main");this.appOptions.canAnalytics,1,Common.Gateway.on("applyeditrights",_.bind(me.onApplyEditRights,me)),Common.Gateway.on("processsaveresult",_.bind(me.onProcessSaveResult,me)),Common.Gateway.on("processrightschange",_.bind(me.onProcessRightsChange,me)),Common.Gateway.on("processmouse",_.bind(me.onProcessMouse,me)),Common.Gateway.on("refreshhistory",_.bind(me.onRefreshHistory,me)),Common.Gateway.on("downloadas",_.bind(me.onDownloadAs,me)),Common.Gateway.sendInfo({mode:me.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(me.onContextMenu,me))}},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.setTitle(i)},onEditorPermissions:function(t){var e=t.asc_getLicenseType();if(!this.onServerVersion(t.asc_getBuildVersion())){this.permissions.review=void 0===this.permissions.review?!1!==this.permissions.edit:this.permissions.review,t.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=this.permissions.review=!1),this.appOptions.canAnalytics=t.asc_getIsAnalyticsEnable(),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.isOffline=this.api.asc_isOffline(),this.appOptions.isReviewOnly=!0===this.permissions.review&&!1===this.permissions.edit,this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canEdit=(!1!==this.permissions.edit||!0===this.permissions.review)&&(this.editorConfig.canRequestEditRights||"view"!==this.editorConfig.mode)&&(!this.appOptions.isReviewOnly||this.appOptions.canLicense),this.appOptions.isEdit=this.appOptions.canLicense&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode,this.appOptions.canReview=this.appOptions.canLicense&&this.appOptions.isEdit&&!0===this.permissions.review,this.appOptions.canUseHistory=this.appOptions.canLicense&&!this.appOptions.isLightVersion&&this.editorConfig.canUseHistory&&this.appOptions.canCoAuthoring&&!this.appOptions.isDesktopApp,this.appOptions.canHistoryClose=this.editorConfig.canHistoryClose,this.appOptions.canHistoryRestore=this.editorConfig.canHistoryRestore&&!!this.permissions.changeHistory,this.appOptions.canUseMailMerge=this.appOptions.canLicense&&this.appOptions.canEdit&&!this.appOptions.isOffline,this.appOptions.canSendEmailAddresses=this.appOptions.canLicense&&this.editorConfig.canSendEmailAddresses&&this.appOptions.canEdit&&this.appOptions.canCoAuthoring,this.appOptions.canComments=!(e!==Asc.c_oLicenseResult.Success&&e!==Asc.c_oLicenseResult.SuccessLimit||"object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canChat=!(e!==Asc.c_oLicenseResult.Success&&e!==Asc.c_oLicenseResult.SuccessLimit||this.appOptions.isOffline||"object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.chat),this.appOptions.canEditStyles=this.appOptions.canLicense&&this.appOptions.canEdit,this.appOptions.canPrint=!1!==this.permissions.print,this.appOptions.canRename=!!this.permissions.rename,this.appOptions.buildVersion=t.asc_getBuildVersion(),this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&"object"==typeof this.editorConfig.customization&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||!("object"==typeof this.editorConfig.customization&&this.editorConfig.customization.commentAuthorOnly),this.appOptions.isTrial=t.asc_getTrial();var i=/^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);this.appOptions.canDownloadOrigin=!this.appOptions.nativeApp&&!1!==this.permissions.download&&i&&"string"==typeof i[1],this.appOptions.canDownload=!(this.appOptions.nativeApp||!1===this.permissions.download||i&&"string"==typeof i[1]),this._state.licenseWarning=e===Asc.c_oLicenseResult.Connections&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode;var n=this.getApplication().getController("Viewport").getView("Common.Views.Header");this.appOptions.canBranding=e===Asc.c_oLicenseResult.Success&&"object"==typeof this.editorConfig.customization,this.appOptions.canBranding&&n.setBranding(this.editorConfig.customization),this.appOptions.canRename&&n.setCanRename(!0),this.appOptions.canBrandingExt=t.asc_getCanBranding()&&("object"==typeof this.editorConfig.customization||this.editorConfig.plugins),this.appOptions.canBrandingExt&&this.updatePlugins(this.plugins,!0),this.applyModeCommonElements(),this.applyModeEditorElements(),this.api.asc_setViewMode(!this.appOptions.isEdit),this.api.asc_LoadDocument(),this.appOptions.isEdit||(this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument))}},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var t=Common.localStorage.getItem("de-hidden-title");t=this.appOptions.isEdit&&null!==t&&1==parseInt(t);var e=this.getApplication(),i=e.getController("Viewport").getView("Viewport"),n=e.getController("Viewport").getView("Common.Views.Header"),o=e.getController("Statusbar").getView("Statusbar"),s=e.getController("DocumentHolder").getView("DocumentHolder");if(n&&(n.setHeaderCaption(this.appOptions.isEdit?"Document Editor":"Document Viewer"),n.setVisible(!this.appOptions.nativeApp&&!t&&!this.appOptions.isDesktopApp)),this.appOptions.nativeApp&&$("body").removeClass("safari"),i&&i.setMode(this.appOptions),o&&o.setMode(this.appOptions),s.setMode(this.appOptions),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api){var a=new Asc.asc_CChartTranslate;a.asc_setTitle(this.txtDiagramTitle),a.asc_setXAxis(this.txtXAxis),a.asc_setYAxis(this.txtYAxis),a.asc_setSeries(this.txtSeries),this.api.asc_setChartTranslate(a);var r=new Asc.asc_TextArtTranslate;r.asc_setDefaultText(this.txtArt),this.api.asc_setTextArtTranslate(r)}},applyModeEditorElements:function(){if(this.appOptions.isEdit){var t=this,e=this.getApplication(),i=e.getController("Toolbar"),n=e.getController("RightMenu"),o=e.getController("Common.Controllers.Fonts"),s=this.appOptions.canReview?e.getController("Common.Controllers.ReviewChanges"):null;o&&o.setApi(t.api),i&&i.setApi(t.api),t.contComments.setMode(t.appOptions),t.contComments.setConfig({config:t.editorConfig},t.api),n&&n.setApi(t.api),s&&s.setMode(t.appOptions).setConfig({config:t.editorConfig},t.api);this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode();var a=i?i.getView("Toolbar"):null;_.each([a,n.getView("RightMenu")],function(e){e&&(e.setApi(t.api),e.on("editcomplete",_.bind(t.onEditComplete,t)),e.setMode(t.appOptions))}),a&&(a.on("insertimage",_.bind(t.onInsertImage,t)),a.on("inserttable",_.bind(t.onInsertTable,t)),a.on("insertshape",_.bind(t.onInsertShape,t)),a.on("inserttextart",_.bind(t.onInsertTextArt,t)),a.on("insertchart",_.bind(t.onInsertChart,t)));var r=Common.localStorage.getItem("de-settings-unit");r=null!==r?parseInt(r):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(r),t.api.asc_SetDocumentUnits(r==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:r==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),r=Common.localStorage.getItem("de-hidden-rulers"),t.api.asc_SetViewRulers(null===r||0===parseInt(r)),t.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(t.onDocumentModifiedChanged,t)),t.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(t.onDocumentCanSaveChanged,t)),t.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(t.onCollaborativeChanges,t)),t.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(t.onTryUndoInFastCollaborative,t)),t.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(t.onAuthParticipantsChanged,t)),t.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(t.onAuthParticipantsChanged,t)),t.stackLongActions.exist({id:ApplyEditRights,type:Asc.c_oAscAsyncActionType.BlockInteraction})?t.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,ApplyEditRights):this._isDocReady||(t.hidePreloader(),t.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument)),window.onbeforeunload=_.bind(t.onBeforeUnload,t),window.onunload=_.bind(t.onUnload,t)}},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",t.title))},onError:function(t,e,i){this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument);var n={closable:!1};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.SplitCellMaxRows:n.msg=this.splitMaxRowsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellMaxCols:n.msg=this.splitMaxColsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellRowsDivider:n.msg=this.splitDividerErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop;break;case Asc.c_oAscError.ID.MailMergeLoadFile:n.msg=this.errorMailMergeLoadFile;break;case Asc.c_oAscError.ID.MailMergeSaveFile:n.msg=this.errorMailMergeSaveFile;break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;default:n.msg=this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",this.appOptions.canBackToFolder&&(n.msg+="<br/><br/>"+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback")})):(n.title=this.notcriticalErrorTitle,n.iconCls="warn",n.buttons=["ok"],n.callback=_.bind(function(e){t==Asc.c_oAscError.ID.Warning&&"ok"==e&&(this.appOptions.canDownload||this.appOptions.canDownloadOrigin)&&(Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.appOptions.canDownload?this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas"):this.api.asc_DownloadOrigin()),this._state.lostEditingRights=!1,this.onEditComplete()},this)),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){var e=this.api.isDocumentModified();if(this._state.isDocModified!==e||t){var i=this.defaultTitleText,n=this.getApplication().getController("Viewport").getView("Common.Views.Header");_.isEmpty(n.getDocumentCaption())||(i=n.getDocumentCaption()+" - "+i),e?(clearTimeout(this._state.timerCaption),_.isUndefined(i)||(i="* "+i,n.setDocumentCaption(n.getDocumentCaption(),!0))):this._state.fastCoauth&&this._state.usersCount>1?this._state.timerCaption=setTimeout(function(){n.setDocumentCaption(n.getDocumentCaption(),!1)},500):n.setDocumentCaption(n.getDocumentCaption(),!1),window.document.title!=i&&(window.document.title=i),Common.Gateway.setDocumentModified(e),e&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.getApplication().getController("Statusbar").setStatusCaption("",!0),this._state.isDocModified=e}},onDocumentModifiedChanged:function(){var t=this.api.asc_isDocumentCanSave();this._state.isDocModified!==t&&Common.Gateway.setDocumentModified(this.api.isDocumentModified()),this.updateWindowTitle();var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e){var i=$(".btn-icon",e.btnSave.cmpEl).hasClass("btn-synch"),n=this.appOptions.forcesave;e.btnSave.isDisabled()!==(!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n)&&e.btnSave.setDisabled(!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n)}this.contComments.isDummyComment&&!this.dontCloseDummyComment&&this.contComments.clearDummyComment()},onDocumentCanSaveChanged:function(t){var e=this.getApplication(),i=e.getController("Toolbar"),n=i.getView("Toolbar");if(n&&this.api){var o=$(".btn-icon",n.btnSave.cmpEl).hasClass("btn-synch"),s=this.appOptions.forcesave;n.btnSave.isDisabled()!==(!t&&!o&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)&&n.btnSave.setDisabled(!t&&!o&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)}},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onBeforeUnload:function(){if(Common.localStorage.save(),this.api.isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){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,mapCustomizationElements),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,mapCustomizationExtElements),Common.Utils.applyCustomizationPlugins(this.UICustomizePlugins))),Common.NotificationCenter.trigger("layout:changed","main"),$("#loading-mask").hide().remove()},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),Common.UI.warning({title:e.titleUpdateVersion,msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument)})}})},onServerVersion:function(t){return!1},onCollaborativeChanges:function(){this._state.hasCollaborativeChanges||(this._state.hasCollaborativeChanges=!0,this.appOptions.isEdit&&this.getApplication().getController("Statusbar").setStatusCaption(this.txtNeedSynchronize,!0))},synchronizeChanges:function(){this.getApplication().getController("Statusbar").synchronizeChanges(),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").hideTips(),this.getApplication().getController("Toolbar").getView("Toolbar").synchronizeChanges(),this._state.hasCollaborativeChanges=!1},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines]},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:DE.Models.ShapeModel}),a=e[o].length>18?7:6,r=35*Math.ceil(e[o].length/a)+3,l=30*a;_.each(e[o],function(t,e){s.add({imageUrl:t.Image,data:{shapeType:t.Type},tip:i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:l,groupHeight:r})}),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("DocumentHolder").getView("DocumentHolder").updateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded&&(this.updateThemeColors(),this.fillTextArt(this.api.asc_getTextArtPreviews()))},loadLanguages:function(){var t,e=this.api.asc_getSpellCheckLanguages(),i=[]
|
|
|
;_.each(e,function(e,n,o){t=Common.util.LanguageInfo.getLocalLanguageName(e.asc_getId()),i.push({title:t[1],tip:t[0],code:e.asc_getId()})},this),i.sort(function(t,e){return t.tip<e.tip?-1:t.tip>e.tip?1:0}),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").setLanguages(i),this.getApplication().getController("Statusbar").setLanguages(i)},onInsertTable:function(){this.getApplication().getController("RightMenu").onInsertTable()},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},unitsChanged:function(t){var e=Common.localStorage.getItem("de-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),this.api.asc_SetDocumentUnits(e==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:e==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit(),this.getApplication().getController("Toolbar").getView("Toolbar").updateMetricUnit()},onAdvancedOptions:function(t){var e,i=t.asc_getOptionId(),n=this;i==Asc.c_oAscAdvancedOptionsID.TXT?e=new Common.Views.OpenDialog({type:i,codepages:t.asc_getOptions().asc_getCodePages(),settings:t.asc_getOptions().asc_getRecommendedSettings(),handler:function(t){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(i,new Asc.asc_CTXTAdvancedOptions(t)),n.loadMask&&n.loadMask.show())}}):i==Asc.c_oAscAdvancedOptionsID.DRM&&(e=new Common.Views.OpenDialog({type:i,handler:function(t){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(i,new Asc.asc_CDRMAdvancedOptions(t)),n.loadMask&&n.loadMask.show())}})),e&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),e.show())},onTryUndoInFastCollaborative:function(){var t=window.localStorage.getItem("de-hide-try-undoredo");t&&1==parseInt(t)||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&window.localStorage.setItem("de-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("de-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),this._state.fastCoauth=!1,Common.localStorage.setItem("de-settings-showchanges-strict","last"),this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.LastChanges)),this.fireEvent("editcomplete",this)},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=Common.localStorage.getItem("de-settings-coauthmode"),e=this._state.fastCoauth;this._state.fastCoauth=null===t||1==parseInt(t),this._state.fastCoauth&&!e&&this.synchronizeChanges()}this.appOptions.canForcesave&&(t=Common.localStorage.getItem("de-settings-forcesave"),this.appOptions.forcesave=null===t?this.appOptions.canForcesave:1==parseInt(t),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(t){this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t),this.updateWindowTitle(!0)},onMeta:function(t){var e=this.getApplication(),i=e.getController("LeftMenu").getView("LeftMenu").getMenu("file");e.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(t.title),this.updateWindowTitle(!0),this.document.title=t.title,i.loadDocument({doc:this.document}),i.panels.info.updateInfo(this.document),Common.Gateway.metaChange(t)},onPrint:function(){this.appOptions.canPrint&&(this.api&&this.api.asc_Print(Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera),Common.component.Analytics.trackEvent("Print"))},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}}t&&(this.iframePrint.src=t)},requestPlugins:function(pluginsPath){if(pluginsPath){var _createXMLHTTPObject=function(){var t;try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t||"undefined"==typeof XMLHttpRequest||(t=new XMLHttpRequest),t},_getPluginJson=function(plugin){if(!plugin)return"";try{var xhrObj=_createXMLHTTPObject();if(xhrObj&&plugin){xhrObj.open("GET",plugin,!1),xhrObj.send("");var pluginJson=eval("("+xhrObj.responseText+")");return pluginJson}}catch(t){}return null},value=_getPluginJson(pluginsPath);value&&this.updatePlugins(value,!1)}},updatePlugins:function(plugins,uiCustomize){if(plugins){var pluginsData=uiCustomize?plugins.UIpluginsData:plugins.pluginsData;if(pluginsData&&!(pluginsData.length<1)){var _createXMLHTTPObject=function(){var t;try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){t=!1}}return t||"undefined"==typeof XMLHttpRequest||(t=new XMLHttpRequest),t},_getPluginJson=function(plugin){if(!plugin)return"";try{var xhrObj=_createXMLHTTPObject();if(xhrObj&&plugin){xhrObj.open("GET",plugin,!1),xhrObj.send("");var pluginJson=eval("("+xhrObj.responseText+")");return pluginJson}}catch(t){}return null},arr=[],baseUrl=_.isEmpty(plugins.url)?"":plugins.url;""!==baseUrl&&console.log("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."),pluginsData.forEach(function(t){t=baseUrl+t;var e=_getPluginJson(t);e&&(e.baseUrl=t.substring(0,t.lastIndexOf("config.json")),e.oldVersion=""!==baseUrl,arr.push(e))}),arr.length>0&&this.updatePluginsList({autoStartGuid:plugins.autoStartGuid,pluginsData:arr},!!uiCustomize)}}},updatePluginsList:function(t,e){var i=this.getApplication().getCollection("Common.Collections.Plugins"),n=this.appOptions.isEdit;if(t){var o=[],s=[];t.pluginsData.forEach(function(t){if(void 0===e||!i.findWhere({baseUrl:t.baseUrl})&&!i.findWhere({guid:t.guid})){var a=t.variations,r=[];a.forEach(function(e){for(var i=!1,o=0;o<e.EditorsSupport.length;o++)if("word"==e.EditorsSupport[o]){i=!0;break}if(i&&(n||e.isViewer)){var a=e.icons;t.oldVersion&&(a=[],e.icons.forEach(function(t){a.push(t.substring(t.lastIndexOf("/")+1))})),t.isUICustomizer?s.push(t.baseUrl+e.url):r.push(new Common.Models.PluginVariation({description:e.description,index:r.length,url:t.oldVersion?e.url.substring(e.url.lastIndexOf("/")+1):e.url,icons:a,isViewer:e.isViewer,EditorsSupport:e.EditorsSupport,isVisual:e.isVisual,isModal:e.isModal,isInsideMode:e.isInsideMode,initDataType:e.initDataType,initData:e.initData,isUpdateOleOnResize:e.isUpdateOleOnResize,buttons:e.buttons,size:e.size,initOnSelectionChanged:e.initOnSelectionChanged}))}}),r.length>0&&!t.isUICustomizer&&o.push(new Common.Models.Plugin({name:t.name,guid:t.guid,baseUrl:t.baseUrl,variations:r,currentVariation:0}))}}),!1!==e&&(this.UICustomizePlugins=s),void 0===e?(i&&i.reset(o),this.appOptions.canPlugins=i.length>0):e||(i&&i.add(o),this.appOptions.canPlugins=i.length>0)}else e||(this.appOptions.canPlugins=!1);this.appOptions.canPlugins&&(this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions),t.autoStartGuid&&this.api.asc_pluginRun(t.autoStartGuid,0,"")),e||this.getApplication().getController("LeftMenu").enablePlugins()},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.",defaultTitleText:"ONLYOFFICE Document Editor",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "Ok" 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...",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",splitMaxRowsErrorText:"The number of rows must be less than %1",splitMaxColsErrorText:"The number of columns must be less than %1",splitDividerErrorText:"The number of rows must be a divisor of %1",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",txtNeedSynchronize:"You have an updates",textLoadingDocument:"Loading document",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",applyChangesTitleText:"Loading Data",applyChangesTextText:"Loading data...",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The document is password protected.",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",txtEditingMode:"Set editing mode...",textAnonymous:"Anonymous",loadingDocumentTitleText:"Loading document",loadingDocumentTextText:"Loading document...",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorDatabaseConnection:"External error.<br>Database connection error. Please, contact support.",titleUpdateVersion:"Version changed",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",errorMailMergeLoadFile:"Loading failed",mailMergeLoadFileText:"Loading Data Source...",mailMergeLoadFileTitle:"Loading Data Source",errorMailMergeSaveFile:"Merge failed.",downloadMergeText:"Downloading...",downloadMergeTitle:"Downloading",sendMergeTitle:"Sending Merge",sendMergeText:"Sending Merge...",txtArt:"Your text here",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="https://api.onlyoffice.com/editors/callback" target="_blank">here</a>',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",txtErrorLoadHistory:"Loading history failed",textBuyNow:"Visit website",textNoLicenseTitle:"ONLYOFFICE open source version",warnNoLicense:"You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",textContactUs:"Contact sales",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",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.",textChangesSaved:"All changes saved",errorBadImageUrl:"Image url is incorrect"}}(),DE.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:850,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&&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("documenteditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog"],function(){"use strict";!DE.Views.FileMenuPanels&&(DE.Views.FileMenuPanels={}),DE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:void 0,formats:[[{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"TXT",imgCls:"txt",type:Asc.c_oAscFileType.TXT},{name:"DOCX",imgCls:"docx",type:Asc.c_oAscFileType.DOCX}],[{name:"ODT",imgCls:"odt",type:Asc.c_oAscFileType.ODT},{name:"HTML (Zipped)",imgCls:"html",type:Asc.c_oAscFileType.HTML}]],template:_.template(["<table><tbody>","<% _.each(rows, function(row) { %>","<tr>","<% _.each(row, function(item) { %>",'<td><span class="btn-doc-format img-doc-format <%= item.imgCls %>" format="<%= item.type %>"/></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)])}}),DE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:void 0,template:_.template(["<table><tbody>",'<tr class="coauth">','<td class="left"><label><%= scope.txtLiveComment %></label></td>','<td class="right"><div id="fms-chb-live-comment"/></td>',"</tr>",'<tr class="divider coauth"></tr>','<tr class="edit">','<td class="left"><label><%= scope.txtSpellCheck %></label></td>','<td class="right"><div id="fms-chb-spell-check"/></td>',"</tr>",'<tr class="divider edit"></tr>','<tr class="edit">','<td class="left"><label><%= scope.txtInput %></label></td>','<td class="right"><div id="fms-chb-input-mode"/></td>',"</tr>",'<tr class="divider edit"></tr>','<tr class="edit">','<td class="left"><label><%= scope.textAlignGuides %></label></td>','<td class="right"><span id="fms-chb-align-guides" /></td>',"</tr>",'<tr class="divider edit"></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 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;"/>','<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>',"</tr>",'<tr class="divider coauth changes"></tr>','<tr class="coauth changes">','<td class="left"><label><%= scope.strShowChanges %></label></td>','<td class="right"><span id="fms-cmb-show-changes" /></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>",'<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(){return $(this.el).html(this.template({scope:this})),this.chInputMode=new Common.UI.CheckBox({el:$("#fms-chb-input-mode"),labelText:this.strInputMode}),this.chLiveComment=new Common.UI.CheckBox({el:$("#fms-chb-live-comment"),labelText:this.strLiveComment}),this.chSpell=new Common.UI.CheckBox({el:$("#fms-chb-spell-check"),labelText:this.strSpellCheckMode}),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.onSelectCoAuthMode(this.cmbCoAuthMode.getSelectedRecord()))},this)),this.lblAutosave=$("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:$("#fms-chb-forcesave"),labelText:this.strForcesave}),this.chAlignGuides=new Common.UI.CheckBox({el:$("#fms-chb-align-guides"),labelText:this.strAlignGuides}),this.cmbZoom=new Common.UI.ComboBox({el:$("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 210px;",data:[{value:-1,displayValue:this.txtFitPage},{value:-2,displayValue:this.txtFitWidth},{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90,displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbShowChanges=new Common.UI.ComboBox({el:$("#fms-cmb-show-changes"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:"none",displayValue:this.txtNone},{value:"all",displayValue:this.txtAll},{value:"last",displayValue:this.txtLast}]}),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.onSelectCoAuthMode(e)},this)),this.lblCoAuthMode=$("#fms-lbl-coauth-mode"),this.cmbFontRender=new Common.UI.ComboBox({el:$("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.txtWin},{value:1,displayValue:this.txtMac},{value:2,displayValue:this.txtNative}]}),this.cmbUnit=new Common.UI.ComboBox({el:$("#fms-cmb-unit"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.btnApply=new Common.UI.Button({el:"#fms-btn-apply"}),this.btnApply.on("click",_.bind(this.applySettings,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings()},setMode:function(t){this.mode=t,$("tr.edit",this.el)[t.isEdit?"show":"hide"](),$("tr.autosave",this.el)[t.isEdit?"show":"hide"](),$("tr.forcesave",this.el)[t.canForcesave?"show":"hide"](),this.mode.isDesktopApp&&this.mode.isOffline&&(this.chAutosave.setCaption(this.strAutoRecover),this.lblAutosave.text(this.textAutoRecover)),$("tr.coauth",this.el)[t.isEdit&&t.canCoAuthoring?"show":"hide"](),$("tr.coauth.changes",this.el)[t.isEdit&&!t.isOffline&&t.canCoAuthoring?"show":"hide"]()},updateSettings:function(){var t=Common.localStorage.getItem("de-settings-inputmode");this.chInputMode.setValue(null!==t&&1==parseInt(t)),t=Common.localStorage.getItem("de-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),t=Common.localStorage.getItem("de-settings-livecomment"),this.chLiveComment.setValue(!(null!==t&&0==parseInt(t))),null===(t=Common.localStorage.getItem("de-settings-coauthmode"))&&null===Common.localStorage.getItem("de-settings-autosave")&&this.mode.customization&&!1===this.mode.customization.autosave&&(t=0);var i=(null===t||1==parseInt(t))&&!(this.mode.isDesktopApp&&this.mode.isOffline)&&this.mode.canCoAuthoring;e=this.cmbCoAuthMode.store.findWhere({value:parseInt(t)}),this.cmbCoAuthMode.setValue(e?e.get("value"):1),this.lblCoAuthMode.text(e?e.get("descValue"):this.strCoAuthModeDescFast),this.fillShowChanges(i),t=Common.localStorage.getItem(i?"de-settings-showchanges-fast":"de-settings-showchanges-strict"),e=this.cmbShowChanges.store.findWhere({value:t}),this.cmbShowChanges.setValue(e?e.get("value"):i?"none":"last"),t=Common.localStorage.getItem("de-settings-fontrender"),e=this.cmbFontRender.store.findWhere({value:parseInt(t)}),this.cmbFontRender.setValue(e?e.get("value"):window.devicePixelRatio>1?1:0),t=Common.localStorage.getItem("de-settings-unit"),e=this.cmbUnit.store.findWhere({value:parseInt(t)}),this.cmbUnit.setValue(e?parseInt(e.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),t=Common.localStorage.getItem("de-settings-autosave"),null===t&&this.mode.customization&&!1===this.mode.customization.autosave&&(t=0),this.chAutosave.setValue(i||(null===t?this.mode.canCoAuthoring:1==parseInt(t))),this.mode.canForcesave&&(t=Common.localStorage.getItem("de-settings-forcesave"),t=null===t?this.mode.canForcesave:1==parseInt(t),this.chForcesave.setValue(t)),t=Common.localStorage.getItem("de-settings-spellcheck"),this.chSpell.setValue(null===t||1==parseInt(t)),t=Common.localStorage.getItem("de-settings-showsnaplines"),this.chAlignGuides.setValue(null===t||1==parseInt(t))},applySettings:function(){Common.localStorage.setItem("de-settings-inputmode",this.chInputMode.isChecked()?1:0),Common.localStorage.setItem("de-settings-zoom",this.cmbZoom.getValue()),Common.localStorage.setItem("de-settings-livecomment",this.chLiveComment.isChecked()?1:0),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&(Common.localStorage.setItem("de-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem(this.cmbCoAuthMode.getValue()?"de-settings-showchanges-fast":"de-settings-showchanges-strict",this.cmbShowChanges.getValue())),Common.localStorage.setItem("de-settings-fontrender",this.cmbFontRender.getValue()),Common.localStorage.setItem("de-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("de-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("de-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.localStorage.setItem("de-settings-spellcheck",this.chSpell.isChecked()?1:0),Common.localStorage.setItem("de-settings-showsnaplines",this.chAlignGuides.isChecked()?1:0),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},fillShowChanges:function(t){if(t&&3==this.cmbShowChanges.store.length||!t&&2==this.cmbShowChanges.store.length){var e=[{value:"none",displayValue:this.txtNone},{value:"all",displayValue:this.txtAll}];t||e.push({value:"last",displayValue:this.txtLast}),this.cmbShowChanges.store.reset(e)}},onSelectCoAuthMode:function(t){this.lblCoAuthMode.text(t.descValue),this.fillShowChanges(1==t.value),this.cmbShowChanges.setValue(1==t.value?"none":"last")},strLiveComment:"Turn on option",strInputMode:"Turn on hieroglyphs",strZoom:"Default Zoom Value",strShowChanges:"Realtime Collaboration Changes",txtAll:"View All",txtNone:"View Nothing",txtLast:"View Last",txtLiveComment:"Live Commenting",okButtonText:"Apply",txtInput:"Alternate Input",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",textAutoSave:"Autosave",strAutosave:"Turn on autosave",txtSpellCheck:"Spell Checking",strSpellCheckMode:"Turn on spell checking option",textAlignGuides:"Alignment Guides",strAlignGuides:"Turn on alignment guides",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",txtFitPage:"Fit to Page",txtFitWidth:"Fit to Width",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)"},DE.Views.FileMenuPanels.Settings||{})),DE.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")])}}),DE.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 img-doc-format"></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)) { %> style="background-image: url(<%= item.icon %>);" <% } %> />','<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 Text Document",
|
|
|
newDescriptionText:"Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template",noTemplatesText:"There are no templates"},DE.Views.FileMenuPanels.CreateNew||{})),DE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">',"<tr>",'<td class="left"><label>'+this.txtTitle+"</label></td>",'<td class="right"><label id="id-info-title">-</label></td>',"</tr>",'<tr class="author">','<td class="left"><label>'+this.txtAuthor+"</label></td>",'<td class="right"><span class="userLink img-commonctrl" id="id-info-author">-</span></td>',"</tr>",'<tr class="placement">','<td class="left"><label>'+this.txtPlacement+"</label></td>",'<td class="right"><label id="id-info-placement">-</label></td>',"</tr>",'<tr class="date">','<td class="left"><label>'+this.txtDate+"</label></td>",'<td class="right"><label id="id-info-date">-</label></td>',"</tr>",'<tr class="divider date"></tr>',"<tr>",'<td class="left" style="vertical-align: top;"><label>'+this.txtStatistics+"</label></td>",'<td class="right" style="vertical-align: top;"><div id="id-info-statistic">',"<table>","<tr>","<td><label>"+this.txtPages+"</label></td>",'<td><label id="id-info-pages"></label></td>',"</tr>","<tr>","<td><label>"+this.txtParagraphs+"</label></td>",'<td><label id="id-info-paragraphs"></label></td>',"</tr>","<tr>","<td><label>"+this.txtWords+"</label></td>",'<td><label id="id-info-words"></label></td>',"</tr>","<tr>","<td><label>"+this.txtSymbols+"</label></td>",'<td><label id="id-info-symbols"></label></td>',"</tr>","<tr>","<td><label>"+this.txtSpaces+"</label></td>",'<td><label id="id-info-spaces"></label></td>',"</tr>","</table>","</div></td>","</tr>","</table>"].join("")),this.infoObj={PageCount:0,WordsCount:0,ParagraphCount:0,SymbolsCount:0,SymbolsWSCount:0},this.inProgress=!1,this.menu=t.menu},render:function(){return $(this.el).html(this.template()),this.lblTitle=$("#id-info-title"),this.lblPlacement=$("#id-info-placement"),this.lblDate=$("#id-info-date"),this.lblAuthor=$("#id-info-author"),this.lblStatPages=$("#id-info-pages"),this.lblStatWords=$("#id-info-words"),this.lblStatParagraphs=$("#id-info-paragraphs"),this.lblStatSymbols=$("#id-info-symbols"),this.lblStatSpaces=$("#id-info-spaces"),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateStatisticInfo()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.stopUpdatingStatisticInfo()},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},this.lblTitle.text(t.title?t.title:"-"),t.info?(t.info.author&&this.lblAuthor.text(t.info.author),this._ShowHideInfoItem("author",void 0!==t.info.author&&null!==t.info.author),t.info.created&&this.lblDate.text(t.info.created),this._ShowHideInfoItem("date",void 0!==t.info.created&&null!==t.info.created),t.info.folder&&this.lblPlacement.text(t.info.folder),this._ShowHideInfoItem("placement",void 0!==t.info.folder&&null!==t.info.folder)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("date",t),this._ShowHideInfoItem("placement",t),this._ShowHideInfoItem("author",t)},updateStatisticInfo:function(){this.api&&this.doc&&this.api.startGetDocInfo()},stopUpdatingStatisticInfo:function(){this.api&&this.api.stopGetDocInfo()},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onGetDocInfoStart",_.bind(this._onGetDocInfoStart,this)),this.api.asc_registerCallback("asc_onGetDocInfoStop",_.bind(this._onGetDocInfoEnd,this)),this.api.asc_registerCallback("asc_onDocInfo",_.bind(this._onDocInfo,this)),this.api.asc_registerCallback("asc_onGetDocInfoEnd",_.bind(this._onGetDocInfoEnd,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this},setMode:function(t){return this},_onGetDocInfoStart:function(){var t=this;this.inProgress=!0,this.infoObj={PageCount:0,WordsCount:0,ParagraphCount:0,SymbolsCount:0,SymbolsWSCount:0},_.defer(function(){t.inProgress&&(t.lblStatPages.text(t.txtLoading),t.lblStatWords.text(t.txtLoading),t.lblStatParagraphs.text(t.txtLoading),t.lblStatSymbols.text(t.txtLoading),t.lblStatSpaces.text(t.txtLoading))},2e3)},_onDocInfo:function(t){t&&(t.get_PageCount()>-1&&(this.infoObj.PageCount=t.get_PageCount()),t.get_WordsCount()>-1&&(this.infoObj.WordsCount=t.get_WordsCount()),t.get_ParagraphCount()>-1&&(this.infoObj.ParagraphCount=t.get_ParagraphCount()),t.get_SymbolsCount()>-1&&(this.infoObj.SymbolsCount=t.get_SymbolsCount()),t.get_SymbolsWSCount()>-1&&(this.infoObj.SymbolsWSCount=t.get_SymbolsWSCount()))},_onGetDocInfoEnd:function(){this.inProgress=!1,this.lblStatPages.text(this.infoObj.PageCount),this.lblStatWords.text(this.infoObj.WordsCount),this.lblStatParagraphs.text(this.infoObj.ParagraphCount),this.lblStatSymbols.text(this.infoObj.SymbolsCount),this.lblStatSpaces.text(this.infoObj.SymbolsWSCount)},onDocumentName:function(t){this.lblTitle.text(t||"-")},txtTitle:"Document Title",txtAuthor:"Author",txtPlacement:"Placement",txtDate:"Creation Date",txtStatistics:"Statistics",txtPages:"Pages",txtWords:"Words",txtParagraphs:"Paragraphs",txtSymbols:"Symbols",txtSpaces:"Symbols with spaces",txtLoading:"Loading..."},DE.Views.FileMenuPanels.DocumentInfo||{})),DE.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 img-commonctrl <% 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})),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)},setApi:function(t){return this.api=t,this},setMode:function(t){return this.sharingSettingsUrl=t.sharingSettingsUrl,this},changeAccessRights:function(t,e,i){if(!this._docAccessDlg){var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.doc.info.sharingSettings=e,n._ShowHideInfoItem("rights",void 0!==n.doc.info.sharingSettings&&null!==n.doc.info.sharingSettings&&n.doc.info.sharingSettings.length>0),n.cntRights.html(n.templateRights({users:n.doc.info.sharingSettings}))}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},DE.Views.FileMenuPanels.DocumentRights||{})),DE.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:200px; top: 0; bottom: 0;" class="no-padding"></div>','<div id="id-help-frame" style="position: absolute; left: 200px; 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:"UsageInstructions/SetPageParameters.htm",name:"Set page parameters",headername:"Usage Instructions",selected:!0},{src:"UsageInstructions/CopyPasteUndoRedo.htm",name:"Copy/paste text passages, undo/redo your actions"},{src:"UsageInstructions/NonprintingCharacters.htm",name:"Show/hide nonprinting characters"},{src:"UsageInstructions/AlignText.htm",name:"Align your text in a line or paragraph"},{src:"UsageInstructions/FormattingPresets.htm",name:"Apply formatting presets"},{src:"UsageInstructions/BackgroundColor.htm",name:"Select background color for a paragraph"},{src:"UsageInstructions/ParagraphIndents.htm",name:"Change paragraph indents"},{src:"UsageInstructions/LineSpacing.htm",name:"Set paragraph line spacing"},{src:"UsageInstructions/PageBreaks.htm",name:"Insert page breaks"},{src:"UsageInstructions/AddBorders.htm",name:"Add Borders"},{src:"UsageInstructions/FontTypeSizeColor.htm",name:"Set font type, size, and color"},{src:"UsageInstructions/DecorationStyles.htm",name:"Apply font decoration styles"},{src:"UsageInstructions/CopyClearFormatting.htm",name:"Copy/clear text formatting"},{src:"UsageInstructions/CreateLists.htm",name:"Create lists"},{src:"UsageInstructions/InsertTables.htm",name:"Insert tables"},{src:"UsageInstructions/InsertImages.htm",name:"Insert images"},{src:"UsageInstructions/AddHyperlinks.htm",name:"Add hyperlinks"},{src:"UsageInstructions/InsertHeadersFooters.htm",name:"Insert headers and footers"},{src:"UsageInstructions/InsertPageNumbers.htm",name:"Insert page numbers"},{src:"UsageInstructions/ViewDocInfo.htm",name:"View document information"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your document"},{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new document or open an existing one"},{src:"HelpfulHints/About.htm",name:"About ONLYOFFICE Document Editor",headername:"Helpful Hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported Formats of Electronic Documents"},{src:"HelpfulHints/Navigation.htm",name:"Navigation through Your Document"},{src:"HelpfulHints/Search.htm",name:"Search Function"},{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(t){if(Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0),t){var e=this.viewHelpPicker.store.findWhere({src:t});e&&(this.viewHelpPicker.selectRecord(e),this.viewHelpPicker.scrollToRecord(e))}}})}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/HistoryVersion",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.HistoryVersion=e.Model.extend({defaults:function(){return{version:0,revision:0,changeid:void 0,userid:void 0,username:"Guest",usercolor:"#ff0000",created:void 0,id:Common.UI.getId(),url:"",urlDiff:"",urlGetTime:"",docId:"",docIdPrev:"",token:"",arrColors:[],markedAsVersion:!1,canRestore:!1,isRevision:!0,hasChanges:!1,isExpanded:!0,isVisible:!0,allowSelected:!0,selected:!1}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/HistoryVersions",["underscore","backbone","common/main/lib/model/HistoryVersion"],function(t,e){"use strict";Common.Collections.HistoryVersions=e.Collection.extend({model:Common.Models.HistoryVersion,findRevision:function(t){return this.findWhere({revision:t})},findRevisions:function(t){return this.where({revision:t})},hasChanges:function(){return!!this.findWhere({isRevision:!1})},hasCollapsed:function(){return!!this.findWhere({isRevision:!0,hasChanges:!0,isExpanded:!1})}})}),define("common/main/lib/controller/History",["core","common/main/lib/collection/HistoryVersions","common/main/lib/view/History"],function(){"use strict";Common.Controllers.History=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.HistoryVersions"],views:["Common.Views.History"],initialize:function(){this.currentChangeId=-1,this.currentArrColors=[],this.currentDocId="",this.currentDocIdPrev="",this.currentRev=0},events:{},onLaunch:function(){this.panelHistory=this.createView("Common.Views.History",{storeHistory:this.getApplication().getCollection("Common.Collections.HistoryVersions")}),this.panelHistory.storeHistory.on("reset",_.bind(this.onResetStore,this)),this.panelHistory.on("render:after",_.bind(this.onAfterRender,this)),Common.Gateway.on("sethistorydata",_.bind(this.onSetHistoryData,this))},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onExpiredToken",_.bind(this.onExpiredToken,this)),this},setMode:function(t){t.canHistoryClose||(this.panelHistory.$el.find("#history-header").hide(),this.panelHistory.$el.find("#history-list").css("padding-top",0))},onAfterRender:function(t){t.viewHistoryList.on("item:click",_.bind(this.onSelectRevision,this)),t.btnBackToDocument.on("click",_.bind(this.onClickBackToDocument,this)),t.btnExpand.on("click",_.bind(this.onClickExpand,this))},onResetStore:function(){var t=this.panelHistory.storeHistory.hasChanges();this.panelHistory.$el.find("#history-expand-changes")[t?"show":"hide"](),this.panelHistory.$el.find("#history-list").css("padding-bottom",t?"45px":0)},onDownloadUrl:function(t){void 0!==this.isFromSelectRevision&&Common.Gateway.requestRestore(this.isFromSelectRevision,t),this.isFromSelectRevision=void 0},onSelectRevision:function(t,e,i,n){if(n){var o=$(n.target);if(o&&o.hasClass("revision-restore"))return void(i.get("isRevision")?Common.Gateway.requestRestore(i.get("revision")):(this.isFromSelectRevision=i.get("revision"),this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX,!0)))}!t&&i&&this.panelHistory.viewHistoryList.scrollToRecord(i);var s=i.get("url"),a=i.get("revision"),r=new Date;if(this.currentChangeId=i.get("changeid"),this.currentArrColors=i.get("arrColors"),this.currentDocId=i.get("docId"),this.currentDocIdPrev=i.get("docIdPrev"),this.currentRev=a,_.isEmpty(s)||r-i.get("urlGetTime")>3e5)_.delay(function(){Common.Gateway.requestHistoryData(a)},10);else{var l=i.get("urlDiff"),c=i.get("token"),d=new Asc.asc_CVersionHistory;d.asc_setDocId(_.isEmpty(l)?this.currentDocId:this.currentDocIdPrev),d.asc_setUrl(s),d.asc_setUrlChanges(l),d.asc_setCurrentChangeId(this.currentChangeId),d.asc_setArrColors(this.currentArrColors),d.asc_setToken(c),d.asc_setIsRequested(!1),this.api.asc_showRevision(d);var h=this.getApplication().getController("Common.Controllers.Comments");h&&h.onApiHideComment()}},onSetHistoryData:function(t){if(t.data.error){var e={closable:!1,title:this.notcriticalErrorTitle,msg:t.data.error,iconCls:"warn",buttons:["ok"]};Common.UI.alert(e)}else{var i=t.data,n=this.getApplication().getCollection("Common.Collections.HistoryVersions");if(n&&null!==i){var o,s=n.findRevisions(i.version),a=new Date,r=void 0===this.currentChangeId?null:t.data.changesUrl,l=!_.isEmpty(r)&&t.data.previous?t.data.previous.url:t.data.url,c=t.data.key?t.data.key:this.currentDocId,d=t.data.previous&&t.data.previous.key?t.data.previous.key:this.currentDocIdPrev,h=t.data.token;if(s&&s.length>0)for(var p=0;p<s.length;p++)o=s[p],o.set("url",l,{silent:!0}),o.set("urlDiff",r,{silent:!0}),o.set("urlGetTime",a,{silent:!0}),t.data.key&&(o.set("docId",c,{silent:!0}),o.set("docIdPrev",d,{silent:!0})),o.set("token",h,{silent:!0});var m=new Asc.asc_CVersionHistory;m.asc_setUrl(l),m.asc_setUrlChanges(r),m.asc_setDocId(_.isEmpty(r)?c:d),m.asc_setCurrentChangeId(this.currentChangeId),m.asc_setArrColors(this.currentArrColors),m.asc_setToken(h),m.asc_setIsRequested(!0),this.api.asc_showRevision(m);var u=this.getApplication().getController("Common.Controllers.Comments");u&&u.onApiHideComment()}}},onExpiredToken:function(){var t=this;_.delay(function(){Common.Gateway.requestHistoryData(t.currentRev)},10)},onClickBackToDocument:function(){Common.Gateway.requestHistoryClose()},onClickExpand:function(){var t=this.panelHistory.storeHistory,e=t.hasCollapsed();t.where({isRevision:!0,hasChanges:!0,isExpanded:!e}).forEach(function(t){t.set("isExpanded",e)}),t.where({isRevision:!1}).forEach(function(t){t.set("isVisible",e)}),this.panelHistory.viewHistoryList.scroller.update({minScrollbarLength:40}),this.panelHistory.btnExpand.cmpEl.text(e?this.panelHistory.textHideAll:this.panelHistory.textShowAll)},notcriticalErrorTitle:"Warning"},Common.Controllers.History||{}))}),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,userid:0,username:"Guest",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",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,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}})}),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"],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.CommentsPopover"],sdkViewName:"#id_main",subEditStrings:{},filter:void 0,hintmode:!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),"comment:disableHint":_.bind(this.disableHint,this),"comment:addDummyComment":_.bind(this.onAddDummyComment,this)}}),Common.NotificationCenter.on("comments:updatefilter",_.bind(this.onUpdateFilter,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.view=this.createView("Common.Views.Comments",{store:this.collection,popoverComments:this.popoverComments}),this.view.render(),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)},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},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_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,i){var n=this,o=null,s=null,a=t(),r=n.findComment(e,i);return _.isUndefined(e)&&(e=r.get("uid")),!(!a||!r)&&(a.asc_putText(r.get("comment")),a.asc_putQuoteText(r.get("quote")),a.asc_putTime(n.utcDateToString(new Date(r.get("time")))),a.asc_putUserId(n.currentUserId),a.asc_putUserName(n.currentUserName),a.asc_putSolved(!r.get("resolved")),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(r.get("unattached")),o=r.get("replys"),o&&o.length&&o.forEach(function(e){(s=t())&&(s.asc_putText(e.get("reply")),s.asc_putTime(n.utcDateToString(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)},onShowComment:function(t,e){var i=this.findComment(t,void 0);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().hide()}else{var n=this.popoverComments.findWhere({uid:t});if(n)return}!_.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().hide(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(e,i){if(i&&i.length>0){var n=this,o=null,s=null,a=null,r=t(),l=n.findComment(e);if(l&&r)return r.asc_putText(i),r.asc_putQuoteText(l.get("quote")),r.asc_putTime(n.utcDateToString(new Date(l.get("time")))),r.asc_putUserId(n.currentUserId),r.asc_putUserName(n.currentUserName),r.asc_putSolved(l.get("resolved")),_.isUndefined(r.asc_putDocumentFlag)||r.asc_putDocumentFlag(l.get("unattached")),l.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=l.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_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),r.asc_addReply(a))}),n.api.asc_changeComment(e,r),!0}return!1},onChangeReplyComment:function(e,i,n){if(n&&n.length>0){var o=this,s=null,a=null,r=t(),l=o.findComment(e);if(r&&l)return r.asc_putText(l.get("comment")),r.asc_putQuoteText(l.get("quote")),r.asc_putTime(o.utcDateToString(new Date(l.get("time")))),r.asc_putUserId(l.get("userid")),r.asc_putUserName(l.get("username")),r.asc_putSolved(l.get("resolved")),_.isUndefined(r.asc_putDocumentFlag)||r.asc_putDocumentFlag(l.get("unattached")),s=l.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")))),r.asc_addReply(a))}),o.api.asc_changeComment(e,r),!0}return!1},onAddReplyComment:function(e,i){if(i.length>0){var n=this,o=null,s=null,a=null,r=t(),l=n.findComment(e);if(r&&l&&(o=l.get("uid"),o&&(n.subEditStrings[o]&&delete n.subEditStrings[o],n.subEditStrings[o+"-R"]&&delete n.subEditStrings[o+"-R"],l.set("showReplyInPopover",!1)),r.asc_putText(l.get("comment")),r.asc_putQuoteText(l.get("quote")),r.asc_putTime(n.utcDateToString(new Date(l.get("time")))),r.asc_putUserId(l.get("userid")),r.asc_putUserName(l.get("username")),r.asc_putSolved(l.get("resolved")),_.isUndefined(r.asc_putDocumentFlag)||r.asc_putDocumentFlag(l.get("unattached")),s=l.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_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),r.asc_addReply(a))}),a=t()))return a.asc_putText(i),a.asc_putTime(n.utcDateToString(new Date)),a.asc_putUserId(n.currentUserId),a.asc_putUserName(n.currentUserName),r.asc_addReply(a),n.api.asc_changeComment(e,r),!0}return!1},onRemoveReplyComment:function(e,i){if(!_.isUndefined(e)&&!_.isUndefined(i)){var n=this,o=null,s=null,a=t(),r=n.findComment(e);if(a&&r)return a.asc_putText(r.get("comment")),a.asc_putQuoteText(r.get("quote")),a.asc_putTime(n.utcDateToString(new Date(r.get("time")))),a.asc_putUserId(r.get("userid")),a.asc_putUserName(r.get("username")),a.asc_putSolved(r.get("resolved")),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(r.get("unattached")),o=r.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_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.filter={property:t.property,value:t.value},e||this.getPopover()&&this.getPopover().hide();var i=this,n=null;this.collection.each(function(t){var e=t.get(i.filter.property);e&&t.set("hide",null===e.match(i.filter.value)),t.get("last")&&t.set("last",!1),t.get("hide")||(n=t)}),n&&n.set("last",!0)}},onApiAddComment:function(t,e){var i=this.readSDKComment(t,e);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]);this.collection.push(i)}this.updateComments(!0)},onApiRemoveComment:function(t,e){if(this.collection.length){var i=this.collection.findWhere({uid:t});i&&(this.collection.remove(i),e||this.updateComments(!0)),this.popoverComments.length&&(i=this.popoverComments.findWhere({uid:t}))&&(this.popoverComments.remove(i),0===this.popoverComments.length&&this.getPopover()&&this.getPopover().hide())}},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,r=0,l=null,c=this.findComment(t);if(c){for(n=this,s=""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),c.set("comment",e.asc_getText()),c.set("userid",e.asc_getUserId()),c.set("username",e.asc_getUserName()),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,
|
|
|
r=e.asc_getRepliesCount(),o=0;o<r;++o)l=""==e.asc_getReply(o).asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getReply(o).asc_getTime())),a.push(new Common.Models.Reply({id:Common.UI.getId(),userid:e.asc_getReply(o).asc_getUserId(),username:e.asc_getReply(o).asc_getUserName(),date:n.dateToLocaleTimeString(l),reply:e.asc_getReply(o).asc_getText(),time:l.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:n.view,editable:n.mode.canEditComments||e.asc_getReply(o).asc_getUserId()==n.currentUserId}));a.sort(function(t,e){return t.get("time")-e.get("time")}),c.set("replys",a),i||(this.updateComments(!1,!0),this.getPopover()&&this.getPopover().isVisible()&&(this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)))}},onApiLockComment:function(t,e){var i=this.findComment(t),n=null,o=null;i&&(n=this.getApplication().getCollection("Common.Collections.Users"))&&(o=n.findWhere({id:e}))&&(this.getPopover()&&this.getPopover().saveText(),i.set("lock",!0),i.set("lockuserid",this.view.getUserName(o.get("username"))))},onApiUnLockComment:function(t){var e=this.findComment(t);e&&(e.set("lock",!1),this.getPopover()&&this.getPopover().loadText())},onApiShowComment:function(t,e,i,n,o,s){if(this.isModeChanged=!1,(!s||!this.isSelectedComment||0!==_.difference(this.uids,t).length)&&(this.mode&&!this.mode.canComments&&(s=!0),this.getPopover())){if(this.clearDummyComment(),this.isSelectedComment&&0===_.difference(this.uids,t).length)return void(this.api&&(this.getPopover().commentsView.setFocusToTextBox(!0),this.api.asc_enableKeyEvents(!0)));var a=0,r="",l="",c=null,d="",h=!0;for(this.popoverComments.reset(),a=0;a<t.length;++a)r=t[a],l=t[a]+"-R",c=this.findComment(r),this.subEditStrings[r]&&!s?(c.set("editTextInPopover",!0),d=this.subEditStrings[r]):this.subEditStrings[l]&&!s&&(c.set("showReplyInPopover",!0),d=this.subEditStrings[l]),c.set("hint",!_.isUndefined(s)&&s),!s&&this.hintmode&&(0===_.difference(this.uids,t).length&&0===this.uids.length&&(h=!1),this.oldUids.length&&0===_.difference(this.oldUids,t).length&&(h=!1,this.oldUids=[])),this.animate&&(h=this.animate,this.animate=!1),this.isSelectedComment=!s||!this.hintmode,this.uids=_.clone(t),this.popoverComments.push(c),this._dontScrollToComment||this.view.commentsView.scrollToRecord(c),this._dontScrollToComment=!1;this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(e,i,n),this.getPopover().show(h,!1,!0,d)}},onApiHideComment:function(t){var e=this;if(this.getPopover()){if(this.isSelectedComment&&t)return;if(t&&this.getPopover().isCommentsViewMouseOver())return;this.popoverComments.each(function(t){t.get("editTextInPopover")&&(e.subEditStrings[t.get("uid")]=e.getPopover().getEditText()),t.get("showReplyInPopover")&&(e.subEditStrings[t.get("uid")+"-R"]=e.getPopover().getEditText())}),this.getPopover().saveText(!0),this.getPopover().hide(),this.collection.clearEditing(),this.popoverComments.clearEditing(),this.oldUids=_.clone(this.uids),this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset()}},onApiUpdateCommentPosition:function(t,e,i,n){var o,s=!1,a=null,r=void 0,l="",c="";if(this.getPopover())if(this.getPopover().saveText(),this.getPopover().hideTips(),i<0||this.getPopover().sdkBounds.height<i||!_.isUndefined(n)&&this.getPopover().sdkBounds.width<n)this.getPopover().hide();else{if(this.isModeChanged&&this.onApiShowComment(t,e,i,n),0===this.popoverComments.length){for(this.popoverComments.reset(),o=0;o<t.length;++o)l=t[o],c=t[o]+"-R",a=this.findComment(l),this.subEditStrings[l]?(a.set("editTextInPopover",!0),r=this.subEditStrings[l]):this.subEditStrings[c]&&(a.set("showReplyInPopover",!0),r=this.subEditStrings[c]),this.popoverComments.push(a);s=!0,this.getPopover().show(s,void 0,void 0,r)}else this.getPopover().isVisible()||this.getPopover().show(!1,void 0,void 0,r);this.getPopover().setLeftTop(e,i,n,void 0,!0)}},onDocumentPlaceChanged:function(){if(this.isDummyComment&&this.getPopover()&&this.getPopover().isVisible()){var t=this.api.asc_getAnchorPosition();t&&this.getPopover().setLeftTop(t.asc_getX()+t.asc_getWidth(),t.asc_getY(),this.hintmode?t.asc_getX():void 0)}},updateComments:function(t,e){var i=this;i.updateCommentsTime=new Date,void 0===i.timerUpdateComments&&(i.timerUpdateComments=setInterval(function(){new Date-i.updateCommentsTime>100&&(clearInterval(i.timerUpdateComments),i.timerUpdateComments=void 0,i.updateCommentsView(t,e))},25))},updateCommentsView:function(t,e){var i,n=!0;if(_.isUndefined(e)&&this.collection.sort(),t){for(i=this.collection.length-1;i>=0;--i)n?this.collection.at(i).set("last",!0,{silent:!0}):this.collection.at(i).get("last")&&this.collection.at(i).set("last",!1,{silent:!0}),n=!1;this.onUpdateFilter(this.filter,!0),this.view.render()}this.view.update()},findComment:function(t,e){return _.isUndefined(t)?this.collection.findWhere({id:e}):this.collection.findWhere({uid:t})},findPopupComment:function(t){return this.popoverComments.findWhere({id:t})},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 this.view.getPopover(this.sdkViewName)},readSDKComment:function(t,e){var i=""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),n=new Common.Models.Comment({uid:t,userid:e.asc_getUserId(),username:e.asc_getUserName(),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});if(n){var o=this.readSDKReplies(e);o.length&&n.set("replys",o)}return n},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_getTime()?new Date:new Date(this.stringUtcToLocalDate(t.asc_getReply(e).asc_getTime())),i.push(new Common.Models.Reply({id:Common.UI.getId(),userid:t.asc_getReply(e).asc_getUserId(),username:t.asc_getReply(e).asc_getUserName(),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}));i.sort(function(t,e){return t.get("time")-e.get("time")})}return i},addDummyComment:function(){if(this.api){var t=this,e=null,i=new Date,n=this.getPopover();if(n){if(this.popoverComments.length)return void _.delay(function(){n.commentsView.setFocusToTextBox()},200);var o=new Common.Models.Comment({id:-1,time:i.getTime(),date:this.dateToLocaleTimeString(i),userid:this.currentUserId,username:this.currentUserName,editTextInPopover:!0,showReplyInPopover:!1,hideAddReply:!0,scope:this.view,dummy:!0});this.popoverComments.reset(),this.popoverComments.push(o),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(){t.clearDummyComment()},e=this.api.asc_getAnchorPosition(),e&&(n.setLeftTop(e.asc_getX()+e.asc_getWidth(),e.asc_getY(),this.hintmode?e.asc_getX():void 0),n.show(!0,!1,!0))}}},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.isDummyComment=!1,this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hide(),i.asc_putText(e),i.asc_putTime(this.utcDateToString(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),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var t=this.getPopover();t&&(t.handlerHide=function(){},t.isVisible()&&t.hide()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1)}},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().show(!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.update())}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:6e4*(new Date).getTimezoneOffset(),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)}},Common.Controllers.Comments||{}))}),define("common/main/lib/model/User",["backbone"],function(t){"use strict";Common.Models=Common.Models||{},Common.Models.User=t.Model.extend({defaults:{id: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.online&&t++}),t},findUser:function(t){return this.find(function(e){return e.get("id")==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)}})},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){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var e=0;for(n in t)void 0!==n&&e++;if(e>1&&void 0==this._isCoAuthoringStopped)return this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),void Common.NotificationCenter.trigger("api:disconnect")}var i=this.getApplication().getCollection("Common.Collections.Users");if(i){var n,o,s=[];for(n in t)void 0!==n&&(o=t[n])&&s.push(new Common.Models.User({id:o.asc_getId(),username:o.asc_getUserName(),online:!0,color:o.asc_getColor(),view:o.asc_getView()}));i[i.size()>0?"add":"reset"](s)}},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(),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.user,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",textUserLimit:'You are using ONLYOFFICE Editors free version.<br>Only two users can co-edit the document simultaneously.<br>Want more? Consider buying ONLYOFFICE Editors Pro version.<br><a href="http://www.onlyoffice.com" target="_blank">Read more</a>'},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,isViewer:!1,EditorsSupport:["word","cell","slide"],isVisual:!1,isModal:!1,isInsideMode:!1,initDataType:0,initData:"",isUpdateOleOnResize:!1,buttons:[],size:[800,600],initOnSelectionChanged:!1}}}),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}}})}),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})}),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:[],collections:["Common.Collections.Plugins"],views:["Common.Views.Plugins"],initialize:function(){},events:function(){return{"click #id-plugin-close":_.bind(this.onToolClose,this)}},onLaunch:function(){this.panelPlugins=this.createView("Common.Views.Plugins",{storePlugins:this.getApplication().getCollection("Common.Collections.Plugins")}),this.panelPlugins.on("render:after",_.bind(this.onAfterRender,this)),this._moveOffset={x:0,y:0}},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},setMode:function(t){t.canPlugins&&this.updatePluginsList()},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)}})},updatePluginsList: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_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")),o.push(e)}),i.set_Variations(o),t.set("pluginObj",i),e.push(i)}),this.api.asc_pluginsRegister("",e)},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,r=this,l=$(n.currentTarget),c=$(this.panelPlugins.el),d=l.offset(),h=c.offset();if(a=[d.left-h.left+l.width(),d.top-h.top+l.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"):r.panelPlugins.textStart,value:parseInt(u.get("index"))}).on("click",function(t,e){r.api&&r.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)}).on("hide:after",function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)})),b.css({left:a[0],top:a[1]}),s.menuAlignEl=l,s.setOffset(-20,-l.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){var i=t.get_Variations()[e];if(i.get_Visual()){var n=i.get_Url();if(n=(0==t.get_BaseUrl().length?n:t.get_BaseUrl())+n,i.get_InsideMode())this.panelPlugins.openInsideMode(t.get_Name(),n)||this.api.asc_pluginButtonClick(-1);else{var o=this,s=i.get_Buttons(),a={},r=i.get_Size();(!r||r.length<2)&&(r=[800,600]),_.isArray(s)&&_.each(s,function(t,e){a[e]={text:t.text,cls:"custom"+(t.primary?" primary":"")}}),o.pluginDlg=new Common.Views.PluginDlg({title:t.get_Name(),width:r[0],height:r[1],url:n,buttons:a,toolcallback:_.bind(this.onToolClose,this)}),o.pluginDlg.on("render:after",function(t){t.getChild(".footer .dlg-btn").on("click",_.bind(o.onDlgBtnClick,o)),o.pluginContainer=o.pluginDlg.$window.find("#id-plugin-container")}).on("close",function(t){o.pluginDlg=void 0}).on("drag",function(t){o.api.asc_pluginEnableMouseEvents("start"==t[1])}).on("resize",function(t){o.api.asc_pluginEnableMouseEvents("start"==t[1])}),o.pluginDlg.show()}}else this.panelPlugins.openNotVisualMode(t.get_Guid())},onPluginClose:function(){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin?this.panelPlugins.closeInsideMode():this.panelPlugins.closeNotVisualMode()},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})}},Common.Controllers.Plugins||{}))}),define("common/main/lib/view/ExternalDiagramEditor",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ExternalDiagramEditor=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:910,height:Common.Utils.innerHeight()-700<0?Common.Utils.innerHeight():700,cls:"advanced-settings-dlg",header:!0,toolclose:"hide",toolcallback:_.bind(this.onToolClose,this)},t),this.template=['<div id="id-diagram-editor-container" class="box" style="height:'+(e.height-85)+'px;">','<div id="id-diagram-editor-placeholder" style="width: 100%;height: 100%;"></div>',"</div>",'<div class="separator horizontal"/>','<div class="footer" style="text-align: center;">','<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">'+this.textSave+"</button>",'<button id="id-btn-diagram-editor-cancel" class="btn normal dlg-btn" result="cancel">'+this.textClose+"</button>","</div>"].join(""),e.tpl=_.template(this.template,e),this.handler=e.handler,this._chartData=null,this._isNewChart=!0,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnSave=new Common.UI.Button({el:$("#id-btn-diagram-editor-apply"),disabled:!0}),this.btnCancel=new Common.UI.Button({el:$("#id-btn-diagram-editor-cancel"),disabled:!0}),this.$window.find(".tool.close").addClass("disabled"),this.$window.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this))},setChartData:function(t){this._chartData=t,this._isExternalDocReady&&this.fireEvent("setchartdata",this)},setEditMode:function(t){this._isNewChart=!t},isEditMode:function(){return!this._isNewChart},setControlsDisabled:function(t){this.btnSave.setDisabled(t),this.btnCancel.setDisabled(t),t?this.$window.find(".tool.close").addClass("disabled"):this.$window.find(".tool.close").removeClass("disabled")},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e)||this.hide()},onToolClose:function(){this.handler&&this.handler.call(this,"cancel")||this.hide()},setHeight:function(t){if(t>=0){var e=parseInt(this.$window.css("min-height"));t<e&&(t=e),this.$window.height(t);var i=this.initConfig.header?parseInt(this.$window.find("> .header").css("height")):0;this.$window.find("> .body").css("height",t-i),this.$window.find("> .body > .box").css("height",t-85);var n=(Common.Utils.innerHeight()-parseInt(t))/2*.9,o=(Common.Utils.innerWidth()-parseInt(this.initConfig.width))/2;this.$window.css("left",o),this.$window.css("top",n)}},textSave:"Save & Exit",textClose:"Close",textTitle:"Chart Editor"},Common.Views.ExternalDiagramEditor||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ExternalDiagramEditor",["core","common/main/lib/view/ExternalDiagramEditor"],function(){"use strict";Common.Controllers.ExternalDiagramEditor=Backbone.Controller.extend(_.extend(function(){var t="en",e=void 0,i="",n=null,o=function(){n=new DocsAPI.DocEditor("id-diagram-editor-placeholder",{width:"100%",height:"100%",documentType:"spreadsheet",document:{url:"_offline_",permissions:{edit:!0,download:!1}},editorConfig:{mode:"editdiagram",targetApp:i,lang:t,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:e,user:{id:"uid-"+Date.now()}},events:{onReady:function(){},onDocumentStateChange:function(){},onError:function(){},onInternalMessage:_.bind(this.onInternalMessage,this)}}),Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this))};return{views:["Common.Views.ExternalDiagramEditor"],initialize:function(){this.addListeners({"Common.Views.ExternalDiagramEditor":{setchartdata:_.bind(this.setChartData,this),drag:_.bind(function(t,e){n&&n.serviceCommand("window:drag","start"==e)},this),show:_.bind(function(t){var e=this.diagramEditorView.getHeight(),i=Common.Utils.innerHeight();(i>e&&e<700||i<e)&&(e=Math.min(i,700),this.diagramEditorView.setHeight(e)),n?(n.serviceCommand("setAppDisabled",!1),this.needDisableEditing&&this.diagramEditorView._isExternalDocReady&&this.onDiagrammEditingDisabled(),n.attachMouseEvents()):o.apply(this),this.isExternalEditorVisible=!0,this.isHandlerCalled=!1},this),hide:_.bind(function(t){n&&(n.detachMouseEvents(),this.isExternalEditorVisible=!1)},this)}})},onLaunch:function(){this.diagramEditorView=this.createView("Common.Views.ExternalDiagramEditor",{handler:_.bind(this.handler,this)})},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onCloseChartEditor",_.bind(this.onDiagrammEditingDisabled,this)),this},handler:function(t,e){if(!this.isHandlerCalled)return this.isHandlerCalled=!0,n&&n.serviceCommand("queryClose",{mr:t}),!0},setChartData:function(){n&&n.serviceCommand("setChartData",this.diagramEditorView._chartData),this.diagramEditorView._chartData=null},loadConfig:function(n){n&&n.config&&(n.config.lang&&(t=n.config.lang),n.config.customization&&(e=n.config.customization),n.config.targetApp&&(i=n.config.targetApp))},onDiagrammEditingDisabled:function(){if(!this.diagramEditorView.isVisible()||!this.diagramEditorView._isExternalDocReady)return void(this.needDisableEditing=!0);this.diagramEditorView.setControlsDisabled(!0),Common.UI.alert({title:this.warningTitle,msg:this.warningText,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.setControlsDisabled(!1),this.diagramEditorView.hide()},this)}),this.needDisableEditing=!1},onInternalMessage:function(t){var e=t.data;if(this.diagramEditorView)if("documentReady"==e.type)this.diagramEditorView._isExternalDocReady=!0,this.diagramEditorView._chartData&&(n&&n.serviceCommand("setChartData",this.diagramEditorView._chartData),this.diagramEditorView._chartData=null),this.needDisableEditing&&this.onDiagrammEditingDisabled();else if("chartDataReady"==e.type)void 0===this.needDisableEditing&&this.diagramEditorView.setControlsDisabled(!1);else if("shortcut"==e.type)"escape"==e.data.key&&this.diagramEditorView.hide();else if("canClose"==e.type)!0===e.data.answer&&(n&&(n.serviceCommand("setAppDisabled",!0),n.serviceCommand("ok"==e.data.mr?"getChartData":"clearChartData")),this.diagramEditorView.hide());else if("processMouse"==e.type){if("mouse:up"==e.data.event)this.diagramEditorView.binding.dragStop();else if("mouse:move"==e.data.event){var i=parseInt(this.diagramEditorView.$window.css("left"))+e.data.pagex,o=parseInt(this.diagramEditorView.$window.css("top"))+e.data.pagey+34;this.diagramEditorView.binding.drag({pageX:i,pageY:o})}}else this.diagramEditorView.fireEvent("internalmessage",this.diagramEditorView,e)},onProcessMouse:function(t){"mouseup"==t.type&&this.isExternalEditorVisible&&n&&n.serviceCommand("processmouse",t)},warningTitle:"Warning",warningText:"The object is disabled because of editing by another user.",textClose:"Close",textAnonymous:"Anonymous"}}(),Common.Controllers.ExternalDiagramEditor||{}))}),define("common/main/lib/view/ExternalMergeEditor",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ExternalMergeEditor=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:910,height:Common.Utils.innerHeight()-700<0?Common.Utils.innerHeight():700,cls:"advanced-settings-dlg",header:!0,toolclose:"hide",toolcallback:_.bind(this.onToolClose,this)},t),this.template=['<div id="id-merge-editor-container" class="box" style="height:'+(e.height-85)+'px;">','<div id="id-merge-editor-placeholder" style="width: 100%;height: 100%;"></div>',"</div>",'<div class="separator horizontal"/>','<div class="footer" style="text-align: center;">','<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">'+this.textSave+"</button>",'<button id="id-btn-merge-editor-cancel" class="btn normal dlg-btn disabled" result="cancel">'+this.textClose+"</button>","</div>"].join(""),e.tpl=_.template(this.template,e),this.handler=e.handler,this._mergeData=null,this._isNewMerge=!0,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnSave=new Common.UI.Button({el:$("#id-btn-merge-editor-apply"),disabled:!0}),this.btnCancel=new Common.UI.Button({el:$("#id-btn-merge-editor-cancel"),disabled:!0}),this.$window.find(".tool.close").addClass("disabled"),this.$window.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this))},setMergeData:function(t){this._mergeData=t,this._isExternalDocReady&&this.fireEvent("setmergedata",this)},setEditMode:function(t){this._isNewMerge=!t},isEditMode:function(){return!this._isNewMerge},setControlsDisabled:function(t){this.btnSave.setDisabled(t),this.btnCancel.setDisabled(t),t?this.$window.find(".tool.close").addClass("disabled"):this.$window.find(".tool.close").removeClass("disabled")},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e)||this.hide()},onToolClose:function(){this.handler&&this.handler.call(this,"cancel")||this.hide()},setHeight:function(t){if(t>=0){var e=parseInt(this.$window.css("min-height"));t<e&&(t=e),this.$window.height(t);var i=this.initConfig.header?parseInt(this.$window.find("> .header").css("height")):0;this.$window.find("> .body").css("height",t-i),this.$window.find("> .body > .box").css("height",t-85);var n=(Common.Utils.innerHeight()-parseInt(t))/2*.9,o=(Common.Utils.innerWidth()-parseInt(this.initConfig.width))/2;this.$window.css("left",o),this.$window.css("top",n)}},textSave:"Save & Exit",textClose:"Close",
|
|
|
textTitle:"Mail Merge Recipients"},Common.Views.ExternalMergeEditor||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ExternalMergeEditor",["core","common/main/lib/view/ExternalMergeEditor"],function(){"use strict";Common.Controllers.ExternalMergeEditor=Backbone.Controller.extend(_.extend(function(){var t="en",e=void 0,i="",n=null,o=function(){n=new DocsAPI.DocEditor("id-merge-editor-placeholder",{width:"100%",height:"100%",documentType:"spreadsheet",document:{url:"_offline_",permissions:{edit:!0,download:!1}},editorConfig:{mode:"editmerge",targetApp:i,lang:t,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:e,user:{id:"uid-"+Date.now()}},events:{onReady:function(){},onDocumentStateChange:function(){},onError:function(){},onInternalMessage:_.bind(this.onInternalMessage,this)}}),Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this))};return{views:["Common.Views.ExternalMergeEditor"],initialize:function(){this.addListeners({"Common.Views.ExternalMergeEditor":{setmergedata:_.bind(this.setMergeData,this),drag:_.bind(function(t,e){n&&n.serviceCommand("window:drag","start"==e)},this),show:_.bind(function(t){var e=this.mergeEditorView.getHeight(),i=Common.Utils.innerHeight();(i>e&&e<700||i<e)&&(e=Math.min(i,700),this.mergeEditorView.setHeight(e)),n?(n.serviceCommand("setAppDisabled",!1),this.needDisableEditing&&this.mergeEditorView._isExternalDocReady&&this.onMergeEditingDisabled(),n.attachMouseEvents()):o.apply(this),this.isExternalEditorVisible=!0},this),hide:_.bind(function(t){n&&(n.detachMouseEvents(),this.isExternalEditorVisible=!1)},this)}})},onLaunch:function(){this.mergeEditorView=this.createView("Common.Views.ExternalMergeEditor",{handler:_.bind(this.handler,this)})},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onCloseMergeEditor",_.bind(this.onMergeEditingDisabled,this)),this},handler:function(t,e){return n&&n.serviceCommand("queryClose",{mr:t}),!0},setMergeData:function(){n&&n.serviceCommand("setMergeData",this.mergeEditorView._mergeData),this.mergeEditorView.setEditMode(!0),this.mergeEditorView._mergeData=null},loadConfig:function(n){n&&n.config&&(n.config.lang&&(t=n.config.lang),n.config.customization&&(e=n.config.customization),n.config.targetApp&&(i=n.config.targetApp))},onMergeEditingDisabled:function(){if(!this.mergeEditorView.isVisible()||!this.mergeEditorView._isExternalDocReady)return void(this.needDisableEditing=!0);this.mergeEditorView.setControlsDisabled(!0),Common.UI.alert({title:this.warningTitle,msg:this.warningText,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){this.setControlsDisabled(!1),this.mergeEditorView.hide()},this)}),this.needDisableEditing=!1},onInternalMessage:function(t){var e=t.data;if(this.mergeEditorView)if("documentReady"==e.type)this.mergeEditorView._isExternalDocReady=!0,this.mergeEditorView.setControlsDisabled(!1),this.mergeEditorView._mergeData&&(n&&n.serviceCommand("setMergeData",this.mergeEditorView._mergeData),this.mergeEditorView._mergeData=null),this.needDisableEditing&&this.onMergeEditingDisabled();else if("shortcut"==e.type)"escape"==e.data.key&&this.mergeEditorView.hide();else if("canClose"==e.type)!0===e.data.answer&&(n&&(n.serviceCommand("setAppDisabled",!0),"ok"==e.data.mr&&n.serviceCommand("getMergeData")),this.mergeEditorView.hide());else if("processMouse"==e.type){if("mouse:up"==e.data.event)this.mergeEditorView.binding.dragStop();else if("mouse:move"==e.data.event){var i=parseInt(this.mergeEditorView.$window.css("left"))+e.data.pagex,o=parseInt(this.mergeEditorView.$window.css("top"))+e.data.pagey+34;this.mergeEditorView.binding.drag({pageX:i,pageY:o})}}else this.mergeEditorView.fireEvent("internalmessage",this.mergeEditorView,e)},onProcessMouse:function(t){"mouseup"==t.type&&this.isExternalEditorVisible&&n&&n.serviceCommand("processmouse",t)},warningTitle:"Warning",warningText:"The object is disabled because of editing by another user.",textClose:"Close",textAnonymous:"Anonymous"}}(),Common.Controllers.ExternalMergeEditor||{}))}),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:"#ee3525",date:void 0,changetext:"",lock:!1,lockuser:"",type:0,changedata:null,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={};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"],function(){"use strict";Common.Controllers.ReviewChanges=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.ReviewChanges"],views:["Common.Views.ReviewChanges","Common.Views.ReviewChangesPopover"],sdkViewName:"#id_main",initialize:function(){this.addListeners({"Common.Views.ReviewChanges":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this)}})},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.ReviewChanges"),this.popoverChanges=new Common.Collections.ReviewChanges,this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this.view=this.createView("Common.Views.ReviewChanges",{store:this.collection,popoverChanges:this.popoverChanges}),this.view.render(),this.bindViewEvents(this.view,this.events);this.view.btnPrev.on("click",_.bind(this.onBtnPreviewClick,this)),this.view.btnNext.on("click",_.bind(this.onBtnPreviewClick,this)),this.view.btnAccept.on("click",_.bind(this.onAcceptClick,this)),this.view.btnAccept.menu.on("item:click",_.bind(this.onAcceptClick,this)),this.view.btnReject.on("click",_.bind(this.onRejectClick,this)),this.view.btnReject.menu.on("item:click",_.bind(this.onRejectClick,this)),this._state={posx:-1e3,posy:-1e3,popoverVisible:!1}},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_onShowRevisionsChange",_.bind(this.onApiShowChange,this)),this.api.asc_registerCallback("asc_onUpdateRevisionsChangesPosition",_.bind(this.onApiUpdateChangePosition,this)))},setMode:function(t){return this.view.isReviewOnly=t.isReviewOnly,this.view.btnAccept.setDisabled(t.isReviewOnly),this.view.btnReject.setDisabled(t.isReviewOnly),this},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,s=null!==t[0].get_LockUserId(),a=this.getUserName(t[0].get_LockUserId());this.popoverChanges.reset(e),o&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i+25,n)),this.getPopover().show(o,s,a),this.view.isReviewOnly||this._state.lock===s||(this.view.btnAccept.setDisabled(1==s),this.view.btnReject.setDisabled(1==s),this._state.lock=s),this._state.posx=i,this._state.posy=n,this._state.popoverVisible=!0}else this._state.popoverVisible&&(this._state.posx=this._state.posy=-1e3,this._state.popoverVisible=!1,this.getPopover().hide(),this.popoverChanges.reset())},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+25,e)))},findChange:function(t,e){return _.isUndefined(t)?this.collection.findWhere({id:e}):this.collection.findWhere({uid:t})},getPopover:function(){return this.view.getPopover(this.sdkViewName)},readSDKChange:function(t){var e=this,i=[];return _.each(t,function(t){var n="",o="",s=t.get_Value();switch(t.get_Type()){case Asc.c_oAscRevisionsChangeType.TextAdd:n=e.textInserted,"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=e.textDeleted,"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 a=e.api.asc_GetStyleNameById(s.Get_PStyle());_.isEmpty(a)||(o+=a+", ")}_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="</b>",n+=o}var r=""==t.get_DateTime()?new Date:new Date(t.get_DateTime()),l=t.get_UserColor(),c=new Common.Models.ReviewChange({uid:Common.UI.getId(),userid:t.get_UserId(),username:t.get_UserName(),usercolor:"#"+Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),date:e.dateToLocaleTimeString(r),changetext:n,id:Common.UI.getId(),lock:null!==t.get_LockUserId(),lockuser:t.get_LockUserId(),type:t.get_Type(),changedata:t,scope:e.view});i.push(c)}),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(t.options.value){case 1:this.api.asc_GetPrevRevisionsChange();break;case 2: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)},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"},Common.Controllers.ReviewChanges||{}))});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",jsrsasign:"../vendor/jsrsasign/jsrsasign-latest-all-min",allfonts:"../../sdkjs/common/AllFonts",sdk:"../../sdkjs/word/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","jsrsasign"]},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:"DE",autoCreate:!1,controllers:["Viewport","DocumentHolder","Toolbar","Statusbar","RightMenu","LeftMenu","Main","Common.Controllers.Fonts","Common.Controllers.History","Common.Controllers.Chat","Common.Controllers.Comments","Common.Controllers.Plugins","Common.Controllers.ExternalDiagramEditor","Common.Controllers.ExternalMergeEditor","Common.Controllers.ReviewChanges"]});Common.Locale.apply(),require(["documenteditor/main/app/controller/Viewport","documenteditor/main/app/controller/DocumentHolder","documenteditor/main/app/controller/Toolbar","documenteditor/main/app/controller/Statusbar","documenteditor/main/app/controller/RightMenu","documenteditor/main/app/controller/LeftMenu","documenteditor/main/app/controller/Main","documenteditor/main/app/view/FileMenuPanels","documenteditor/main/app/view/ParagraphSettings","documenteditor/main/app/view/HeaderFooterSettings","documenteditor/main/app/view/ImageSettings","documenteditor/main/app/view/TableSettings","documenteditor/main/app/view/ShapeSettings","documenteditor/main/app/view/TextArtSettings","common/main/lib/util/utils","common/main/lib/util/LocalStorage","common/main/lib/controller/Fonts","common/main/lib/controller/History","common/main/lib/controller/Comments","common/main/lib/controller/Chat","common/main/lib/controller/Plugins","documenteditor/main/app/view/ChartSettings","common/main/lib/controller/ExternalDiagramEditor","common/main/lib/controller/ExternalMergeEditor","common/main/lib/controller/ReviewChanges"],function(){n.start()})},function(t){if("timeout"==t.requireType&&!reqerr){var e=(function(){for(var t,e=/\+/g,i=/([^&=]+)=?([^&]*)/g,n=function(t){return decodeURIComponent(t.replace(e," "))},o=window.location.search.substring(1),s={};t=i.exec(o);)s[n(t[1])]=n(t[2]);return s}().lang||"en").split("-")[0];reqerr="de"==e?"Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.":"es"==e?"La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.":"fr"==e?"La connexion est trop lente, certains des composants n'ons pas pu être chargé. Veuillez recharger la page.":"ru"==e?"Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.":"The connection is too slow, some of the components could not be loaded. Please reload the page.",window.alert(reqerr),window.location.reload()}}),define("../apps/documenteditor/main/app.js",function(){}); |