|
|
function onDropDownKeyDown(e){var t=$(this),n=t.parent(),r=jQuery.Event("keydown.before.bs.dropdown"),i=jQuery.Event("keydown.after.bs.dropdown");n.trigger(r),n.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(e=arguments[1]),/^(38|40|27|13|9|37|39)$/.test(e.keyCode)&&!e.ctrlKey&&!e.altKey&&(patchDropDownKeyDownAdditional.call(this,e),/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation()))):(patchDropDownKeyDown.call(this,e),e.preventDefault(),e.stopPropagation()),n.trigger(i)}function patchDropDownKeyDown(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);e.preventDefault(),e.stopPropagation();if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&e.keyCode==27){if(e.which==27){i=$("[role=menu] li.dropdown-submenu.over:visible",n);if(i.size())return i.eq(i.size()-1).removeClass("over"),!1;n.hasClass("dropdown-submenu")&&n.hasClass("over")?(n.removeClass("over"),n.find("> a").focus()):n.find("[data-toggle=dropdown]").focus()}return r?t.click():undefined}var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(":focus"));if(e.keyCode==39){if(s<0)return;var o=i.eq(s).parent();o.hasClass("dropdown-submenu")&&!o.hasClass("over")&&(o.mouseenter(),o.addClass("focused-submenu"),_.delay(function(){var e=$("> [role=menu]",o),t=e.find("> li:not(.divider):not(.disabled):visible > a"),n=0;if(e.find("> .menu-scroll").length>0){var r=e.scrollTop();for(var i=0;i<t.length;i++)if(t[i].offsetTop>r){n=i;break}}t.length>0&&t.eq(n).focus()},250))}else e.keyCode==37?n.hasClass("dropdown-submenu")&&n.hasClass("over")&&(n.removeClass("over"),n.find("> a").focus()):(e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s<i.length-1?s++:t.hasClass("no-cyclic")?s=i.length-1:s=0),~s||(s=0),n.hasClass("dropdown-submenu")&&n.hasClass("over")&&n.addClass("focused-submenu"),i.eq(s).focus())}function patchDropDownKeyDownAdditional(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation());if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&(e.keyCode==27||e.keyCode==37||e.keyCode==39))return r?t.click():undefined;var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(".focus"));e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s<i.length-1?s++:t.hasClass("no-cyclic")?s=i.length-1:s=0),~s||(s=0),i.removeClass("focus"),i.eq(s).addClass("focus")}function getParent(e){var t=e.attr("data-target");t||(t=e.attr("href"),t=t&&/#/.test(t)&&t.replace(/.*(?=#[^\s]*$)/,""));var n=t&&$(t);return n&&n.length?n:e.parent()}function clearMenus(e){$(".dropdown-toggle").each(function(t){var n=$(this).parent();if(!n.hasClass("open"))return;n.trigger(t=$.Event("hide.bs.dropdown"));if(t.isDefaultPrevented())return;n.removeClass("open").trigger("hidden.bs.dropdown",e)})}(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.5.2";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else{var o=x.keys(e);for(var i=0,s=o.length;i<s;i++)if(t.call(r,e[o[i]],o[i],e)===n)return}};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r},x.sample=function(e,t,n){return arguments.length<2||n?e[x.random(e.length-1)]:x.shuffle(e).slice(0,Math.max(0,t))};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index-t.index}),"value")};var L=function(e){return function(t,n,r){var i={},s=n==null?x.identity:k(n);return T(t,function(n,o){var u=s.call(r,n,o,t);e(i,u,n)}),i}};x.groupBy=L(function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)}),x.indexBy=L(function(e,t,n){e[t]=n}),x.countBy=L(function(e,t){x.has(e,t)?e[t]++:e[t]=1}),x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t==null||n?e[0]:u.call(e,0,t)},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t==null||n?e[e.length-1]:u.call(e,Math.max(e.length-t,0))},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return t&&x.every(e,x.isArray)?a.apply(n,e):(T(e,function(e){x.isArray(e)||x.isArguments(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n)};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(x.flatten(arguments,!0))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=x.max(x.pluck(arguments,"length").concat(0)),t=new Array(e);for(var n=0;n<e;n++)t[n]=x.pluck(arguments,""+n);return t},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(S&&e.bind===S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:new Date,o=null,s=e.apply(r,i)};return function(){var f=new Date;!u&&n.leading===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(o),o=null,u=f,s=e.apply(r,i)):!o&&n.trailing!==!1&&(o=setTimeout(a,l)),s}},x.debounce=function(e,t,n){var r,i,s,o,u;return function(){s=this,i=arguments,o=new Date;var a=function(){var f=new Date-o;f<t?r=setTimeout(a,t-f):(r=null,n||(u=e.apply(s,i)))},f=n&&!r;return r||(r=setTimeout(a,t)),f&&(u=e.apply(s,i)),u}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=x.keys(e),n=t.length,r=new Array(n);for(var i=0;i<n;i++)r[i]=e[t[i]];return r},x.pairs=function(e){var t=x.keys(e),n=t.length,r=new Array(n);for(var i=0;i<n;i++)r[i]=[t[i],e[t[i]]];return r},x.invert=function(e){var t={},n=x.keys(e);for(var r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;var o=e.constructor,u=t.constructor;if(o!==u&&!(x.isFunction(o)&&o instanceof o&&x.isFunction(u)&&u instanceof u))return!1;n.push(e),r.push(t);var a=0,l=!0;if(i=="[object Array]"){a=e.length,l=a==t.length;if(l)while(a--)if(!(l=M(e[a],t[a],n,r)))break}else{for(var c in e)if(x.has(e,c)){a++;if(!(l=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(l){for(c in t)if(x.has(t,c)&&!(a--))break;l=!a}}return n.pop(),r.pop(),l};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(Math.max(0,e));for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),define("underscore",function(e){return function(){var t,n;return t||e._}}(this)),function(e,t){typeof module=="object"&&typeof module.exports=="object"?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}(typeof window!="undefined"?window:this,function(window,noGlobal){function isArrayLike(e){var t=!!e&&"length"in e&&e.length,n=jQuery.type(e);return n==="function"||jQuery.isWindow(e)?!1:n==="array"||t===0||typeof t=="number"&&t>0&&t-1 in e}function winnow(e,t,n){if(jQuery.isFunction(t))return jQuery.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return jQuery.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(risSimple.test(t))return jQuery.filter(t,e,n);t=jQuery.filter(t,e)}return jQuery.grep(e,function(e){return indexOf.call(t,e)>-1!==n})}function sibling(e,t){while((e=e[t])&&e.nodeType!==1);return e}function createOptions(e){var t={};return jQuery.each(e.match(rnotwhite)||[],function(e,n){t[n]=!0}),t}function completed(){document.removeEventListener("DOMContentLoaded",completed),window.removeEventListener("load",completed),jQuery.ready()}function Data(){this.expando=jQuery.expando+Data.uid++}function dataAttr(e,t,n){var r;if(n===undefined&&e.nodeType===1){r="data-"+t.replace(rmultiDash,"-$&").toLowerCase(),n=e.getAttribute(r);if(typeof n=="string"){try{n=n==="true"?!0:n==="false"?!1:n==="null"?null:+n+""===n?+n:rbrace.test(n)?jQuery.parseJSON(n):n}catch(i){}dataUser.set(e,t,n)}else n=undefined}return n}function adjustCSS(e,t,n,r){var i,s=1,o=20,u=r?function(){return r.cur()}:function(){return jQuery.css(e,t,"")},a=u(),f=n&&n[3]||(jQuery.cssNumber[t]?"":"px"),l=(jQuery.cssNumber[t]||f!=="px"&&+a)&&rcssNum.exec(jQuery.css(e,t));if(l&&l[3]!==f){f=f||l[3],n=n||[],l=+a||1;do s=s||".5",l/=s,jQuery.style(e,t,l+f);while(s!==(s=u()/a)&&s!==1&&--o)}return n&&(l=+l||+a||0,i=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=f,r.start=l,r.end=i)),i}function getAll(e,t){var n=typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll(t||"*"):[];return t===undefined||t&&jQuery.nodeName(e,t)?jQuery.merge([e],n):n}function setGlobalEval(e,t){var n=0,r=e.length;for(;n<r;n++)dataPriv.set(e[n],"globalEval",!t||dataPriv.get(t[n],"globalEval"))}function buildFragment(e,t,n,r,i){var s,o,u,a,f,l,c=t.createDocumentFragment(),h=[],p=0,d=e.length;for(;p<d;p++){s=e[p];if(s||s===0)if(jQuery.type(s)==="object")jQuery.merge(h,s.nodeType?[s]:s);else if(!rhtml.test(s))h.push(t.createTextNode(s));else{o=o||c.appendChild(t.createElement("div")),u=(rtagName.exec(s)||["",""])[1].toLowerCase(),a=wrapMap[u]||wrapMap._default,o.innerHTML=a[1]+jQuery.htmlPrefilter(s)+a[2],l=a[0];while(l--)o=o.lastChild;jQuery.merge(h,o.childNodes),o=c.firstChild,o.textContent=""}}c.textContent="",p=0;while(s=h[p++]){if(r&&jQuery.inArray(s,r)>-1){i&&i.push(s);continue}f=jQuery.contains(s.ownerDocument,s),o=getAll(c.appendChild(s),"script"),f&&setGlobalEval(o);if(n){l=0;while(s=o[l++])rscriptType.test(s.type||"")&&n.push(s)}}return c}function returnTrue(){return!0}function returnFalse(){return!1}function safeActiveElement(){try{return document.activeElement}catch(e){}}function on(e,t,n,r,i,s){var o,u;if(typeof t=="object"){typeof n!="string"&&(r=r||n,n=undefined);for(u in t)on(e,u,n,r,t[u],s);return e}r==null&&i==null?(i=n,r=n=undefined):i==null&&(typeof n=="string"?(i=r,r=undefined):(i=r,r=n,n=undefined));if(i===!1)i=returnFalse;else if(!i)return e;return s===1&&(o=i,i=function(e){return jQuery().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=jQuery.guid++)),e.each(function(){jQuery.event.add(this,t,i,r,n)})}function manipulationTarget(e,t){return jQuery.nodeName(e,"table")&&jQuery.nodeName(t.nodeType!==11?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function disableScript(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function restoreScript(e){var t=rscriptTypeMasked.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function cloneCopyEvent(e,t){var n,r,i,s,o,u,a,f;if(t.nodeType!==1)return;if(dataPriv.hasData(e)){s=dataPriv.access(e),o=dataPriv.set(t,s),f=s.events;if(f){delete o.handle,o.events={};for(i in f)for(n=0,r=f[i].length;n<r;n++)jQuery.event.add(t,i,f[i][n])}}dataUser.hasData(e)&&(u=dataUser.access(e),a=jQuery.extend({},u),dataUser.set(t,a))}function fixInput(e,t){var n=t.nodeName.toLowerCase();if(n==="input"&&rcheckableType.test(e.type))t.checked=e.checked;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function domManip(e,t,n,r){t=concat.apply([],t);var i,s,o,u,a,f,l=0,c=e.length,h=c-1,p=t[0],d=jQuery.isFunction(p);if(d||c>1&&typeof p=="string"&&!support.checkClone&&rchecked.test(p))return e.each(function(i){var s=e.eq(i);d&&(t[0]=p.call(this,i,s.html())),domManip(s,t,n,r)});if(c){i=buildFragment(t,e[0].ownerDocument,!1,e,r),s=i.firstChild,i.childNodes.length===1&&(i=s);if(s||r){o=jQuery.map(getAll(i,"script"),disableScript),u=o.length;for(;l<c;l++)a=i,l!==h&&(a=jQuery.clone(a,!0,!0),u&&jQuery.merge(o,getAll(a,"script"))),n.call(e[l],a,l);if(u){f=o[o.length-1].ownerDocument,jQuery.map(o,restoreScript);for(l=0;l<u;l++)a=o[l],rscriptType.test(a.type||"")&&!dataPriv.access(a,"globalEval")&&jQuery.contains(f,a)&&(a.src?jQuery._evalUrl&&jQuery._evalUrl(a.src):jQuery.globalEval(a.textContent.replace(rcleanScript,"")))}}}return e}function remove(e,t,n){var r,i=t?jQuery.filter(t,e):e,s=0;for(;(r=i[s])!=null;s++)!n&&r.nodeType===1&&jQuery.cleanData(getAll(r)),r.parentNode&&(n&&jQuery.contains(r.ownerDocument,r)&&setGlobalEval(getAll(r,"script")),r.parentNode.removeChild(r));return e}function actualDisplay(e,t){var n=jQuery(t.createElement(e)).appendTo(t.body),r=jQuery.css(n[0],"display");return n.detach(),r}function defaultDisplay(e){var t=document,n=elemdisplay[e];if(!n){n=actualDisplay(e,t);if(n==="none"||!n)iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=iframe[0].contentDocument,t.write(),t.close(),n=actualDisplay(e,t),iframe.detach();elemdisplay[e]=n}return n}function curCSS(e,t,n){var r,i,s,o,u=e.style;return n=n||getStyles(e),o=n?n.getPropertyValue(t)||n[t]:undefined,(o===""||o===undefined)&&!jQuery.contains(e.ownerDocument,e)&&(o=jQuery.style(e,t)),n&&!support.pixelMarginRight()&&rnumnonpx.test(o)&&rmargin.test(t)&&(r=u.width,i=u.minWidth,s=u.maxWidth,u.minWidth=u.maxWidth=u.width=o,o=n.width,u.width=r,u.minWidth=i,u.maxWidth=s),o!==undefined?o+"":o}function addGetHookIf(e,t){return{get:function(){if(e()){delete this.get;return}return(this.get=t).apply(this,arguments)}}}function vendorPropName(e){if(e in emptyStyle)return e;var t=e[0].toUpperCase()+e.slice(1),n=cssPrefixes.length;while(n--){e=cssPrefixes[n]+t;if(e in emptyStyle)return e}}function setPositiveNumber(e,t,n){var r=rcssNum.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function augmentWidthOrHeight(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=jQuery.css(e,n+cssExpand[s],!0,i)),r?(n==="content"&&(o-=jQuery.css(e,"padding"+cssExpand[s],!0,i)),n!=="margin"&&(o-=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i))):(o+=jQuery.css(e,"padding"+cssExpand[s],!0,i),n!=="padding"&&(o+=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i)));return o}function getWidthOrHeight(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=getStyles(e),o=jQuery.css(e,"boxSizing",!1,s)==="border-box";document.msFullscreenElement&&window.top!==window&&e.getClientRects().length&&(i=Math.round(e.getBoundingClientRect()[t]*100));if(i<=0||i==null){i=curCSS(e,t,s);if(i<0||i==null)i=e.style[t];if(rnumnonpx.test(i))return i;r=o&&(support.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+augmentWidthOrHeight(e,t,n||(o?"border":"content"),r,s)+"px"}function showHide(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o<u;o++){r=e[o];if(!r.style)continue;s[o]=dataPriv.get(r,"olddisplay"),n=r.style.display,t?(!s[o]&&n==="none"&&(r.style.display=""),r.style.display===""&&isHidden(r)&&(s[o]=dataPriv.access(r,"olddisplay",defaultDisplay(r.nodeName)))):(i=isHidden(r),(n!=="none"||!i)&&dataPriv.set(r,"olddisplay",i?n:jQuery.css(r,"display")))}for(o=0;o<u;o++){r=e[o];if(!r.style)continue;if(!t||r.style.display==="none"||r.style.display==="")r.style.display=t?s[o]||"":"none"}return e}function Tween(e,t,n,r,i){return new Tween.prototype.init(e,t,n,r,i)}function createFxNow(){return window.setTimeout(function(){fxNow=undefined}),fxNow=jQuery.now()}function genFx(e,t){var n,r=0,i={height:e};t=t?1:0;for(;r<4;r+=2-t)n=cssExpand[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function createTween(e,t,n){var r,i=(Animation.tweeners[t]||[]).concat(Animation.tweeners["*"]),s=0,o=i.length;for(;s<o;s++)if(r=i[s].call(n,t,e))return r}function defaultPrefilter(e,t,n){var r,i,s,o,u,a,f,l,c=this,h={},p=e.style,d=e.nodeType&&isHidden(e),v=dataPriv.get(e,"fxshow");n.queue||(u=jQuery._queueHooks(e,"fx"),u.unqueued==null&&(u.unqueued=0,a=u.empty.fire,u.empty.fire=function(){u.unqueued||a()}),u.unqueued++,c.always(function(){c.always(function(){u.unqueued--,jQuery.queue(e,"fx").length||u.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],f=jQuery.css(e,"display"),l=f==="none"?dataPriv.get(e,"olddisplay")||defaultDisplay(e.nodeName):f,l==="inline"&&jQuery.css(e,"float")==="none"&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",c.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){i=t[r];if(rfxtypes.exec(i)){delete t[r],s=s||i==="toggle";if(i===(d?"hide":"show")){if(i!=="show"||!v||v[r]===undefined)continue;d=!0}h[r]=v&&v[r]||jQuery.style(e,r)}else f=undefined}if(!jQuery.isEmptyObject(h)){v?"hidden"in v&&(d=v.hidden):v=dataPriv.access(e,"fxshow",{}),s&&(v.hidden=!d),d?jQuery(e).show():c.done(function(){jQuery(e).hide()}),c.done(function(){var t;dataPriv.remove(e,"fxshow");for(t in h)jQuery.style(e,t,h[t])});for(r in h)o=createTween(d?v[r]:0,r,c),r in v||(v[r]=o.start,d&&(o.end=o.start,o.start=r==="width"||r==="height"?1:0))}else(f==="none"?defaultDisplay(e.nodeName):f)==="inline"&&(p.display=f)}function propFilter(e,t){var n,r,i,s,o;for(n in e){r=jQuery.camelCase(n),i=t[r],s=e[n],jQuery.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=jQuery.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Animation(e,t,n){var r,i,s=0,o=Animation.prefilters.length,u=jQuery.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=fxNow||createFxNow(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),s<1&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:jQuery.extend({},t),opts:jQuery.extend(!0,{specialEasing:{},easing:jQuery.easing._default},n),originalProperties:t,originalOptions:n,startTime:fxNow||createFxNow(),duration:n.duration,tweens:[],createTween:function(t,n){var r=jQuery.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);return t?(u.notifyWith(e,[f,1,0]),u.resolveWith(e,[f,t])):u.rejectWith(e,[f,t]),this}}),l=f.props;propFilter(l,f.opts.specialEasing);for(;s<o;s++){r=Animation.prefilters[s].call(f,e,l,f.opts);if(r)return jQuery.isFunction(r.stop)&&(jQuery._queueHooks(f.elem,f.opts.queue).stop=jQuery.proxy(r.stop,r)),r}return jQuery.map(l,createTween,f),jQuery.isFunction(f.opts.start)&&f.opts.start.call(e,f),jQuery.fx.timer(jQuery.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function getClass(e){return e.getAttribute&&e.getAttribute("class")||""}function addToPrefiltersOrTransports(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(n))while(r=s[i++])r[0]==="+"?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function inspectPrefiltersOrTransports(e,t,n,r){function o(u){var a;return i[u]=!0,jQuery.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f])return t.dataTypes.unshift(f),o(f),!1;if(s)return!(a=f)}),a}var i={},s=e===transports;return o(t.dataTypes[0])||!i["*"]&&o("*")}function ajaxExtend(e,t){var n,r,i=jQuery.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&jQuery.extend(!0,e,r),e}function ajaxHandleResponses(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while(a[0]==="*")a.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}if(s)return s!==a[0]&&a.unshift(s),n[s]}function ajaxConvert(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s){e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift();if(s)if(s==="*")s=a;else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o)for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}}}if(o!==!0)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}return{state:"success",data:t}}function buildParams(e,t,n,r){var i;if(jQuery.isArray(t))jQuery.each(t,function(t,i){n||rbracket.test(e)?r(e,i):buildParams(e+"["+(typeof i=="object"&&i!=null?t:"")+"]",i,n,r)});else if(!n&&jQuery.type(t)==="object")for(i in t)buildParams(e+"["+i+"]",t[i],n,r);else r(e,t)}function getWindow(e){return jQuery.isWindow(e)?e:e.nodeType===9&&e.defaultView}var arr=[],document=window.document,slice=arr.slice,concat=arr.concat,push=arr.push,indexOf=arr.indexOf,class2type={},toString=class2type.toString,hasOwn=class2type.hasOwnProperty,support={},version="2.2.3",jQuery=function(e,t){return new jQuery.fn.init(e,t)},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(e,t){return t.toUpperCase()};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,selector:"",length:0,toArray:function(){return slice.call(this)},get:function(e){return e!=null?e<0?this[e+this.length]:this[e]:slice.call(this)},pushStack:function(e){var t=jQuery.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return jQuery.each(this,e)},map:function(e){return this.pushStack(jQuery.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:push,sort:arr.sort,splice:arr.splice},jQuery.extend=jQuery.fn.extend=function(){var e,t,n,r,i,s,o=arguments[0]||{},u=1,a=arguments.length,f=!1;typeof o=="boolean"&&(f=o,o=arguments[u]||{},u++),typeof o!="object"&&!jQuery.isFunction(o)&&(o={}),u===a&&(o=this,u--);for(;u<a;u++)if((e=arguments[u])!=null)for(t in e){n=o[t],r=e[t];if(o===r)continue;f&&r&&(jQuery.isPlainObject(r)||(i=jQuery.isArray(r)))?(i?(i=!1,s=n&&jQuery.isArray(n)?n:[]):s=n&&jQuery.isPlainObject(n)?n:{},o[t]=jQuery.extend(f,s,r)):r!==undefined&&(o[t]=r)}return o},jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return jQuery.type(e)==="function"},isArray:Array.isArray,isWindow:function(e){return e!=null&&e===e.window},isNumeric:function(e){var t=e&&e.toString();return!jQuery.isArray(e)&&t-parseFloat(t)+1>=0},isPlainObject:function(e){var t;if(jQuery.type(e)!=="object"||e.nodeType||jQuery.isWindow(e))return!1;if(e.constructor&&!hasOwn.call(e,"constructor")&&!hasOwn.call(e.constructor.prototype||{},"isPrototypeOf"))return!1;for(t in e);return t===undefined||hasOwn.call(e,t)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?class2type[toString.call(e)]||"object":typeof e},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code),code&&(code.indexOf("use strict")===1?(script=document.createElement("script"),script.text=code,document.head.appendChild(script).parentNode.removeChild(script)):indirect(code))},camelCase:function(e){return e.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,r=0;if(isArrayLike(e)){n=e.length;for(;r<n;r++)if(t.call(e[r],r,e[r])===!1)break}else for(r in e)if(t.call(e[r],r,e[r])===!1)break;return e},trim:function(e){return e==null?"":(e+"").replace(rtrim,"")},makeArray:function(e,t){var n=t||[];return e!=null&&(isArrayLike(Object(e))?jQuery.merge(n,typeof e=="string"?[e]:e):push.call(n,e)),n},inArray:function(e,t,n){return t==null?-1:indexOf.call(t,e,n)},merge:function(e,t){var n=+t.length,r=0,i=e.length;for(;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length,u=!n;for(;s<o;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(e,t,n){var r,i,s=0,o=[];if(isArrayLike(e)){r=e.length;for(;s<r;s++)i=t(e[s],s,n),i!=null&&o.push(i)}else for(s in e)i=t(e[s],s,n),i!=null&&o.push(i);return concat.apply([],o)},guid:1,proxy:function(e,t){var n,r,i;return typeof t=="string"&&(n=e[t],t=e,e=n),jQuery.isFunction(e)?(r=slice.call(arguments,2),i=function(){return e.apply(t||this,r.concat(slice.call(arguments)))},i.guid=e.guid=e.guid||jQuery.guid++,i):undefined},now:Date.now,support:support}),typeof Symbol=="function"&&(jQuery.fn[Symbol.iterator]=arr[Symbol.iterator]),jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){class2type["[object "+t+"]"]=t.toLowerCase()});var Sizzle=function(e){function st(e,t,r,i){var s,u,f,l,c,d,g,y,S=t&&t.ownerDocument,x=t?t.nodeType:9;r=r||[];if(typeof e!="string"||!e||x!==1&&x!==9&&x!==11)return r;if(!i){(t?t.ownerDocument||t:E)!==p&&h(t),t=t||p;if(v){if(x!==11&&(d=Y.exec(e)))if(s=d[1]){if(x===9){if(!(f=t.getElementById(s)))return r;if(f.id===s)return r.push(f),r}else if(S&&(f=S.getElementById(s))&&b(t,f)&&f.id===s)return r.push(f),r}else{if(d[2])return D.apply(r,t.getElementsByTagName(e)),r;if((s=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return D.apply(r,t.getElementsByClassName(s)),r}if(n.qsa&&!C[e+" "]&&(!m||!m.test(e))){if(x!==1)S=t,y=e;else if(t.nodeName.toLowerCase()!=="object"){(l=t.getAttribute("id"))?l=l.replace(et,"\\$&"):t.setAttribute("id",l=w),g=o(e),u=g.length,c=$.test(l)?"#"+l:"[id='"+l+"']";while(u--)g[u]=c+" "+mt(g[u]);y=g.join(","),S=Z.test(e)&&dt(t.parentNode)||t}if(y)try{return D.apply(r,S.querySelectorAll(y)),r}catch(T){}finally{l===w&&t.removeAttribute("id")}}}}return a(e.replace(U,"$1"),t,r,i)}function ot(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function ut(e){return e[w]=!0,e}function at(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ft(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function lt(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function pt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function dt(e){return e&&typeof e.getElementsByTagName!="undefined"&&e}function vt(){}function mt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function gt(e,t,n){var r=t.dir,i=n&&r==="parentNode",s=x++;return t.first?function(t,n,s){while(t=t[r])if(t.nodeType===1||i)return e(t,n,s)}:function(t,n,o){var u,a,f,l=[S,s];if(o){while(t=t[r])if(t.nodeType===1||i)if(e(t,n,o))return!0}else while(t=t[r])if(t.nodeType===1||i){f=t[w]||(t[w]={}),a=f[t.uniqueID]||(f[t.uniqueID]={});if((u=a[r])&&u[0]===S&&u[1]===s)return l[2]=u[2];a[r]=l;if(l[2]=e(t,n,o))return!0}}}function yt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function bt(e,t,n){var r=0,i=t.length;for(;r<i;r++)st(e,t[r],n);return n}function wt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function Et(e,t,n,r,i,s){return r&&!r[w]&&(r=Et(r)),i&&!i[w]&&(i=Et(i,s)),ut(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||bt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?wt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=wt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?H(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=wt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function St(e){var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=gt(function(e){return e===t},u,!0),c=gt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];for(;a<s;a++)if(n=r.relative[e[a].type])h=[gt(yt(h),n)];else{n=r.filter[e[a].type].apply(null,e[a].matches);if(n[w]){i=++a;for(;i<s;i++)if(r.relative[e[i].type])break;return Et(a>1&&yt(h),a>1&&mt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(U,"$1"),n,a<i&&St(e.slice(a,i)),i<s&&St(e=e.slice(i)),i<s&&mt(e))}h.push(n)}return yt(h)}function xt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,d,m,g=0,y="0",b=s&&[],w=[],E=f,x=s||i&&r.find.TAG("*",l),T=S+=E==null?1:Math.random()||.1,N=x.length;l&&(f=o===p||o||l);for(;y!==N&&(c=x[y])!=null;y++){if(i&&c){d=0,!o&&c.ownerDocument!==p&&(h(c),u=!v);while(m=e[d++])if(m(c,o||p,u)){a.push(c);break}l&&(S=T)}n&&((c=!m&&c)&&g--,s&&b.push(c))}g+=y;if(n&&y!==g){d=0;while(m=t[d++])m(b,w,o,u);if(s){if(g>0)while(y--)!b[y]&&!w[y]&&(w[y]=M.call(a));w=wt(w)}D.apply(a,w),l&&!s&&w.length>0&&g+t.length>1&&st.uniqueSort(a)}return l&&(S=T,f=E),b};return n?ut(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ot(),N=ot(),C=ot(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){var n=0,r=e.length;for(;n<r;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",j="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",I="\\["+j+"*("+F+")(?:"+j+"*([*^$|!~]?=)"+j+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+F+"))|)"+j+"*\\]",q=":("+F+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|"+".*"+")\\)|)",R=new RegExp(j+"+","g"),U=new RegExp("^"+j+"+|((?:^|[^\\\\])(?:\\\\.)*)"+j+"+$","g"),z=new RegExp("^"+j+"*,"+j+"*"),W=new RegExp("^"+j+"*([>+~]|"+j+")"+j+"*"),X=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),V=new RegExp(q),$=new RegExp("^"+F+"$"),J={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},K=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,G=/^[^{]+\{\s*\[native \w/,Y=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/[+~]/,et=/'|\\/g,tt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),nt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)},rt=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(it){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=st.support={},s=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},h=st.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;if(o===p||o.nodeType!==9||!o.documentElement)return p;p=o,d=p.documentElement,v=!s(p),(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",rt,!1):i.attachEvent&&i.attachEvent("onunload",rt)),n.attributes=at(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=at(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=G.test(p.getElementsByClassName),n.getById=at(function(e){return d.appendChild(e).id=w,!p.getElementsByName||!p.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!="undefined"&&v){var n=t.getElementById(e);return n?[n]:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e);if(n.qsa)return t.querySelectorAll(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!="undefined"&&v)return t.getElementsByClassName(e)},g=[],m=[];if(n.qsa=G.test(p.querySelectorAll))at(function(e){d.appendChild(e).innerHTML="<a id='"+w+"'></a>"+"<select id='"+w+"-\r\\' msallowcapture=''>"+"<option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),at(function(e){var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")});return(n.matchesSelector=G.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&at(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",q)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=G.test(d.compareDocumentPosition),b=t||G.test(d.contains)?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,r&1||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===p||e.ownerDocument===E&&b(E,e)?-1:t===p||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:r&4?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,o=[e],u=[t];if(!i||!s)return e===p?-1:t===p?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return lt(e,t);n=e;while(n=n.parentNode)o.unshift(n);n=t;while(n=n.parentNode)u.unshift(n);while(o[r]===u[r])r++;return r?lt(o[r],u[r]):o[r]===E?-1:u[r]===E?1:0},p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){(e.ownerDocument||e)!==p&&h(e),t=t.replace(X,"='$1']");if(n.matchesSelector&&v&&!C[t+" "]&&(!g||!g.test(t))&&(!m||!m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&e.document.nodeType!==11)return r}catch(i){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},st.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):undefined;return s!==undefined?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},st.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,r=[],i=0,s=0;c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k);if(c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=st.getText=function(e){var t,n="",r=0,s=e.nodeType;if(!s)while(t=e[r++])n+=i(t);else if(s===1||s===9||s===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(s===3||s===4)return e.nodeValue;return n},r=st.selectors={cacheLength:50,createPseudo:ut,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(tt,nt),e[3]=(e[3]||e[4]||e[5]||"").replace(tt,nt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return J.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&V.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(tt,nt).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!="undefined"&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i.replace(R," ")+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u,b=!1;if(m){if(s){while(v){h=t;while(h=h[v])if(u?h.nodeName.toLowerCase()===g:h.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){h=m,c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),f=l[e]||[],p=f[0]===S&&f[1],b=p&&f[2],h=p&&m.childNodes[p];while(h=++p&&h&&h[v]||(b=p=0)||d.pop())if(h.nodeType===1&&++b&&h===t){l[e]=[S,p,b];break}}else{y&&(h=t,c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),f=l[e]||[],p=f[0]===S&&f[1],b=p);if(b===!1)while(h=++p&&h&&h[v]||(b=p=0)||d.pop())if((u?h.nodeName.toLowerCase()===g:h.nodeType===1)&&++b){y&&(c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),l[e]=[S,b]);if(h===t)break}}return b-=i,b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:ut(function(e){var t=[],n=[],r=u(e.replace(U,"$1"));return r[w]?ut(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:ut(function(e){return function(t){return st(e,t).length>0}}),contains:ut(function(e){return e=e.replace(tt,nt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:ut(function(e){return $.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(tt,nt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return K.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()==="text")},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[n<0?n+t:n]}),even:pt(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ct(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=ht(t);return vt.prototype=r.filters=r.pseudos,r.setFilters=new vt,o=st.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){if(!n||(i=z.exec(u)))i&&(u=u.slice(i[0].length)||u),a.push(s=[]);n=!1;if(i=W.exec(u))n=i.shift(),s.push({value:n,type:i[0].replace(U," ")}),u=u.slice(n.length);for(o in r.filter)(i=J[o].exec(u))&&(!f[o]||(i=f[o](i)))&&(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?st.error(e):N(e,a).slice(0)},u=st.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=St(t[n]),s[w]?r.push(s):i.push(s);s=C(e,xt(i,r)),s.selector=e}return s},a=st.select=function(e,t,i,s){var a,f,l,c,h,p=typeof e=="function"&&e,d=!s&&o(e=p.selector||e);i=i||[];if(d.length===1){f=d[0]=d[0].slice(0);if(f.length>2&&(l=f[0]).type==="ID"&&n.getById&&t.nodeType===9&&v&&r.relative[f[1].type]){t=(r.find.ID(l.matches[0].replace(tt,nt),t)||[])[0];if(!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=J.needsContext.test(e)?0:f.length;while(a--){l=f[a];if(r.relative[c=l.type])break;if(h=r.find[c])if(s=h(l.matches[0].replace(tt,nt),Z.test(f[0].type)&&dt(t.parentNode)||t)){f.splice(a,1),e=s.length&&mt(f);if(!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,!t||Z.test(e)&&dt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=at(function(e){return e.compareDocumentPosition(p.createElement("div"))&1}),at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild.getAttribute("href")==="#"})||ft("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}),(!n.attributes||!at(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),e.firstChild.getAttribute("value")===""}))&&ft("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input")return e.defaultValue}),at(function(e){return e.getAttribute("disabled")==null})||ft(B,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),st}(window);jQuery.find=Sizzle,jQuery.expr=Sizzle.selectors,jQuery.expr[":"]=jQuery.expr.pseudos,jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort,jQuery.text=Sizzle.getText,jQuery.isXMLDoc=Sizzle.isXML,jQuery.contains=Sizzle.contains;var dir=function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&e.nodeType!==9)if(e.nodeType===1){if(i&&jQuery(e).is(n))break;r.push(e)}return r},siblings=function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n},rneedsContext=jQuery.expr.match.needsContext,rsingleTag=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,risSimple=/^.[^:#\[\.,]*$/;jQuery.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),t.length===1&&r.nodeType===1?jQuery.find.matchesSelector(r,e)?[r]:[]:jQuery.find.matches(e,jQuery.grep(t,function(e){return e.nodeType===1}))},jQuery.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if(typeof e!="string")return this.pushStack(jQuery(e).filter(function(){for(t=0;t<n;t++)if(jQuery.contains(i[t],this))return!0}));for(t=0;t<n;t++)jQuery.find(e,i[t],r);return r=this.pushStack(n>1?jQuery.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(winnow(this,e||[],!1))},not:function(e){return this.pushStack(winnow(this,e||[],!0))},is:function(e){return!!winnow(this,typeof e=="string"&&rneedsContext.test(e)?jQuery(e):e||[],!1).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(e,t,n){var r,i;if(!e)return this;n=n||rootjQuery;if(typeof e=="string"){e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?r=[null,e,null]:r=rquickExpr.exec(e);if(r&&(r[1]||!t)){if(r[1]){t=t instanceof jQuery?t[0]:t,jQuery.merge(this,jQuery.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:document,!0));if(rsingleTag.test(r[1])&&jQuery.isPlainObject(t))for(r in t)jQuery.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=document.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=document,this.selector=e,this}return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):jQuery.isFunction(e)?n.ready!==undefined?n.ready(e):e(jQuery):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),jQuery.makeArray(e,this))};init.prototype=jQuery.fn,rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:!0,contents:!0,next:!0,prev:!0};jQuery.fn.extend({has:function(e){var t=jQuery(e,this),n=t.length;return this.filter(function(){var e=0;for(;e<n;e++)if(jQuery.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,s=[],o=rneedsContext.test(e)||typeof e!="string"?jQuery(e,t||this.context):0;for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:n.nodeType===1&&jQuery.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?jQuery.uniqueSort(s):s)},index:function(e){return e?typeof e=="string"?indexOf.call(jQuery(e),this[0]):indexOf.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),jQuery.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return dir(e,"parentNode")},parentsUntil:function(e,t,n){return dir(e,"parentNode",n)},next:function(e){return sibling(e,"nextSibling")},prev:function(e){return sibling(e,"previousSibling")},nextAll:function(e){return dir(e,"nextSibling")},prevAll:function(e){return dir(e,"previousSibling")},nextUntil:function(e,t,n){return dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return dir(e,"previousSibling",n)},siblings:function(e){return siblings((e.parentNode||{}).firstChild,e)},children:function(e){return siblings(e.firstChild)},contents:function(e){return e.contentDocument||jQuery.merge([],e.childNodes)}},function(e,t){jQuery.fn[e]=function(n,r){var i=jQuery.map(this,t,n);return e.slice(-5)!=="Until"&&(r=n),r&&typeof r=="string"&&(i=jQuery.filter(r,i)),this.length>1&&(guaranteedUnique[e]||jQuery.uniqueSort(i),rparentsprev.test(e)&&i.reverse()),this.pushStack(i)}});var rnotwhite=/\S+/g;jQuery.Callbacks=function(e){e=typeof e=="string"?createOptions(e):jQuery.extend({},e);var t,n,r,i,s=[],o=[],u=-1,a=function(){i=e.once,r=t=!0;for(;o.length;u=-1){n=o.shift();while(++u<s.length)s[u].apply(n[0],n[1])===!1&&e.stopOnFalse&&(u=s.length,n=!1)}e.memory||(n=!1),t=!1,i&&(n?s=[]:s="")},f={add:function(){return s&&(n&&!t&&(u=s.length-1,o.push(n)),function r(t){jQuery.each(t,function(t,n){jQuery.isFunction(n)?(!e.unique||!f.has(n))&&s.push(n):n&&n.length&&jQuery.type(n)!=="string"&&r(n)})}(arguments),n&&!t&&a()),this},remove:function(){return jQuery.each(arguments,function(e,t){var n;while((n=jQuery.inArray(t,s,n))>-1)s.splice(n,1),n<=u&&u--}),this},has:function(e){return e?jQuery.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return i=o=[],s=n="",this},disabled:function(){return!s},lock:function(){return i=o=[],n||(s=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],o.push(n),t||a()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},jQuery.extend({Deferred:function(e){var t=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return jQuery.Deferred(function(n){jQuery.each(t,function(t,s){var o=jQuery.isFunction(e[t])&&e[t];i[s[1]](function(){var e=o&&o.apply(this,arguments);e&&jQuery.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[s[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?jQuery.extend(e,r):r}},i={};return r.pipe=r.then,jQuery.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=slice.call(arguments),r=n.length,i=r!==1||e&&jQuery.isFunction(e.promise)?r:0,s=i===1?e:jQuery.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?slice.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&jQuery.isFunction(n[t].promise)?n[t].promise().progress(o(t,a,u)).done(o(t,f,n)).fail(s.reject):--i}return i||s.resolveWith(f,n),s.promise()}});var readyList;jQuery.fn.ready=function(e){return jQuery.ready.promise().done(e),this},jQuery.extend({isReady:!1,readyWait:1,holdReady:function(e){e?jQuery.readyWait++:jQuery.ready(!0)},ready:function(e){if(e===!0?--jQuery.readyWait:jQuery.isReady)return;jQuery.isReady=!0;if(e!==!0&&--jQuery.readyWait>0)return;readyList.resolveWith(document,[jQuery]),jQuery.fn.triggerHandler&&(jQuery(document).triggerHandler("ready"),jQuery(document).off("ready"))}}),jQuery.ready.promise=function(e){return readyList||(readyList=jQuery.Deferred(),document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll?window.setTimeout(jQuery.ready):(document.addEventListener("DOMContentLoaded",completed),window.addEventListener("load",completed))),readyList.promise(e)},jQuery.ready.promise();var access=function(e,t,n,r,i,s,o){var u=0,a=e.length,f=n==null;if(jQuery.type(n)==="object"){i=!0;for(u in n)access(e,t,u,n[u],!0,s,o)}else if(r!==undefined){i=!0,jQuery.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(jQuery(e),n)}));if(t)for(;u<a;u++)t(e[u],n,o?r:r.call(e[u],u,t(e[u],n)))}return i?e:f?t.call(e):a?t(e[0],n):s},acceptData=function(e){return e.nodeType===1||e.nodeType===9||!+e.nodeType};Data.uid=1,Data.prototype={register:function(e,t){var n=t||{};return e.nodeType?e[this.expando]=n:Object.defineProperty(e,this.expando,{value:n,writable:!0,configurable:!0}),e[this.expando]},cache:function(e){if(!acceptData(e))return{};var t=e[this.expando];return t||(t={},acceptData(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if(typeof t=="string")i[t]=n;else for(r in t)i[r]=t[r];return i},get:function(e,t){return t===undefined?this.cache(e):e[this.expando]&&e[this.expando][t]},access:function(e,t,n){var r;return t===undefined||t&&typeof t=="string"&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,jQuery.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,s=e[this.expando];if(s===undefined)return;if(t===undefined)this.register(e);else{jQuery.isArray(t)?r=t.concat(t.map(jQuery.camelCase)):(i=jQuery.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(rnotwhite)||[])),n=r.length;while(n--)delete s[r[n]]}if(t===undefined||jQuery.isEmptyObject(s))e.nodeType?e[this.expando]=undefined:delete e[this.expando]},hasData:function(e){var t=e[this.expando];return t!==undefined&&!jQuery.isEmptyObject(t)}};var dataPriv=new Data,dataUser=new Data,rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/[A-Z]/g;jQuery.extend({hasData:function(e){return dataUser.hasData(e)||dataPriv.hasData(e)},data:function(e,t,n){return dataUser.access(e,t,n)},removeData:function(e,t){dataUser.remove(e,t)},_data:function(e,t,n){return dataPriv.access(e,t,n)},_removeData:function(e,t){dataPriv.remove(e,t)}}),jQuery.fn.extend({data:function(e,t){var n,r,i,s=this[0],o=s&&s.attributes;if(e===undefined){if(this.length){i=dataUser.get(s);if(s.nodeType===1&&!dataPriv.get(s,"hasDataAttrs")){n=o.length;while(n--)o[n]&&(r=o[n].name,r.indexOf("data-")===0&&(r=jQuery.camelCase(r.slice(5)),dataAttr(s,r,i[r])));dataPriv.set(s,"hasDataAttrs",!0)}}return i}return typeof e=="object"?this.each(function(){dataUser.set(this,e)}):access(this,function(t){var n,r;if(s&&t===undefined){n=dataUser.get(s,e)||dataUser.get(s,e.replace(rmultiDash,"-$&").toLowerCase());if(n!==undefined)return n;r=jQuery.camelCase(e),n=dataUser.get(s,r);if(n!==undefined)return n;n=dataAttr(s,r,undefined);if(n!==undefined)return n;return}r=jQuery.camelCase(e),this.each(function(){var n=dataUser.get(this,r);dataUser.set(this,r,t),e.indexOf("-")>-1&&n!==undefined&&dataUser.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){dataUser.remove(this,e)})}}),jQuery.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=dataPriv.get(e,t),n&&(!r||jQuery.isArray(n)?r=dataPriv.access(e,t,jQuery.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=jQuery.queue(e,t),r=n.length,i=n.shift(),s=jQuery._queueHooks(e,t),o=function(){jQuery.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return dataPriv.get(e,n)||dataPriv.access(e,n,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(e,[t+"queue",n])})})}}),jQuery.fn.extend({queue:function(e,t){var n=2;return typeof e!="string"&&(t=e,e="fx",n--),arguments.length<n?jQuery.queue(this[0],e):t===undefined?this:this.each(function(){var n=jQuery.queue(this,e,t);jQuery._queueHooks(this,e),e==="fx"&&n[0]!=="inprogress"&&jQuery.dequeue(this,e)})},dequeue:function(e){return this.each(function(){jQuery.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=jQuery.Deferred(),s=this,o=this.length,u=function(){--r||i.resolveWith(s,[s])};typeof e!="string"&&(t=e,e=undefined),e=e||"fx";while(o--)n=dataPriv.get(s[o],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,rcssNum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i"),cssExpand=["Top","Right","Bottom","Left"],isHidden=function(e,t){return e=t||e,jQuery.css(e,"display")==="none"||!jQuery.contains(e.ownerDocument,e)},rcheckableType=/^(?:checkbox|radio)$/i,rtagName=/<([\w:-]+)/,rscriptType=/^$|\/(?:java|ecma)script/i,wrapMap={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,"",""]};wrapMap.optgroup=wrapMap.option,wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead,wrapMap.th=wrapMap.td;var rhtml=/<|&#?\w+;/;(function(){var e=document.createDocumentFragment(),t=e.appendChild(document.createElement("div")),n=document.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),support.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",support.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue})();var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;jQuery.event={global:{},add:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=dataPriv.get(e);if(!m)return;n.handler&&(s=n,n=s.handler,i=s.selector),n.guid||(n.guid=jQuery.guid++),(a=m.events)||(a=m.events={}),(o=m.handle)||(o=m.handle=function(t){return typeof jQuery!="undefined"&&jQuery.event.triggered!==t.type?jQuery.event.dispatch.apply(e,arguments):undefined}),t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p)continue;c=jQuery.event.special[p]||{},p=(i?c.delegateType:c.bindType)||p,c=jQuery.event.special[p]||{},l=jQuery.extend({type:p,origType:v,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&jQuery.expr.match.needsContext.test(i),namespace:d.join(".")},s),(h=a[p])||(h=a[p]=[],h.delegateCount=0,(!c.setup||c.setup.call(e,r,d,o)===!1)&&e.addEventListener&&e.addEventListener(p,o)),c.add&&(c.add.call(e,l),l.handler.guid||(l.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,l):h.push(l),jQuery.event.global[p]=!0}},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=dataPriv.hasData(e)&&dataPriv.get(e);if(!m||!(a=m.events))return;t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p){for(p in a)jQuery.event.remove(e,p+t[f],n,r,!0);continue}c=jQuery.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],(i||v===l.origType)&&(!n||n.guid===l.guid)&&(!u||u.test(l.namespace))&&(!r||r===l.selector||r==="**"&&l.selector)&&(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&((!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&jQuery.removeEvent(e,p,m.handle),delete a[p])}jQuery.isEmptyObject(a)&&dataPriv.remove(e,"handle events")},dispatch:function(e){e=jQuery.event.fix(e);var t,n,r,i,s,o=[],u=slice.call(arguments),a=(dataPriv.get(this,"events")||{})[e.type]||[],f=jQuery.event.special[e.type]||{};u[0]=e,e.delegateTarget=this;if(f.preDispatch&&f.preDispatch.call(this,e)===!1)return;o=jQuery.event.handlers.call(this,e,a),t=0;while((i=o[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((s=i.handlers[n++])&&!e.isImmediatePropagationStopped())if(!e.rnamespace||e.rnamespace.test(s.namespace))e.handleObj=s,e.data=s.data,r=((jQuery.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,u),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation())}return f.postDispatch&&f.postDispatch.call(this,e),e.result},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(e.type!=="click"||isNaN(e.button)||e.button<1))for(;a!==this;a=a.parentNode||this)if(a.nodeType===1&&(a.disabled!==!0||e.type!=="click")){r=[];for(n=0;n<u;n++)s=t[n],i=s.selector+" ",r[i]===undefined&&(r[i]=s.needsContext?jQuery(i,this).index(a)>-1:jQuery.find(i,this,null,[a]).length),r[i]&&r.push(s);r.length&&o.push({elem:a,handlers:r})}return u<t.length&&o.push({elem:this,handlers:t.slice(u)}),o},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(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return e.pageX==null&&t.clientX!=null&&(n=e.target.ownerDocument||document,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),!e.which&&s!==undefined&&(e.which=s&1?1:s&2?3:s&4?2:0),e}},fix:function(e){if(e[jQuery.expando])return e;var t,n,r,i=e.type,s=e,o=this.fixHooks[i];o||(this.fixHooks[i]=o=rmouseEvent.test(i)?this.mouseHooks:rkeyEvent.test(i)?this.keyHooks:{}),r=o.props?this.props.concat(o.props):this.props,e=new jQuery.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=document),e.target.nodeType===3&&(e.target=e.target.parentNode),o.filter?o.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&jQuery.nodeName(this,"input"))return this.click(),!1},_default:function(e){return jQuery.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},jQuery.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},jQuery.Event=function(e,t){if(!(this instanceof jQuery.Event))return new jQuery.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.defaultPrevented===undefined&&e.returnValue===!1?returnTrue:returnFalse):this.type=e,t&&jQuery.extend(this,t),this.timeStamp=e&&e.timeStamp||jQuery.now(),this[jQuery.expando]=!0},jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue,e&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue,e&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue,e&&e.stopImmediatePropagation(),this.stopPropagation()}},jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){jQuery.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!jQuery.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),jQuery.fn.extend({on:function(e,t,n,r){return on(this,e,t,n,r)},one:function(e,t,n,r){return on(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,jQuery(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if(typeof e=="object"){for(i in e)this.off(i,t,e[i]);return this}if(t===!1||typeof t=="function")n=t,t=undefined;return n===!1&&(n=returnFalse),this.each(function(){jQuery.event.remove(this,e,n,t)})}});var rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,rnoInnerhtml=/<script|<style|<link/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;jQuery.extend({htmlPrefilter:function(e){return e.replace(rxhtmlTag,"<$1></$2>")},clone:function(e,t,n){var r,i,s,o,u=e.cloneNode(!0),a=jQuery.contains(e.ownerDocument,e);if(!support.noCloneChecked&&(e.nodeType===1||e.nodeType===11)&&!jQuery.isXMLDoc(e)){o=getAll(u),s=getAll(e);for(r=0,i=s.length;r<i;r++)fixInput(s[r],o[r])}if(t)if(n){s=s||getAll(e),o=o||getAll(u);for(r=0,i=s.length;r<i;r++)cloneCopyEvent(s[r],o[r])}else cloneCopyEvent(e,u);return o=getAll(u,"script"),o.length>0&&setGlobalEval(o,!a&&getAll(e,"script")),u},cleanData:function(e){var t,n,r,i=jQuery.event.special,s=0;for(;(n=e[s])!==undefined;s++)if(acceptData(n)){if(t=n[dataPriv.expando]){if(t.events)for(r in t.events)i[r]?jQuery.event.remove(n,r):jQuery.removeEvent(n,r,t.handle);n[dataPriv.expando]=undefined}n[dataUser.expando]&&(n[dataUser.expando]=undefined)}}}),jQuery.fn.extend({domManip:domManip,detach:function(e){return remove(this,e,!0)},remove:function(e){return remove(this,e)},text:function(e){return access(this,function(e){return e===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9)this.textContent=e})},null,e,arguments.length)},append:function(){return domManip(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.appendChild(e)}})},prepend:function(){return domManip(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return domManip(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return domManip(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++)e.nodeType===1&&(jQuery.cleanData(getAll(e,!1)),e.textContent="");return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return jQuery.clone(this,e,t)})},html:function(e){return access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&t.nodeType===1)return t.innerHTML;if(typeof e=="string"&&!rnoInnerhtml.test(e)&&!wrapMap[(rtagName.exec(e)||["",""])[1].toLowerCase()]){e=jQuery.htmlPrefilter(e);try{for(;n<r;n++)t=this[n]||{},t.nodeType===1&&(jQuery.cleanData(getAll(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return domManip(this,arguments,function(t){var n=this.parentNode;jQuery.inArray(this,e)<0&&(jQuery.cleanData(getAll(this)),n&&n.replaceChild(t,this))},e)}}),jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){jQuery.fn[e]=function(e){var n,r=[],i=jQuery(e),s=i.length-1,o=0;for(;o<=s;o++)n=o===s?this:this.clone(!0),jQuery(i[o])[t](n),push.apply(r,n.get());return this.pushStack(r)}});var iframe,elemdisplay={HTML:"block",BODY:"block"},rmargin=/^margin/,rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i"),getStyles=function(e){var t=e.ownerDocument.defaultView;if(!t||!t.opener)t=window;return t.getComputedStyle(e)},swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i},documentElement=document.documentElement;(function(){function o(){s.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%",s.innerHTML="",documentElement.appendChild(i);var o=window.getComputedStyle(s);e=o.top!=="1%",r=o.marginLeft==="2px",t=o.width==="4px",s.style.marginRight="50%",n=o.marginRight==="4px",documentElement.removeChild(i)}var e,t,n,r,i=document.createElement("div"),s=document.createElement("div");if(!s.style)return;s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",support.clearCloneStyle=s.style.backgroundClip==="content-box",i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",i.appendChild(s),jQuery.extend(support,{pixelPosition:function(){return o(),e},boxSizingReliable:function(){return t==null&&o(),t},pixelMarginRight:function(){return t==null&&o(),n},reliableMarginLeft:function(){return t==null&&o(),r},reliableMarginRight:function(){var e,t=s.appendChild(document.createElement("div"));return t.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",s.style.width="1px",documentElement.appendChild(i),e=!parseFloat(window.getComputedStyle(t).marginRight),documentElement.removeChild(i),s.removeChild(t),e}})})();var rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"],emptyStyle=document.createElement("div").style;jQuery.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=curCSS(e,"opacity");return n===""?"1":n}}}},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(e,t,n,r){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var i,s,o,u=jQuery.camelCase(t),a=e.style;t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(u)||u),o=jQuery.cssHooks[t]||jQuery.cssHooks[u];if(n===undefined)return o&&"get"in o&&(i=o.get(e,!1,r))!==undefined?i:a[t];s=typeof n,s==="string"&&(i=rcssNum.exec(n))&&i[1]&&(n=adjustCSS(e,t,i),s="number");if(n==null||n!==n)return;s==="number"&&(n+=i&&i[3]||(jQuery.cssNumber[u]?"":"px")),!support.clearCloneStyle&&n===""&&t.indexOf("background")===0&&(a[t]="inherit");if(!o||!("set"in o)||(n=o.set(e,n,r))!==undefined)a[t]=n},css:function(e,t,n,r){var i,s,o,u=jQuery.camelCase(t);return t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(u)||u),o=jQuery.cssHooks[t]||jQuery.cssHooks[u],o&&"get"in o&&(i=o.get(e,!0,n)),i===undefined&&(i=curCSS(e,t,r)),i==="normal"&&t in cssNormalTransform&&(i=cssNormalTransform[t]),n===""||n?(s=parseFloat(i),n===!0||isFinite(s)?s||0:i):i}}),jQuery.each(["height","width"],function(e,t){jQuery.cssHooks[t]={get:function(e,n,r){if(n)return rdisplayswap.test(jQuery.css(e,"display"))&&e.offsetWidth===0?swap(e,cssShow,function(){return getWidthOrHeight(e,t,r)}):getWidthOrHeight(e,t,r)},set:function(e,n,r){var i,s=r&&getStyles(e),o=r&&augmentWidthOrHeight(e,t,r,jQuery.css(e,"boxSizing",!1,s)==="border-box",s);return o&&(i=rcssNum.exec(n))&&(i[3]||"px")!=="px"&&(e.style[t]=n,n=jQuery.css(e,t)),setPositiveNumber(e,n,o)}}}),jQuery.cssHooks.marginLeft=addGetHookIf(support.reliableMarginLeft,function(e,t){if(t)return(parseFloat(curCSS(e,"marginLeft"))||e.getBoundingClientRect().left-swap(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),jQuery.cssHooks.marginRight=addGetHookIf(support.reliableMarginRight,function(e,t){if(t)return swap(e,{display:"inline-block"},curCSS,[e,"marginRight"])}),jQuery.each({margin:"",padding:"",border:"Width"},function(e,t){jQuery.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+cssExpand[r]+t]=s[r]||s[r-2]||s[0];return i}},rmargin.test(e)||(jQuery.cssHooks[e+t].set=setPositiveNumber)}),jQuery.fn.extend({css:function(e,t){return access(this,function(e,t,n){var r,i,s={},o=0;if(jQuery.isArray(t)){r=getStyles(e),i=t.length;for(;o<i;o++)s[t[o]]=jQuery.css(e,t[o],!1,r);return s}return n!==undefined?jQuery.style(e,t,n):jQuery.css(e,t)},e,t,arguments.length>1)},show:function(){return showHide(this,!0)},hide:function(){return showHide(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){isHidden(this)?jQuery(this).show():jQuery(this).hide()})}}),jQuery.Tween=Tween,Tween.prototype={constructor:Tween,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||jQuery.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(jQuery.cssNumber[n]?"":"px")},cur:function(){var e=Tween.propHooks[this.prop];return e&&e.get?e.get(this):Tween.propHooks._default.get(this)},run:function(e){var t,n=Tween.propHooks[this.prop];return this.options.duration?this.pos=t=jQuery.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Tween.propHooks._default.set(this),this}},Tween.prototype.init.prototype=Tween.prototype,Tween.propHooks={_default:{get:function(e){var t;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(t=jQuery.css(e.elem,e.prop,""),!t||t==="auto"?0:t)},set:function(e){jQuery.fx.step[e.prop]?jQuery.fx.step[e.prop](e):e.elem.nodeType!==1||e.elem.style[jQuery.cssProps[e.prop]]==null&&!jQuery.cssHooks[e.prop]?e.elem[e.prop]=e.now:jQuery.style(e.elem,e.prop,e.now+e.unit)}}},Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},jQuery.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},jQuery.fx=Tween.prototype.init,jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return adjustCSS(n.elem,e,rcssNum.exec(t),n),n}]},tweener:function(e,t){jQuery.isFunction(e)?(t=e,e=["*"]):e=e.match(rnotwhite);var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Animation.tweeners[n]=Animation.tweeners[n]||[],Animation.tweeners[n].unshift(t)},prefilters:[defaultPrefilter],prefilter:function(e,t){t?Animation.prefilters.unshift(e):Animation.prefilters.push(e)}}),jQuery.speed=function(e,t,n){var r=e&&typeof e=="object"?jQuery.extend({},e):{complete:n||!n&&t||jQuery.isFunction(e)&&e,duration:e,easing:n&&t||t&&!jQuery.isFunction(t)&&t};r.duration=jQuery.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in jQuery.fx.speeds?jQuery.fx.speeds[r.duration]:jQuery.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){jQuery.isFunction(r.old)&&r.old.call(this),r.queue&&jQuery.dequeue(this,r.queue)},r},jQuery.fn.extend({fadeTo:function(e,t,n,r){return this.filter(isHidden).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=jQuery.isEmptyObject(e),s=jQuery.speed(t,n,r),o=function(){var t=Animation(this,jQuery.extend({},e),s);(i||dataPriv.get(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return typeof e!="string"&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=e!=null&&e+"queueHooks",s=jQuery.timers,o=dataPriv.get(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&rrun.test(i)&&r(o[i]);for(i=s.length;i--;)s[i].elem===this&&(e==null||s[i].queue===e)&&(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&jQuery.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=dataPriv.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=jQuery.timers,o=r?r.length:0;n.finish=!0,jQuery.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0);for(t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),jQuery.each(["toggle","show","hide"],function(e,t){var n=jQuery.fn[t];jQuery.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(genFx(t,!0),e,r,i)}}),jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){jQuery.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),jQuery.timers=[],jQuery.fx.tick=function(){var e,t=0,n=jQuery.timers;fxNow=jQuery.now();for(;t<n.length;t++)e=n[t],!e()&&n[t]===e&&n.splice(t--,1);n.length||jQuery.fx.stop(),fxNow=undefined},jQuery.fx.timer=function(e){jQuery.timers.push(e),e()?jQuery.fx.start():jQuery.timers.pop()},jQuery.fx.interval=13,jQuery.fx.start=function(){timerId||(timerId=window.setInterval(jQuery.fx.tick,jQuery.fx.interval))},jQuery.fx.stop=function(){window.clearInterval(timerId),timerId=null},jQuery.fx.speeds={slow:600,fast:200,_default:400},jQuery.fn.delay=function(e,t){return e=jQuery.fx?jQuery.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=window.setTimeout(t,e);n.stop=function(){window.clearTimeout(r)}})},function(){var e=document.createElement("input"),t=document.createElement("select"),n=t.appendChild(document.createElement("option"));e.type="checkbox",support.checkOn=e.value!=="",support.optSelected=n.selected,t.disabled=!0,support.optDisabled=!n.disabled,e=document.createElement("input"),e.value="t",e.type="radio",support.radioValue=e.value==="t"}();var boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(e,t){return access(this,jQuery.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){jQuery.removeAttr(this,e)})}}),jQuery.extend({attr:function(e,t,n){var r,i,s=e.nodeType;if(s===3||s===8||s===2)return;if(typeof e.getAttribute=="undefined")return jQuery.prop(e,t,n);if(s!==1||!jQuery.isXMLDoc(e))t=t.toLowerCase(),i=jQuery.attrHooks[t]||(jQuery.expr.match.bool.test(t)?boolHook:undefined);if(n!==undefined){if(n===null){jQuery.removeAttr(e,t);return}return i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:(e.setAttribute(t,n+""),n)}return i&&"get"in i&&(r=i.get(e,t))!==null?r:(r=jQuery.find.attr(e,t),r==null?undefined:r)},attrHooks:{type:{set:function(e,t){if(!support.radioValue&&t==="radio"&&jQuery.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(rnotwhite);if(s&&e.nodeType===1)while(n=s[i++])r=jQuery.propFix[n]||n,jQuery.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)}}),boolHook={set:function(e,t,n){return t===!1?jQuery.removeAttr(e,n):e.setAttribute(n,n),n}},jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(e,t){var n=attrHandle[t]||jQuery.find.attr;attrHandle[t]=function(e,t,r){var i,s;return r||(s=attrHandle[t],attrHandle[t]=i,i=n(e,t,r)!=null?t.toLowerCase():null,attrHandle[t]=s),i}});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(e,t){return access(this,jQuery.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[jQuery.propFix[e]||e]})}}),jQuery.extend({prop:function(e,t,n){var r,i,s=e.nodeType;if(s===3||s===8||s===2)return;if(s!==1||!jQuery.isXMLDoc(e))t=jQuery.propFix[t]||t,i=jQuery.propHooks[t];return n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&(r=i.get(e,t))!==null?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=jQuery.find.attr(e,"tabindex");return t?parseInt(t,10):rfocusable.test(e.nodeName)||rclickable.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),support.optSelected||(jQuery.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;jQuery.fn.extend({addClass:function(e){var t,n,r,i,s,o,u,a=0;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).addClass(e.call(this,t,getClass(this)))});if(typeof e=="string"&&e){t=e.match(rnotwhite)||[];while(n=this[a++]){i=getClass(n),r=n.nodeType===1&&(" "+i+" ").replace(rclass," ");if(r){o=0;while(s=t[o++])r.indexOf(" "+s+" ")<0&&(r+=s+" ");u=jQuery.trim(r),i!==u&&n.setAttribute("class",u)}}}return this},removeClass:function(e){var t,n,r,i,s,o,u,a=0;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).removeClass(e.call(this,t,getClass(this)))});if(!arguments.length)return this.attr("class","");if(typeof e=="string"&&e){t=e.match(rnotwhite)||[];while(n=this[a++]){i=getClass(n),r=n.nodeType===1&&(" "+i+" ").replace(rclass," ");if(r){o=0;while(s=t[o++])while(r.indexOf(" "+s+" ")>-1)r=r.replace(" "+s+" "," ");u=jQuery.trim(r),i!==u&&n.setAttribute("class",u)}}}return this},toggleClass:function(e,t){var n=typeof e;return typeof t=="boolean"&&n==="string"?t?this.addClass(e):this.removeClass(e):jQuery.isFunction(e)?this.each(function(n){jQuery(this).toggleClass(e.call(this,n,getClass(this),t),t)}):this.each(function(){var t,r,i,s;if(n==="string"){r=0,i=jQuery(this),s=e.match(rnotwhite)||[];while(t=s[r++])i.hasClass(t)?i.removeClass(t):i.addClass(t)}else if(e===undefined||n==="boolean")t=getClass(this),t&&dataPriv.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":dataPriv.get(this,"__className__")||"")})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(n.nodeType===1&&(" "+getClass(n)+" ").replace(rclass," ").indexOf(t)>-1)return!0;return!1}});var rreturn=/\r/g,rspaces=/[\x20\t\r\n\f]+/g;jQuery.fn.extend({val:function(e){var t,n,r,i=this[0];if(!arguments.length){if(i)return t=jQuery.valHooks[i.type]||jQuery.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,typeof n=="string"?n.replace(rreturn,""):n==null?"":n);return}return r=jQuery.isFunction(e),this.each(function(n){var i;if(this.nodeType!==1)return;r?i=e.call(this,n,jQuery(this).val()):i=e,i==null?i="":typeof i=="number"?i+="":jQuery.isArray(i)&&(i=jQuery.map(i,function(e){return e==null?"":e+""})),t=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!t||!("set"in t)||t.set(this,i,"value")===undefined)this.value=i})}}),jQuery.extend({valHooks:{option:{get:function(e){var t=jQuery.find.attr(e,"value");return t!=null?t:jQuery.trim(jQuery.text(e)).replace(rspaces," ")}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!jQuery.nodeName(n.parentNode,"optgroup"))){t=jQuery(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n,r,i=e.options,s=jQuery.makeArray(t),o=i.length;while(o--){r=i[o];if(r.selected=jQuery.inArray(jQuery.valHooks.option.get(r),s)>-1)n=!0}return n||(e.selectedIndex=-1),s}}}}),jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(e,t){if(jQuery.isArray(t))return e.checked=jQuery.inArray(jQuery(e).val(),t)>-1}},support.checkOn||(jQuery.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(e,t,n,r){var i,s,o,u,a,f,l,c=[n||document],h=hasOwn.call(e,"type")?e.type:e,p=hasOwn.call(e,"namespace")?e.namespace.split("."):[];s=o=n=n||document;if(n.nodeType===3||n.nodeType===8)return;if(rfocusMorph.test(h+jQuery.event.triggered))return;h.indexOf(".")>-1&&(p=h.split("."),h=p.shift(),p.sort()),a=h.indexOf(":")<0&&"on"+h,e=e[jQuery.expando]?e:new jQuery.Event(h,typeof e=="object"&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=undefined,e.target||(e.target=n),t=t==null?[e]:jQuery.makeArray(t,[e]),l=jQuery.event.special[h]||{};if(!r&&l.trigger&&l.trigger.apply(n,t)===!1)return;if(!r&&!l.noBubble&&!jQuery.isWindow(n)){u=l.delegateType||h,rfocusMorph.test(u+h)||(s=s.parentNode);for(;s;s=s.parentNode)c.push(s),o=s;o===(n.ownerDocument||document)&&c.push(o.defaultView||o.parentWindow||window)}i=0;while((s=c[i++])&&!e.isPropagationStopped())e.type=i>1?u:l.bindType||h,f=(dataPriv.get(s,"events")||{})[e.type]&&dataPriv.get(s,"handle"),f&&f.apply(s,t),f=a&&s[a],f&&f.apply&&acceptData(s)&&(e.result=f.apply(s,t),e.result===!1&&e.preventDefault());return e.type=h,!r&&!e.isDefaultPrevented()&&(!l._default||l._default.apply(c.pop(),t)===!1)&&acceptData(n)&&a&&jQuery.isFunction(n[h])&&!jQuery.isWindow(n)&&(o=n[a],o&&(n[a]=null),jQuery.event.triggered=h,n[h](),jQuery.event.triggered=undefined,o&&(n[a]=o)),e.result},simulate:function(e,t,n){var r=jQuery.extend(new jQuery.Event,n,{type:e,isSimulated:!0});jQuery.event.trigger(r,null,t),r.isDefaultPrevented()&&n.preventDefault()}}),jQuery.fn.extend({trigger:function(e,t){return this.each(function(){jQuery.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return jQuery.event.trigger(e,t,n,!0)}}),jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){jQuery.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),jQuery.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),support.focusin="onfocusin"in window,support.focusin||jQuery.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){jQuery.event.simulate(t,e.target,jQuery.event.fix(e))};jQuery.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=dataPriv.access(r,t);i||r.addEventListener(e,n,!0),dataPriv.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=dataPriv.access(r,t)-1;i?dataPriv.access(r,t,i):(r.removeEventListener(e,n,!0),dataPriv.remove(r,t))}}});var location=window.location,nonce=jQuery.now(),rquery=/\?/;jQuery.parseJSON=function(e){return JSON.parse(e+"")},jQuery.parseXML=function(e){var t;if(!e||typeof e!="string")return null;try{t=(new window.DOMParser).parseFromString(e,"text/xml")}catch(n){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&jQuery.error("Invalid XML: "+e),t};var rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href,jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ajaxExtend(ajaxExtend(e,jQuery.ajaxSettings),t):ajaxExtend(jQuery.ajaxSettings,e)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(e,t){function S(e,t,s,u){var f,m,g,b,E,S=t;if(y===2)return;y=2,o&&window.clearTimeout(o),n=undefined,i=u||"",w.readyState=e>0?4:0,f=e>=200&&e<300||e===304,s&&(b=ajaxHandleResponses(l,w,s)),b=ajaxConvert(l,b,w,f);if(f)l.ifModified&&(E=w.getResponseHeader("Last-Modified"),E&&(jQuery.lastModified[r]=E),E=w.getResponseHeader("etag"),E&&(jQuery.etag[r]=E)),e===204||l.type==="HEAD"?S="nocontent":e===304?S="notmodified":(S=b.state,m=b.data,g=b.error,f=!g);else{g=S;if(e||!S)S="error",e<0&&(e=0)}w.status=e,w.statusText=(t||S)+"",f?p.resolveWith(c,[m,S,w]):p.rejectWith(c,[w,S,g]),w.statusCode(v),v=undefined,a&&h.trigger(f?"ajaxSuccess":"ajaxError",[w,l,f?m:g]),d.fireWith(c,[w,S]),a&&(h.trigger("ajaxComplete",[w,l]),--jQuery.active||jQuery.event.trigger("ajaxStop"))}typeof e=="object"&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=jQuery.ajaxSetup({},t),c=l.context||l,h=l.context&&(c.nodeType||c.jquery)?jQuery(c):jQuery.event,p=jQuery.Deferred(),d=jQuery.Callbacks("once memory"),v=l.statusCode||{},m={},g={},y=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(y===2){if(!s){s={};while(t=rheaders.exec(i))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return y===2?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=g[n]=g[n]||e,m[e]=t),this},overrideMimeType:function(e){return y||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(y<2)for(t in e)v[t]=[v[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),S(0,t),this}};p.promise(w).complete=d.add,w.success=w.done,w.error=w.fail,l.url=((e||l.url||location.href)+"").replace(rhash,"").replace(rprotocol,location.protocol+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=jQuery.trim(l.dataType||"*").toLowerCase().match(rnotwhite)||[""];if(l.crossDomain==null){u=document.createElement("a");try{u.href=l.url,u.href=u.href,l.crossDomain=originAnchor.protocol+"//"+originAnchor.host!=u.protocol+"//"+u.host}catch(E){l.crossDomain=!0}}l.data&&l.processData&&typeof l.data!="string"&&(l.data=jQuery.param(l.data,l.traditional)),inspectPrefiltersOrTransports(prefilters,l,t,w);if(y===2)return w;a=jQuery.event&&l.global,a&&jQuery.active++===0&&jQuery.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rnoContent.test(l.type),r=l.url,l.hasContent||(l.data&&(r=l.url+=(rquery.test(r)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rts.test(r)?r.replace(rts,"$1_="+nonce++):r+(rquery.test(r)?"&":"?")+"_="+nonce++)),l.ifModified&&(jQuery.lastModified[r]&&w.setRequestHeader("If-Modified-Since",jQuery.lastModified[r]),jQuery.etag[r]&&w.setRequestHeader("If-None-Match",jQuery.etag[r])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):l.accepts["*"]);for(f in l.headers)w.setRequestHeader(f,l.headers[f]);if(!l.beforeSend||l.beforeSend.call(c,w,l)!==!1&&y!==2){b="abort";for(f in{success:1,error:1,complete:1})w[f](l[f]);n=inspectPrefiltersOrTransports(transports,l,t,w);if(!n)S(-1,"No Transport");else{w.readyState=1,a&&h.trigger("ajaxSend",[w,l]);if(y===2)return w;l.async&&l.timeout>0&&(o=window.setTimeout(function(){w.abort("timeout")},l.timeout));try{y=1,n.send(m,S)}catch(E){if(!(y<2))throw E;S(-1,E)}}return w}return w.abort()},getJSON:function(e,t,n){return jQuery.get(e,t,n,"json")},getScript:function(e,t){return jQuery.get(e,undefined,t,"script")}}),jQuery.each(["get","post"],function(e,t){jQuery[t]=function(e,n,r,i){return jQuery.isFunction(n)&&(i=i||r,r=n,n=undefined),jQuery.ajax(jQuery.extend({url:e,type:t,dataType:i,data:n,success:r},jQuery.isPlainObject(e)&&e))}}),jQuery._evalUrl=function(e){return jQuery.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},jQuery.fn.extend({wrapAll:function(e){var t;return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapAll(e.call(this,t))}):(this[0]&&(t=jQuery(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapInner(e.call(this,t))}):this.each(function(){var t=jQuery(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=jQuery.isFunction(e);return this.each(function(n){jQuery(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()}}),jQuery.expr.filters.hidden=function(e){return!jQuery.expr.filters.visible(e)},jQuery.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;jQuery.param=function(e,t){var n,r=[],i=function(e,t){t=jQuery.isFunction(t)?t():t==null?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};t===undefined&&(t=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional);if(jQuery.isArray(e)||e.jquery&&!jQuery.isPlainObject(e))jQuery.each(e,function(){i(this.name,this.value)});else for(n in e)buildParams(n,e[n],t,i);return r.join("&").replace(r20,"+")},jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=jQuery.prop(this,"elements");return e?jQuery.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=jQuery(this).val();return n==null?null:jQuery.isArray(n)?jQuery.map(n,function(e){return{name:t.name,value:e.replace(rCRLF,"\r\n")}}):{name:t.name,value:n.replace(rCRLF,"\r\n")}}).get()}}),jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&"withCredentials"in xhrSupported,support.ajax=xhrSupported=!!xhrSupported,jQuery.ajaxTransport(function(e){var t,n;if(support.cors||xhrSupported&&!e.crossDomain)return{send:function(r,i){var s,o=e.xhr();o.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(s in e.xhrFields)o[s]=e.xhrFields[s];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),!e.crossDomain&&!r["X-Requested-With"]&&(r["X-Requested-With"]="XMLHttpRequest");for(s in r)o.setRequestHeader(s,r[s]);t=function(e){return function(){t&&(t=n=o.onload=o.onerror=o.onabort=o.onreadystatechange=null,e==="abort"?o.abort():e==="error"?typeof o.status!="number"?i(0,"error"):i(o.status,o.statusText):i(xhrSuccessStatus[o.status]||o.status,o.statusText,(o.responseType||"text")!=="text"||typeof o.responseText!="string"?{binary:o.response}:{text:o.responseText},o.getAllResponseHeaders()))}},o.onload=t(),n=o.onerror=t("error"),o.onabort!==undefined?o.onabort=n:o.onreadystatechange=function(){o.readyState===4&&window.setTimeout(function(){t&&n()})},t=t("abort");try{o.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return jQuery.globalEval(e),e}}}),jQuery.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),jQuery.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=jQuery("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i(e.type==="error"?404:200,e.type)}),document.head.appendChild(t[0])},abort:function(){n&&n()}}}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;return this[e]=!0,e}}),jQuery.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,s,o=e.jsonp!==!1&&(rjsonp.test(e.url)?"url":typeof e.data=="string"&&(e.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&rjsonp.test(e.data)&&"data");if(o||e.dataTypes[0]==="jsonp")return r=e.jsonpCallback=jQuery.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,o?e[o]=e[o].replace(rjsonp,"$1"+r):e.jsonp!==!1&&(e.url+=(rquery.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return s||jQuery.error(r+" was not called"),s[0]},e.dataTypes[0]="json",i=window[r],window[r]=function(){s=arguments},n.always(function(){i===undefined?jQuery(window).removeProp(r):window[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,oldCallbacks.push(r)),s&&jQuery.isFunction(i)&&i(s[0]),s=i=undefined}),"script"}),jQuery.parseHTML=function(e,t,n){if(!e||typeof e!="string")return null;typeof t=="boolean"&&(n=t,t=!1),t=t||document;var r=rsingleTag.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=buildFragment([e],t,i),i&&i.length&&jQuery(i).remove(),jQuery.merge([],r.childNodes))};var _load=jQuery.fn.load;jQuery.fn.load=function(e,t,n){if(typeof e!="string"&&_load)return _load.apply(this,arguments);var r,i,s,o=this,u=e.indexOf(" ");return u>-1&&(r=jQuery.trim(e.slice(u)),e=e.slice(0,u)),jQuery.isFunction(t)?(n=t,t=undefined):t&&typeof t=="object"&&(i="POST"),o.length>0&&jQuery.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){s=arguments,o.html(r?jQuery("<div>").append(jQuery.parseHTML(e)).find(r):e)}).always(n&&function(e,t){o.each(function(){n.apply(this,s||[e.responseText,t,e])})}),this},jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){jQuery.fn[t]=function(e){return this.on(t,e)}}),jQuery.expr.filters.animated=function(e){return jQuery.grep(jQuery.timers,function(t){return e===t.elem}).length},jQuery.offset={setOffset:function(e,t,n){var r,i,s,o,u,a,f,l=jQuery.css(e,"position"),c=jQuery(e),h={};l==="static"&&(e.style.position="relative"),u=c.offset(),s=jQuery.css(e,"top"),a=jQuery.css(e,"left"),f=(l==="absolute"||l==="fixed")&&(s+a).indexOf("auto")>-1,f?(r=c.position(),o=r.top,i=r.left):(o=parseFloat(s)||0,i=parseFloat(a)||0),jQuery.isFunction(t)&&(t=t.call(e,n,jQuery.extend({},u))),t.top!=null&&(h.top=t.top-u.top+o),t.left!=null&&(h.left=t.left-u.left+i),"using"in t?t.using.call(e,h):c.css(h)}},jQuery.fn.extend({offset:function(e){if(arguments.length)return e===undefined?this:this.each(function(t){jQuery.offset.setOffset(this,e,t)});var t,n,r=this[0],i={top:0,left:0},s=r&&r.ownerDocument;if(!s)return;return t=s.documentElement,jQuery.contains(t,r)?(i=r.getBoundingClientRect(),n=getWindow(s),{top:i.top+n.pageYOffset-t.clientTop,left:i.left+n.pageXOffset-t.clientLeft}):i},position:function(){if(!this[0])return;var e,t,n=this[0],r={top:0,left:0};return jQuery.css(n,"position")==="fixed"?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),jQuery.nodeName(e[0],"html")||(r=e.offset()),r.top+=jQuery.css(e[0],"borderTopWidth",!0),r.left+=jQuery.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-jQuery.css(n,"marginTop",!0),left:t.left-r.left-jQuery.css(n,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&jQuery.css(e,"position")==="static")e=e.offsetParent;return e||documentElement})}}),jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;jQuery.fn[e]=function(r){return access(this,function(e,r,i){var s=getWindow(e);if(i===undefined)return s?s[t]:e[r];s?s.scrollTo(n?s.pageXOffset:i,n?i:s.pageYOffset):e[r]=i},e,r,arguments.length)}}),jQuery.each(["top","left"],function(e,t){jQuery.cssHooks[t]=addGetHookIf(support.pixelPosition,function(e,n){if(n)return n=curCSS(e,t),rnumnonpx.test(n)?jQuery(e).position()[t]+"px":n})}),jQuery.each({Height:"height",Width:"width"},function(e,t){jQuery.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){jQuery.fn[r]=function(r,i){var s=arguments.length&&(n||typeof r!="boolean"),o=n||(r===!0||i===!0?"margin":"border");return access(this,function(t,n,r){var i;return jQuery.isWindow(t)?t.document.documentElement["client"+e]:t.nodeType===9?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?jQuery.css(t,n,o):jQuery.style(t,n,r,o)},t,s?r:undefined,s,null)}})}),jQuery.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},size:function(){return this.length}}),jQuery.fn.andSelf=jQuery.fn.addBack,typeof define=="function"&&define.amd&&define("jquery",[],function(){return jQuery});var _jQuery=window.jQuery,_$=window.$;return jQuery.noConflict=function(e){return window.$===jQuery&&(window.$=_$),e&&window.jQuery===jQuery&&(window.jQuery=_jQuery),jQuery},noGlobal||(window.jQuery=window.$=jQuery),jQuery}),function(){var e=this,t=e.Backbone,n=[],r=n.push,i=n.slice,s=n.splice,o;typeof exports!="undefined"?o=exports:o=e.Backbone={},o.VERSION="1.1.0";var u=e._;!u&&typeof require!="undefined"&&(u=require("underscore")),o.$=e.jQuery||e.Zepto||e.ender||e.$,o.noConflict=function(){return e.Backbone=t,this},o.emulateHTTP=!1,o.emulateJSON=!1;var a=o.Events={on:function(e,t,n){if(!l(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!l(this,"once",e,[t,n])||!t)return this;var r=this,i=u.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){var r,i,s,o,a,f,c,h;if(!this._events||!l(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;o=e?[e]:u.keys(this._events);for(a=0,f=o.length;a<f;a++){e=o[a];if(s=this._events[e]){this._events[e]=r=[];if(t||n)for(c=0,h=s.length;c<h;c++)i=s[c],(t&&t!==i.callback&&t!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[e]}}return this},trigger:function(e){if(!this._events)return this;var t=i.call(arguments,1);if(!l(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&c(n,t),r&&c(r,arguments),this},stopListening:function(e,t,n){var r=this._listeningTo;if(!r)return this;var i=!t&&!n;!n&&typeof t=="object"&&(n=this),e&&((r={})[e._listenId]=e);for(var s in r)e=r[s],e.off(t,n,this),(i||u.isEmpty(e._events))&&delete this._listeningTo[s];return this}},f=/\s+/,l=function(e,t,n,r){if(!n)return!0;if(typeof n=="object"){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(f.test(n)){var s=n.split(f);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r));return!1}return!0},c=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t)}},h={listenTo:"on",listenToOnce:"once"};u.each(h,function(e,t){a[t]=function(t,n,r){var i=this._listeningTo||(this._listeningTo={}),s=t._listenId||(t._listenId=u.uniqueId("l"));return i[s]=t,!r&&typeof n=="object"&&(r=this),t[e](n,r,this),this}}),a.bind=a.on,a.unbind=a.off,u.extend(o,a);var p=o.Model=function(e,t){var n=e||{};t||(t={}),this.cid=u.uniqueId("c"),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{}),n=u.defaults({},n,u.result(this,"defaults")),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};u.extend(p.prototype,a,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return u.clone(this.attributes)},sync:function(){return o.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return u.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i,s,o,a,f,l,c;if(e==null)return this;typeof e=="object"?(i=e,n=t):(i={})[e]=t,n||(n={});if(!this._validate(i,n))return!1;s=n.unset,a=n.silent,o=[],f=this._changing,this._changing=!0,f||(this._previousAttributes=u.clone(this.attributes),this.changed={}),c=this.attributes,l=this._previousAttributes,this.idAttribute in i&&(this.id=i[this.idAttribute]);for(r in i)t=i[r],u.isEqual(c[r],t)||o.push(r),u.isEqual(l[r],t)?delete this.changed[r]:this.changed[r]=t,s?delete c[r]:c[r]=t;if(!a){o.length&&(this._pending=!0);for(var h=0,p=o.length;h<p;h++)this.trigger("change:"+o[h],this,c[o[h]],n)}if(f)return this;if(!a)while(this._pending)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,u.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,u.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!u.isEmpty(this.changed):u.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?u.clone(this.changed):!1;var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var i in e){if(u.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return u.clone(this._previousAttributes)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r){if(!t.set(t.parse(r,e),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},F(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,i,s,o=this.attributes;e==null||typeof e=="object"?(r=e,n=t):(r={})[e]=t,n=u.extend({validate:!0},n);if(r&&!n.wait){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;r&&n.wait&&(this.attributes=u.extend({},o,r)),n.parse===void 0&&(n.parse=!0);var a=this,f=n.success;return n.success=function(e){a.attributes=o;var t=a.parse(e,n);n.wait&&(t=u.extend(r||{},t));if(u.isObject(t)&&!a.set(t,n))return!1;f&&f(a,e,n),a.trigger("sync",a,e,n)},F(this,n),i=this.isNew()?"create":n.patch?"patch":"update",i==="patch"&&(n.attrs=r),s=this.sync(i,this,n),r&&n.wait&&(this.attributes=o),s},destroy:function(e){e=e?u.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e),t.isNew()||t.trigger("sync",t,i,e)};if(this.isNew())return e.success(),!1;F(this,e);var i=this.sync("delete",this,e);return e.wait||r(),i},url:function(){var e=u.result(this,"urlRoot")||u.result(this.collection,"url")||j();return this.isNew()?e:e+(e.charAt(e.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(e){return this._validate({},u.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=u.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,u.extend(t,{validationError:n})),!1):!0}});var d=["keys","values","pairs","invert","pick","omit"];u.each(d,function(e){p.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.attributes),u[e].apply(u,t)}});var v=o.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,u.extend({silent:!0},t))},m={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};u.extend(v.prototype,a,{model:p,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return o.sync.apply(this,arguments)},add:function(e,t){return this.set(e,u.extend({merge:!1},t,g))},remove:function(e,t){var n=!u.isArray(e);e=n?[e]:u.clone(e),t||(t={});var r,i,s,o;for(r=0,i=e.length;r<i;r++){o=e[r]=this.get(e[r]);if(!o)continue;delete this._byId[o.id],delete this._byId[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o)}return n?e[0]:e},set:function(e,t){t=u.defaults({},t,m),t.parse&&(e=this.parse(e,t));var n=!u.isArray(e);e=n?e?[e]:[]:u.clone(e);var r,i,s,o,a,f,l,c=t.at,h=this.model,d=this.comparator&&c==null&&t.sort!==!1,v=u.isString(this.comparator)?this.comparator:null,g=[],y=[],b={},w=t.add,E=t.merge,S=t.remove,x=!d&&w&&S?[]:!1;for(r=0,i=e.length;r<i;r++){a=e[r],a instanceof p?s=o=a:s=a[h.prototype.idAttribute];if(f=this.get(s))S&&(b[f.cid]=!0),E&&(a=a===o?o.attributes:a,t.parse&&(a=f.parse(a,t)),f.set(a,t),d&&!l&&f.hasChanged(v)&&(l=!0)),e[r]=f;else if(w){o=e[r]=this._prepareModel(a,t);if(!o)continue;g.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,o.id!=null&&(this._byId[o.id]=o)}x&&x.push(f||o)}if(S){for(r=0,i=this.length;r<i;++r)b[(o=this.models[r]).cid]||y.push(o);y.length&&this.remove(y,t)}if(g.length||x&&x.length){d&&(l=!0),this.length+=g.length;if(c!=null)for(r=0,i=g.length;r<i;r++)this.models.splice(c+r,0,g[r]);else{x&&(this.models.length=0);var T=x||g;for(r=0,i=T.length;r<i;r++)this.models.push(T[r])}}l&&this.sort({silent:!0});if(!t.silent){for(r=0,i=g.length;r<i;r++)(o=g[r]).trigger("add",o,this,t);(l||x&&x.length)&&this.trigger("sort",this,t)}return n?e[0]:e},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),e=this.add(e,u.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,u.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,u.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return i.apply(this.models,arguments)},get:function(e){return e==null?void 0:this._byId[e.id]||this._byId[e.cid]||this._byId[e]},at:function(e){return this.models[e]},where:function(e,t){return u.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),u.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(u.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return u.invoke(this.models,"get",e)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=e.success,n=this;return e.success=function(r){var i=e.reset?"reset":"set";n[i](r,e),t&&t(n,r,e),n.trigger("sync",n,r,e)},F(this,e),this.sync("read",this,e)},create:function(e,t){t=t?u.clone(t):{};if(!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,r=t.success;return t.success=function(e,t,i){i.wait&&n.add(e,i),r&&r(e,t,i)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof p)return e.collection||(e.collection=this),e;t=t?u.clone(t):{},t.collection=this;var n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var y=["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"];u.each(y,function(e){v.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.models),u[e].apply(u,t)}});var b=["groupBy","countBy","sortBy"];u.each(b,function(e){v.prototype[e]=function(t,n){var r=u.isFunction(t)?t:function(e){return e.get(t)};return u[e](this.models,r,n)}});var w=o.View=function(e){this.cid=u.uniqueId("view"),e||(e={}),u.extend(this,u.pick(e,S)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},E=/^(\S+)\s*(.*)$/,S=["model","collection","el","id","attributes","className","tagName","events"];u.extend(w.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof o.$?e:o.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=u.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];u.isFunction(n)||(n=this[e[t]]);if(!n)continue;var r=t.match(E),i=r[1],s=r[2];n=u.bind(n,this),i+=".delegateEvents"+this.cid,s===""?this.$el.on(i,n):this.$el.on(i,s,n)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(!this.el){var e=u.extend({},u.result(this,"attributes"));this.id&&(e.id=u.result(this,"id")),this.className&&(e["class"]=u.result(this,"className"));var t=o.$("<"+u.result(this,"tagName")+">").attr(e);this.setElement(t,!1)}else this.setElement(u.result(this,"el"),!1)}}),o.sync=function(e,t,n){var r=T[e];u.defaults(n||(n={}),{emulateHTTP:o.emulateHTTP,emulateJSON:o.emulateJSON});var i={type:r,dataType:"json"};n.url||(i.url=u.result(t,"url")||j()),n.data==null&&t&&(e==="create"||e==="update"||e==="patch")&&(i.contentType="application/json",i.data=JSON.stringify(n.attrs||t.toJSON(n))),n.emulateJSON&&(i.contentType="application/x-www-form-urlencoded",i.data=i.data?{model:i.data}:{});if(n.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){i.type="POST",n.emulateJSON&&(i.data._method=r);var s=n.beforeSend;n.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",r);if(s)return s.apply(this,arguments)}}i.type!=="GET"&&!n.emulateJSON&&(i.processData=!1),i.type==="PATCH"&&x&&(i.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=n.xhr=o.ajax(u.extend(i,n));return t.trigger("request",t,a,n),a};var x=typeof window!="undefined"&&!!window.ActiveXObject&&(!window.XMLHttpRequest||!(new XMLHttpRequest).dispatchEvent),T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};o.ajax=function(){return o.$.ajax.apply(o.$,arguments)};var N=o.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},C=/\((.*?)\)/g,k=/(\(\?)?:\w+/g,L=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;u.extend(N.prototype,a,{initialize:function(){},route:function(e,t,n){u.isRegExp(e)||(e=this._routeToRegExp(e)),u.isFunction(t)&&(n=t,t=""),n||(n=this[t]);var r=this;return o.history.route(e,function(i){var s=r._extractParameters(e,i);n&&n.apply(r,s),r.trigger.apply(r,["route:"+t].concat(s)),r.trigger("route",t,s),o.history.trigger("route",r,t,s)}),this},navigate:function(e,t){return o.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;this.routes=u.result(this,"routes");var e,t=u.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(C,"(?:$1)?").replace(k,function(e,t){return t?e:"([^/]+)"}).replace(L,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return u.map(n,function(e){return e?decodeURIComponent(e):null})}});var O=o.History=function(){this.handlers=[],u.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},M=/^[#\/]|\s+$/g,_=/^\/+|\/+$/g,D=/msie [\w.]+/,P=/\/$/,H=/[?#].*$/;O.started=!1,u.extend(O.prototype,a,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(P,"");e.indexOf(n)||(e=e.slice(n.length))}else e=this.getHash();return e.replace(M,"")},start:function(e){if(O.started)throw new Error("Backbone.history has already been started");O.started=!0,this.options=u.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,r=D.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(_,"/"),r&&this._wantsHashChange&&(this.iframe=o.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?o.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?o.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=this.location,s=i.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!s)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&s&&i.hash&&(this.fragment=this.getHash().replace(M,""),this.history.replaceState({},document.title,this.root+this.fragment+i.search))}if(!this.options.silent)return this.loadUrl()},stop:function(){o.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),O.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return e=this.fragment=this.getFragment(e),u.any(this.handlers,function(t){if(t.route.test(e))return t.callback(e),!0})},navigate:function(e,t){if(!O.started)return!1;if(!t||t===!0)t={trigger:!!t};var n=this.root+(e=this.getFragment(e||""));e=e.replace(H,"");if(this.fragment===e)return;this.fragment=e,e===""&&n!=="/"&&(n=n.slice(0,-1));if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}if(t.trigger)return this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),o.history=new O;var B=function(e,t){var n=this,r;e&&u.has(e,"constructor")?r=e.constructor:r=function(){return n.apply(this,arguments)},u.extend(r,n,t);var i=function(){this.constructor=r};return i.prototype=n.prototype,r.prototype=new i,e&&u.extend(r.prototype,e),r.__super__=n.prototype,r};p.extend=v.extend=N.extend=w.extend=O.extend=B;var j=function(){throw new Error('A "url" property or function must be specified')},F=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}}}.call(this),define("backbone",["underscore","jquery"],function(e){return function(){var t,n;return t||e.Backbone}}(this));if(typeof jQuery=="undefined")throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){"use strict";var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||t[0]==1&&t[1]==9&&t[2]<1||t[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(e.style[n]!==undefined)return{end:t[n]};return!1}e.fn.emulateTransitionEnd=function(t){var n=!1,r=this;e(this).one("bsTransitionEnd",function(){n=!0});var i=function(){n||e(r).trigger(e.support.transition.end)};return setTimeout(i,t),this},e(function(){e.support.transition=t();if(!e.support.transition)return;e.event.special.bsTransitionEnd={bindType:e.support.transition.end,delegateType:e.support.transition.end,handle:function(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}}})}(jQuery),+function(e){"use strict";function r(t){return this.each(function(){var r=e(this),i=r.data("bs.alert");i||r.data("bs.alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})}var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.VERSION="3.3.7",n.TRANSITION_DURATION=150,n.prototype.close=function(t){function o(){s.detach().trigger("closed.bs.alert").remove()}var r=e(this),i=r.attr("data-target");i||(i=r.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,""));var s=e(i==="#"?[]:i);t&&t.preventDefault(),s.length||(s=r.closest(".alert")),s.trigger(t=e.Event("close.bs.alert"));if(t.isDefaultPrevented())return;s.removeClass("in"),e.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",o).emulateTransitionEnd(n.TRANSITION_DURATION):o()};var i=e.fn.alert;e.fn.alert=r,e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",t,n.prototype.close)}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.button"),s=typeof n=="object"&&n;i||r.data("bs.button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})}var t=function(n,r){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,r),this.isLoading=!1};t.VERSION="3.3.7",t.DEFAULTS={loadingText:"loading..."},t.prototype.setState=function(t){var n="disabled",r=this.$element,i=r.is("input")?"val":"html",s=r.data();t+="Text",s.resetText==null&&r.data("resetText",r[i]()),setTimeout(e.proxy(function(){r[i](s[t]==null?this.options[t]:s[t]),t=="loadingText"?(this.isLoading=!0,r.addClass(n).attr(n,n).prop(n,!0)):this.isLoading&&(this.isLoading=!1,r.removeClass(n).removeAttr(n).prop(n,!1))},this),0)},t.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var n=this.$element.find("input");n.prop("type")=="radio"?(n.prop("checked")&&(e=!1),t.find(".active").removeClass("active"),this.$element.addClass("active")):n.prop("type")=="checkbox"&&(n.prop("checked")!==this.$element.hasClass("active")&&(e=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),e&&n.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var r=e.fn.button;e.fn.button=n,e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=r,this},e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var r=e(t.target).closest(".btn");n.call(r,"toggle"),e(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),r.is("input,button")?r.trigger("focus"):r.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){e(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.carousel"),s=e.extend({},t.DEFAULTS,r.data(),typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("bs.carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})}var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",e.proxy(this.keydown,this)),this.options.pause=="hover"&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",e.proxy(this.pause,this)).on("mouseleave.bs.carousel",e.proxy(this.cycle,this))};t.VERSION="3.3.7",t.TRANSITION_DURATION=600,t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},t.prototype.keydown=function(e){if(/input|textarea/i.test(e.target.tagName))return;switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()},t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},t.prototype.getItemIndex=function(e){return this.$items=e.parent().children(".item"),this.$items.index(e||this.$active)},t.prototype.getItemForDirection=function(e,t){var n=this.getItemIndex(t),r=e=="prev"&&n===0||e=="next"&&n==this.$items.length-1;if(r&&!this.options.wrap)return t;var i=e=="prev"?-1:1,s=(n+i)%this.$items.length;return this.$items.eq(s)},t.prototype.to=function(e){var t=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(e>this.$items.length-1||e<0)return;return this.sliding?this.$element.one("slid.bs.carousel",function(){t.to(e)}):n==e?this.pause().cycle():this.slide(e>n?"next":"prev",this.$items.eq(e))},t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},t.prototype.next=function(){if(this.sliding)return;return this.slide("next")},t.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")},t.prototype.slide=function(n,r){var i=this.$element.find(".item.active"),s=r||this.getItemForDirection(n,i),o=this.interval,u=n=="next"?"left":"right",a=this;if(s.hasClass("active"))return this.sliding=!1;var f=s[0],l=e.Event("slide.bs.carousel",{relatedTarget:f,direction:u});this.$element.trigger(l);if(l.isDefaultPrevented())return;this.sliding=!0,o&&this.pause();if(this.$indicators.length){this.$indicators.find(".active").removeClass("active");var c=e(this.$indicators.children()[this.getItemIndex(s)]);c&&c.addClass("active")}var h=e.Event("slid.bs.carousel",{relatedTarget:f,direction:u});return e.support.transition&&this.$element.hasClass("slide")?(s.addClass(n),s[0].offsetWidth,i.addClass(u),s.addClass(u),i.one("bsTransitionEnd",function(){s.removeClass([n,u].join(" ")).addClass("active"),i.removeClass(["active",u].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(h)},0)}).emulateTransitionEnd(t.TRANSITION_DURATION)):(i.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(h)),o&&this.cycle(),this};var r=e.fn.carousel;e.fn.carousel=n,e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=r,this};var i=function(t){var r,i=e(this),s=e(i.attr("data-target")||(r=i.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""));if(!s.hasClass("carousel"))return;var o=e.extend({},s.data(),i.data()),u=i.attr("data-slide-to");u&&(o.interval=!1),n.call(s,o),u&&s.data("bs.carousel").to(u),t.preventDefault()};e(document).on("click.bs.carousel.data-api","[data-slide]",i).on("click.bs.carousel.data-api","[data-slide-to]",i),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){"use strict";function n(t){var n,r=t.attr("data-target")||(n=t.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return e(r)}function r(n){return this.each(function(){var r=e(this),i=r.data("bs.collapse"),s=e.extend({},t.DEFAULTS,r.data(),typeof n=="object"&&n);!i&&s.toggle&&/show|hide/.test(n)&&(s.toggle=!1),i||r.data("bs.collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(n,r){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,r),this.$trigger=e('[data-toggle="collapse"][href="#'+n.id+'"],'+'[data-toggle="collapse"][data-target="#'+n.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};t.VERSION="3.3.7",t.TRANSITION_DURATION=350,t.DEFAULTS={toggle:!0},t.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},t.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var n,i=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(i&&i.length){n=i.data("bs.collapse");if(n&&n.transitioning)return}var s=e.Event("show.bs.collapse");this.$element.trigger(s);if(s.isDefaultPrevented())return;i&&i.length&&(r.call(i,"hide"),n||i.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var u=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return u.call(this);var a=e.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",e.proxy(u,this)).emulateTransitionEnd(t.TRANSITION_DURATION)[o](this.$element[0][a])},t.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var n=e.Event("hide.bs.collapse");this.$element.trigger(n);if(n.isDefaultPrevented())return;var r=this.dimension();this.$element[r](this.$element[r]())[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 i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!e.support.transition)return i.call(this);this.$element[r](0).one("bsTransitionEnd",e.proxy(i,this)).emulateTransitionEnd(t.TRANSITION_DURATION)},t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},t.prototype.getParent=function(){return e(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(e.proxy(function(t,r){var i=e(r);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},t.prototype.addAriaAndCollapsedClass=function(e,t){var n=e.hasClass("in");e.attr("aria-expanded",n),t.toggleClass("collapsed",!n).attr("aria-expanded",n)};var i=e.fn.collapse;e.fn.collapse=r,e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=i,this},e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var i=e(this);i.attr("data-target")||t.preventDefault();var s=n(i),o=s.data("bs.collapse"),u=o?"toggle":i.data();r.call(s,u)})}(jQuery),+function(e){"use strict";function i(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var r=n&&e(n);return r&&r.length?r:t.parent()}function s(r){if(r&&r.which===3)return;e(t).remove(),e(n).each(function(){var t=e(this),n=i(t),s={relatedTarget:this};if(!n.hasClass("open"))return;if(r&&r.type=="click"&&/input|textarea/i.test(r.target.tagName)&&e.contains(n[0],r.target))return;n.trigger(r=e.Event("hide.bs.dropdown",s));if(r.isDefaultPrevented())return;t.attr("aria-expanded","false"),n.removeClass("open").trigger(e.Event("hidden.bs.dropdown",s))})}function o(t){return this.each(function(){var n=e(this),i=n.data("bs.dropdown");i||n.data("bs.dropdown",i=new r(this)),typeof t=="string"&&i[t].call(n)})}var t=".dropdown-backdrop",n='[data-toggle="dropdown"]',r=function(t){e(t).on("click.bs.dropdown",this.toggle)};r.VERSION="3.3.7",r.prototype.toggle=function(t){var n=e(this);if(n.is(".disabled, :disabled"))return;var r=i(n),o=r.hasClass("open");s();if(!o){"ontouchstart"in document.documentElement&&!r.closest(".navbar-nav").length&&e(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(e(this)).on("click",s);var u={relatedTarget:this};r.trigger(t=e.Event("show.bs.dropdown",u));if(t.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),r.toggleClass("open").trigger(e.Event("shown.bs.dropdown",u))}return!1},r.prototype.keydown=function(t){if(!/(38|40|27|32)/.test(t.which)||/input|textarea/i.test(t.target.tagName))return;var r=e(this);t.preventDefault(),t.stopPropagation();if(r.is(".disabled, :disabled"))return;var s=i(r),o=s.hasClass("open");if(!o&&t.which!=27||o&&t.which==27)return t.which==27&&s.find(n).trigger("focus"),r.trigger("click");var u=" li:not(.disabled):visible a",a=s.find(".dropdown-menu"+u);if(!a.length)return;var f=a.index(t.target);t.which==38&&f>0&&f--,t.which==40&&f<a.length-1&&f++,~f||(f=0),a.eq(f).trigger("focus")};var u=e.fn.dropdown;e.fn.dropdown=o,e.fn.dropdown.Constructor=r,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=u,this},e(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",n,r.prototype.toggle).on("keydown.bs.dropdown.data-api",n,r.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",r.prototype.keydown)}(jQuery),+function(e){"use strict";function n(n,r){return this.each(function(){var i=e(this),s=i.data("bs.modal"),o=e.extend({},t.DEFAULTS,i.data(),typeof n=="object"&&n);s||i.data("bs.modal",s=new t(this,o)),typeof n=="string"?s[n](r):o.show&&s.show(r)})}var t=function(t,n){this.options=n,this.$body=e(document.body),this.$element=e(t),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,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};t.VERSION="3.3.7",t.TRANSITION_DURATION=300,t.BACKDROP_TRANSITION_DURATION=150,t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},t.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},t.prototype.show=function(n){var r=this,i=e.Event("show.bs.modal",{relatedTarget:n});this.$element.trigger(i);if(this.isShown||i.isDefaultPrevented())return;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"]',e.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){r.$element.one("mouseup.dismiss.bs.modal",function(t){e(t.target).is(r.$element)&&(r.ignoreBackdropClick=!0)})}),this.backdrop(function(){var i=e.support.transition&&r.$element.hasClass("fade");r.$element.parent().length||r.$element.appendTo(r.$body),r.$element.show().scrollTop(0),r.adjustDialog(),i&&r.$element[0].offsetWidth,r.$element.addClass("in"),r.enforceFocus();var s=e.Event("shown.bs.modal",{relatedTarget:n});i?r.$dialog.one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(t.TRANSITION_DURATION):r.$element.trigger("focus").trigger(s)})},t.prototype.hide=function(n){n&&n.preventDefault(),n=e.Event("hide.bs.modal"),this.$element.trigger(n);if(!this.isShown||n.isDefaultPrevented())return;this.isShown=!1,this.escape(),this.resize(),e(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"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(t.TRANSITION_DURATION):this.hideModal()},t.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){document!==e.target&&this.$element[0]!==e.target&&!this.$element.has(e.target).length&&this.$element.trigger("focus")},this))},t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",e.proxy(function(e){e.which==27&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},t.prototype.resize=function(){this.isShown?e(window).on("resize.bs.modal",e.proxy(this.handleUpdate,this)):e(window).off("resize.bs.modal")},t.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.$body.removeClass("modal-open"),e.resetAdjustments(),e.resetScrollbar(),e.$element.trigger("hidden.bs.modal")})},t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},t.prototype.backdrop=function(n){var r=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=e.support.transition&&i;this.$backdrop=e(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",e.proxy(function(e){if(this.ignoreBackdropClick){this.ignoreBackdropClick=!1;return}if(e.target!==e.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus():this.hide()},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!n)return;s?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):n()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var o=function(){r.removeBackdrop(),n&&n()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",o).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):o()}else n&&n()},t.prototype.handleUpdate=function(){this.adjustDialog()},t.prototype.adjustDialog=function(){var e=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&e?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!e?this.scrollbarWidth:""})},t.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},t.prototype.checkScrollbar=function(){var e=window.innerWidth;if(!e){var t=document.documentElement.getBoundingClientRect();e=t.right-Math.abs(t.left)}this.bodyIsOverflowing=document.body.clientWidth<e,this.scrollbarWidth=this.measureScrollbar()},t.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",e+this.scrollbarWidth)},t.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},t.prototype.measureScrollbar=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",this.$body.append(e);var t=e.offsetWidth-e.clientWidth;return this.$body[0].removeChild(e),t};var r=e.fn.modal;e.fn.modal=n,e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=r,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=e(this),i=r.attr("href"),s=e(r.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},s.data(),r.data());r.is("a")&&t.preventDefault(),s.one("show.bs.modal",function(e){if(e.isDefaultPrevented())return;s.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})}),n.call(s,o,this)})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s=typeof n=="object"&&n;if(!i&&/destroy|hide/.test(n))return;i||r.data("bs.tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(e,t){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",e,t)};t.VERSION="3.3.7",t.TRANSITION_DURATION=150,t.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}},t.prototype.init=function(t,n,r){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&e(e.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};if(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!");var i=this.options.trigger.split(" ");for(var s=i.length;s--;){var o=i[s];if(o=="click")this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if(o!="manual"){var u=o=="hover"?"mouseenter":"focusin",a=o=="hover"?"mouseleave":"focusout";this.$element.on(u+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(a+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},t.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,r){n[e]!=r&&(t[e]=r)}),t},t.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),t instanceof e.Event&&(n.inState[t.type=="focusin"?"focus":"hover"]=!0);if(n.tip().hasClass("in")||n.hoverState=="in"){n.hoverState="in";return}clearTimeout(n.timeout),n.hoverState="in";if(!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},t.prototype.isInStateTrue=function(){for(var e in this.inState)if(this.inState[e])return!0;return!1},t.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),t instanceof e.Event&&(n.inState[t.type=="focusout"?"focus":"hover"]=!1);if(n.isInStateTrue())return;clearTimeout(n.timeout),n.hoverState="out";if(!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},t.prototype.show=function(){var n=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(n);var r=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(n.isDefaultPrevented()||!r)return;var i=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var u=typeof this.options.placement=="function"?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,f=a.test(u);f&&(u=u.replace(a,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(u).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 l=this.getPosition(),c=s[0].offsetWidth,h=s[0].offsetHeight;if(f){var p=u,d=this.getPosition(this.$viewport);u=u=="bottom"&&l.bottom+h>d.bottom?"top":u=="top"&&l.top-h<d.top?"bottom":u=="right"&&l.right+c>d.width?"left":u=="left"&&l.left-c<d.left?"right":u,s.removeClass(p).addClass(u)}var v=this.getCalculatedOffset(u,l,c,h);this.applyPlacement(v,u);var m=function(){var e=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,e=="out"&&i.leave(i)};e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",m).emulateTransitionEnd(t.TRANSITION_DURATION):m()}},t.prototype.applyPlacement=function(t,n){var r=this.tip(),i=r[0].offsetWidth,s=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),u=parseInt(r.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(u)&&(u=0),t.top+=o,t.left+=u,e.offset.setOffset(r[0],e.extend({using:function(e){r.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),r.addClass("in");var a=r[0].offsetWidth,f=r[0].offsetHeight;n=="top"&&f!=s&&(t.top=t.top+s-f);var l=this.getViewportAdjustedDelta(n,t,a,f);l.left?t.left+=l.left:t.top+=l.top;var c=/top|bottom/.test(n),h=c?l.left*2-i+a:l.top*2-s+f,p=c?"offsetWidth":"offsetHeight";r.offset(t),this.replaceArrow(h,r[0][p],c)},t.prototype.replaceArrow=function(e,t,n){this.arrow().css(n?"left":"top",50*(1-e/t)+"%").css(n?"top":"left","")},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},t.prototype.hide=function(n){function o(){r.hoverState!="in"&&i.detach(),r.$element&&r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type),n&&n()}var r=this,i=e(this.$tip),s=e.Event("hide.bs."+this.type);this.$element.trigger(s);if(s.isDefaultPrevented())return;return i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",o).emulateTransitionEnd(t.TRANSITION_DURATION):o(),this.hoverState=null,this},t.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},t.prototype.hasContent=function(){return this.getTitle()},t.prototype.getPosition=function(t){t=t||this.$element;var n=t[0],r=n.tagName=="BODY",i=n.getBoundingClientRect();i.width==null&&(i=e.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var s=window.SVGElement&&n instanceof window.SVGElement,o=r?{top:0,left:0}:s?null:t.offset(),u={scroll:r?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},a=r?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},i,u,a,o)},t.prototype.getCalculatedOffset=function(e,t,n,r){return e=="bottom"?{top:t.top+t.height,left:t.left+t.width/2-n/2}:e=="top"?{top:t.top-r,left:t.left+t.width/2-n/2}:e=="left"?{top:t.top+t.height/2-r/2,left:t.left-n}:{top:t.top+t.height/2-r/2,left:t.left+t.width}},t.prototype.getViewportAdjustedDelta=function(e,t,n,r){var i={top:0,left:0};if(!this.$viewport)return i;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(e)){var u=t.top-s-o.scroll,a=t.top+s-o.scroll+r;u<o.top?i.top=o.top-u:a>o.top+o.height&&(i.top=o.top+o.height-a)}else{var f=t.left-s,l=t.left+s+n;f<o.left?i.left=o.left-f:l>o.right&&(i.left=o.left+o.width-l)}return i},t.prototype.getTitle=function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},t.prototype.getUID=function(e){do e+=~~(Math.random()*1e6);while(document.getElementById(e));return e},t.prototype.tip=function(){if(!this.$tip){this.$tip=e(this.options.template);if(this.$tip.length!=1)throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!")}return this.$tip},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},t.prototype.enable=function(){this.enabled=!0},t.prototype.disable=function(){this.enabled=!1},t.prototype.toggleEnabled=function(){this.enabled=!this.enabled},t.prototype.toggle=function(t){var n=this;t&&(n=e(t.currentTarget).data("bs."+this.type),n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n))),t?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},t.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type),e.$tip&&e.$tip.detach(),e.$tip=null,e.$arrow=null,e.$viewport=null,e.$element=null})};var r=e.fn.tooltip;e.fn.tooltip=n,e.fn.tooltip.Constructor=t,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.popover"),s=typeof n=="object"&&n;if(!i&&/destroy|hide/.test(n))return;i||r.data("bs.popover",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");t.VERSION="3.3.7",t.DEFAULTS=e.extend({},e.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>'}),t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),t.prototype.constructor=t,t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content").children().detach().end()[this.options.html?typeof n=="string"?"html":"append":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},t.prototype.hasContent=function(){return this.getTitle()||this.getContent()},t.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||(typeof t.content=="function"?t.content.call(e[0]):t.content)},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var r=e.fn.popover;e.fn.popover=n,e.fn.popover.Constructor=t,e.fn.popover.noConflict=function(){return e.fn.popover=r,this}}(jQuery),+function(e){"use strict";function t(n,r){this.$body=e(document.body),this.$scrollElement=e(n).is(document.body)?e(window):e(n),this.options=e.extend({},t.DEFAULTS,r),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e.proxy(this.process,this)),this.refresh(),this.process()}function n(n){return this.each(function(){var r=e(this),i=r.data("bs.scrollspy"),s=typeof n=="object"&&n;i||r.data("bs.scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})}t.VERSION="3.3.7",t.DEFAULTS={offset:10},t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},t.prototype.refresh=function(){var t=this,n="offset",r=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),e.isWindow(this.$scrollElement[0])||(n="position",r=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=e(this),i=t.data("target")||t.attr("href"),s=/^#./.test(i)&&e(i);return s&&s.length&&s.is(":visible")&&[[s[n]().top+r,i]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},t.prototype.process=function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.getScrollHeight(),n=this.options.offset+t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;this.scrollHeight!=t&&this.refresh();if(e>=n)return s!=(o=i[i.length-1])&&this.activate(o);if(s&&e<r[0])return this.activeTarget=null,this.clear();for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(r[o+1]===undefined||e<r[o+1])&&this.activate(i[o])},t.prototype.activate=function(t){this.activeTarget=t,this.clear();var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',r=e(n).parents("li").addClass("active");r.parent(".dropdown-menu").length&&(r=r.closest("li.dropdown").addClass("active")),r.trigger("activate.bs.scrollspy")},t.prototype.clear=function(){e(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=e.fn.scrollspy;e.fn.scrollspy=n,e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=r,this},e(window).on("load.bs.scrollspy.data-api",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.tab");i||r.data("bs.tab",i=new t(this)),typeof n=="string"&&i[n]()})}var t=function(t){this.element=e(t)};t.VERSION="3.3.7",t.TRANSITION_DURATION=150,t.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.data("target");r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;var i=n.find(".active:last a"),s=e.Event("hide.bs.tab",{relatedTarget:t[0]}),o=e.Event("show.bs.tab",{relatedTarget:i[0]});i.trigger(s),t.trigger(o);if(o.isDefaultPrevented()||s.isDefaultPrevented())return;var u=e(r);this.activate(t.closest("li"),n),this.activate(u,u.parent(),function(){i.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:i[0]})})},t.prototype.activate=function(n,r,i){function u(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),n.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),o?(n[0].offsetWidth,n.addClass("in")):n.removeClass("fade"),n.parent(".dropdown-menu").length&&n.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}var s=r.find("> .active"),o=i&&e.support.transition&&(s.length&&s.hasClass("fade")||!!r.find("> .fade").length);s.length&&o?s.one("bsTransitionEnd",u).emulateTransitionEnd(t.TRANSITION_DURATION):u(),s.removeClass("in")};var r=e.fn.tab;e.fn.tab=n,e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=r,this};var i=function(t){t.preventDefault(),n.call(e(this),"show")};e(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.affix"),s=typeof n=="object"&&n;i||r.data("bs.affix",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(n,r){this.options=e.extend({},t.DEFAULTS,r),this.$target=e(this.options.target).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(n),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};t.VERSION="3.3.7",t.RESET="affix affix-top affix-bottom",t.DEFAULTS={offset:0,target:window},t.prototype.getState=function(e,t,n,r){var i=this.$target.scrollTop(),s=this.$element.offset(),o=this.$target.height();if(n!=null&&this.affixed=="top")return i<n?"top":!1;if(this.affixed=="bottom")return n!=null?i+this.unpin<=s.top?!1:"bottom":i+o<=e-r?!1:"bottom";var u=this.affixed==null,a=u?i:s.top,f=u?o:t;return n!=null&&i<=n?"top":r!=null&&a+f>=e-r?"bottom":!1},t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var e=this.$target.scrollTop(),n=this.$element.offset();return this.pinnedOffset=n.top-e},t.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var n=this.$element.height(),r=this.options.offset,i=r.top,s=r.bottom,o=Math.max(e(document).height(),e(document.body).height());typeof r!="object"&&(s=i=r),typeof i=="function"&&(i=r.top(this.$element)),typeof s=="function"&&(s=r.bottom(this.$element));var u=this.getState(o,n,i,s);if(this.affixed!=u){this.unpin!=null&&this.$element.css("top","");var a="affix"+(u?"-"+u:""),f=e.Event(a+".bs.affix");this.$element.trigger(f);if(f.isDefaultPrevented())return;this.affixed=u,this.unpin=u=="bottom"?this.getPinnedOffset():null,this.$element.removeClass(t.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}u=="bottom"&&this.$element.offset({top:o-n-s})};var r=e.fn.affix;e.fn.affix=n,e.fn.affix.Constructor=t,e.fn.affix.noConflict=function(){return e.fn.affix=r,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),r=t.data();r.offset=r.offset||{},r.offsetBottom!=null&&(r.offset.bottom=r.offsetBottom),r.offsetTop!=null&&(r.offset.top=r.offsetTop),n.call(t,r)})})}(jQuery),define("bootstrap",["jquery"],function(){});if(Common===undefined)var Common={};define("notification",["backbone"],function(e){"use strict";var t=function(){};_.extend(t.prototype,e.Events);if(typeof Common.NotificationCenter!="undefined")throw"Native Common.NotificationCenter instance already defined.";t.extend=e.Model.extend,Common.NotificationCenter=new t}),function(){var e=function(e,t){var n=e.split("."),r=t||window;for(var i=0,s=n.length;i<s;i++)r=r[n[i]]||{};return r},t=function(e){_.extend(this,e||{}),this.eventbus=new r({application:this}),this.createApplicationNamespace(),this.initialize.apply(this,arguments),this.autoCreate!==!1&&$($.proxy(this.onReady,this))};_.extend(t.prototype,{nameSpace:"Application",models:{},collections:{},controllers:{},allocationMap:{model:"Models",collection:"Collections",controller:"Controllers",view:"Views"},createApplicationNamespace:function(){var e=window;this.nameSpace&&typeof e[this.nameSpace]=="undefined"&&(e[this.nameSpace]={}),e[this.nameSpace]=this,_.each(this.allocationMap,function(e,t){this[e]=this[e]||{}},this)},initialize:function(){},onReady:function(){this.start()},start:function(){this.initializeControllers(this.controllers||{}),this.launchControllers(),this.launch.call(this)},getClasseRefs:function(t,n){var r={},i=this.allocationMap[t],s=this[i];return _.each(n,function(t){r[t]=e(t,t.indexOf(".")>-1?window:s)},this),r},initializeControllers:function(t){this.controllers={},_.each(t,function(t){var n=t.indexOf(".")>-1?window:this[this.allocationMap.controller],r=e(t,n),i=t.split(".").pop(),s=new r({id:t,application:this});s.views=this.getClasseRefs("view",s.views||[]),_.extend(this.models,this.getClasseRefs("model",s.models||[])),_.extend(this.collections,this.getClasseRefs("collection",s.collections||{})),this.buildCollections(),this.controllers[t]=s},this)},launchControllers:function(){_.each(this.controllers,function(e,t){e.onLaunch(this)},this)},launch:function(){},addListeners:function(e,t){this.eventbus.addListeners(e,t)},getController:function(e){return this.controllers[e]},getModel:function(e){this._modelsCache=this._modelsCache||{};var t=this._modelsCache[e],n=this.getModelConstructor(e);return!t&&n&&(t=this.createModel(e),this._modelsCache[e]=t),t||null},getModelConstructor:function(e){return this.models[e]},createModel:function(e,t){var n=this.getModelConstructor(e),r=null;return n&&(r=new n(_.extend(t||{}))),r},getCollection:function(e){this._collectionsCache=this._collectionsCache||{};var t=this._collectionsCache[e],n=this.getCollectionConstructor(e);return!t&&n&&(t=this.createCollection(e),this._collectionsCache[e]=t),t||null},getCollectionConstructor:function(e){return this.collections[e]},createCollection:function(e){var t=this.getCollectionConstructor(e),n=null;return t&&(n=new t),n},buildCollections:function(){_.each(this.collections,function(e,t){this.getCollection(t)},this)}});if(typeof Backbone.Application!="undefined")throw"Native Backbone.Application instance already defined.";Backbone.Application=t,Backbone.Application.extend=Backbone.Model.extend;var n=function(e){_.extend(this,e||{}),this.initialize.apply(this,arguments)};_.extend(n.prototype,{name:null,views:{},models:{},collections:{},initialize:function(e){},addListeners:function(e){this.getApplication().addListeners(e,this)},onLaunch:function(e){},getApplication:function(){return this.application},getView:function(e){return this._viewsCache[e]},getViewConstructor:function(e){return this.views[e]},createView:function(e,t){var n=this.getViewConstructor(e),r=_.extend(t||{},{alias:e});return this._viewsCache=this._viewsCache||{},this._viewsCache[e]=new n(r),this._viewsCache[e].options=_.extend({},r),this._viewsCache[e]},getModel:function(e){return this.application.getModel(e)},getModelConstructor:function(e){return this.application.getModelConstructor(e)},createModel:function(e,t){return this.application.createModel(e)},getCollection:function(e){return this.application.getCollection(e)},getCollectionConstructor:function(e){return this.application.getCollectionConstructor(e)},createCollection:function(e){return this.application.createCollection(e)},fireEvent:function(e,t,n){this.application.eventbus.fireEvent(e,t,n)},bindViewEvents:function(e,t){this.unbindViewEvents(e),t=_.isFunction(t)?t.call(this):t;for(var n in t){var r=t[n];_.isFunction(r)||(r=this[t[n]]);var i=n.match(/^(\S+)\s*(.*)$/),s=i[1],o=i[2];r=_.bind(r,this),s+=".bindViewEvents"+e.cid,e.$el.on(s,o,r)}return this},unbindViewEvents:function(e){return e.$el.off(".bindViewEvents"+e.cid),this}});if(typeof Backbone.Controller!="undefined")throw"Native Backbone.Controller instance already defined.";Backbone.Controller=n,Backbone.Controller.extend=Backbone.Model.extend;var r=function(e){var t=this;_.extend(this,e||{}),_.extend(Backbone.View.prototype,{alias:null,hidden:!1,getAlias:function(){return this.options.alias},fireEvent:function(e,n){this.trigger.apply(this,arguments),t.fireEvent(this.getAlias(),e,n)},hide:function(){this.$el.hide(),this.hidden=!0},show:function(){this.$el.show(),this.hidden=!1}})};_.extend(r.prototype,{pool:{},addListeners:function(e,t){this.pool[t.id]=this.pool[t.id]||{};var n=this.pool[t.id];_.isArray(e)?_.each(e,function(e){this.addListeners(e,t)},this):_.isObject(e)&&_.each(e,function(e,t){_.each(e,function(e,r){n[t]=n[t]||{},n[t][r]=n[t][r]||[],n[t][r].push(e)},this)},this)},fireEvent:function(e,t,n){var r=this.getApplication();_.each(this.pool,function(i,s){var o=i[e];if(o){var u=o[t],a=r.getController(s);_.each(u,function(e){e.apply(a,n)})}},this)},getApplication:function(){return this.application}});if(typeof Backbone.EventBus!="undefined")throw"Native Backbone.Application instance already defined.";Backbone.EventBus=r}(),define("core",["backbone","notification"],function(){});if(Common===undefined)var Common={};Common.component=Common.component||{},Common.Analytics=Common.component.Analytics=new function(){var e;return{initialize:function(t,n){if(typeof t=="undefined")throw"Analytics: invalid id.";if(typeof n=="undefined"||Object.prototype.toString.apply(n)!=="[object String]")throw"Analytics: invalid category type.";e=n,$("head").append('<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(["_setAccount", "'+t+'"]);'+'_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(t,n,r){if(typeof t!="undefined"&&Object.prototype.toString.apply(t)!=="[object String]")throw"Analytics: invalid action type.";if(typeof n!="undefined"&&Object.prototype.toString.apply(n)!=="[object String]")throw"Analytics: invalid label type.";if(typeof r!="undefined"&&(Object.prototype.toString.apply(r)!=="[object Number]"||!isFinite(r)))throw"Analytics: invalid value type.";if(typeof _gaq=="undefined")return;if(e==="undefined")throw"Analytics is not initialized.";_gaq.push(["_trackEvent",e,t,n,r])}}},define("analytics",["jquery"],function(){});if(Common===undefined)var Common={};Common.Gateway=new function(){var e=this,t=$(e),n={init:function(e){t.trigger("init",e)},openDocument:function(e){t.trigger("opendocument",e)},showMessage:function(e){t.trigger("showmessage",e)},applyEditRights:function(e){t.trigger("applyeditrights",e)},processSaveResult:function(e){t.trigger("processsaveresult",e)},processRightsChange:function(e){t.trigger("processrightschange",e)},refreshHistory:function(e){t.trigger("refreshhistory",e)},setHistoryData:function(e){t.trigger("sethistorydata",e)},setEmailAddresses:function(e){t.trigger("setemailaddresses",e)},processMailMerge:function(e){t.trigger("processmailmerge",e)},downloadAs:function(){t.trigger("downloadas")},processMouse:function(e){t.trigger("processmouse",e)},internalCommand:function(e){t.trigger("internalcommand",e)},resetFocus:function(e){t.trigger("resetfocus",e)}},r=function(e){window.parent&&window.JSON&&(e.frameEditorId=window.frameEditorId,window.parent.postMessage(window.JSON.stringify(e),"*"))},i=function(e){var t=e.data;if(Object.prototype.toString.apply(t)!=="[object String]"||!window.JSON)return;var r,i;try{r=window.JSON.parse(t)}catch(s){r=""}r&&(i=n[r.command],i&&i.call(this,r.data))},s=function(e){i(e)};return window.attachEvent?window.attachEvent("onmessage",s):window.addEventListener("message",s,!1),{ready:function(){r({event:"onReady"})},requestEditRights:function(){r({event:"onRequestEditRights"})},requestHistory:function(){r({event:"onRequestHistory"})},requestHistoryData:function(e){r({event:"onRequestHistoryData",data:e})},requestRestore:function(e,t){r({event:"onRequestRestore",data:{version:e,url:t}})},requestEmailAddresses:function(){r({event:"onRequestEmailAddresses"})},requestStartMailMerge:function(){r({event:"onRequestStartMailMerge"})},requestHistoryClose:function(e){r({event:"onRequestHistoryClose"})},reportError:function(e,t){r({event:"onError",data:{errorCode:e,errorDescription:t}})},sendInfo:function(e){r({event:"onInfo",data:e})},setDocumentModified:function(e){r({event:"onDocumentStateChange",data:e})},internalMessage:function(e,t){r({event:"onInternalMessage",data:{type:e,data:t}})},updateVersion:function(){r({event:"onOutdatedVersion"})},downloadAs:function(e){r({event:"onDownloadAs",data:e})},collaborativeChanges:function(){r({event:"onCollaborativeChanges"})},requestRename:function(e){r({event:"onRequestRename",data:e})},metaChange:function(e){r({event:"onMetaChange",data:e})},on:function(n,r){var i=function(t,n){r.call(e,n)};t.on(n,i)}}},define("gateway",["jquery"],function(){});if(Common===undefined)var Common={};Common.Locale=new function(){var l10n={},_createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_applyLocalization=function(){try{for(var e in l10n){var t=e.split(".");if(t&&t.length>2){var n=window;for(var r=0;r<t.length-1;++r)n[t[r]]===undefined&&(n[t[r]]=new Object),n=n[t[r]];n&&(n[t[t.length-1]]=l10n[e])}}}catch(i){}},_get=function(prop,scope){var res="";return scope&&scope.name&&(res=l10n[scope.name+"."+prop]),res||(scope?eval(scope.name).prototype[prop]:"")},_getUrlParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),n=t.exec(location.search);return n==null?"":decodeURIComponent(n[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(e){}return{apply:_applyLocalization,get:_get}},define("locale",function(){}),define("text",["module"],function(e){"use strict";var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.10",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}d.isBuild=i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i.indexOf("")===0&&(i=i.substring(1)),t(i)}catch(s){r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("text!common/main/lib/template/Header.template",[],function(){return'<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>'});if(Common===undefined)var Common={};define("common/main/lib/component/BaseView",["backbone"],function(e){"use strict";Common.UI=_.extend(Common.UI||{},{Keys:{BACKSPACE:8,TAB:9,RETURN:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,HOME:36,END:35,SPACE:32,PAGEUP:33,PAGEDOWN:34,INSERT:45,NUM_PLUS:107,NUM_MINUS:109,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,EQUALITY:187,MINUS:189},BaseView:e.View.extend({isSuspendEvents:!1,initialize:function(e){this.options=this.options?_({}).extend(this.options,e):e},setVisible:function(e){return this[e?"show":"hide"]()},isVisible:function(){return $(this.el).is(":visible")},suspendEvents:function(){this.isSuspendEvents=!0},resumeEvents:function(){this.isSuspendEvents=!1}}),getId:function(e){return _.uniqueId(e||"asc-gen")}})});if(Common===undefined)var Common={};define("common/main/lib/component/Window",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Window=Common.UI.BaseView.extend(_.extend(function(){function n(){var e=$(".modals-mask");return e.length==0&&(e=$("<div class='modals-mask'>").appendTo(document.body).hide(),e.attr("counter",0)),e}function r(e){if(!this.isLocked()&&this.isVisible()&&this.initConfig.enableKeyEvents)switch(e.keyCode){case Common.UI.Keys.ESC:if($(".asc-loadmask").length<1)return e.preventDefault(),e.stopPropagation(),this.initConfig.closable!==!1&&(this.initConfig.toolclose=="hide"?this.hide():this.close()),!1;break;case Common.UI.Keys.RETURN:if(this.$window.find(".btn.primary").length&&$(".asc-loadmask").length<1&&(this.initConfig.onprimary||this.onPrimary).call(this)===!1)return e.preventDefault(),!1}}function i(){if(window.innerHeight==undefined)var e=document.documentElement.offsetWidth,t=document.documentElement.offsetHeight;else e=Common.Utils.innerWidth(),t=Common.Utils.innerHeight();if(this.initConfig.height=="auto"){var n=parseInt(this.$window.find(".body").css("height"));this.initConfig.header&&(n+=parseInt(this.$window.find(".header").css("height")))}else n=this.initConfig.height;var r=this.initConfig.width=="auto"?parseInt(this.$window.find(".body").css("width")):this.initConfig.width,i=Math.floor((parseInt(t)-parseInt(n))/2*.9),s=Math.floor((parseInt(e)-parseInt(r))/2);this.$window.css("left",s),this.$window.css("top",i)}function s(e){return{"-webkit-transition":"0.3s opacity","-moz-transition":"0.3s opacity","-ms-transition":"0.3s opacity","-o-transition":"0.3s opacity",opacity:e}}function o(e){if($(e.target).hasClass("close"))return;Common.UI.Menu.Manager.hideAll();var t=e instanceof jQuery.Event?Common.Utils.zoom():1;this.dragging.enabled=!0,this.dragging.initx=e.pageX*t-parseInt(this.$window.css("left")),this.dragging.inity=e.pageY*t-parseInt(this.$window.css("top"));if(window.innerHeight==undefined)var n=document.documentElement.offsetWidth,r=document.documentElement.offsetHeight;else n=Common.Utils.innerWidth(),r=Common.Utils.innerHeight();this.dragging.maxx=n-parseInt(this.$window.css("width")),this.dragging.maxy=r-parseInt(this.$window.css("height")),$(document).on("mousemove",this.binding.drag),$(document).on("mouseup",this.binding.dragStop),this.fireEvent("drag",[this,"start"])}function u(){$(document).off("mousemove",this.binding.drag),$(document).off("mouseup",this.binding.dragStop),this.dragging.enabled=!1,this.fireEvent("drag",[this,"end"])}function a(e){if(this.dragging.enabled){var t=e instanceof jQuery.Event?Common.Utils.zoom():1,n=e.pageX*t-this.dragging.initx,r=e.pageY*t-this.dragging.inity;n<0?n=0:n>this.dragging.maxx&&(n=this.dragging.maxx),r<0?r=0:r>this.dragging.maxy&&(r=this.dragging.maxy),this.$window.css({left:n,top:r})}}function f(e){Common.UI.Menu.Manager.hideAll();var t=$(e.target),n=parseInt(this.$window.css("left")),r=parseInt(this.$window.css("top"));this.resizing.enabled=!0,this.resizing.initpage_x=e.pageX*Common.Utils.zoom(),this.resizing.initpage_y=e.pageY*Common.Utils.zoom(),this.resizing.initx=this.resizing.initpage_x-n,this.resizing.inity=this.resizing.initpage_y-r,this.resizing.initw=parseInt(this.$window.css("width")),this.resizing.inith=parseInt(this.$window.css("height")),this.resizing.type=[t.hasClass("left")?-1:t.hasClass("right")?1:0,t.hasClass("top")?-1:t.hasClass("bottom")?1:0];var i=window.innerHeight==undefined?document.documentElement.offsetWidth:Common.Utils.innerWidth(),s=window.innerHeight==undefined?document.documentElement.offsetHeight:Common.Utils.innerHeight(),o=this.initConfig.maxwidth?this.initConfig.maxwidth:i,u=this.initConfig.maxheight?this.initConfig.maxheight:s;this.resizing.type[0]>0?(this.resizing.maxx=Math.min(i,n+o),this.resizing.minx=n+this.initConfig.minwidth):this.resizing.type[0]<0&&(this.resizing.maxx=n+this.resizing.initw-this.initConfig.minwidth,this.resizing.minx=Math.max(0,n+this.resizing.initw-o)),this.resizing.type[1]>0?(this.resizing.maxy=Math.min(s,r+u),this.resizing.miny=r+this.initConfig.minheight):this.resizing.type[1]<0&&(this.resizing.maxy=r+this.resizing.inith-this.initConfig.minheight,this.resizing.miny=Math.max(0,r+this.resizing.inith-u)),$(document.body).css("cursor",t.css("cursor")),this.$window.find(".resize-border").addClass("resizing"),this.$window.find(".header").addClass("resizing"),$(document).on("mousemove",this.binding.resize),$(document).on("mouseup",this.binding.resizeStop),this.fireEvent("resize",[this,"start"])}function l(e){if(this.resizing.enabled){var t=!1,n=e instanceof jQuery.Event?Common.Utils.zoom():1,r=e.pageX*n,i=e.pageY*n;this.resizing.type[0]&&r<this.resizing.maxx&&r>this.resizing.minx&&(this.resizing.type[0]<0&&this.$window.css({left:r-this.resizing.initx}),this.setWidth(this.resizing.initw+(r-this.resizing.initpage_x)*this.resizing.type[0]),t=!0),this.resizing.type[1]&&i<this.resizing.maxy&&i>this.resizing.miny&&(this.resizing.type[1]<0&&this.$window.css({top:i-this.resizing.inity}),this.setHeight(this.resizing.inith+(i-this.resizing.initpage_y)*this.resizing.type[1]),t=!0),t&&this.fireEvent("resizing")}}function c(){$(document).off("mousemove",this.binding.resize),$(document).off("mouseup",this.binding.resizeStop),$(document.body).css("cursor","auto"),this.$window.find(".resize-border").removeClass("resizing"),this.$window.find(".header").removeClass("resizing"),this.resizing.enabled=!1,this.fireEvent("resize",[this,"end"])}var e={closable:!0,header:!0,modal:!0,width:"auto",height:"auto",title:"Title",alias:"Window",cls:"",toolclose:"close",maxwidth:undefined,maxheight:undefined,minwidth:0,minheight:0,enableKeyEvents:!0},t='<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>';return Common.UI.alert=function(e){function u(t){var n=t.getChild(".info-box"),r=t.getChild(".info-box span"),i=t.getChild(".footer"),s=t.getChild(".header"),o=t.getChild(".body"),u=t.getChild(".icon"),a=t.getChild(".info-box .dont-show-checkbox");e.dontshow||o.css("padding-bottom","10px"),e.maxwidth&&e.width=="auto"&&r.position().left+r.width()+parseInt(n.css("padding-right"))>e.maxwidth&&(e.width=e.maxwidth),e.width=="auto"?(n.height(Math.max(r.height()+(a.length>0?a.height()+parseInt(a.css("margin-top")):0),u.height())),o.height(parseInt(n.css("height"))+parseInt(i.css("height"))),t.setSize(r.position().left+r.width()+parseInt(n.css("padding-right")),parseInt(o.css("height"))+parseInt(s.css("height")))):(r.css("white-space","normal"),t.setWidth(e.width),n.height(Math.max(r.height()+(a.length>0?a.height()+parseInt(a.css("margin-top")):0),u.height())),o.height(parseInt(n.css("height"))+parseInt(i.css("height"))),t.setHeight(parseInt(o.css("height"))+parseInt(s.css("height")))),r.height()<u.height()-10&&r.css({"vertical-align":"baseline","line-height":u.height()+"px"})}function a(t){e.callback&&e.callback.call(s,t.currentTarget.attributes.result.value,o?o.getValue()=="checked":!1),s.close(!0)}function f(e){return a({currentTarget:s.getChild(".footer .dlg-btn")[0]}),!1}var t=this.Window.prototype,n={ok:t.okButtonText,cancel:t.cancelButtonText,yes:t.yesButtonText,no:t.noButtonText,close:t.closeButtonText};if(!e.buttons)e.buttons={},e.buttons.ok={text:n.ok,cls:"primary"};else if(_.isArray(e.buttons)){e.primary==undefined&&(e.primary="ok");var r={};_.each(e.buttons,function(t){typeof t=="object"?t.value!==undefined&&(r[t.value]={text:t.caption,cls:"custom"+(t.primary||e.primary==t.value?" primary":"")}):(r[t]={text:t=="custom"?e.customButtonText:n[t],cls:e.primary==t?"primary":""},t=="custom"&&(r[t].cls+=" custom"))}),e.buttons=r}e.dontshow=e.dontshow||!1,e.width||(e.width="auto");var i='<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><% } %>';_.extend(e,{cls:"alert",onprimary:f,tpl:_.template(i,e)});var s=new Common.UI.Window(e),o=null;s.on({"render:after":function(e){e.getChild(".footer .dlg-btn").on("click",a),o=new Common.UI.CheckBox({el:s.$window.find(".dont-show-checkbox"),labelText:s.textDontShow}),u(e)},show:function(e){e.getChild(".footer .dlg-btn").focus()},close:function(){e.callback&&e.callback.call(s,"close")}}),s.show()},Common.UI.error=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textError),Common.UI.alert(_.extend(e,{iconCls:"error"}))},Common.UI.confirm=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textConfirmation),Common.UI.alert(_.extend(e,{iconCls:"confirm"}))},Common.UI.info=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textInformation),Common.UI.alert(_.extend(e,{iconCls:"info"}))},Common.UI.warning=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textWarning),Common.UI.alert(_.extend(e,{iconCls:"warn"}))},{$window:undefined,$lastmodal:undefined,dragging:{enabled:!1},resizing:{enabled:!1},initialize:function(t){this.initConfig={},this.binding={},_.extend(this.initConfig,e,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 e=this.initConfig.renderTo||document.body;$(e).append(_.template(t,this.initConfig)),this.$window=$("#"+this.initConfig.id),this.binding.keydown=_.bind(r,this);if(this.initConfig.header){this.binding.drag=_.bind(a,this),this.binding.dragStop=_.bind(u,this),this.binding.dragStart=_.bind(o,this);var n=function(){if(this.$window.find(".tool.close").hasClass("disabled"))return;this.initConfig.toolcallback?this.initConfig.toolcallback.call(this):this.initConfig.toolclose=="hide"?this.hide():this.close()};this.$window.find(".header").on("mousedown",this.binding.dragStart),this.$window.find(".tool.close").on("click",_.bind(n,this))}else this.$window.find(".body").css({top:0,"border-radius":"5px"});if(this.initConfig.height=="auto"){var i=parseInt(this.$window.find("> .body").css("height"));this.initConfig.header&&(i+=parseInt(this.$window.find("> .header").css("height"))),this.$window.height(i)}else this.$window.css("height",this.initConfig.height);this.initConfig.resizable&&this.setResizable(this.initConfig.resizable);var s=this;return Common.NotificationCenter.on("window:close",function(){s.$window&&s.isVisible()&&s.close()}),this.fireEvent("render:after",this),this},show:function(e,t){if(this.initConfig.modal){var r=n();if(this.options.animate!==!1){var o=r.css("opacity");r.css("opacity",0),r.attr("counter",parseInt(r.attr("counter"))+1),r.show(),setTimeout(function(){r.css(s(o))},1)}else r.attr("counter",parseInt(r.attr("counter"))+1),r.show();Common.NotificationCenter.trigger("modal:show",this),this.$lastmodal=$(".asc-window.modal:not(.dethrone):visible").first().addClass("dethrone")}this.$window?this.$window.is(":visible")||(this.$window.css({opacity:0}),this.$window.show()):(this.render(),_.isNumber(e)&&_.isNumber(t)?(this.$window.css("left",Math.floor(e)),this.$window.css("top",Math.floor(t))):i.call(this)),$(document).on("keydown."+this.cid,this.binding.keydown);var u=this;setTimeout(function(){u.fireEvent("animate:before",u)},10),this.options.animate!==!1?(this.$window.css({"-webkit-transform":"scale(0.8)","-moz-transform":"scale(0.8)","-ms-transform":"scale(0.8)","-o-transform":"scale(0.8)",opacity:0}),setTimeout(function(){u.$window.css({"-webkit-transition":"0.2s opacity, 0.2s -webkit-transform","-webkit-transform":"scale(1)","-moz-transition":"0.2s opacity, 0.2s -moz-transform","-moz-transform":"scale(1)","-ms-transition":"0.2s opacity, 0.2s -ms-transform","-ms-transform":"scale(1)","-o-transition":"0.2s opacity, 0.2s -o-transform","-o-transform":"scale(1)",opacity:"1"})},1),setTimeout(function(){u.$window.addClass("notransform"),u.fireEvent("show",u)},this.initConfig.modal?1e3:350)):(this.$window.css({opacity:1}),this.$window.addClass("notransform"),this.fireEvent("show",this)),Common.NotificationCenter.trigger("window:show")},close:function(e){$(document).off("keydown."+this.cid),this.initConfig.header&&this.$window.find(".header").off("mousedown",this.binding.dragStart);if(this.initConfig.modal){var t=n(),r=!0;t.attr("counter",parseInt(t.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),r=!this.$lastmodal.hasClass("modal")||!this.$lastmodal.is(":visible"));if(r)if(this.options.animate!==!1){var i=t.css("opacity");t.css(s(0)),setTimeout(function(){t.css("opacity",i),parseInt(t.attr("counter"))<1&&(t.hide(),t.attr("counter",0))},300)}else parseInt(t.attr("counter"))<1&&(t.hide(),t.attr("counter",0));Common.NotificationCenter.trigger("modal:close",this)}this.$window.remove(),e!==!0&&this.fireEvent("close",this)},hide:function(){$(document).off("keydown."+this.cid);if(this.$window){if(this.initConfig.modal){var e=n(),t=!0;e.attr("counter",parseInt(e.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),t=!this.$lastmodal.hasClass("modal")||!this.$lastmodal.is(":visible"));if(t)if(this.options.animate!==!1){var r=e.css("opacity");e.css(s(0)),setTimeout(function(){e.css("opacity",r),parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0))},300)}else parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0));Common.NotificationCenter.trigger("modal:hide",this)}this.$window.hide(),this.$window.removeClass("notransform"),this.fireEvent("hide",this)}},isLocked:function(){return this.$window.hasClass("dethrone")||!this.options.modal&&this.$window.parent().find(".asc-window.modal:visible").length},getChild:function(e){return e?this.$window.find(e):this.$window},setWidth:function(e){if(e>=0){var t=parseInt(this.$window.css("min-width"));e<t&&(e=t),e-=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width")),this.$window.width(e)}},getWidth:function(){return parseInt(this.$window.css("width"))},setHeight:function(e){if(e>=0){var t=parseInt(this.$window.css("min-height"));e<t&&(e=t),e-=parseInt(this.$window.css("border-bottom-width"))+parseInt(this.$window.css("border-top-width")),this.$window.height(e),this.initConfig.header&&(e-=parseInt(this.$window.find("> .header").css("height"))),this.$window.find("> .body").css("height",e)}},getHeight:function(){return parseInt(this.$window.css("height"))},setSize:function(e,t){this.setWidth(e),this.setHeight(t)},getSize:function(){return[this.getWidth(),this.getHeight()]},setTitle:function(e){this.$window.find("> .header > .title").text(e)},getTitle:function(){return this.$window.find("> .header > .title").text()},isVisible:function(){return this.$window&&this.$window.is(":visible")},setResizable:function(e,t,n){if(e!==this.resizable){if(e){var r='<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&&(r+='<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(r)),this.binding.resize=_.bind(l,this),this.binding.resizeStop=_.bind(c,this),this.binding.resizeStart=_.bind(f,this),t&&t.length>1&&(this.initConfig.minwidth=t[0]),t&&t.length>1&&(this.initConfig.minheight=t[1]),n&&n.length>1&&(this.initConfig.maxwidth=n[0]),n&&n.length>1&&(this.initConfig.maxheight=n[1]),this.$window.find(".resize-border").on("mousedown",this.binding.resizeStart)}else this.$window.find(".resize-border").remove();this.resizable=e}},onPrimary:function(){},cancelButtonText:"Cancel",okButtonText:"OK",yesButtonText:"Yes",noButtonText:"No",closeButtonText:"Close",textWarning:"Warning",textError:"Error",textConfirmation:"Confirmation",textInformation:"Information",textDontShow:"Don't show this message again"}}(),Common.UI.Window||{}))}),define("common/main/lib/view/RenameDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.RenameDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",filename:""},initialize:function(e){_.extend(this.options,e||{}),this.template=['<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 e=this;e.inputName=new Common.UI.InputField({el:$("#id-dlg-newname"),style:"width: 100%;",validateOnBlur:!1,validation:function(t){return/[\t*\+:\"<>?|\\\\/]/gim.test(t)?e.txtInvalidName+'*+:"<>?|/':!0}});var t=this.getChild();t.find(".btn").on("click",_.bind(this.onBtnClick,this)),e.inputNameEl=t.find("input"),e.inputNameEl.on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.inputName.setValue(e.options.filename),e.inputNameEl.focus().select()},100)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputName.checkValidate()!==!0){this.inputNameEl.focus();return}this.options.handler.call(this,e,this.inputName.getValue())}this.close()},textName:"File name",cancelButtonText:"Cancel",okButtonText:"Ok",txtInvalidName:"The file name cannot contain any of the following characters: "},Common.Views.RenameDialog||{}))});if(Common===undefined)var Common={};Common.Views=Common.Views||{},define("common/main/lib/view/Header",["backbone","text!common/main/lib/template/Header.template","core","common/main/lib/view/RenameDialog"],function(e,t){"use strict";Common.Views.Header=e.View.extend(_.extend({options:{branding:{},headerCaption:"Default Caption",documentCaption:"",canBack:!1},el:"#header",template:_.template(t),events:{"click #header-logo":function(e){var t=!this.branding||!this.branding.logo||!this.branding.logo.url?"http://www.onlyoffice.com":this.branding.logo.url,n=window.open(t);n&&n.focus()}},initialize:function(e){this.options=this.options?_({}).extend(this.options,e):e,this.headerCaption=this.options.headerCaption,this.documentCaption=this.options.documentCaption,this.canBack=this.options.canBack,this.branding=this.options.customization,this.isModified=!1},render:function(){$(this.el).html(this.template({headerCaption:this.headerCaption,documentCaption:Common.Utils.String.htmlEncode(this.documentCaption),canBack:this.canBack,textBack:this.textBack}));var e=(new Common.UI.MenuItem({caption:this.openNewTabText})).on("click",function(e,t){Common.NotificationCenter.trigger("goback",!0),Common.component.Analytics.trackEvent("Back to Folder")});this.gotoDocsMenu=new Common.UI.Menu({style:"min-width: 100px;",items:[e]})},setVisible:function(e){e?this.show():this.hide()},setBranding:function(e){var t;this.branding=e,e&&e.logo&&e.logo.image&&(t=$("#header-logo"),t&&(t.html('<img src="'+e.logo.image+'" style="max-width:86px; max-height:20px; margin: 0 8px 0 15px;"/>'),t.css({"background-image":"none",width:"auto"})))},setHeaderCaption:function(e){this.headerCaption=e;var t=$("#header-caption > div");return t&&t.html(e),e},getHeaderCaption:function(){return this.headerCaption},setDocumentCaption:function(e,t){t!==undefined&&(this.isModified=t),this.documentCaption=e,e||(e=""),this.isModified&&(e+="*");var n=$("#header-documentcaption div");return n&&n.html(Common.Utils.String.htmlEncode(e)),e},getDocumentCaption:function(){return this.documentCaption},setCanBack:function(e){this.canBack=e;var t=$("#header-back");t&&(t.off("mouseup"),t.css("display",e?"table-cell":"none"),e&&t.on("mouseup",_.bind(this.onBackClick,this)))},getCanBack:function(){return this.canBack},onBackClick:function(e){if(e.which==3){Common.UI.Menu.Manager.hideAll();var t=this,n=[e.pageX*Common.Utils.zoom(),e.pageY*Common.Utils.zoom()],r=$(this.el).find(Common.Utils.String.format("#menu-container-{0}",this.gotoDocsMenu.id));this.gotoDocsMenu.rendered||(r.length<1&&(r=$(Common.Utils.String.format('<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(r)),this.gotoDocsMenu.render(r),this.gotoDocsMenu.cmpEl.attr({tabindex:"-1"})),_.delay(function(){r.css({left:n[0]-t.gotoDocsMenu.cmpEl.width(),top:n[1]+3}),t.gotoDocsMenu.show()},10)}else Common.NotificationCenter.trigger("goback",e.which==2),Common.component.Analytics.trackEvent("Back to Folder")},setCanRename:function(e){var t=$("#header-documentcaption div");if(e){var n=this;t.tooltip({title:n.txtRename,placement:"cursor"}),t.on("click",function(e){(new Common.Views.RenameDialog({filename:n.documentCaption,handler:function(e,t){e=="ok"&&!_.isEmpty(t.trim())&&n.documentCaption!==t.trim()&&Common.Gateway.requestRename(t),Common.NotificationCenter.trigger("edit:complete",n)}})).show(t.position().left-1,20)})}else{var r=t.data("bs.tooltip");r&&(r.options.title="",r.setContent()),t.off("click")}t.css("cursor",e?"pointer":"default"),t.toggleClass("renamed",e)},textBack:"Go to Documents",openNewTabText:"Open in New Tab",txtRename:"Rename"},Common.Views.Header||{}))}),define("presentationeditor/main/app/model/Pages",["backbone"],function(e){"use strict";PE.Models=PE.Models||{},PE.Models.Pages=e.Model.extend({defaults:{current:0,count:0}})}),define("presentationeditor/main/app/view/DocumentPreview",["jquery","underscore","backbone","common/main/lib/component/BaseView","presentationeditor/main/app/model/Pages"],function(){"use strict";function e(e,t,n){var r=e.get("current"),i=e.get("count");$("#preview-label-slides").text(Common.Utils.String.format(this.slideIndexText,r<i?r:i,i))}PE.Views.DocumentPreview=Common.UI.BaseView.extend(_.extend({el:"#pe-preview",events:{},options:{alias:"DocumentPreview"},initialize:function(t){_.extend(this.options,t||{}),this.template=['<div id="presentation-preview" style="width:100%; height:100%"></div>','<div id="preview-controls-panel" class="preview-controls" style="position: absolute; bottom: 0;">','<div class="preview-group" style="">','<button id="btn-preview-prev" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>','<button id="btn-preview-play" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>','<button id="btn-preview-next" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>','<div class="separator"/>',"</div>",'<div class="preview-group dropup">','<label id="preview-label-slides" class="status-label dropdown-toggle" data-toggle="dropdown">Slide 1 of 1</label>','<div id="preview-goto-box" class="dropdown-menu">','<label style="float:left;line-height:22px;">'+this.goToSlideText+"</label>",'<div id="preview-goto-page" style="display:inline-block;"></div>',"</div>","</div>",'<div class="preview-group" style="">','<div class="separator"/>','<button id="btn-preview-fullscreen" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>','<div class="separator fullscreen"/>','<button id="btn-preview-close" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>',"</div>","</div>"].join(""),this.pages=new PE.Models.Pages({current:1,count:1}),this.pages.on("change",_.bind(e,this))},render:function(){var e=$(this.el),t=this;e.html(_.template(this.template,{scope:this})),this.btnPrev=new Common.UI.Button({el:$("#btn-preview-prev",this.el),hint:this.txtPrev,hintAnchor:"top"}),this.btnPrev.on("click",_.bind(function(){this.api&&this.api.DemonstrationPrevSlide()},this)),this.btnNext=new Common.UI.Button({el:$("#btn-preview-next",this.el),hint:this.txtNext,hintAnchor:"top"}),this.btnNext.on("click",_.bind(function(){this.api&&this.api.DemonstrationNextSlide()},this)),this.btnPlay=new Common.UI.Button({el:$("#btn-preview-play",this.el),hint:this.txtPlay,hintAnchor:"top"}),this.btnPlay.on("click",_.bind(function(e){var t=$(".btn-icon",this.btnPlay.cmpEl);t.hasClass("btn-pause")?(t.removeClass("btn-pause"),this.btnPlay.updateHint(this.txtPlay),this.api&&this.api.DemonstrationPause()):(t.addClass("btn-pause"),this.btnPlay.updateHint(this.txtPause),this.api&&this.api.DemonstrationPlay())},this)),this.btnClose=new Common.UI.Button({el:$("#btn-preview-close",this.el),hint:this.txtClose,hintAnchor:"top"}),this.btnClose.on("click",_.bind(function(){this.api&&this.api.EndDemonstration()},this)),this.btnFullScreen=new Common.UI.Button({el:$("#btn-preview-fullscreen",this.el),hint:this.txtFullScreen,hintAnchor:"top"}),this.btnFullScreen.on("click",_.bind(function(e){this.toggleFullScreen()},this)),this.txtGoToPage=(new Common.UI.InputField({el:$("#preview-goto-page"),allowBlank:!0,validateOnChange:!0,style:"width: 60px;",maskExp:/[0-9]/,validation:function(e){if(/(^[0-9]+$)/.test(e)){e=parseInt(e);if(undefined!==e&&e>0&&e<=t.pages.get("count"))return!0}return t.txtPageNumInvalid}})).on("keypress:after",function(e,n){if(n.keyCode===Common.UI.Keys.RETURN){var r=t.$el.find("#preview-goto-box"),i=r.find("input[type=text]"),s=parseInt(i.val());return!s||s-->t.pages.get("count")||s<0?(i.select(),!1):(r.focus(),r.parent().removeClass("open"),t.api.DemonstrationGoToSlide(s),t.api.asc_enableKeyEvents(!0),!1)}}).on("keyup:after",function(e,n){if(n.keyCode===Common.UI.Keys.ESC){var r=t.$el.find("#preview-goto-box");return r.focus(),r.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0),!1}});var n=this.$el.find("#preview-goto-box");n.on("click",function(){return!1}),n.parent().on("show.bs.dropdown",function(){var e=t.txtGoToPage.$el.find("input");_.defer(function(){e.focus(),e.select()},100)}),n.parent().on("hide.bs.dropdown",function(){var e=t.$el.find("#preview-goto-box");t.api&&e&&(e.focus(),e.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0))}),$(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;t.btnFullScreen.cmpEl.toggleClass("fullscreen",e!==undefined&&e!==null),Common.Utils.isIE?(t.btnFullScreen.updateHint(e?"":t.txtFullScreen),t.btnPrev.updateHint(e?"":t.txtPrev),t.btnPlay.updateHint(e?"":$(".btn-icon",t.btnPlay.cmpEl).hasClass("btn-pause")?t.txtPause:t.txtPlay),t.btnNext.updateHint(e?"":t.txtNext),t.btnClose.updateHint(e?"":t.txtClose)):t.btnFullScreen.updateHint(e?t.txtExitFullScreen:t.txtFullScreen)}),Common.Utils.isIE&&e.find(".preview-controls").css("opacity","0.4"),this.separatorFullScreen=e.find(".separator.fullscreen")},show:function(){var e=PE.getController("Toolbar").getView("Toolbar");e._state.hasCollaborativeChanges&&(e._state.hasCollaborativeChanges=!1,e.synchTooltip&&e.synchTooltip.hide(),e.needShowSynchTip=!0),Common.UI.BaseView.prototype.show.call(this,arguments);var t=$(".btn-icon",this.btnPlay.cmpEl);t.hasClass("btn-pause")||(t.addClass("btn-pause"),this.btnPlay.updateHint(this.txtPause)),$("#viewport-vbox-layout").css("z-index","0"),this.fireEvent("editcomplete",this)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),$("#viewport-vbox-layout").css("z-index","auto"),Common.NotificationCenter.trigger("layout:changed","preview");var e=PE.getController("Toolbar").getView("Toolbar");e.needShowSynchTip&&(e.needShowSynchTip=!1,e.onCollaborativeChanges()),this.fireEvent("editcomplete",this)},setApi:function(e){return this.api=e,this.api&&(this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onCountSlides,this)),this.api.asc_registerCallback("asc_onEndDemonstration",_.bind(this.onEndDemonstration,this)),this.api.asc_registerCallback("asc_onDemonstrationSlideChanged",_.bind(this.onDemonstrationSlideChanged,this)),this.api.DemonstrationEndShowMessage(this.txtFinalMessage)),this},setMode:function(e){this.mode=e;if(this.mode.isDesktopApp||Common.Utils.isIE11)this.btnFullScreen.setVisible(!1),this.separatorFullScreen.hide(),$(document).off("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange");return this},onCountSlides:function(e){this.pages.set("count",e)},onDemonstrationSlideChanged:function(e){this.pages.set("current",e+1);if(this.api&&_.isNumber(e)){var t=this.api.getCountPages();t!==this.pages.get("count")&&this.pages.set("count",t),this.btnPrev.setDisabled(e<=0),this.btnNext.setDisabled(e>=t-1),this.txtGoToPage.setValue(e+1),this.txtGoToPage.checkValidate()}},onEndDemonstration:function(){this.hide(),this.fullScreenCancel()},toggleFullScreen:function(){!document.fullscreenElement&&!document.msFullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement?this.fullScreen(document.documentElement):this.fullScreenCancel()},fullScreen:function(e){if(this.mode.isDesktopApp||Common.Utils.isIE11)return;e&&(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},fullScreenCancel:function(){if(this.mode.isDesktopApp||Common.Utils.isIE11)return;document.cancelFullScreen?document.cancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()},txtPrev:"Previous Slide",txtNext:"Next Slide",txtClose:"Close Slideshow",goToSlideText:"Go to Slide",slideIndexText:"Slide {0} of {1}",txtPlay:"Start Presentation",txtPause:"Pause Presentation",txtFinalMessage:"The end of slide preview. Click to exit.",txtPageNumInvalid:"Slide number invalid",txtFullScreen:"Full Screen",txtExitFullScreen:"Exit Full Screen"},PE.Views.DocumentPreview||{}))}),define("text!presentationeditor/main/app/template/Viewport.template",[],function(){return'<div class="layout-region">\n <div id="pe-preview" style="position:absolute; left: 0; top: 0; display:none; width:100%; height:100%; z-index: 1;"></div>\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>\n </div>\n <div id="statusbar" class="layout-item"></div>\n </div>\n</div>\n'});if(Common===undefined)var Common={};define("common/main/lib/component/Layout",["backbone"],function(){"use strict";var e=function(e){this.box=null,this.panels=[],this.splitters=[],_.extend(this,e||{})},t=function(){return{width:null,height:null,resize:!1,stretch:!1,rely:!1}};_.extend(e.prototype,Backbone.Events,{initialize:function(e){this.$parent=this.box.parent(),this.resize={eventMove:_.bind(this.resizeMove,this),eventStop:_.bind(this.resizeStop,this)};var n,r,i=!1;e.items.forEach(function(e){e.el instanceof HTMLElement&&(e.el=$(e.el)),n=_.extend(new t,e),n.stretch&&(i=!0,n.rely=!1,n.resize=!1),this.panels.push(n),n.resize&&(r={isresizer:!0,minpos:n.resize.min||0,maxpos:n.resize.max||0,fmin:n.resize.fmin,fmax:n.resize.fmax,behaviour:n.behaviour,index:this.splitters.length},i?(n.resize.el=r.el=n.el.before('<div class="layout-resizer before"></div>').prev(),this.panels.splice(this.panels.length-1,0,r)):(n.resize.el=r.el=n.el.after('<div class="layout-resizer after"></div>').next(),this.panels.push(r)),this.splitters.push({resizer:r}),n.resize.hidden&&r.el.hide())},this),this.freeze=e.freeze,this.freeze&&this.freezePanels(this.freeze)},doLayout:function(){},getElementHeight:function(e){return parseInt(e.css("height"))},getElementWidth:function(e){return parseInt(e.css("width"))},onSelectStart:function(e){return e.preventDefault&&e.preventDefault(),!1},addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},clearSelection:function(){if(window.getSelection){var e=window.getSelection();e.empty?e.empty():e.removeAllRanges&&e.removeAllRanges()}else document.selection&&document.selection.empty()},resizeStart:function(e){this.clearSelection(),this.addHandler(window.document,"selectstart",this.onSelectStart),$(document).on({mousemove:this.resize.eventMove,mouseup:this.resize.eventStop}),Common.NotificationCenter.on({"frame:mousemove":this.resize.eventMove,"frame:mouseup":this.resize.eventStop});var t=e.data.panel;this.resize.type=e.data.type,this.resize.$el=t.el,this.resize.min=t.minpos,this.resize.fmin=t.fmin,this.resize.fmax=t.fmax,this.resize.behaviour=t.behaviour,this.resize.$el.addClass("move"),e.data.type=="vertical"?(this.resize.height=parseInt(this.resize.$el.css("height")),this.resize.max=(t.maxpos>0?t.maxpos:this.resize.$el.parent().height()+t.maxpos)-this.resize.height,this.resize.inity=e.pageY*Common.Utils.zoom()-parseInt(e.currentTarget.style.top)):e.data.type=="horizontal"&&(this.resize.width=parseInt(this.resize.$el.css("width")),this.resize.max=(t.maxpos>0?t.maxpos:this.resize.$el.parent().height()+t.maxpos)-this.resize.width,this.resize.initx=e.pageX*Common.Utils.zoom()-parseInt(e.currentTarget.style.left)),Common.NotificationCenter.trigger("layout:resizestart")},resizeMove:function(e){var t=e instanceof jQuery.Event?Common.Utils.zoom():1;if(this.resize.type=="vertical")var n="top",r=e.pageY*t-this.resize.inity;else this.resize.type=="horizontal"&&(n="left",r=e.pageX*t-this.resize.initx);this.resize.fmin&&this.resize.fmax?!(r<this.resize.fmin())&&!(r>this.resize.fmax())&&(this.resize.$el[0].style[n]=r+"px"):!(r<this.resize.min)&&!(r>this.resize.max)&&(this.resize.$el[0].style[n]=r+"px")},resizeStop:function(e){this.removeHandler(window.document,"selectstart",this.onSelectStart),$(document).off({mousemove:this.resize.eventMove,mouseup:this.resize.eventStop}),Common.NotificationCenter.off({"frame:mousemove":this.resize.eventMove,"frame:mouseup":this.resize.eventStop});if(!this.resize.$el)return;var t=e instanceof jQuery.Event?Common.Utils.zoom():1;if(this.resize.type=="vertical")var n="height",r=e.pageY*t-this.resize.inity;else this.resize.type=="horizontal"&&(n="width",r=e.pageX*t-this.resize.initx);this.resize.fmin&&this.resize.fmax?(r<this.resize.fmin()&&(r=this.resize.fmin()),r>this.resize.fmax()&&(r=this.resize.fmax())):(r<this.resize.min&&(r=this.resize.min),r>this.resize.max&&(r=this.resize.max));var i=null,s=null,o=0;this.resize.$el.hasClass("after")?(i=this.resize.$el.prev(),s=this.resize.$el.next(),o=parseInt(i.css(n))):(i=this.resize.$el.next(),s=this.resize.$el.next(),o=parseInt(i.css(n)),r=i.parent()[n]()-(r+this.resize[n])),this.resize.type=="vertical"&&(r-=i.position().top),this.resize.type=="horizontal"&&(r-=i.position().left),i.css(n,r+"px"),this.resize.behaviour&&s.css(n,parseInt(s.css(n))-(r-o)),this.resize.$el.removeClass("move"),delete this.resize.$el,this.resize.value!=r&&(this.doLayout(),this.trigger("layout:resizedrag",this)),Common.NotificationCenter.trigger("layout:resizestop")},freezePanels:function(e){this.panels.forEach(function(t){!t.stretch&&t.resize&&$(t.resize.el).css("cursor",e?"default":"")}),this.freeze=e},setResizeValue:function(e,t){if(e>=this.splitters.length)return;var n=null,r=null,i=0,s=this.splitters[e].resizer,o="height";t<s.fmin()&&(t=s.fmin()),t>s.fmax()&&(t=s.fmax()),s.el.hasClass("after")?(n=s.el.prev(),r=s.el.next(),i=parseInt(n.css(o))):(n=s.el.next(),t=n.parent()[o]()-(t+s[o]),r=s.el.next(),i=parseInt(n.css(o))),t-=n.position().top,n.css(o,t+"px"),s.behaviour&&r.css(o,parseInt(r.css(o))-(t-i)),s.value!=t&&this.doLayout()}}),!Common.UI&&(Common.UI={}),Common.UI.VBoxLayout=function(t){e.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.VBoxLayout.prototype=_.extend(new e,{initialize:function(t){e.prototype.initialize.call(this,t),this.panels.forEach(function(e){!e.stretch&&!e.height&&(e.height=this.getElementHeight(e.el)),e.isresizer&&e.el.on("mousedown",{type:"vertical",panel:e},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)},doLayout:function(){var e=0,t,n;this.panels.forEach(function(r){r.stretch?t=r:(n=r.el.is(":visible"),n&&(e+=r.rely!==!0?r.height:this.getElementHeight(r.el)),r.resize&&r.resize.autohide!==!1&&r.resize.el&&(n?(r.resize.el.show(),t&&(e+=r.resize.height)):(r.resize.el.hide(),t&&(e-=r.resize.height))))},this),t&&(t.height=this.$parent.height()-e),e=0,this.panels.forEach(function(t){t.el.is(":visible")&&(n={top:e},t.rely!==!0&&(n.height=t.height),t.el.css(n),e+=this.getElementHeight(t.el))},this)}}),Common.UI.HBoxLayout=function(t){e.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.HBoxLayout.prototype=_.extend(new e,{initialize:function(t){e.prototype.initialize.call(this,t),this.panels.forEach(function(e){!e.stretch&&!e.width&&(e.width=this.getElementWidth(e.el)),e.isresizer&&e.el.on("mousedown",{type:"horizontal",panel:e},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)},doLayout:function(e){var t=0,n,r;this.panels.forEach(function(e){e.stretch?n=e:(r=e.el.is(":visible"),r&&(t+=e.rely!==!0?e.width:this.getElementWidth(e.el)),e.resize&&e.resize.autohide!==!1&&e.resize.el&&(r?(e.resize.el.show(),n&&(t-=e.resize.width)):(e.resize.el.hide(),n&&(t-=e.resize.width))))},this),n&&(n.width=this.$parent.width()-t),t=0,this.panels.forEach(function(e){e.el.is(":visible")&&(r={left:t},e.rely!==!0&&(r.width=e.width),e.el.css(r),t+=this.getElementWidth(e.el))},this)}}),Common.UI.VBoxLayout.prototype.constructor=Common.UI.VBoxLayout,Common.UI.HBoxLayout.prototype.constructor=Common.UI.HBoxLayout}),define("presentationeditor/main/app/view/Viewport",["text!presentationeditor/main/app/template/Viewport.template","jquery","underscore","backbone","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(e,t,n,r){"use strict";PE.Views.Viewport=r.View.extend({el:"#viewport",template:n.template(e),events:{},initialize:function(){},render:function(){var e=t(this.el);e.html(this.template({})),Common.Utils.isSafari?(t("body").addClass("safari"),t("body").mousewheel(function(e){e.preventDefault(),e.stopPropagation()})):Common.Utils.isChrome&&t("body").addClass("chrome");var n=t("#viewport-vbox-layout",e),r=n.find(" > .layout-item");return this.vlayout=new Common.UI.VBoxLayout({box:n,items:[{el:r[0],rely:!0},{el:r[1],rely:!0},{el:r[2],stretch:!0},{el:r[3],height:25}]}),n=t("#viewport-hbox-layout",e),r=n.find(" > .layout-item"),this.hlayout=new Common.UI.HBoxLayout({box:n,items:[{el:r[0],rely:!0,resize:{hidden:!0,autohide:!1,min:300,max:600}},{el:r[1],stretch:!0},{el:t(r[2]).hide(),rely:!0}]}),this},applyEditorMode:function(){var e=this,t=PE.getController("Toolbar").getView("Toolbar"),n=PE.getController("RightMenu").getView("RightMenu"),r=PE.getController("Statusbar").getView("Statusbar");e._toolbar=t.render(this.mode),e._rightMenu=n.render();var i=Common.localStorage.getItem("pe-hidden-status");i!==null&&parseInt(i)==1&&r.setVisible(!1)},setMode:function(e,t){e.isDisconnected?(n.isUndefined(this.mode)&&(this.mode={}),this.mode.canCoAuthoring=!1):this.mode=e}})}),define("presentationeditor/main/app/controller/Viewport",["core","common/main/lib/view/Header","presentationeditor/main/app/view/DocumentPreview","presentationeditor/main/app/view/Viewport"],function(e){"use strict";PE.Controllers.Viewport=Backbone.Controller.extend({models:[],collections:[],views:["Viewport","Common.Views.Header","DocumentPreview"],initialize:function(){this.addListeners({Viewport:{}})},setApi:function(e){this.api=e},onLaunch:function(){this.viewport=this.createView("Viewport").render(),this.header=this.createView("Common.Views.Header",{headerCaption:"Presentation Editor"}).render(),this.docPreview=this.createView("DocumentPreview",{}).render(),Common.NotificationCenter.on("layout:changed",_.bind(this.onLayoutChanged,this)),$(window).on("resize",_.bind(this.onWindowResize,this));var e=$("#left-menu");this.viewport.hlayout.on("layout:resizedrag",function(){this.api.Resize(),Common.localStorage.setItem("pe-mainmenu-width",e.width())},this)},onLayoutChanged:function(e){switch(e){default:this.viewport.vlayout.doLayout();case"rightmenu":this.viewport.hlayout.doLayout();break;case"leftmenu":var t=this.viewport.hlayout.items[0];t.resize.el&&(t.el.width()>40?t.resize.el.show():t.resize.el.hide()),this.viewport.hlayout.doLayout();break;case"header":case"toolbar":case"status":this.viewport.vlayout.doLayout()}this.api.Resize()},onWindowResize:function(e){this.onLayoutChanged("window"),Common.NotificationCenter.trigger("window:resize")}})});if(Common===undefined)var Common={};Common.Utils===undefined&&(Common.Utils={}),Common.Utils=_.extend(new function(){var e=navigator.userAgent.toLowerCase(),t=function(t){return t.test(e)},n=document.compatMode=="CSS1Compat",r=function(t,n){var r;return t&&(r=n.exec(e))?parseFloat(r[1]):0},i=document.documentMode,s=t(/opera/),o=s&&t(/version\/10\.5/),u=t(/\bchrome\b/),a=t(/webkit/),f=!u&&t(/safari/),l=f&&t(/applewebkit\/4/),c=f&&t(/version\/3/),h=f&&t(/version\/4/),p=f&&t(/version\/5\.0/),d=f&&t(/version\/5/),v=!s&&(t(/msie/)||t(/trident/)),m=v&&(t(/msie 7/)&&i!=8&&i!=9&&i!=10||i==7),g=v&&(t(/msie 8/)&&i!=7&&i!=9&&i!=10||i==8),y=v&&(t(/msie 9/)&&i!=7&&i!=8&&i!=10||i==9),b=v&&(t(/msie 10/)&&i!=7&&i!=8&&i!=9||i==10),w=v&&(t(/trident\/7\.0/)&&i!=7&&i!=8&&i!=9&&i!=10||i==11),E=v&&t(/msie 6/),S=!a&&!v&&t(/gecko/),x=S&&t(/rv:1\.9/),T=S&&t(/rv:2\.0/),N=S&&t(/rv:5\./),C=S&&t(/rv:10\./),k=x&&t(/rv:1\.9\.0/),L=x&&t(/rv:1\.9\.1/),A=x&&t(/rv:1\.9\.2/),O=t(/windows|win32/),M=t(/macintosh|mac os x/),_=t(/linux/),D=r(!0,/\bchrome\/(\d+\.\d+)/),P=r(!0,/\bfirefox\/(\d+\.\d+)/),H=r(v,/msie (\d+\.\d+)/),B=r(s,/version\/(\d+\.\d+)/),j=r(f,/version\/(\d+\.\d+)/),F=r(a,/webkit\/(\d+\.\d+)/),I=/^https/i.test(window.location.protocol),q=/^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,R=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/i,U=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,z=/^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,W=/(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,X=/(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,V=/((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,J={Paragraph:0,Table:1,Image:2,Header:3,TextArt:4,Shape:5,Slide:6,Chart:7,MailMerge:8},K=/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent||navigator.vendor||window.opera),Q=this,G=function(){Q.zoom=1;if(u&&!s&&!K&&document&&document.firstElementChild&&document.body)if(window.devicePixelRatio>.1){if(window.devicePixelRatio<1.99){var e=1;Q.zoom=window.devicePixelRatio/e}else{var e=2;Q.zoom=window.devicePixelRatio/e}document.firstElementChild.style.zoom=1/Q.zoom}else document.firstElementChild.style.zoom="normal";Q.innerWidth=window.innerWidth*Q.zoom,Q.innerHeight=window.innerHeight*Q.zoom};return Q.zoom=1,Q.innerWidth=window.innerWidth,Q.innerHeight=window.innerHeight,G(),$(window).on("resize",G),{userAgent:e,isStrict:n,isIEQuirks:v&&!n&&(E||m||g||y),isOpera:s,isOpera10_5:o,isWebKit:a,isChrome:u,isSafari:f,isSafari3:c,isSafari4:h,isSafari5:d,isSafari5_0:p,isSafari2:l,isIE:v,isIE6:E,isIE7:m,isIE7m:E||m,isIE7p:v&&!E,isIE8:g,isIE8m:E||m||g,isIE8p:v&&!E&&!m,isIE9:y,isIE9m:E||m||g||y,isIE9p:v&&!(E||m||g),isIE10:b,isIE10m:E||m||g||y||b,isIE10p:v&&!(E||m||g||y),isIE11:w,isIE11m:E||m||g||y||b||w,isIE11p:v&&!(E||m||g||y||b),isGecko:S,isGecko3:x,isGecko4:T,isGecko5:N,isGecko10:C,isFF3_0:k,isFF3_5:L,isFF3_6:A,isFF4:4<=P&&P<5,isFF5:5<=P&&P<6,isFF10:10<=P&&P<11,isLinux:_,isWindows:O,isMac:M,chromeVersion:D,firefoxVersion:P,ieVersion:H,operaVersion:B,safariVersion:j,webKitVersion:F,isSecure:I,emailRe:q,ipRe:R,hostnameRe:U,localRe:z,emailStrongRe:W,ipStrongRe:X,hostnameStrongRe:V,documentSettingsType:J,zoom:function(){return Q.zoom},innerWidth:function(){return Q.innerWidth},innerHeight:function(){return Q.innerHeight}}},Common.Utils||{}),Common.Utils.ThemeColor=new function(){return{ThemeValues:[6,15,7,16,0,1,2,3,4,5],setColors:function(e,t){var n,r,i;if(t&&t.length>0){var s=[];for(n=0;n<t.length;n++)i=this.getHexColor(t[n].get_r(),t[n].get_g(),t[n].get_b()),s.push(i);this.standartcolors=s}var o=[];for(n=0;n<6;n++)for(r=0;r<10;r++){var u=n+r*6;i={color:this.getHexColor(e[u].get_r(),e[u].get_g(),e[u].get_b()),effectId:u,effectValue:this.ThemeValues[r]},o.push(i)}this.effectcolors=o},getEffectColors:function(){return this.effectcolors},getStandartColors:function(){return this.standartcolors},getHexColor:function(e,t,n){return e=e.toString(16),t=t.toString(16),n=n.toString(16),e.length==1&&(e="0"+e),t.length==1&&(t="0"+t),n.length==1&&(n="0"+n),e+t+n},getRgbColor:function(e){var t=typeof e=="object"?e.color:e;t=t.replace(/#/,""),t.length==3&&(t=t.replace(/(.)/g,"$1$1")),t=parseInt(t,16);var n=new Asc.asc_CColor;return n.put_type(typeof e=="object"&&e.effectId!==undefined?Asc.c_oAscColor.COLOR_TYPE_SCHEME:Asc.c_oAscColor.COLOR_TYPE_SRGB),n.put_r(t>>16),n.put_g((t&65280)>>8),n.put_b(t&255),n.put_a(255),e.effectId!==undefined&&n.put_value(e.effectId),n},colorValue2EffectId:function(e){if(typeof e=="object"&&e.effectValue!==undefined&&this.effectcolors)for(var t=0;t<this.effectcolors.length;t++)if(this.effectcolors[t].effectValue===e.effectValue&&e.color.toUpperCase()===this.effectcolors[t].color.toUpperCase()){e.effectId=this.effectcolors[t].effectId;break}return e}}},Common.Utils.Metric=_.extend(new function(){var e=this;return e.c_MetricUnits={cm:0,pt:1,inch:2},e.currentMetric=e.c_MetricUnits.pt,e.metricName=["Cm","Pt","Inch"],e.defaultMetric=e.c_MetricUnits.cm,{c_MetricUnits:e.c_MetricUnits,txtCm:"cm",txtPt:"pt",txtInch:'"',setCurrentMetric:function(t){e.currentMetric=t},getCurrentMetric:function(){return e.currentMetric},getCurrentMetricName:function(){return this["txt"+e.metricName[e.currentMetric]]},getMetricName:function(t){return this["txt"+e.metricName[t!==undefined?t:0]]},setDefaultMetric:function(t){e.defaultMetric=t},getDefaultMetric:function(){return e.defaultMetric},fnRecalcToMM:function(t){if(t!==null&&t!==undefined)switch(e.currentMetric){case e.c_MetricUnits.cm:return t*10;case e.c_MetricUnits.pt:return t*25.4/72;case e.c_MetricUnits.inch:return t*25.4}return t},fnRecalcFromMM:function(t){switch(e.currentMetric){case e.c_MetricUnits.cm:return parseFloat((t/10).toFixed(4));case e.c_MetricUnits.pt:return parseFloat((t*72/25.4).toFixed(3));case e.c_MetricUnits.inch:return parseFloat((t/25.4).toFixed(3))}return t}}},Common.Utils.Metric||{}),Common.Utils.RGBColor=function(e){var t,n,r;e.charAt(0)=="#"&&(e=e.substr(1,6)),e=e.replace(/ /g,""),e=e.toLowerCase();var i=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^hsb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(e){var t={},n=Math.round(e[1]),r=Math.round(e[2]*255/100),i=Math.round(e[3]*255/100);if(r==0)t.r=t.g=t.b=i;else{var s=i,o=(255-r)*i/255,u=(s-o)*(n%60)/60;n==360&&(n=0),n<60?(t.r=s,t.b=o,t.g=o+u):n<120?(t.g=s,t.b=o,t.r=s-u):n<180?(t.g=s,t.r=o,t.b=o+u):n<240?(t.b=s,t.r=o,t.g=s-u):n<300?(t.b=s,t.g=o,t.r=o+u):n<360?(t.r=s,t.g=o,t.b=s-u):(t.r=0,t.g=0,t.b=0)}return[Math.round(t.r),Math.round(t.g),Math.round(t.b)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}];for(var s=0;s<i.length;s++){var o=i[s].re,u=i[s].process,a=o.exec(e);if(a){var f=u(a);t=f[0],n=f[1],r=f[2]}}t=t<0||isNaN(t)?0:t>255?255:t,n=n<0||isNaN(n)?0:n>255?255:n,r=r<0||isNaN(r)?0:r>255?255:r;var l=function(e){return t==e.r&&n==e.g&&r==e.b},c=function(){return"rgb("+t+", "+n+", "+r+")"},h=function(e){return e===undefined&&(e=1),"rgba("+t+", "+n+", "+r+", "+e+")"},p=function(){var e=t.toString(16),i=n.toString(16),s=r.toString(16);return e.length==1&&(e="0"+e),i.length==1&&(i="0"+i),s.length==1&&(s="0"+s),"#"+e+i+s},d=function(){var e={h:0,s:0,b:0},i=Math.min(t,n,r),s=Math.max(t,n,r),o=s-i;return e.b=s,e.s=s!=0?255*o/s:0,e.s!=0?t==s?e.h=0+(n-r)/o:n==s?e.h=2+(r-t)/o:e.h=4+(t-n)/o:e.h=0,e.h*=60,e.h<0&&(e.h+=360),e.s*=100/255,e.b*=100/255,e.h=parseInt(e.h),e.s=parseInt(e.s),e.b=parseInt(e.b),e};return{r:t,g:n,b:r,isEqual:l,toRGB:c,toRGBA:h,toHex:p,toHSB:d}},Common.Utils.String=new function(){return{format:function(e){var t=_.toArray(arguments).slice(1);return e.replace(/\{(\d+)\}/g,function(e,n){return t[n]})},htmlEncode:function(e){return _.escape(e)},htmlDecode:function(e){return _.unescape(e)},ellipsis:function(e,t,n){if(e&&e.length>t){if(n){var r=e.substr(0,t-2),i=Math.max(r.lastIndexOf(" "),r.lastIndexOf("."),r.lastIndexOf("!"),r.lastIndexOf("?"));if(i!==-1&&i>=t-15)return r.substr(0,i)+"..."}return e.substr(0,t-3)+"..."}return e},platformKey:function(e,t,n){return _.isEmpty(t)&&(t=" ({0})"),Common.Utils.isMac?(_.isFunction(n)&&(e=n.call(this,e)),Common.Utils.String.format(t,e.replace(/\+(?=\S)/g,"").replace(/Ctrl|ctrl/g,"⌘").replace(/Alt|alt/g,"⌥").replace(/Shift|shift/g,"⇧"))):Common.Utils.String.format(t,e)}}},Common.Utils.isBrowserSupported=function(){return!(Common.Utils.ieVersion!=0&&Common.Utils.ieVersion<9||Common.Utils.safariVersion!=0&&Common.Utils.safariVersion<5||Common.Utils.firefoxVersion!=0&&Common.Utils.firefoxVersion<4||Common.Utils.chromeVersion!=0&&Common.Utils.chromeVersion<7||Common.Utils.operaVersion!=0&&Common.Utils.operaVersion<10.5)},Common.Utils.showBrowserRestriction=function(){var e=window.DE?"Document":window.SSE?"Spreadsheet":window.PE?"Presentation":"that",t=document.createElement("div");t.innerHTML='<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, '+e+" 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(t),$("#loading-mask").hide().remove(),$("#viewport").hide().remove()},Common.Utils.applyCustomization=function(e,t){for(var n in e){var r;if(!!t[n]){r=$(t[n]);if(r.length){var i=e[n];i===!1||i.visible===!1?r.hide():(!i.text||r.text(i.text),i.visible===!1&&r.hide())}}}},Common.Utils.applyCustomizationPlugins=function(plugins){if(!plugins||plugins.length<1)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_getPluginCode=function(url){if(!url)return"";try{var xhrObj=_createXMLHTTPObject();xhrObj&&url&&(xhrObj.open("GET",url,!1),xhrObj.send(""),xhrObj.status==200&&eval(xhrObj.responseText))}catch(e){}return null};plugins.forEach(function(e){e&&_getPluginCode(e)})},Common.Utils.fillUserInfo=function(e,t,n){var r=e||{};return!r.id&&(r.id="uid-"+Date.now()),_.isEmpty(r.name)?(_.isEmpty(r.firstname)&&_.isEmpty(r.lastname)&&(r.firstname=n),_.isEmpty(r.firstname)?r.fullname=r.lastname:_.isEmpty(r.lastname)?r.fullname=r.firstname:r.fullname=/^ru/.test(t)?r.lastname+" "+r.firstname:r.firstname+" "+r.lastname):r.fullname=r.name,r},String.prototype.strongMatch=function(e){if(e&&e instanceof RegExp){var t=this.toString().match(e);return!!(t&&t.length>0&&t[0].length==this.length)}return!1},define("common/main/lib/util/utils",function(){}),$(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api","[data-toggle=dropdown], [role=menu]",onDropDownKeyDown),function(){function n(e){(e.which==1||e.which==undefined)&&clearMenus(/form-control/.test(e.target.className))}var e=$._data($(document).get(0),"events"),t;e&&e.click&&e.click.every(function(e,n,r){return/click/.test(e.type)&&!e.selector&&/bs\..+\.dropdown/.test(e.namespace)&&(t=e.handler),!t}),!t||$(document).off("click.bs.dropdown.data-api",t).on("click.bs.dropdown.data-api",n)}(),define("common/main/lib/extend/Bootstrap",function(){});if(Common===undefined)var Common={};define("common/main/lib/component/ToggleManager",["common/main/lib/component/BaseView"],function(){"use strict";function t(t,n){var r,i,s;if(n){r=e[t.toggleGroup];for(i=0,s=r.length;i<s;i++)r[i]!==t&&(r[i].isActive?r[i].isActive()&&r[i].toggle(!1):r[i].toggle(!1))}}var e={};Common.UI.ToggleManager={register:function(n){if(!n.toggleGroup)return;var r=e[n.toggleGroup];r||(r=e[n.toggleGroup]=[]),r.push(n),n.on("toggle",t)},unregister:function(n){if(!n.toggleGroup)return;var r=e[n.toggleGroup];r&&(_.without(r,n),n.off("toggle",t))},getToggled:function(t){var n=e[t],r=0,i;if(n)for(i=n.length;r<i;r++)if(n[r].pressed===!0||n[r].checked===!0)return n[r];return null}}});if(Common===undefined)var Common={};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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.caption=t.options.caption,this.menu=t.options.menu||null,this.checkable=t.options.checkable,this.checked=t.options.checked,t.allowDepress=t.options.allowDepress,this.disabled=t.options.disabled,this.value=t.options.value,this.toggleGroup=t.options.toggleGroup,this.template=t.options.template||this.template,this.iconCls=t.options.iconCls,this.rendered=!1,this.menu!==null&&!(this.menu instanceof Common.UI.Menu)&&(this.menu=new Common.UI.Menu(_.extend({},t.options.menu))),t.options.el&&this.render()},render:function(){var e=this,t=$(this.el);e.trigger("render:before",e);if(e.caption==="--")t.addClass("divider");else if(!this.rendered){t.off("click"),Common.UI.ToggleManager.unregister(e),$(this.el).html(this.template({id:e.id,caption:e.caption,iconCls:e.iconCls,style:e.style,options:e.options})),e.menu&&(t.addClass("dropdown-submenu"),e.menu.render($(this.el)),t.mouseenter(_.bind(e.menu.alignPosition,e.menu)),t.focusout(_.bind(e.onBlurItem,e)),t.hover(_.bind(e.onHoverItem,e),_.bind(e.onUnHoverItem,e)));var n=t.children(":first");this.checkable&&n&&(n.toggleClass("checkable",this.checkable),n.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||n.css("background-image","none")),this.disabled&&$(this.el).toggleClass("disabled",this.disabled),t.on("click",_.bind(this.onItemClick,this)),t.on("mousedown",_.bind(this.onItemMouseDown,this)),Common.UI.ToggleManager.register(e)}return e.cmpEl=$(this.el),e.rendered=!0,e.trigger("render:after",e),this},setCaption:function(e,t){this.caption=e,this.rendered&&(this.cmpEl.find("a").contents().last()[0].textContent=t?e:Common.Utils.String.htmlEncode(e))},setChecked:function(e,t){this.toggle(e,t)},isChecked:function(){return this.checked},setDisabled:function(e){this.disabled=!!e,this.rendered&&this.cmpEl.toggleClass("disabled",this.disabled)},isDisabled:function(){return this.disabled},toggle:function(e,t){var n=e===undefined?!this.checked:!!e;if(this.checkable){this.checked=n;if(this.rendered){var r=this.cmpEl.children(":first");r&&(r.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||r.css("background-image","none"))}t||this.trigger("toggle",this,n)}},onItemMouseDown:function(e){if(e.which!=1)return e.preventDefault(),e.stopPropagation(),!1},onItemClick:function(e){if(!(e.which==1||e.which===undefined&&!this.menu))return!1;!this.disabled&&(this.allowDepress||!this.checked||!this.toggleGroup)&&!this.menu&&this.setChecked(!this.checked);if(this.menu){if(e.target.id==this.id)return!1;this.menu.isOver||this.cmpEl.removeClass("over");return}if(!!this.disabled)return!1;this.trigger("click",this,e)},onHoverItem:function(e){this._doHover(e)},onUnHoverItem:function(e){this._doUnHover(e)},onBlurItem:function(e){this._doUnHover(e)},_doHover:function(e){var t=this;t.menu&&!t.disabled&&(clearTimeout(t.hideMenuTimer),t.cmpEl.trigger("show.bs.dropdown"),t.expandMenuTimer=_.delay(function(){t.cmpEl.addClass("over"),t.cmpEl.trigger("shown.bs.dropdown")},200))},_doUnHover:function(e){var t=this;if(t.cmpEl.hasClass("dropdown-submenu")&&t.cmpEl.hasClass("over")&&(e&&e.relatedTarget&&t.cmpEl.find(e.relatedTarget).length>0||t.cmpEl.hasClass("focused-submenu"))){t.cmpEl.removeClass("focused-submenu");return}if(t.menu&&!t.disabled){clearTimeout(t.expandMenuTimer),t.hideMenuTimer=_.delay(function(){t.menu.isOver||t.cmpEl.removeClass("over")},200);if(e&&e.type!=="focusout"){var n=t.cmpEl.children(":focus");n.length>0&&(n.blur(),t.cmpEl.closest("ul").focus())}}}}),Common.UI.MenuItemSeparator=function(e){return e=e||{},e.caption="--",new Common.UI.MenuItem(e)}}),function(e){typeof define=="function"&&define.amd?define("jmousewheel",["jquery"],e):typeof exports=="object"?module.exports=e:e(jQuery)}(function(e){function a(t){var n=t||window.event,o=r.call(arguments,1),u=0,a=0,c=0,h=0;t=e.event.fix(n),t.type="mousewheel","detail"in n&&(c=n.detail*-1),"wheelDelta"in n&&(c=n.wheelDelta),"wheelDeltaY"in n&&(c=n.wheelDeltaY),"wheelDeltaX"in n&&(a=n.wheelDeltaX*-1),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(a=c*-1,c=0),u=c===0?a:c,"deltaY"in n&&(c=n.deltaY*-1,u=c),"deltaX"in n&&(a=n.deltaX,c===0&&(u=a*-1));if(c===0&&a===0)return;if(n.deltaMode===1){var p=e.data(this,"mousewheel-line-height");u*=p,c*=p,a*=p}else if(n.deltaMode===2){var d=e.data(this,"mousewheel-page-height");u*=d,c*=d,a*=d}h=Math.max(Math.abs(c),Math.abs(a));if(!s||h<s)s=h,l(n,h)&&(s/=40);return l(n,h)&&(u/=40,a/=40,c/=40),u=Math[u>=1?"floor":"ceil"](u/s),a=Math[a>=1?"floor":"ceil"](a/s),c=Math[c>=1?"floor":"ceil"](c/s),t.deltaX=a,t.deltaY=c,t.deltaFactor=s,t.deltaMode=0,o.unshift(t,u,a,c),i&&clearTimeout(i),i=setTimeout(f,200),(e.event.dispatch||e.event.handle).apply(this,o)}function f(){s=null}function l(e,t){return u.settings.adjustOldDeltas&&e.type==="mousewheel"&&t%120===0}var t=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],n="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r=Array.prototype.slice,i,s;if(e.event.fixHooks)for(var o=t.length;o;)e.event.fixHooks[t[--o]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var t=n.length;t;)this.addEventListener(n[--t],a,!1);else this.onmousewheel=a;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=n.length;e;)this.removeEventListener(n[--e],a,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"use strict";typeof define=="function"&&define.amd?define("perfectscrollbar",["jquery"],e):typeof exports=="object"?e(require("jquery")):e(jQuery)}(function(e){"use strict";var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1,includeMargin:!0},n=function(){var e=0;return function(){var t=e;return e+=1,".perfect-scrollbar-"+t}}();e.fn.perfectScrollbar=function(r,i){return this.each(function(){var s=e.extend(!0,{},t),o=e(this);typeof r=="object"?e.extend(!0,s,r):i=r;if(i==="update")return o.data("perfect-scrollbar-update")&&o.data("perfect-scrollbar-update")(),o;if(i==="destroy")return o.data("perfect-scrollbar-destroy")&&o.data("perfect-scrollbar-destroy")(),o;if(o.data("perfect-scrollbar"))return o.data("perfect-scrollbar");o.addClass("ps-container");var u=e("<div class='ps-scrollbar-x-rail'></div>").appendTo(o),a=e("<div class='ps-scrollbar-y-rail'></div>").appendTo(o),f=e("<div class='ps-scrollbar-x'></div>").appendTo(u),l=e("<div class='ps-scrollbar-y'></div>").appendTo(a),c,h,p,d,v,m,g,y,b=parseInt(u.css("bottom"),10),w,E,S=parseInt(a.css("right"),10),x,T=n(),N=function(e,t){var n=e+t,r=x-w;n<0?E=0:n>r?E=r:E=n;var i=parseInt(E*(m-d)/(x-w),10);o.scrollTop(i),u.css({bottom:b-i})},C=function(e,t){var n=e+t,r=p-g;n<0?y=0:n>r?y=r:y=n;var i=parseInt(y*(v-p)/(p-g),10);o.scrollLeft(i),a.css({right:S-i})},k=function(e){return s.minScrollbarLength&&(e=Math.max(e,s.minScrollbarLength)),e},L=function(){u.css({left:o.scrollLeft(),bottom:b-o.scrollTop(),width:p,display:c?"inherit":"none"}),a.hasClass("in-scrolling")?a.css({right:S-o.scrollLeft(),height:x,display:h?"inherit":"none"}):a.css({top:o.scrollTop(),right:S-o.scrollLeft(),height:x,display:h?"inherit":"none"}),f.css({left:y,width:g}),l.css({top:E,height:w})},A=function(){p=s.includePadding?o.innerWidth():o.width(),d=s.includePadding?o.innerHeight():o.height(),x=d-(s.includeMargin?parseInt(a.css("margin-top"))+parseInt(a.css("margin-bottom")):0),v=o.prop("scrollWidth"),m=o.prop("scrollHeight"),!s.suppressScrollX&&p+s.scrollXMarginOffset<v?(c=!0,g=k(parseInt(p*p/v,10)),y=parseInt(o.scrollLeft()*(p-g)/(v-p),10)):(c=!1,g=0,y=0,o.scrollLeft(0)),!s.suppressScrollY&&d+s.scrollYMarginOffset<m?(h=!0,w=k(parseInt(x*d/m,10)),E=parseInt(o.scrollTop()*(x-w)/(m-d),10)):(h=!1,w=0,E=0,o.scrollTop(0)),E>=x-w&&(E=x-w),y>=p-g&&(y=p-g),L(),s.onChange&&s.onChange(this)},O=function(){var t,n;f.bind("mousedown"+T,function(e){n=e.pageX,t=f.position().left,u.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+T,function(e){u.hasClass("in-scrolling")&&(C(t,e.pageX-n),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+T,function(e){u.hasClass("in-scrolling")&&u.removeClass("in-scrolling")}),t=n=null},M=function(){var t,n;l.bind("mousedown"+T,function(e){n=e.pageY,t=l.position().top,a.addClass("in-scrolling");var r=parseInt(a.css("margin-top")),i=a[0].getBoundingClientRect();a.css({position:"fixed",left:i.left,top:i.top-r}),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+T,function(e){a.hasClass("in-scrolling")&&(N(t,e.pageY-n),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+T,function(e){a.hasClass("in-scrolling")&&(a.removeClass("in-scrolling"),a.css({position:"",left:"",top:""}),L())}),t=n=null},_=function(e,t){var n=o.scrollTop();if(e===0){if(!h)return!1;if(n===0&&t>0||n>=m-d&&t<0)return!s.wheelPropagation}var r=o.scrollLeft();if(t===0){if(!c)return!1;if(r===0&&e<0||r>=v-p&&e>0)return!s.wheelPropagation}return!0},D=function(){s.wheelSpeed/=10;var t=!1;o.bind("mousewheel"+T,function(n,r,i,u){var a=n.deltaX*n.deltaFactor||i,f=n.deltaY*n.deltaFactor||u;if(n&&n.target&&(n.target.type==="textarea"||n.target.type==="input")){n.stopImmediatePropagation(),n.preventDefault();var l=e(n.target).scrollTop(),p=0;n.originalEvent?n.originalEvent.wheelDelta?p=n.originalEvent.wheelDelta:n.originalEvent.deltaY?p=-n.originalEvent.deltaY*40:n.originalEvent.detail&&(p=n.originalEvent.detail):p=n.wheelDelta!==undefined?n.wheelDelta:n.deltaY,e(n.target).scrollTop(l-p);return}t=!1,s.useBothWheelAxes?h&&!c?(f?o.scrollTop(o.scrollTop()-f*s.wheelSpeed):o.scrollTop(o.scrollTop()+a*s.wheelSpeed),t=!0):c&&!h&&(a?o.scrollLeft(o.scrollLeft()+a*s.wheelSpeed):o.scrollLeft(o.scrollLeft()-f*s.wheelSpeed),t=!0):(o.scrollTop(o.scrollTop()-f*s.wheelSpeed),o.scrollLeft(o.scrollLeft()+a*s.wheelSpeed)),A(),t=t||_(a,f),t&&(n.stopPropagation(),n.preventDefault())}),o.bind("MozMousePixelScroll"+T,function(e){t&&e.preventDefault()})},P=function(){var t=!1;o.bind("mouseenter"+T,function(e){t=!0}),o.bind("mouseleave"+T,function(e){t=!1});var n=!1;e(document).bind("keydown"+T,function(r){if(!t||e(document.activeElement).is(":input,[contenteditable]"))return;var i=0,s=0;switch(r.which){case 37:i=-30;break;case 38:s=30;break;case 39:i=30;break;case 40:s=-30;break;case 33:s=90;break;case 32:case 34:s=-90;break;case 35:s=-d;break;case 36:s=d;break;default:return}o.scrollTop(o.scrollTop()-s),o.scrollLeft(o.scrollLeft()+i),n=_(i,s),n&&r.preventDefault()})},H=function(){var e=function(e){e.stopPropagation()};l.bind("click"+T,e),a.bind("click"+T,function(e){var t=parseInt(w/2,10),n=e.pageY-a.offset().top-t,r=x-w,i=n/r;i<0?i=0:i>1&&(i=1),o.scrollTop((m-d)*i)}),f.bind("click"+T,e),u.bind("click"+T,function(e){var t=parseInt(g/2,10),n=e.pageX-u.offset().left-t,r=p-g,i=n/r;i<0?i=0:i>1&&(i=1),o.scrollLeft((v-p)*i)})},B=function(){var t=function(e,t){o.scrollTop(o.scrollTop()-t),o.scrollLeft(o.scrollLeft()-e),A()},n={},r=0,i={},s=null,u=!1;e(window).bind("touchstart"+T,function(e){u=!0}),e(window).bind("touchend"+T,function(e){u=!1}),o.bind("touchstart"+T,function(e){var t=e.originalEvent.targetTouches[0];n.pageX=t.pageX,n.pageY=t.pageY,r=(new Date).getTime(),s!==null&&clearInterval(s),e.stopPropagation()}),o.bind("touchmove"+T,function(e){if(!u&&e.originalEvent.targetTouches.length===1){var s=e.originalEvent.targetTouches[0],o={};o.pageX=s.pageX,o.pageY=s.pageY;var a=o.pageX-n.pageX,f=o.pageY-n.pageY;t(a,f),n=o;var l=(new Date).getTime(),c=l-r;c>0&&(i.x=a/c,i.y=f/c,r=l),e.preventDefault()}}),o.bind("touchend"+T,function(e){clearInterval(s),s=setInterval(function(){if(Math.abs(i.x)<.01&&Math.abs(i.y)<.01){clearInterval(s);return}t(i.x*30,i.y*30),i.x*=.8,i.y*=.8},10)})},j=function(){o.bind("scroll"+T,function(e){A()})},F=function(){o.unbind(T),e(window).unbind(T),e(document).unbind(T),o.data("perfect-scrollbar",null),o.data("perfect-scrollbar-update",null),o.data("perfect-scrollbar-destroy",null),f.remove(),l.remove(),u.remove(),a.remove(),f=l=p=d=v=m=g=y=b=w=E=S=null},I=function(t){o.addClass("ie").addClass("ie"+t);var n=function(){var t=function(){e(this).addClass("hover")},n=function(){e(this).removeClass("hover")};o.bind("mouseenter"+T,t).bind("mouseleave"+T,n),u.bind("mouseenter"+T,t).bind("mouseleave"+T,n),a.bind("mouseenter"+T,t).bind("mouseleave"+T,n),f.bind("mouseenter"+T,t).bind("mouseleave"+T,n),l.bind("mouseenter"+T,t).bind("mouseleave"+T,n)},r=function(){L=function(){f.css({left:y+o.scrollLeft(),bottom:b,width:g}),l.css({top:E+o.scrollTop(),right:S,height:w}),f.hide().show(),l.hide().show()}};t===6&&(n(),r())},q="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,R=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&e[1]==="msie"&&I(parseInt(e[2],10)),A(),j(),O(),M(),H(),q&&B(),o.mousewheel&&D(),s.useKeyboard&&P(),o.data("perfect-scrollbar",o),o.data("perfect-scrollbar-update",A),o.data("perfect-scrollbar-destroy",F)};return R(),o})}});if(Common===undefined)var Common={};define("common/main/lib/component/Scroller",["jmousewheel","perfectscrollbar","common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Scroller=function(){var e;return _.extend(Common.UI.BaseView.extend({options:{wheelSpeed:20,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:5,scrollYMarginOffset:5,includePadding:!0,includeMargin:!0,alwaysVisibleX:!1,alwaysVisibleY:!1},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.options.el&&this.render()},render:function(){var e=this;return e.cmpEl=$(this.el),e.rendered||(e.cmpEl.perfectScrollbar(_.extend({},e.options)),e.rendered=!0,this.setAlwaysVisibleX(e.options.alwaysVisibleX),this.setAlwaysVisibleY(e.options.alwaysVisibleY)),this},remove:function(){this.destroy(),Backbone.View.prototype.remove.call(this)},update:function(t){var n=this.options;t?(this.destroy(),n=_.extend(this.options,t),this.cmpEl.perfectScrollbar(n)):this.cmpEl.perfectScrollbar("update"),this.setAlwaysVisibleX(n.alwaysVisibleX),this.setAlwaysVisibleY(n.alwaysVisibleY);var r=function(t){e=!0;var n=function(t){$(document).unbind("mouseup",n),_.delay(function(){e=!1},10)};$(document).mouseup(n)};$(".ps-scrollbar-x-rail, .ps-scrollbar-y-rail, .ps-scrollbar-x, .ps-scrollbar-y",this.cmpEl).off("mousedown",r).on("mousedown",r)},destroy:function(){this.cmpEl.perfectScrollbar("destroy")},scrollLeft:function(e){this.cmpEl.scrollLeft(e),this.update()},scrollTop:function(e){this.cmpEl.scrollTop(e),this.update()},getScrollTop:function(){return this.cmpEl.scrollTop()},getScrollLeft:function(){return this.cmpEl.scrollLeft()},setAlwaysVisibleX:function(e){e?($(this.el).find(".ps-scrollbar-x-rail").addClass("always-visible-x"),$(this.el).find(".ps-scrollbar-x").addClass("always-visible-x")):($(this.el).find(".ps-scrollbar-x-rail").removeClass("always-visible-x"),$(this.el).find(".ps-scrollbar-x").addClass("always-visible-x"))},setAlwaysVisibleY:function(e){e?($(this.el).find(".ps-scrollbar-y-rail").addClass("always-visible-y"),$(this.el).find(".ps-scrollbar-y").addClass("always-visible-y")):($(this.el).find(".ps-scrollbar-y-rail").removeClass("always-visible-y"),$(this.el).find(".ps-scrollbar-y").addClass("always-visible-y"))}}),{isMouseCapture:function(){return e}})}()});if(Common===undefined)var Common={};define("common/main/lib/component/Menu",["common/main/lib/extend/Bootstrap","common/main/lib/component/BaseView","common/main/lib/component/MenuItem","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.Menu=function(){var e=function(){var e=[],t={};return{register:function(n){t[n.id]=n,n.on("show:after",function(t){e.push(t)}).on("hide:after",function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)})},unregister:function(n){var r=e.indexOf(n);delete t[n.id],r>-1&&e.splice(r,1),n.off("show:after").off("hide:after")},hideAll:function(){return Common.NotificationCenter.trigger("menumanager:hideall"),e&&e.length>0?(_.each(e,function(e){e&&e.hide()}),!0):!1}}}();return _.extend(Common.UI.BaseView.extend({options:{cls:"",style:"",itemTemplate:null,items:[],menuAlign:"tl-bl",menuAlignEl:null,offset:[0,0],cyclic:!0},template:_.template(['<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var n=this;this.id=this.options.id||Common.UI.getId(),this.itemTemplate=this.options.itemTemplate||Common.UI.MenuItem.prototype.template,this.rendered=!1,this.items=[],this.offset=[0,0],this.menuAlign=this.options.menuAlign,this.menuAlignEl=this.options.menuAlignEl,this.options.cyclic||(this.options.cls+=" no-cyclic"),_.each(this.options.items,function(e){e instanceof Common.UI.MenuItem?n.items.push(e):n.items.push(new Common.UI.MenuItem(_.extend({tagName:"li",template:n.itemTemplate},e)))}),this.options.el&&this.render(),e.register(this)},remove:function(){e.unregister(this),Common.UI.BaseView.prototype.remove.call(this)},render:function(e){var t=this;this.trigger("render:before",this),this.cmpEl=$(this.el),e?(this.setElement(e,!1),t.rendered||(this.cmpEl=$(this.template({options:t.options})),e.append(this.cmpEl))):t.rendered||(this.cmpEl=this.template({options:t.options}),$(this.el).append(this.cmpEl));var n=this.cmpEl.parent(),r=n.attr("role")==="menu"?n:n.find("[role=menu]");return r&&(t.rendered||_.each(t.items||[],function(e){r.append(e.render().el),e.on("click",_.bind(t.onItemClick,t)),e.on("toggle",_.bind(t.onItemToggle,t))}),r.css({"max-height":t.options.maxHeight||"none",position:"fixed",right:"auto",left:-1e3,top:-1e3}),this.parentEl=r.parent(),this.parentEl.on("show.bs.dropdown",_.bind(t.onBeforeShowMenu,t)),this.parentEl.on("shown.bs.dropdown",_.bind(t.onAfterShowMenu,t)),this.parentEl.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),this.parentEl.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t)),this.parentEl.on("keydown.after.bs.dropdown",_.bind(t.onAfterKeydownMenu,t)),r.on("scroll",_.bind(t.onScroll,t)),r.hover(function(e){t.isOver=!0},function(e){t.isOver=!1})),this.rendered=!0,this.trigger("render:after",this),this},isVisible:function(){return this.rendered&&this.cmpEl.is(":visible")},show:function(){this.rendered&&this.parentEl&&!this.parentEl.hasClass("open")&&this.cmpEl.dropdown("toggle")},hide:function(){this.rendered&&this.parentEl&&(this.parentEl.hasClass("open")?this.cmpEl.dropdown("toggle"):this.parentEl.hasClass("over")&&this.parentEl.removeClass("over"))},insertItem:function(e,t){var n=this,r=this.cmpEl;t instanceof Common.UI.MenuItem||(t=new Common.UI.MenuItem(_.extend({tagName:"li",template:n.itemTemplate},t))),e<0||e>=n.items.length?n.items.push(t):n.items.splice(e,0,t);if(this.rendered){var i=r.attr("role")==="menu"?r:r.find("[role=menu]");i&&(e<0?i.append(t.render().el):e===0?i.prepend(t.render().el):$("li:nth-child("+(e+1)+")",i).before(t.render().el),t.on("click",_.bind(n.onItemClick,n)),t.on("toggle",_.bind(n.onItemToggle,n)))}},doLayout:function(){if(this.options.maxHeight>0){if(!this.rendered){this.mustLayout=!0;return}var e=this,t=this.cmpEl,n=t.attr("role")==="menu"?t:t.find("[role=menu]");if(!n.is(":visible")){var r=[n.css("left"),n.css("top")];n.css({left:"-1000px",top:"-1000px",display:"block"})}var i=n.find("li");if(i.height()*i.length>this.options.maxHeight){var s='<div class="menu-scroll top"></div>';n.prepend(s),s='<div class="menu-scroll bottom"></div>',n.append(s),n.css({"box-shadow":"none","overflow-y":"hidden","padding-top":"18px"}),n.find("> li:last-of-type").css("margin-bottom",18);var o=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},u=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";o(n[0],u,_.bind(this.onMouseWheel,this)),n.find(".menu-scroll").on("click",_.bind(this.onScrollClick,this))}r&&n.css({display:"",left:r[0],top:r[1]})}},addItem:function(e){this.insertItem(-1,e)},removeItem:function(e){var t=this,n=t.items.indexOf(e);n>-1&&(t.items.splice(n,1),e.off("click").off("toggle"),e.remove())},removeItems:function(e,t){if(e>this.items.length-1)return;e+t>this.items.length&&(t=this.items.length-e);for(var n=e;n<e+t;n++)this.items[n].off("click").off("toggle"),this.items[n].remove();this.items.splice(e,t)},removeAll:function(){var e=this;_.each(e.items,function(e){e.off("click").off("toggle"),e.remove()}),e.items=[]},onBeforeShowMenu:function(e){Common.NotificationCenter.trigger("menu:show"),this.mustLayout&&(delete this.mustLayout,this.doLayout.call(this)),this.trigger("show:before",this,e),this.alignPosition()},onAfterShowMenu:function(e){this.trigger("show:after",this,e);if(this.$el.find("> ul > .menu-scroll").length){var t=this.$el.find("li .checked")[0];if(t){var n=t.offsetTop-this.options.maxHeight/2;this.scrollMenu(n<0?0:n)}}},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault()},onAfterHideMenu:function(e,t){this.trigger("hide:after",this,e,t),Common.NotificationCenter.trigger("menu:hide",this,t)},onAfterKeydownMenu:function(e){if(e.keyCode==Common.UI.Keys.RETURN){var t=$(e.target).closest("li");t.length<=0&&(t=$(e.target).parent().find("li .dataview")),t.length>0&&t.click(),t.hasClass("dropdown-submenu")||Common.UI.Menu.Manager.hideAll(),$(e.currentTarget).closest("li").hasClass("dropdown-submenu")&&e.stopPropagation()}else e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?this.fromKeyDown=!0:e.keyCode==Common.UI.Keys.ESC},onScroll:function(e,t){if(this.fromKeyDown){var n=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]");n.find(".menu-scroll.top").css("top",n.scrollTop()+"px"),n.find(".menu-scroll.bottom").css("bottom",-n.scrollTop()+"px")}},onItemClick:function(e,t){e.menu||(this.isOver=!1);if(e.options.stopPropagation){t.stopPropagation();var n=this;_.delay(function(){n.$el.parent().parent().find("[data-toggle=dropdown]").focus()},10);return}this.trigger("item:click",this,e,t)},onItemToggle:function(e,t,n){this.trigger("item:toggle",this,e,t,n)},onScrollClick:function(e){return this.scrollMenu(/top/.test(e.currentTarget.className)),!1},onMouseWheel:function(e){this.scrollMenu((e.detail&&-e.detail||e.wheelDelta)>0)},scrollMenu:function(e){this.fromKeyDown=!1;var t=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]"),n=typeof e=="boolean"?t.scrollTop()+(e?-20:20):e;t.scrollTop(n),t.find(".menu-scroll.top").css("top",t.scrollTop()+"px"),t.find(".menu-scroll.bottom").css("bottom",-t.scrollTop()+"px")},setOffset:function(e,t){this.offset[0]=_.isUndefined(e)?this.offset[0]:e,this.offset[1]=_.isUndefined(t)?this.offset[1]:t,this.alignPosition()},getOffset:function(){return this.offset},alignPosition:function(){var e=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]"),t=this.menuAlignEl||e.parent(),n=this.menuAlign.match(/^([a-z]+)-([a-z]+)/),r=t.offset(),i=Common.Utils.innerWidth(),s=Common.Utils.innerHeight()-10,o=e.outerWidth(),u=e.outerHeight(),a=t.outerWidth(),f=t.outerHeight(),l={tl:[0,0],bl:[0,u],tr:[o,0],br:[o,u]},c={tl:[0,0],tr:[a,0],bl:[0,f],br:[a,f]},h=r.left-l[n[1]][0]+c[n[2]][0]+this.offset[0],p=r.top-l[n[1]][1]+c[n[2]][1]+this.offset[1];h+o>i&&(t.is("li.dropdown-submenu")?h=r.left-o+2:h=i-o),p+u>s&&(p=s-u),p<0&&(p=0),this.options.additionalAlign?this.options.additionalAlign.call(this,e,h,p):e.css({left:h,top:p})}}),{Manager:function(){return e}()})}()});if(Common===undefined)var Common={};define("common/main/lib/view/CopyWarningDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.CopyWarningDialog=Common.UI.Window.extend(_.extend({options:{width:500,height:325,cls:"modal-dlg copy-warning"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<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 e=this.getChild(".box"),t=this.getChild(".footer"),n=this.getChild(".header"),r=this.getChild(".body");r.height(parseInt(e.height())+parseInt(t.css("height"))),this.setHeight(parseInt(r.css("height"))+parseInt(n.css("height")))},onBtnClick:function(e){this.options.handler&&this.options.handler.call(this,this.chDontShow.getValue()=="checked"),this.close()},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&(this.options.handler&&this.options.handler.call(this,this.chDontShow.getValue()=="checked"),this.close())},getSettings:function(){return this.chDontShow.getValue()=="checked"},textTitle:"Copy, Cut and Paste Actions",textMsg:"Copy, cut and paste actions using the editor toolbar buttons and context menu actions will be performed within this editor tab only.<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||{}))}),function(e){var t=e.fn.tooltip;t.prototype=e.fn.tooltip.Constructor.prototype,e.extend(e.fn.tooltip.Constructor.DEFAULTS,{container:"body",delay:{show:500},arrow:!1});var n=function(e,t){this.init("tooltip",e,t)};n.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:n,init:function(){t.prototype.init.apply(this,arguments),this.options.placement=="cursor"&&/hover/.exec(this.options.trigger)&&this.$element.on("mousemove.tooltip",this.options.selector,e.proxy(this.mousemove,this)),this.options.zIndex&&this.tip().css("z-index",this.options.zIndex);var n=this;Common.NotificationCenter.on({"layout:changed":function(e){!n.options.hideonclick&&n.tip().is(":visible")&&n.hide()}})},mousemove:function(e){this.targetXY=[e.clientX*Common.Utils.zoom(),e.clientY*Common.Utils.zoom()]},leave:function(e){t.prototype.leave.apply(this,arguments),this.dontShow=undefined},show:function(n){if(this.hasContent()&&this.enabled&&!this.dontShow){if(!this.$element.is(":visible")&&this.$element.closest("[role=menu]").length>0)return;var r=this.tip(),i=typeof this.options.placement=="function"?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement;this.options.arrow===!1&&r.addClass("arrow-free"),this.options.cls&&r.addClass(this.options.cls);var s=/^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(i);if(!n&&!s[2].length)t.prototype.show.apply(this,arguments);else{var o=e.Event("show.bs.tooltip");this.$element.trigger(o);if(o.isDefaultPrevented())return;this.setContent(),this.options.animation&&r.addClass("fade"),r.detach().css({top:0,left:0,display:"block"}),this.options.container?r.appendTo(this.options.container):r.insertAfter(this.$element);if(typeof n=="object"){var u={top:n[1]+15,left:n[0]+18},a=Common.Utils.innerWidth();u.left+r.width()>a&&(u.left=a-r.width()-30),r.offset(u).addClass("in")}else{var f=this.getPosition(),l=r[0].offsetWidth,c=r[0].offsetHeight;switch(s[1]){case"bottom":u={top:f.top+f.height+10};break;case"top":u={top:f.top-c-10}}switch(s[2]){case"left":u.left=f.left,this.$element.outerWidth()<=18&&(u.left-=4);break;case"right":u.left=f.left+f.width-l,this.$element.outerWidth()<=18&&(u.left+=4)}this.applyPlacement(u,s[1]),this.moveArrow(),r.addClass(s[1]).addClass(s[0])}this.$element.trigger("shown.bs.tooltip")}var h=this;clearTimeout(h.timeout),h.timeout=setTimeout(function(){h.hoverState=="in"&&h.hide(),h.dontShow=!1},5e3)}},moveArrow:function(){var e=this.tip().find(".tooltip-arrow, .arrow"),t=10;switch(this.options.placement){case"top-left":case"bottom-left":e.css("left",t);break;case"top-right":case"bottom-right":e.css("right",t)}},enter:function(t){if(t.type!=="mouseenter")return;var n=e(t.target);if(n.is("[role=menu]")||n.parentsUntil(t.currentTarget,"[role=menu]").length&&t.target!==t.currentTarget||this.tip().is(":visible"))return;var r=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs.tooltip");clearTimeout(r.timeout),r.hoverState="in",!r.options.delay||!r.options.delay.show?r.show():r.timeout=setTimeout(function(){r.hoverState=="in"&&r.show(r.options.placement=="cursor"?r.targetXY:undefined)},r.options.delay.show)},replaceArrow:function(e,n,r){this.options.arrow===!1?this.arrow().hide():t.prototype.replaceArrow.apply(this,arguments)},getCalculatedOffset:function(e,n,r,i){var s=t.prototype.getCalculatedOffset.apply(this,arguments);if(this.options.offset>0||this.options.offset<0)switch(/(bottom|top)/.exec(e)[1]){case"bottom":s.top+=this.options.offset;break;case"top":s.top-=this.options.offset}return s}});var r=e.fn.tooltip;e.fn.tooltip=function(t){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s=typeof t=="object"&&t;i||r.data("bs.tooltip",i=new n(this,s)),typeof t=="string"&&i[t]()})},e.fn.tooltip.Constructor=n,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(window.jQuery),define("tip",function(){}),define("common/main/lib/component/Tooltip",["tip","backbone"],function(){"use strict";var e=function(e){this.$element=this.placement=undefined,this.init.call(this,e)};_.extend(e.prototype,Backbone.Events,{init:function(e){this.$element=e.owner instanceof Backbone.View?e.owner.$el:$(e.owner),this.placement=e.placement,this.$element.data("bs.tooltip")&&this.$element.removeData("bs.tooltip"),this.$element.tooltip({title:e.title,trigger:"manual",placement:e.placement,offset:e.offset,cls:e.cls,html:e.html,hideonclick:e.hideonclick});if(e.hideonclick){var t=this.$element.data("bs.tooltip");t&&t.tip().on("click",function(){t.hide()})}this.$element.on("shown.bs.tooltip",_.bind(this.onTipShown,this)),this.$element.on("hidden.bs.tooltip",_.bind(this.onTipHidden,this))},show:function(e){this.getBSTip().show(e)},hide:function(e){this.getBSTip().hide(e)},setTitle:function(e){var t=this.getBSTip();t&&(t.options.title=e)},updateTitle:function(){var e=this.getBSTip();e.$tip.find(".tooltip-inner")[e.options.html?"html":"text"](e.options.title)},getBSTip:function(){return this.$element.data("bs.tooltip")},onTipShown:function(){this.trigger("tooltip:show",this)},onTipHidden:function(){this.trigger("tooltip:hide",this)},isVisible:function(){return this.getBSTip().tip().is(":visible")}}),Common.UI=Common.UI||{},Common.UI.Tooltip=e});if(Common===undefined)var Common={};define("common/main/lib/component/InputField",["common/main/lib/component/BaseView","common/main/lib/component/Tooltip"],function(){"use strict";Common.UI.InputField=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",value:"",type:"text",name:"",validation:null,allowBlank:!0,placeHolder:"",blankError:null,spellcheck:!1,maskExp:"",validateOnChange:!1,validateOnBlur:!0,disabled:!1},template:_.template(['<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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.value=t.options.value,this.type=t.options.type,this.name=t.options.name,this.validation=t.options.validation,this.allowBlank=t.options.allowBlank,this.placeHolder=t.options.placeHolder,this.template=t.options.template||t.template,this.editable=t.options.editable||!0,this.disabled=t.options.disabled,this.spellcheck=t.options.spellcheck,this.blankError=t.options.blankError||"This field is required",this.validateOnChange=t.options.validateOnChange,this.validateOnBlur=t.options.validateOnBlur,this.maxLength=t.options.maxLength,t.rendered=t.options.rendered||!1,t.options.el&&t.render()},render:function(e){var t=this;t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,value:this.value,type:this.type,name:this.name,placeHolder:this.placeHolder,spellcheck:this.spellcheck,scope:t})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));if(!t.rendered){var n=this.cmpEl;this._input=this.cmpEl.find("input").andSelf().filter("input"),this.editable&&(this._input.on("blur",_.bind(this.onInputChanged,this)),this._input.on("keypress",_.bind(this.onKeyPress,this)),this._input.on("keyup",_.bind(this.onKeyUp,this)),this.validateOnChange&&this._input.on("input",_.bind(this.onInputChanging,this)),this.maxLength&&this._input.attr("maxlength",this.maxLength)),this.setEditable(this.editable),this.disabled&&this.setDisabled(this.disabled);if(this._input.closest(".asc-window").length>0)var r=function(){var e=n.find(".input-error").data("bs.tooltip");e&&e.tip().remove(),Common.NotificationCenter.off({"modal:close":r})};Common.NotificationCenter.on({"modal:close":r})}return t.rendered=!0,this},_doChange:function(e,t){if(t&&t.synthetic)return;var n=$(e.target).val(),r=this.value;this.trigger("changed:before",this,n,r,e);if(e.isDefaultPrevented())return;this.value=n,this.validateOnBlur&&this.checkValidate(),this.trigger("changed:after",this,n,r,e)},onInputChanged:function(e,t){this._doChange(e,t)},onInputChanging:function(e,t){var n=$(e.target).val(),r=this.value;if(e.isDefaultPrevented())return;this.value=n,this.validateOnBlur&&this.checkValidate(),this.trigger("changing",this,n,r,e)},onKeyPress:function(e){this.trigger("keypress:before",this,e);if(e.isDefaultPrevented())return;if(e.keyCode===Common.UI.Keys.RETURN)this._doChange(e);else if(this.options.maskExp&&!_.isEmpty(this.options.maskExp.source)){var t=String.fromCharCode(e.which);!this.options.maskExp.test(t)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&(e.preventDefault(),e.stopPropagation())}this.trigger("keypress:after",this,e)},onKeyUp:function(e){this.trigger("keyup:before",this,e);if(e.isDefaultPrevented())return;this.trigger("keyup:after",this,e)},setEditable:function(e){var t=this._input;this.editable=e,e&&t?(t.removeAttr("readonly"),t.removeAttr("data-can-copy")):(t.attr("readonly","readonly"),t.attr("data-can-copy",!1))},isEditable:function(){return this.editable},setDisabled:function(e){this.disabled=e,$(this.el).toggleClass("disabled",e),e?this._input.attr("disabled",!0):this._input.removeAttr("disabled")},isDisabled:function(){return this.disabled},setValue:function(e){this.value=e,this.rendered&&this._input.val(e)},getValue:function(){return this.value},focus:function(){this._input.focus()},checkValidate:function(){var e=this,t=[];!e.allowBlank&&_.isEmpty(e.value)&&t.push(e.blankError);if(_.isFunction(e.validation)){var n=e.validation.call(e,e.value);n!==!0&&(t=_.flatten(t.concat(n)))}if(!_.isEmpty(t)){if(e.cmpEl.hasClass("error")){var r=e.cmpEl.find(".input-error").data("bs.tooltip");return r&&(r.options.title=t.join("\n"),r.setContent()),t}e.cmpEl.addClass("error");var i=e.cmpEl.find(".input-error"),s=i.closest(".asc-window"),r=i.data("bs.tooltip");return r&&r.tip().remove(),i.attr("data-toggle","tooltip"),i.removeData("bs.tooltip"),i.tooltip({title:t.join("\n"),placement:"cursor"}),s.length>0&&i.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),t}return e.cmpEl.removeClass("error"),!0},showError:function(e){var t=this;if(!_.isEmpty(e)){t.cmpEl.addClass("error");var n=t.cmpEl.find(".input-error"),r=n.closest(".asc-window"),i=n.data("bs.tooltip");i&&i.tip().remove(),n.attr("data-toggle","tooltip"),n.removeData("bs.tooltip"),n.tooltip({title:e.join("\n"),placement:"cursor"}),r.length>0&&n.data("bs.tooltip").tip().css("z-index",parseInt(r.css("z-index"))+10)}else t.cmpEl.removeClass("error")}}}())});if(Common===undefined)var Common={};define("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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.menuCls=t.options.menuCls,this.menuStyle=t.options.menuStyle,this.template=t.options.template||t.template,this.itemsTemplate=t.options.itemsTemplate,this.hint=t.options.hint,this.editable=t.options.editable,this.disabled=t.options.disabled,this.store=t.options.store||new Common.UI.ComboBoxStore,this.displayField=t.options.displayField,this.valueField=t.options.valueField,this.scrollAlwaysVisible=t.options.scrollAlwaysVisible,t.rendered=t.options.rendered||!1,this.lastValue=null,t.store.add(t.options.data),t.options.el&&t.render()},render:function(e){var t=this;if(!t.rendered){var n=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:n,scope:t})),this.itemsTemplate&&this.cmpEl.find("ul").append($(this.itemsTemplate({items:n,scope:t}))),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl)}else this.cmpEl=$(this.el);if(!t.rendered){var r=this.cmpEl;this._input=r.find("input"),this._button=r.find(".btn"),r.on("click","a",_.bind(this.itemClicked,this)),r.on("mousedown","a",_.bind(this.itemMouseDown,this)),this.editable?(r.on("change","input",_.bind(this.onInputChanged,this)),r.on("keydown","input",_.bind(this.onInputKeyDown,this)),r.on("focusin","input",_.bind(this.onInputFocusIn,this)),r.on("click",".form-control",_.bind(this.onEditableInputClick,this))):(r.on("click",".form-control",_.bind(this.onInputClick,this)),this._input.attr("readonly","readonly"),this._input.attr("data-can-copy",!1)),t.options.hint&&(r.attr("data-toggle","tooltip"),r.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"})),r.on("show.bs.dropdown",_.bind(t.onBeforeShowMenu,t)),r.on("shown.bs.dropdown",_.bind(t.onAfterShowMenu,t)),r.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),r.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t)),r.on("keydown.after.bs.dropdown",_.bind(t.onAfterKeydownMenu,t)),Common.NotificationCenter.on("menumanager:hideall",_.bind(t.closeMenu,t)),this.setDefaultSelection(),this.listenTo(this.store,"reset",this.onResetItems)}return t.rendered=!0,t.disabled&&t.setDisabled(t.disabled),this},setData:function(e){this.store.reset([]),this.store.add(e),this.setRawValue(""),this.onResetItems()},openMenu:function(e){var t=this;this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),_.delay(function(){t.cmpEl.addClass("open")},e||0)},closeMenu:function(){this.cmpEl.removeClass("open")},isMenuOpen:function(){return this.cmpEl.hasClass("open")},onBeforeShowMenu:function(e){this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),Common.NotificationCenter.trigger("menu:show"),this.trigger("show:before",this,e);if(this.options.hint){var t=this.cmpEl.data("bs.tooltip");t&&(t.dontShow===undefined&&(t.dontShow=!0),t.hide())}},onAfterShowMenu:function(e){var t=$(this.el).find("ul"),n=t.find("> li.selected");if(n.length){var r=n.position().top,i=n.height(),s=t.height();(r<0||r+i>s)&&t.scrollTop(t.scrollTop()+r+i-s/2)}this.scroller&&this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible}),this.trigger("show:after",this,e)},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault()},onAfterHideMenu:function(e,t){this.cmpEl.find(".dropdown-toggle").blur(),this.trigger("hide:after",this,e,t),Common.NotificationCenter.trigger("menu:hide",this,t)},onAfterKeydownMenu:function(e){if(e.keyCode==Common.UI.Keys.RETURN){$(e.target).click();var t=this;return this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur()),!1}if(e.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this.closeMenu(),this.onAfterHideMenu(e),!1},onInputKeyDown:function(e){var t=this;e.keyCode==Common.UI.Keys.ESC?(this.closeMenu(),this.onAfterHideMenu(e)):e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?(this.isMenuOpen()||this.openMenu(),_.delay(function(){t._skipInputChange=!0,t.cmpEl.find("ul li:first a").focus()},10)):e.keyCode==Common.UI.Keys.RETURN&&$(e.target).val()===t.lastValue?this._input.trigger("change",{reapply:!0}):t._skipInputChange=!1},onInputFocusIn:function(e){this.trigger("combo:focusin",this,e)},onInputChanged:function(e,t){if(t&&t.synthetic)return;if(this._skipInputChange){this._skipInputChange=!1;return}var n=$(e.target).val(),r={};if(this.lastValue===n&&(!t||!t.reapply)){t&&t.onkeydown&&this.trigger("combo:blur",this,e);return}r[this.valueField]=n,this.trigger("changed:before",this,r,e);if(e.isDefaultPrevented())return;var i;this._selectedItem=this.store.findWhere((i={},i[this.displayField]=n,i)),this._selectedItem&&(r=this._selectedItem.toJSON(),$(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")),this.trigger("changed:after",this,r,e)},onInputClick:function(e){this._button&&this._button.dropdown("toggle"),e.preventDefault(),e.stopPropagation()},onEditableInputClick:function(e){if(this.options.hint){var t=this.cmpEl.data("bs.tooltip");t&&(t.dontShow===undefined&&(t.dontShow=!0),t.hide())}this.isMenuOpen()&&e.which==1&&e.stopPropagation()},setDefaultSelection:function(){if(!this.rendered)return;var e=this._input.val(),t;e&&(this._selectedItem=this.store.findWhere((t={},t[this.displayField]=e,t)),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")))},setDisabled:function(e){this.disabled=e;if(!this.rendered)return;e?this._input.attr("disabled",!0):this._input.removeAttr("disabled"),this.cmpEl.toggleClass("disabled",e),this._button.toggleClass("disabled",e)},isDisabled:function(){return this.disabled},setRawValue:function(e){this.rendered&&(this._input.val(e).trigger("change",{synthetic:!0}),this.lastValue=e!==null&&e!==undefined?e.toString():e)},getRawValue:function(){return this.rendered?this._input.val():null},setValue:function(e,t){if(!this.rendered)return;var n;this._selectedItem=this.store.findWhere((n={},n[this.valueField]=e,n)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem?(this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")):this.setRawValue(t!==undefined?t:e)},getValue:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?this._selectedItem.get(this.valueField):this._input.val():null},getDisplayValue:function(e){return Common.Utils.String.htmlEncode(e[this.displayField])},getSelectedRecord:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?_.extend({},this._selectedItem.toJSON()):null:null},selectRecord:function(e){if(!this.rendered||!e)return;this._selectedItem=e,$(".selected",$(this.el)).removeClass("selected"),this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")},itemClicked:function(e){var t=$(e.target).closest("li");this._selectedItem=this.store.findWhere({id:t.attr("id")}),this._selectedItem&&(this.lastValue=this._selectedItem.get(this.displayField),this._input.val(this.lastValue).trigger("change",{synthetic:!0}),$(".selected",$(this.el)).removeClass("selected"),t.addClass("selected"),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),e.preventDefault()),this._isMouseDownMenu=!1},itemMouseDown:function(e){if(e.which!=1)return e.preventDefault(),e.stopPropagation(),!1;this._isMouseDownMenu=!0},onResetItems:function(){this.itemsTemplate?$(this.el).find("ul").html($(this.itemsTemplate({items:this.store.toJSON(),scope:this}))):$(this.el).find("ul").html(_.template(["<% _.each(items, function(item) { %>",'<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))}}}())});if(Common===undefined)var Common={};define("common/main/lib/component/RadioBox",["common/main/lib/component/BaseView","underscore"],function(e,t){"use strict";Common.UI.RadioBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,template:t.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><%= labelText %></label>'),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var n=this,r=$(this.el);this.name=this.options.name||Common.UI.getId(),this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.checked!==undefined&&this.setValue(this.options.checked,!0),this.$radio.on("click",t.bind(this.onItemCheck,this))},render:function(){var e=$(this.el);return e.html(this.template({labelText:this.options.labelText,name:this.name})),this.$radio=e.find("input[type=button]"),this.rendered=!0,this},setDisabled:function(e){e!==this.disabled&&(this.$radio.toggleClass("disabled",e),e?this.$radio.attr({disabled:e}):this.$radio.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},onItemCheck:function(e){this.disabled||this.setValue(!0)},setRawValue:function(e){var e=e===!0||e==="true"||e==="1"||e===1;$("input[type=button][name="+this.name+"]").removeClass("checked"),this.$radio.toggleClass("checked",e)},setValue:function(e,t){if(this.rendered){var n=this.$radio.hasClass("checked");this.setRawValue(e),t!==!0&&n!==e&&this.trigger("change",this,this.$radio.hasClass("checked"))}else this.options.checked=e},getValue:function(){return this.$radio.hasClass("checked")}})});if(Common===undefined)var Common={};var c_oHyperlinkType={InternalLink:0,WebLink:1};define("presentationeditor/main/app/view/HyperlinkSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/ComboBox","common/main/lib/component/RadioBox","common/main/lib/component/Window"],function(){"use strict";PE.Views.HyperlinkSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 230px;",cls:"modal-dlg",id:"window-hyperlink-settings"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<div class="box" style="height: 270px;">','<div class="input-row">','<label style="font-weight: bold;">'+this.textLinkType+"</label>","</div>",'<div id="id-dlg-hyperlink-type" class="input-row" style="margin-bottom: 5px;"></div>','<div id="id-external-link">','<div class="input-row">','<label style="font-weight: bold;">'+this.strLinkTo+" *</label>","</div>",'<div id="id-dlg-hyperlink-url" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div id="id-internal-link" class="hidden" style="margin-top: 15px;">','<div id="id-dlg-hyperlink-radio-next" style="display: block;margin-bottom: 5px;"></div>','<div id="id-dlg-hyperlink-radio-prev" style="display: block;margin-bottom: 5px;"></div>','<div id="id-dlg-hyperlink-radio-first" style="display: block;margin-bottom: 5px;"></div>','<div id="id-dlg-hyperlink-radio-last" style="display: block;margin-bottom: 5px;"></div>','<div id="id-dlg-hyperlink-radio-slide" style="display: inline-block;margin-bottom: 5px;margin-right: 10px;"></div>','<div id="id-dlg-hyperlink-slide" style="display: inline-block;margin-bottom: 10px;"></div>',"</div>",'<div class="input-row">','<label style="font-weight: bold;">'+this.strDisplay+"</label>","</div>",'<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">','<label style="font-weight: bold;">'+this.textTipText+"</label>","</div>",'<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),this.slides=this.options.slides,this.api=this.options.api,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,t=this.getChild();e._arrTypeSrc=[{displayValue:e.textInternalLink,value:c_oHyperlinkType.InternalLink},{displayValue:e.textExternalLink,value:c_oHyperlinkType.WebLink}],e.cmbLinkType=new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-type"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 318px;",editable:!1,data:this._arrTypeSrc}),e.cmbLinkType.setValue(e._arrTypeSrc[1].value),e.cmbLinkType.on("selected",_.bind(function(e,t){this.ShowHideElem(t.value)},e)),e.inputUrl=new Common.UI.InputField({el:$("#id-dlg-hyperlink-url"),allowBlank:!1,blankError:e.txtEmpty,validateOnBlur:!1,style:"width: 100%;",validation:function(t){var n=e.api.asc_getUrlType($.trim(t));return e.isEmail=n==2,n>0?!0:e.txtNotUrl}}),e.inputDisplay=(new Common.UI.InputField({el:$("#id-dlg-hyperlink-display"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isTextChanged=!0}),e.inputTip=new Common.UI.InputField({el:$("#id-dlg-hyperlink-tip"),style:"width: 100%;",maxLength:Asc.c_oAscMaxTooltipLength}),e.radioNext=new Common.UI.RadioBox({el:$("#id-dlg-hyperlink-radio-next"),labelText:this.txtNext,name:"asc-radio-slide",checked:!0}),e.radioPrev=new Common.UI.RadioBox({el:$("#id-dlg-hyperlink-radio-prev"),labelText:this.txtPrev,name:"asc-radio-slide"}),e.radioFirst=new Common.UI.RadioBox({el:$("#id-dlg-hyperlink-radio-first"),labelText:this.txtFirst,name:"asc-radio-slide"}),e.radioLast=new Common.UI.RadioBox({el:$("#id-dlg-hyperlink-radio-last"),labelText:this.txtLast,name:"asc-radio-slide"}),e.radioSlide=new Common.UI.RadioBox({el:$("#id-dlg-hyperlink-radio-slide"),labelText:this.txtSlide,name:"asc-radio-slide"}),e.cmbSlides=new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-slide"),cls:"input-group-nr",style:"width: 50px;",menuStyle:"min-width: 50px; max-height: 200px;",editable:!1,data:this.slides}),e.cmbSlides.setValue(0),e.cmbSlides.on("selected",_.bind(function(t,n){e.radioSlide.setValue(!0)},e)),t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this)),e.externalPanel=t.find("#id-external-link"),e.internalPanel=t.find("#id-internal-link")},setSettings:function(e){if(e){var t=this,n=t.parseUrl(e.get_Value());t.cmbLinkType.setValue(n),t.ShowHideElem(n),e.get_Text()!==null?(t.inputDisplay.setValue(e.get_Text()),t.inputDisplay.setDisabled(!1)):(this.inputDisplay.setValue(this.textDefault),this.inputDisplay.setDisabled(!0)),this.isTextChanged=!1,this.inputTip.setValue(e.get_ToolTip()),n==c_oHyperlinkType.WebLink&&t.inputUrl.cmpEl.find("input").focus()}},getSettings:function(){var e=this,t=new Asc.CHyperlinkProperty,n="";if(e.cmbLinkType.getValue()==c_oHyperlinkType.InternalLink){var r="ppaction://hlink",i="",s=e.inputTip.getValue();this.radioSlide.getValue()?(r=r+"sldjumpslide"+this.cmbSlides.getValue(),i=this.txtSlide+" "+(this.cmbSlides.getValue()+1)):this.radioFirst.getValue()?(r+="showjump?jump=firstslide",i=this.txtFirst):this.radioLast.getValue()?(r+="showjump?jump=lastslide",i=this.txtLast):this.radioNext.getValue()?(r+="showjump?jump=nextslide",i=this.txtNext):this.radioPrev.getValue()&&(r+="showjump?jump=previousslide",i=this.txtPrev),t.put_Value(r),t.put_ToolTip(_.isEmpty(s)?i:s),n=i}else{var r=$.trim(e.inputUrl.getValue());/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(r)||(r=(e.isEmail?"mailto:":"http://")+r),r=r.replace(new RegExp("%20","g")," "),t.put_Value(r),t.put_ToolTip(e.inputTip.getValue()),n=r}return!e.inputDisplay.isDisabled()&&(e.isTextChanged||_.isEmpty(e.inputDisplay.getValue()))?(_.isEmpty(e.inputDisplay.getValue())&&e.inputDisplay.setValue(n),t.put_Text(e.inputDisplay.getValue())):t.put_Text(null),t},onBtnClick:function(e){e.currentTarget&&e.currentTarget.attributes.result&&this._handleInput(e.currentTarget.attributes.result.value)},onKeyPress:function(e){if(e.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(e){if(this.options.handler){if(e=="ok"){var t=this.cmbLinkType.getValue()==c_oHyperlinkType.WebLink?this.inputUrl.checkValidate():!0,n=this.inputDisplay.checkValidate();if(t!==!0){this.inputUrl.cmpEl.find("input").focus();return}if(n!==!0){this.inputDisplay.cmpEl.find("input").focus();return}}this.options.handler.call(this,this,e)}this.close()},ShowHideElem:function(e){this.externalPanel.toggleClass("hidden",e!==c_oHyperlinkType.WebLink),this.internalPanel.toggleClass("hidden",e!==c_oHyperlinkType.InternalLink)},parseUrl:function(e){if(e===null||e===undefined||e=="")return c_oHyperlinkType.WebLink;var t=e.indexOf("ppaction://hlink");if(0==t){if(e=="ppaction://hlinkshowjump?jump=firstslide")this.radioFirst.setValue(!0);else if(e=="ppaction://hlinkshowjump?jump=lastslide")this.radioLast.setValue(!0);else if(e=="ppaction://hlinkshowjump?jump=nextslide")this.radioNext.setValue(!0);else if(e=="ppaction://hlinkshowjump?jump=previousslide")this.radioPrev.setValue(!0);else{this.radioSlide.setValue(!0);var n="ppaction://hlinksldjumpslide",r=e.indexOf(n);if(0==r){var i=parseInt(e.substring(n.length));i>=0&&i<this.slides.length&&this.cmbSlides.setValue(i)}}return c_oHyperlinkType.InternalLink}return this.inputUrl.setValue(e?e.replace(new RegExp(" ","g"),"%20"):""),c_oHyperlinkType.WebLink},textTitle:"Hyperlink Settings",textInternalLink:"Place In This Document",textExternalLink:"File or Web Page",textEmptyLink:"Enter link here",textEmptyDesc:"Enter caption here",textEmptyTooltip:"Enter tooltip here",txtSlide:"Slide",textLinkType:"Link Type",strDisplay:"Display",textTipText:"Screen Tip Text",strLinkTo:"Link To",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"',strPlaceInDocument:"Select a Place in This Document",cancelButtonText:"Cancel",okButtonText:"Ok",txtNext:"Next Slide",txtPrev:"Previous Slide",txtFirst:"First Slide",txtLast:"Last Slide",textDefault:"Selected text"},PE.Views.HyperlinkSettingsDialog||{}))}),define("text!presentationeditor/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>\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 colspan=2 class="padding-large" width="50%">\r\n <div id="paragraphadv-spin-spacing"></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>'}),define("common/main/lib/view/AdvancedSettingsWindow",["common/main/lib/component/Window"],function(){"use strict";Common.Views.AdvancedSettingsWindow=Common.UI.Window.extend(_.extend({initialize:function(e){var t={};_.extend(t,{height:200,header:!0,cls:"advanced-settings-dlg",toggleGroup:"advanced-settings-group",contentTemplate:"",items:[]},e),this.template=e.template||['<div class="box" style="height:'+(t.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" >'+t.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(""),t.tpl=_.template(this.template,t),this.handler=t.handler,this.toggleGroup=t.toggleGroup,this.contentWidth=t.contentWidth,this.storageName=t.storageName,Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this)),this.btnsCategory=[],_.each(t.find(".btn-category"),function(t,n){var r=$(t),i=new Common.UI.Button({el:r,enableToggle:!0,toggleGroup:e.toggleGroup,allowDepress:!1,contentTarget:r.attr("content-target")});i.on("click",_.bind(e.onCategoryClick,e)),e.btnsCategory.push(i)});var n=t.find(".content-panel");n.width(this.contentWidth),t.width(t.find(".menu-panel").width()+n.outerWidth()+2),this.content_panels=t.find(".settings-panel"),this.btnsCategory.length>0&&this.btnsCategory[0].toggle(!0,!0)},setHeight:function(e){Common.UI.Window.prototype.setHeight.call(this,e);var t=this.getChild(),n=t.find(".body > .box");n.css("height",e-85)},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;if(this.handler&&this.handler.call(this,t,t=="ok"?this.getSettings():undefined))return;this.close()},onCategoryClick:function(e,t){this.content_panels.filter(".active").removeClass("active"),$("#"+e.options.contentTarget).addClass("active")},getSettings:function(){return},onPrimary:function(){if(this.handler&&this.handler.call(this,"ok",this.getSettings()))return;return this.close(),!1},setActiveCategory:function(e){if(this.btnsCategory.length<1)return;var t=this.btnsCategory[e>=0&&e<this.btnsCategory.length?e:0];if(!t.isVisible()||t.isDisabled())for(var n=0;n<this.btnsCategory.length;n++){var r=this.btnsCategory[n];if(r.isVisible()&&!r.isDisabled()){t=r;break}}t.toggle(!0),this.onCategoryClick(t)},getActiveCategory:function(){var e=-1;return this.btnsCategory.forEach(function(t,n){t.pressed&&(e=n)}),e},close:function(e){this.storageName&&Common.localStorage.setItem(this.storageName,this.getActiveCategory()),Common.UI.Window.prototype.close.call(this,e)},cancelButtonText:"Cancel",okButtonText:"Ok"},Common.Views.AdvancedSettingsWindow||{}))});if(Common===undefined)var Common={};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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);n.addClass("spinner"),n.on("mousedown",".spinner-up",_.bind(this.onMouseDown,this,!0)),n.on("mousedown",".spinner-down",_.bind(this.onMouseDown,this,!1)),n.on("mouseup",".spinner-up",_.bind(this.onMouseUp,this,!0)),n.on("mouseup",".spinner-down",_.bind(this.onMouseUp,this,!1)),n.on("mouseover",".spinner-up, .spinner-down",_.bind(this.onMouseOver,this)),n.on("mouseout",".spinner-up, .spinner-down",_.bind(this.onMouseOut,this)),n.on("keydown",".form-control",_.bind(this.onKeyDown,this)),n.on("keyup",".form-control",_.bind(this.onKeyUp,this)),n.on("blur",".form-control",_.bind(this.onBlur,this)),n.on("input",".form-control",_.bind(this.onInput,this)),this.options.allowDecimal||n.on("keypress",".form-control",_.bind(this.onKeyPress,this)),this.switches={count:1,enabled:!0,fromKeyDown:!1},this.options.speed==="medium"?this.switches.speed=300:this.options.speed==="fast"?this.switches.speed=100:this.switches.speed=500,this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.value!==undefined&&(this.value=this.options.value),this.setRawValue(this.value),this.options.width&&$(this.el).width(this.options.width),this.options.defaultValue===undefined&&(this.options.defaultValue=this.options.minValue),this.oldValue=this.options.minValue,this.lastValue=null},render:function(){var e=$(this.el);return e.html(this.template),this.$input=e.find(".form-control"),this.rendered=!0,this.options.tabindex!=undefined&&this.$input.attr("tabindex",this.options.tabindex),this},setDisabled:function(e){var t=$(this.el);e!==this.disabled&&(t.find("button").toggleClass("disabled",e),t.toggleClass("disabled",e),e?this.$input.attr({disabled:e}):this.$input.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},setDefaultUnit:function(e){if(this.options.defaultUnit!=e){var t=this.options.defaultUnit;this.options.defaultUnit=e,this.setMinValue(this._recalcUnits(this.options.minValue,t)),this.setMaxValue(this._recalcUnits(this.options.maxValue,t)),this.setValue(this._recalcUnits(this.getNumberValue(),t),!0)}},setMinValue:function(e){this.options.minValue=e},setMaxValue:function(e){this.options.maxValue=e},setStep:function(e){this.options.step=e},getNumberValue:function(){return this.options.allowAuto&&this.value==this.options.autoText?-1:parseFloat(this.value)},getUnitValue:function(){return this.options.defaultUnit},getValue:function(){return this.value},setRawValue:function(e){this.$input&&this.$input.val(e)},getRawValue:function(){return this.$input.val()},setValue:function(e,t){var n=!1;this._fromKeyDown=!1,this.lastValue=this.value;if(typeof e=="undefined"||e==="")this.value="";else if(this.options.allowAuto&&(Math.abs(parseFloat(e)+1)<1e-4||e==this.options.autoText))this.value=this.options.autoText;else{var r=this._add(parseFloat(e),0,this.options.allowDecimal?3:0);if(typeof e=="undefined"||isNaN(r))r=this.oldValue,n=!0;var i=this.options.defaultUnit;if(typeof e.match!="undefined"){var s=e.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i);null!==s&&s[0]!=="undefined"&&(i=s[0].toLowerCase())}this.options.defaultUnit!==i&&!n&&(r=this._recalcUnits(r,i)),r>this.options.maxValue&&(r=this.options.maxValue,n=!0),r<this.options.minValue&&(r=this.options.minValue,n=!0),this.value=(r+" "+this.options.defaultUnit).trim(),this.oldValue=r}t!==!0&&this.lastValue!==this.value&&this.trigger("change",this,this.value,this.lastValue),t!==!0&&n&&this.trigger("inputerror",this,this.value),this.rendered?this.setRawValue(this.value):this.options.value=this.value},setMask:function(e){this.options.maskExp=e},onMouseDown:function(e,t){if(this.disabled)return;t&&$(t.currentTarget).addClass("active"),this.options.hold&&(this.switches.fromKeyDown=!1,this._startSpin(e,t))},onMouseUp:function(e,t){if(this.disabled)return;$(t.currentTarget).removeClass("active"),this.options.hold?this._stopSpin():this._step(e)},onMouseOver:function(e){if(this.disabled)return;$(e.currentTarget).addClass("over")},onMouseOut:function(e){if(this.disabled)return;$(e.currentTarget).removeClass("active over"),this.options.hold&&this._stopSpin()},onKeyDown:function(e){if(this.disabled)return;if(!this.options.hold||e.keyCode!=Common.UI.Keys.UP&&e.keyCode!=Common.UI.Keys.DOWN)if(e.keyCode==Common.UI.Keys.RETURN)if(this.options.defaultUnit&&this.options.defaultUnit.length){var t=this.getRawValue();if(this.value!=t)return this.onEnterValue(),this.value==t}else this.onEnterValue();else this._fromKeyDown=!0;else e.preventDefault(),e.stopPropagation(),this.switches.timeout===undefined&&(this.switches.fromKeyDown=!0,this._startSpin(e.keyCode==Common.UI.Keys.UP,e))},onKeyUp:function(e){if(this.disabled)return;if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN)e.stopPropagation(),e.preventDefault(),this.options.hold?this._stopSpin():this._step(e.keyCode==Common.UI.Keys.UP)},onKeyPress:function(e){if(this.disabled)return;var t=String.fromCharCode(e.charCode);t=="."||t==","?(e.preventDefault(),e.stopPropagation()):this.options.maskExp&&!this.options.maskExp.test(t)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.RETURN&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB&&(e.preventDefault(),e.stopPropagation())},onInput:function(e,t){if(this.disabled||e.isDefaultPrevented())return;this.trigger("changing",this,$(e.target).val(),e)},onEnterValue:function(){if(this.$input){var e=this.getRawValue();this.setValue(e===""?this.value:e),this.trigger("entervalue",this)}},onBlur:function(e){if(this.$input){var t=this.getRawValue();this.setValue(t===""?this.value:t),this.options.hold&&this.switches.fromKeyDown&&this._stopSpin()}},_startSpin:function(e,t){if(!this.disabled){var n=this.switches.count;n===1?(this._step(e,!0),n=1):n<3?n=1.5:n<8?n=2.5:n=6,this.switches.timeout=setTimeout($.proxy(function(){this._step(e,!0),this._startSpin(e)},this),this.switches.speed/n),this.switches.count++}},_stopSpin:function(e){this.switches.timeout!==undefined&&(clearTimeout(this.switches.timeout),this.switches.timeout=undefined,this.switches.count=1,this.trigger("change",this,this.value,this.lastValue))},_increase:function(e){var t=this;if(!t.readOnly){var n=t.options.step;t._fromKeyDown?(n=this.getRawValue(),n=_.isEmpty(n)?t.oldValue:parseFloat(n)):t.getValue()!==""?(t.options.allowAuto&&t.getValue()==t.options.autoText?n=t.options.minValue-t.options.step:n=parseFloat(t.getValue()),isNaN(n)&&(n=this.oldValue)):n=t.options.defaultValue,t.setValue((this._add(n,t.options.step,t.options.allowDecimal?3:0)+" "+this.options.defaultUnit).trim(),e)}},_decrease:function(e){var t=this;if(!t.readOnly){var n=t.options.step;if(t._fromKeyDown)n=this.getRawValue(),n=_.isEmpty(n)?t.oldValue:parseFloat(n);else if(t.getValue()!==""){t.options.allowAuto&&t.getValue()==t.options.autoText?n=t.options.minValue:n=parseFloat(t.getValue()),isNaN(n)&&(n=this.oldValue);if(t.options.allowAuto&&this._add(n,-t.options.step,t.options.allowDecimal?3:0)<t.options.minValue){t.setValue(t.options.autoText,!0);return}}else n=t.options.defaultValue;t.setValue((this._add(n,-t.options.step,t.options.allowDecimal?3:0)+" "+this.options.defaultUnit).trim(),e)}},_step:function(e,t){e?this._increase(t):this._decrease(t)},_add:function(e,t,n){var r=Math.pow(10,n||this.options.allowDecimal?2:0);return(Math.round(e*r)+Math.round(t*r))/r},_recalcUnits:function(e,t){if(t.match(/(s|ms|сек|мс)$/i)&&this.options.defaultUnit.match(/(s|ms|сек|мс)$/i)){var n=e;if(t=="ms"||t=="мс")n/=1e3;if(this.options.defaultUnit=="ms"||this.options.defaultUnit=="мс")n*=1e3;return n}if(t.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)===null||this.options.defaultUnit.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)===null)return e;var n=e;return t=="cm"||t=="см"?n*=10:t=="pt"||t=="пт"?n=n*25.4/72:t=='"'?n*=25.4:t=="pc"&&(n=n*25.4/6),this.options.defaultUnit=="cm"||this.options.defaultUnit=="см"?n/=10:this.options.defaultUnit=="pt"||this.options.defaultUnit=="пт"?n=parseFloat((n*72/25.4).toFixed(3)):this.options.defaultUnit=='"'?n=parseFloat((n/25.4).toFixed(3)):this.options.defaultUnit=="pc"&&(n=n*6/25.4),n}}),Common.UI.CustomSpinner=Common.UI.MetricSpinner.extend(_.extend({initialize:function(e){this.options.toCustomFormat=e.toCustomFormat?e.toCustomFormat:function(e){return e},this.options.fromCustomFormat=e.fromCustomFormat?e.fromCustomFormat:function(e){return e},Common.UI.MetricSpinner.prototype.initialize.call(this,e)},setRawValue:function(e){this.$input&&this.$input.val(this.options.toCustomFormat(e))},getRawValue:function(){return this.options.fromCustomFormat(this.$input.val())}},Common.UI.CustomSpinner||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/CheckBox",["common/main/lib/component/BaseView","underscore"],function(e,t){"use strict";Common.UI.CheckBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,indeterminate:!1,checked:!1,value:"unchecked",template:t.template('<label class="checkbox-indeterminate"><input type="button" class="img-commonctrl"><span><%= labelText %></span></label>'),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var n=this,r=$(this.el);this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.value!==undefined&&this.setValue(this.options.value,!0),this.$chk.on("click",t.bind(this.onItemCheck,this))},render:function(){var e=$(this.el);return e.html(this.template({labelText:this.options.labelText})),this.$chk=e.find("input[type=button]"),this.$label=e.find("label"),this.rendered=!0,this},setDisabled:function(e){e=e===!0,e!==this.disabled&&(this.$label.toggleClass("disabled",e),e?this.$chk.attr({disabled:e}):this.$chk.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},onItemCheck:function(e){this.disabled||(this.indeterminate?(this.indeterminate=!1,this.setValue(!1)):this.setValue(!this.checked))},setRawValue:function(e){this.checked=e===!0||e==="true"||e==="1"||e===1||e==="checked",this.indeterminate=e==="indeterminate",this.$chk.toggleClass("checked",this.checked),this.$chk.toggleClass("indeterminate",this.indeterminate),this.value=this.indeterminate?"indeterminate":this.checked?"checked":"unchecked"},setValue:function(e,t){this.rendered?(this.lastValue=this.value,this.setRawValue(e),t!==!0&&this.lastValue!==e&&this.trigger("change",this,this.value,this.lastValue)):this.options.value=e},getValue:function(){return this.value},isChecked:function(){return this.checked},setCaption:function(e){this.$label.find("span").text(e)}})});if(Common===undefined)var Common={};define("common/main/lib/component/DataView",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.DataViewGroupModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),caption:"",inline:!1,headername:undefined}}}),Common.UI.DataViewGroupStore=Backbone.Collection.extend({model:Common.UI.DataViewGroupModel}),Common.UI.DataViewModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),selected:!1,allowSelected:!0,value:null,disabled:!1}}}),Common.UI.DataViewStore=Backbone.Collection.extend({model:Common.UI.DataViewModel}),Common.UI.DataViewItem=Common.UI.BaseView.extend({options:{},template:_.template(['<div id="<%= id %>"><%= value %></div>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.template=t.options.template||t.template,t.listenTo(t.model,"change",t.render),t.listenTo(t.model,"change:selected",t.onSelectChange),t.listenTo(t.model,"remove",t.remove)},render:function(){if(_.isUndefined(this.model.id))return this;var e=$(this.el);return e.html(this.template(this.model.toJSON())),e.addClass("item"),e.toggleClass("selected",this.model.get("selected")&&this.model.get("allowSelected")),e.off("click").on("click",_.bind(this.onClick,this)),e.off("dblclick").on("dblclick",_.bind(this.onDblClick,this)),e.off("contextmenu").on("contextmenu",_.bind(this.onContextMenu,this)),e.toggleClass("disabled",this.model.get("disabled")),_.isUndefined(this.model.get("cls"))||e.addClass(this.model.get("cls")),this.trigger("change",this,this.model),this},remove:function(){this.stopListening(this.model),this.trigger("remove",this,this.model),Common.UI.BaseView.prototype.remove.call(this)},onClick:function(e){if(this.model.get("disabled"))return!1;this.trigger("click",this,this.model,e)},onDblClick:function(e){if(this.model.get("disabled"))return!1;this.trigger("dblclick",this,this.model,e)},onContextMenu:function(e){this.trigger("contextmenu",this,this.model,e)},onSelectChange:function(e,t){this.trigger("select",this,e,t)}}),Common.UI.DataView=Common.UI.BaseView.extend({options:{multiSelect:!1,handleSelect:!0,enableKeyEvents:!0,keyMoveDirection:"both",restoreHeight:0,emptyText:"",listenStoreEvents:!0,allowScrollbar:!0,showLast:!0,useBSKeydown:!1},template:_.template(['<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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.template=t.options.template||t.template,t.store=t.options.store||new Common.UI.DataViewStore,t.groups=t.options.groups||null,t.itemTemplate=t.options.itemTemplate||null,t.multiSelect=t.options.multiSelect,t.handleSelect=t.options.handleSelect,t.parentMenu=t.options.parentMenu,t.enableKeyEvents=t.options.enableKeyEvents,t.useBSKeydown=t.options.useBSKeydown,t.showLast=t.options.showLast,t.style=t.options.style||"",t.emptyText=t.options.emptyText||"",t.listenStoreEvents=t.options.listenStoreEvents!==undefined?t.options.listenStoreEvents:!0,t.allowScrollbar=t.options.allowScrollbar!==undefined?t.options.allowScrollbar:!0,t.rendered=!1,t.dataViewItems=[],t.options.keyMoveDirection=="vertical"?t.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN]:t.options.keyMoveDirection=="horizontal"?t.moveKeys=[Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT]:t.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN,Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT],t.options.el&&t.render()},render:function(e){var t=this;this.trigger("render:before",this),this.cmpEl=$(this.el),e?(this.setElement(e,!1),this.cmpEl=$(this.template({groups:t.groups?t.groups.toJSON():null,style:t.style})),e.html(this.cmpEl)):this.cmpEl.html(this.template({groups:t.groups?t.groups.toJSON():null,style:t.style})),this.rendered||(this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)),this.onResetItems(),this.parentMenu&&(this.cmpEl.closest("li").css("height","100%"),this.cmpEl.css("height","100%"),this.parentMenu.on("show:after",_.bind(this.alignPosition,this))),this.enableKeyEvents&&this.parentMenu&&this.handleSelect&&(t.showLast||this.parentMenu.on("show:before",function(e){t.deselectAll()}),this.parentMenu.on("show:after",function(e){t.showLast&&t.showLastSelected(),Common.NotificationCenter.trigger("dataview:focus"),_.delay(function(){e.cmpEl.find(".dataview").focus()},10)}).on("hide:after",function(){Common.NotificationCenter.trigger("dataview:blur")}))),_.isUndefined(this.scroller)&&this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10}));var n=this.cmpEl.closest(".asc-window");return n.length>0&&(this.tipZIndex=parseInt(n.css("z-index"))+10),this.rendered=!0,this.cmpEl.on("click",function(e){if(/dataview/.test(e.target.className))return!1}),this.trigger("render:after",this),this},setStore:function(e){e&&(this.stopListening(this.store),this.store=e,this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)))},selectRecord:function(e,t){if(!this.handleSelect)return;t&&this.suspendEvents(),this.multiSelect?e&&e.set({selected:!e.get("selected")}):(_.each(this.store.where({selected:!0}),function(e){e.set({selected:!1})}),e&&e.set({selected:!0})),t&&this.resumeEvents()},selectByIndex:function(e,t){this.store.length>0&&e>-1&&e<this.store.length&&this.selectRecord(this.store.at(e),t)},deselectAll:function(e){e&&this.suspendEvents(),_.each(this.store.where({selected:!0}),function(e){e.set({selected:!1})}),e&&this.resumeEvents()},getSelectedRec:function(){if(this.multiSelect){var e=[];return _.each(this.store.where({selected:!0}),function(t){e.push(t)}),e}return this.store.where({selected:!0})},onAddItem:function(e,t,n){var r=new Common.UI.DataViewItem({template:this.itemTemplate,model:e});if(r){var i=$(this.el).find(".inner").andSelf().filter(".inner");if(this.groups&&this.groups.length>0){var s=this.groups.findWhere({id:e.get("group")});s&&(i=i.find("#"+s.id+" "+".group-items-container"))}if(i){n&&n.at==0?i.prepend(r.render().el):i.append(r.render().el),i.find(".empty-text").remove(),this.dataViewItems.push(r);if(e.get("tip")){var o=$(r.el);o.attr("data-toggle","tooltip"),o.tooltip({title:e.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}this.listenTo(r,"change",this.onChangeItem),this.listenTo(r,"remove",this.onRemoveItem),this.listenTo(r,"click",this.onClickItem),this.listenTo(r,"dblclick",this.onDblClickItem),this.listenTo(r,"select",this.onSelectItem),this.listenTo(r,"contextmenu",this.onContextMenuItem),this.isSuspendEvents||this.trigger("item:add",this,r,e)}}},onResetItems:function(){_.each(this.dataViewItems,function(e){var t=e.$el.data("bs.tooltip");t&&t.tip().remove()},this),$(this.el).html(this.template({groups:this.groups?this.groups.toJSON():null,style:this.style})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.store.length<1&&this.emptyText.length>0&&$(this.el).find(".inner").andSelf().filter(".inner").append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>"),_.each(this.dataViewItems,function(e){this.stopListening(e),e.stopListening(e.model)},this),this.dataViewItems=[],this.store.each(this.onAddItem,this),this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10})),this.attachKeyEvents(),this.lastSelectedRec=null,this._layoutParams=undefined},onChangeItem:function(e,t){this.isSuspendEvents||this.trigger("item:change",this,e,t)},onRemoveItem:function(e,t){this.stopListening(e),e.stopListening();if(this.store.length<1&&this.emptyText.length>0){var n=$(this.el).find(".inner").andSelf().filter(".inner");n.find(".empty-text").length<=0&&n.append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>")}for(var r=0;r<this.dataViewItems.length;r++)if(_.isEqual(e,this.dataViewItems[r])){this.dataViewItems.splice(r,1);break}this.isSuspendEvents||this.trigger("item:remove",this,e,t)},onClickItem:function(e,t,n){if(this.disabled)return;window._event=n,this.showLast&&this.selectRecord(t),this.lastSelectedRec=null;var r=e.$el.data("bs.tooltip");r&&r.tip().remove(),this.isSuspendEvents||this.trigger("item:click",this,e,t,n)},onDblClickItem:function(e,t,n){if(this.disabled)return;window._event=n,this.selectRecord(t),this.lastSelectedRec=null,this.isSuspendEvents||this.trigger("item:dblclick",this,e,t,n)},onSelectItem:function(e,t,n){this.isSuspendEvents||this.trigger(n?"item:select":"item:deselect",this,e,t,this._fromKeyDown)},onContextMenuItem:function(e,t,n){this.isSuspendEvents||this.trigger("item:contextmenu",this,e,t,n)},scrollToRecord:function(e){var t=$(this.el).find(".inner"),n=t.offset().top,r=_.indexOf(this.store.models,e),i=r>=0&&this.dataViewItems.length>r?$(this.dataViewItems[r].el):t.find("#"+e.get("id"));if(i.length<=0)return;var s=i.offset().top;if(s<n||s+i.outerHeight()>n+t.height())this.scroller&&this.allowScrollbar?this.scroller.scrollTop(t.scrollTop()+s-n,0):t.scrollTop(t.scrollTop()+s-n)},onKeyDown:function(e,t){if(this.disabled)return;t===undefined&&(t=e);if(_.indexOf(this.moveKeys,t.keyCode)>-1||t.keyCode==Common.UI.Keys.RETURN){t.preventDefault(),t.stopPropagation();var n=this.getSelectedRec()[0];this.lastSelectedRec===null&&(this.lastSelectedRec=n);if(t.keyCode==Common.UI.Keys.RETURN)this.lastSelectedRec=null,this.selectedBeforeHideRec&&(n=this.selectedBeforeHideRec),this.trigger("item:click",this,this,n,e),this.trigger("item:select",this,this,n,e),this.trigger("entervalue",this,n,e),this.parentMenu&&this.parentMenu.hide();else{var r=_.indexOf(this.store.models,n);if(r<0)if(t.keyCode==Common.UI.Keys.LEFT){var i=$(e.target).closest(".dropdown-submenu.over");i.length>0?(i.removeClass("over"),i.find("> a").focus()):r=0}else r=0;else if(this.options.keyMoveDirection=="both"){this._layoutParams===undefined&&this.fillIndexesArray();var s=this.dataViewItems[r].topIdx,o=this.dataViewItems[r].leftIdx;r=undefined;if(t.keyCode==Common.UI.Keys.LEFT)while(r===undefined){o--;if(o<0){var i=$(e.target).closest(".dropdown-submenu.over");if(i.length>0){i.removeClass("over"),i.find("> a").focus();break}o=this._layoutParams.columns-1}r=this._layoutParams.itemsIndexes[s][o]}else if(t.keyCode==Common.UI.Keys.RIGHT)while(r===undefined)o++,o>this._layoutParams.columns-1&&(o=0),r=this._layoutParams.itemsIndexes[s][o];else if(t.keyCode==Common.UI.Keys.UP)while(r===undefined)s--,s<0&&(s=this._layoutParams.rows-1),r=this._layoutParams.itemsIndexes[s][o];else while(r===undefined)s++,s>this._layoutParams.rows-1&&(s=0),r=this._layoutParams.itemsIndexes[s][o]}else r=t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.LEFT?Math.max(0,r-1):Math.min(this.store.length-1,r+1);r!==undefined&&r>=0&&(n=this.store.at(r)),n&&(this._fromKeyDown=!0,this.selectRecord(n),this._fromKeyDown=!1,this.scrollToRecord(n))}}else this.trigger("item:keydown",this,n,e)},attachKeyEvents:function(){if(this.enableKeyEvents&&this.handleSelect){var e=$(this.el).find(".inner").andSelf().filter(".inner");e.addClass("canfocused"),e.attr("tabindex","0"),e.on(this.parentMenu&&this.useBSKeydown?"dataview:keydown":"keydown",_.bind(this.onKeyDown,this))}},showLastSelected:function(){if(this.lastSelectedRec)this.selectRecord(this.lastSelectedRec,!0),this.scrollToRecord(this.lastSelectedRec),this.lastSelectedRec=null;else{var e=this.getSelectedRec()[0];e&&this.scrollToRecord(e)}},setDisabled:function(e){this.disabled=e,$(this.el).find(".inner").andSelf().filter(".inner").toggleClass("disabled",e)},isDisabled:function(){return this.disabled},setEmptyText:function(e){this.emptyText=e},alignPosition:function(){var e=this.parentMenu.cmpEl.attr("role")==="menu"?this.parentMenu.cmpEl:this.parentMenu.cmpEl.find("[role=menu]"),t=$(this.el).find(".inner").andSelf().filter(".inner"),n=Common.Utils.innerHeight(),r=e.outerHeight(),i=parseInt(e.css("top"));r>n?(t.css("max-height",n-parseInt(e.css("padding-top"))-parseInt(e.css("padding-bottom"))-5+"px"),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40})):t.height()<this.options.restoreHeight&&(t.css("max-height",Math.min(n-parseInt(e.css("padding-top"))-parseInt(e.css("padding-bottom"))-5,this.options.restoreHeight)+"px"),r=e.outerHeight(),i+r>n&&e.css("top",0),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40}))},fillIndexesArray:function(){if(this.dataViewItems.length<=0)return;this._layoutParams={itemsIndexes:[],columns:0,rows:0};var e=$(this.dataViewItems[0].el),t=e.outerWidth()+parseInt(e.css("margin-left"))+parseInt(e.css("margin-right")),n=this.$el.offset().left,r=-1,i=0,s=0;for(var o=0;o<this.dataViewItems.length;o++){var u=$(this.dataViewItems[o].el).offset().top;s=Math.floor(($(this.dataViewItems[o].el).offset().left-n)/t),u>r&&(r=u,this._layoutParams.itemsIndexes.push([]),i=this._layoutParams.itemsIndexes.length-1),this._layoutParams.itemsIndexes[i][s]=o,this.dataViewItems[o].topIdx=i,this.dataViewItems[o].leftIdx=s,this._layoutParams.columns<s&&(this._layoutParams.columns=s)}this._layoutParams.rows=this._layoutParams.itemsIndexes.length,this._layoutParams.columns++},onResize:function(){this._layoutParams=undefined}}),$(document).on("keydown.dataview","[data-toggle=dropdown], [role=menu]",function(e){if(e.keyCode!==Common.UI.Keys.UP&&e.keyCode!==Common.UI.Keys.DOWN&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.RETURN)return;_.defer(function(){var t=$(e.target).closest(".dropdown-toggle");t.length?t.parent().find(".inner.canfocused").trigger("dataview:keydown",e):$(e.target).closest(".dropdown-submenu").find(".inner.canfocused").trigger("dataview:keydown",e)},100)})});if(Common===undefined)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(e,t){var n=new Common.UI.DataViewItem({template:this.itemTemplate,model:e});this.innerEl||(this.innerEl=$(this.el).find(".inner"),this.innerEl.find(".empty-text").remove());if(n&&this.innerEl){if(this.options.simpleAddMode)this.innerEl.append(n.render().el);else{var r=_.indexOf(this.store.models,e),i=this.innerEl.find("> div");r>0?$(i.get(r-1)).after(n.render().el):i.length>0?$(i[r]).before(n.render().el):this.innerEl.append(n.render().el)}this.dataViewItems.push(n),this.listenTo(n,"change",this.onChangeItem),this.listenTo(n,"remove",this.onRemoveItem),this.listenTo(n,"click",this.onClickItem),this.listenTo(n,"dblclick",this.onDblClickItem),this.listenTo(n,"select",this.onSelectItem),this.isSuspendEvents||this.trigger("item:add",this,n,e)}}}}())}),define("presentationeditor/main/app/view/ParagraphSettingsAdvanced",["text!presentationeditor/main/app/template/ParagraphSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(e){"use strict";PE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:320,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"pe-para-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-paragraph-indents",panelCaption:this.strParagraphIndents},{panelId:"id-adv-paragraph-font",panelCaption:this.strParagraphFont},{panelId:"id-adv-paragraph-tabs",panelCaption:this.strTabs}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.spinners=[],this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.numFirstLine=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-first-line"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numFirstLine.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.get_Ind()===null||this._changedProps.get_Ind()===undefined)&&this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_FirstLine(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numFirstLine),this.numIndentsLeft=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-left"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.numIndentsLeft.on("change",_.bind(function(e,t,n,r){var i=e.getNumberValue();this._changedProps&&((this._changedProps.get_Ind()===null||this._changedProps.get_Ind()===undefined)&&this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_Left(Common.Utils.Metric.fnRecalcToMM(i))),this.numFirstLine.setMinValue(-i),this.numFirstLine.getNumberValue()<-i&&this.numFirstLine.setValue(-i)},this)),this.spinners.push(this.numIndentsLeft),this.numIndentsRight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-right"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.numIndentsRight.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.get_Ind()===null||this._changedProps.get_Ind()===undefined)&&this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_Right(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.chStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-strike"),labelText:this.strStrike}),this.chStrike.on("change",_.bind(this.onStrikeChange,this)),this.chDoubleStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-double-strike"),labelText:this.strDoubleStrike}),this.chDoubleStrike.on("change",_.bind(this.onDoubleStrikeChange,this)),this.chSuperscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-superscript"),labelText:this.strSuperscript}),this.chSuperscript.on("change",_.bind(this.onSuperscriptChange,this)),this.chSubscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-subscript"),labelText:this.strSubscript}),this.chSubscript.on("change",_.bind(this.onSubscriptChange,this)),this.chSmallCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-small-caps"),labelText:this.strSmallCaps}),this.chSmallCaps.on("change",_.bind(this.onSmallCapsChange,this)),this.chAllCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-all-caps"),labelText:this.strAllCaps}),this.chAllCaps.on("change",_.bind(this.onAllCapsChange,this)),this.numSpacing=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing"),step:.01,width:100,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numSpacing.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()));if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},this)),this.spinners.push(this.numSpacing),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:180,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numTab),this.numDefaultTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-default-tab"),step:.1,width:107,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.put_DefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()).toFixed(1)))},this)),this.spinners.push(this.numDefaultTab),this.tabList=new Common.UI.ListView({el:$("#paraadv-list-tabs"),emptyText:this.noTabs,store:new Common.UI.DataViewStore}),this.tabList.store.comparator=function(e){return e.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var t=function(){e._noApply||(e._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",t),this.listenTo(this.tabList.store,"remove",t),this.listenTo(this.tabList.store,"reset",t),this.radioLeft=new Common.UI.RadioBox({el:$("#paragraphadv-radio-left"),labelText:this.textTabLeft,name:"asc-radio-tab",checked:!0}),this.radioCenter=new Common.UI.RadioBox({el:$("#paragraphadv-radio-center"),labelText:this.textTabCenter,name:"asc-radio-tab"}),this.radioRight=new Common.UI.RadioBox({el:$("#paragraphadv-radio-right"),labelText:this.textTabRight,name:"asc-radio-tab"}),this.btnAddTab=new Common.UI.Button({el:$("#paraadv-button-add-tab")}),this.btnAddTab.on("click",_.bind(this.addTab,this)),this.btnRemoveTab=new Common.UI.Button({el:$("#paraadv-button-remove-tab")}),this.btnRemoveTab.on("click",_.bind(this.removeTab,this)),this.btnRemoveAll=new Common.UI.Button({el:$("#paraadv-button-remove-all")}),this.btnRemoveAll.on("click",_.bind(this.removeAllTabs,this)),this.afterRender()},getSettings:function(){return this._tabListChanged&&((this._changedProps.get_Tabs()===null||this._changedProps.get_Tabs()===undefined)&&this._changedProps.put_Tabs(new Asc.asc_CParagraphTabs),this.tabList.store.each(function(e,t){var n=new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(e.get("tabPos")),e.get("tabAlign"));this._changedProps.get_Tabs().add_Tab(n)},this)),{paragraphProps:this._changedProps}},_setDefaults:function(e){if(e){this._originalProps=new Asc.asc_CParagraphProperty(e),this.numIndentsLeft.setValue(e.get_Ind()!==null&&e.get_Ind().get_Left()!==null?Common.Utils.Metric.fnRecalcFromMM(e.get_Ind().get_Left()):"",!0),this.numFirstLine.setMinValue(-this.numIndentsLeft.getNumberValue()),this.numFirstLine.setValue(e.get_Ind()!==null&&e.get_Ind().get_FirstLine()!==null?Common.Utils.Metric.fnRecalcFromMM(e.get_Ind().get_FirstLine()):"",!0),this.numIndentsRight.setValue(e.get_Ind()!==null&&e.get_Ind().get_Right()!==null?Common.Utils.Metric.fnRecalcFromMM(e.get_Ind().get_Right()):"",!0),this._noApply=!0,this.chStrike.setValue(e.get_Strikeout()!==null&&e.get_Strikeout()!==undefined?e.get_Strikeout():"indeterminate",!0),this.chDoubleStrike.setValue(e.get_DStrikeout()!==null&&e.get_DStrikeout()!==undefined?e.get_DStrikeout():"indeterminate",!0),this.chSubscript.setValue(e.get_Subscript()!==null&&e.get_Subscript()!==undefined?e.get_Subscript():"indeterminate",!0),this.chSuperscript.setValue(e.get_Superscript()!==null&&e.get_Superscript()!==undefined?e.get_Superscript():"indeterminate",!0),this.chSmallCaps.setValue(e.get_SmallCaps()!==null&&e.get_SmallCaps()!==undefined?e.get_SmallCaps():"indeterminate",!0),this.chAllCaps.setValue(e.get_AllCaps()!==null&&e.get_AllCaps()!==undefined?e.get_AllCaps():"indeterminate",!0),this.numSpacing.setValue(e.get_TextSpacing()!==null&&e.get_TextSpacing()!==undefined?Common.Utils.Metric.fnRecalcFromMM(e.get_TextSpacing()):"",!0),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(e.get_DefaultTab()!==null&&e.get_DefaultTab()!==undefined?Common.Utils.Metric.fnRecalcFromMM(parseFloat(e.get_DefaultTab().toFixed(1))):"",!0);var t=this.tabList.store,n=e.get_Tabs();if(n){var r=[],i=n.get_Count();for(var s=0;s<i;s++){var o=n.get_Tab(s),u=Common.Utils.Metric.fnRecalcFromMM(parseFloat(o.get_Pos().toFixed(1))),a=new Common.UI.DataViewModel;a.set({tabPos:u,value:parseFloat(u.toFixed(3))+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:o.get_Value()}),r.push(a)}t.reset(r,{silent:!1}),this.tabList.selectByIndex(0)}this._noApply=!1,this._changedProps=new Asc.asc_CParagraphProperty}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.el.id=="paragraphadv-spin-spacing"?t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01):t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},afterRender:function(){this.updateMetricUnit(),this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},onStrikeChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=1&&this._changedProps.put_Strikeout(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=1,this.chDoubleStrike.setValue(0),this._changedProps&&this._changedProps.put_DStrikeout(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_Strikeout(e.getValue()=="checked"),i.put_DStrikeout(this.chDoubleStrike.getValue()=="checked"),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onDoubleStrikeChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=1&&this._changedProps.put_DStrikeout(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=1,this.chStrike.setValue(0),this._changedProps&&this._changedProps.put_Strikeout(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_DStrikeout(e.getValue()=="checked"),i.put_Strikeout(this.chStrike.getValue()=="checked"),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onSuperscriptChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=2&&this._changedProps.put_Superscript(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=2,this.chSubscript.setValue(0),this._changedProps&&this._changedProps.put_Subscript(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_Superscript(e.getValue()=="checked"),i.put_Subscript(this.chSubscript.getValue()=="checked"),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onSubscriptChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=2&&this._changedProps.put_Subscript(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=2,this.chSuperscript.setValue(0),this._changedProps&&this._changedProps.put_Superscript(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_Subscript(e.getValue()=="checked"),i.put_Superscript(this.chSuperscript.getValue()=="checked"),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onSmallCapsChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=3&&this._changedProps.put_SmallCaps(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=3,this.chAllCaps.setValue(0),this._changedProps&&this._changedProps.put_AllCaps(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_SmallCaps(e.getValue()=="checked"),i.put_AllCaps(this.chAllCaps.getValue()=="checked"),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onAllCapsChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=3&&this._changedProps.put_AllCaps(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=3,this.chSmallCaps.setValue(0),this._changedProps&&this._changedProps.put_SmallCaps(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.put_AllCaps(e.getValue()=="checked"),i.put_SmallCaps(this.chSmallCaps.getValue()=="checked"),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",i)}},addTab:function(e,t){var n=this.numTab.getNumberValue(),r=this.radioLeft.getValue()?1:this.radioCenter.getValue()?3:2,i=this.tabList.store,s=i.find(function(e){return Math.abs(e.get("tabPos")-n)<.001});s?s.set("tabAlign",r):(s=new Common.UI.DataViewModel,s.set({tabPos:n,value:n+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:r}),i.add(s)),this.tabList.selectRecord(s),this.tabList.scrollToRecord(s)},removeTab:function(e,t){var n=this.tabList.getSelectedRec();if(n.length>0){var r=this.tabList.store,i=_.indexOf(r.models,n[0]);r.remove(n[0]),i>r.length-1&&(i=r.length-1),r.length>0&&(this.tabList.selectByIndex(i),this.tabList.scrollToRecord(r.at(i)))}},removeAllTabs:function(e,t){this.tabList.store.reset()},onSelectTab:function(e,t,n){var r={},i=_.isFunction(n.toJSON);if(i){if(!n.get("selected"))return;r=n.toJSON()}else r=n;this.numTab.setValue(r.tabPos),r.tabAlign==1?this.radioLeft.setValue(!0):r.tabAlign==3?this.radioCenter.setValue(!0):this.radioRight.setValue(!0)},textTitle:"Paragraph - Advanced Settings",strIndentsFirstLine:"First line",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Placement",strParagraphFont:"Font",cancelButtonText:"Cancel",okButtonText:"Ok",textEffects:"Effects",textCharacterSpacing:"Character Spacing",strDoubleStrike:"Double strikethrough",strStrike:"Strikethrough",strSuperscript:"Superscript",strSubscript:"Subscript",strSmallCaps:"Small caps",strAllCaps:"All caps",strTabs:"Tab",textSet:"Specify",textRemove:"Remove",textRemoveAll:"Remove All",textTabLeft:"Left",textTabRight:"Right",textTabCenter:"Center",textAlign:"Alignment",textTabPosition:"Tab Position",textDefault:"Default Tab",noTabs:"The specified tabs will appear in this field"},PE.Views.ParagraphSettingsAdvanced||{}))}),define("text!presentationeditor/main/app/template/ShapeSettingsAdvanced.template",[],function(){return'<div id="id-adv-shape-width" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td width="108px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="shape-advanced-spin-width"></div>\r\n </td>\r\n <td width="28px" style="vertical-align: bottom;">\r\n <div id="shape-advanced-button-ratio"></div>\r\n </td>\r\n <td width="108px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="shape-advanced-spin-height"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-shape" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textLineStyle %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="125px">\r\n <label class="input-label"><%= scope.textCapType %></label>\r\n <div id="shape-advanced-cap-type" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textJoinType %></label>\r\n <div id="shape-advanced-join-type" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textArrows %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textBeginStyle %></label>\r\n <div id="shape-advanced-begin-style" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textEndStyle %></label>\r\n <div id="shape-advanced-end-style" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBeginSize %></label>\r\n <div id="shape-advanced-begin-size" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textEndSize %></label>\r\n <div id="shape-advanced-end-size" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-margins" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="shape-margin-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="shape-margin-left"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBottom %></label>\r\n <div id="shape-margin-bottom"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="shape-margin-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-alttext" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="1" width="100%">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textAltTitle %></label>\r\n <div id="shape-advanced-alt-title"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textAltDescription %></label>\r\n <textarea id="shape-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("presentationeditor/main/app/view/ShapeSettingsAdvanced",["text!presentationeditor/main/app/template/ShapeSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner"],function(e){"use strict";PE.Views.ShapeSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"shape-adv-settings-group",sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},properties:null,storageName:"pe-shape-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-shape-width",panelCaption:this.textSize},{panelId:"id-adv-shape-shape",panelCaption:this.textWeightArrows},{panelId:"id-adv-shape-margins",panelCaption:this.strMargins},{panelId:"id-adv-shape-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this.Margins=undefined,this._nRatio=1,this._originalProps=this.options.shapeProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnWidth.on("change",_.bind(function(e,t,n,r){if(this.btnRatio.pressed){var i=e.getNumberValue(),s=i/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,i=s*this._nRatio,this.spnWidth.setValue(i,!0)),this.spnHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(e.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:$("#shape-advanced-spin-height"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(e,t,n,r){var i=e.getNumberValue(),s=null;this.btnRatio.pressed&&(s=i*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,i=s/this._nRatio,this.spnHeight.setValue(i,!0)),this.spnWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.spinners.push(this.spnHeight),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render($("#shape-advanced-button-ratio")),this.btnRatio.on("click",_.bind(function(e,t){e.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect(e.pressed)},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#shape-margin-top"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginTop.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.get_paddings()===null||this._changedProps.get_paddings()===undefined)&&this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Top(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#shape-margin-bottom"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginBottom.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.get_paddings()===null||this._changedProps.get_paddings()===undefined)&&this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Bottom(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#shape-margin-left"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginLeft.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.get_paddings()===null||this._changedProps.get_paddings()===undefined)&&this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Left(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#shape-margin-right"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginRight.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.get_paddings()===null||this._changedProps.get_paddings()===undefined)&&this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Right(Common.Utils.Metric.fnRecalcToMM(e.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(e,t){this._changedProps&&(this._changedProps.get_stroke()===null&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linecap(t.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(e,t){this._changedProps&&(this._changedProps.get_stroke()===null&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linejoin(t.value))},this));var t=[],n=[];for(var r=0;r<6;r++)t.push({value:r,offsetx:80*r+10,offsety:0});t[0].type=Asc.c_oAscLineBeginType.None,t[1].type=Asc.c_oAscLineBeginType.Triangle,t[2].type=Asc.c_oAscLineBeginType.Arrow,t[3].type=Asc.c_oAscLineBeginType.Stealth,t[4].type=Asc.c_oAscLineBeginType.Diamond,t[5].type=Asc.c_oAscLineBeginType.Oval;for(r=0;r<9;r++)n.push({value:r,offsetx:90,offsety:20*(r+1)});n[0].type=Asc.c_oAscLineBeginSize.small_small,n[1].type=Asc.c_oAscLineBeginSize.small_mid,n[2].type=Asc.c_oAscLineBeginSize.small_large,n[3].type=Asc.c_oAscLineBeginSize.mid_small,n[4].type=Asc.c_oAscLineBeginSize.mid_mid,n[5].type=Asc.c_oAscLineBeginSize.mid_large,n[6].type=Asc.c_oAscLineBeginSize.large_small,n[7].type=Asc.c_oAscLineBeginSize.large_mid,n[8].type=Asc.c_oAscLineBeginSize.large_large,this.btnBeginStyle=new Common.UI.ComboBox({el:$("#shape-advanced-begin-style"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnBeginStyleMenu=(new Common.UI.Menu({style:"min-width: 105px;",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(t),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuBeginStylePicker.on("item:click",_.bind(this.onSelectBeginStyle,this)),this._selectStyleItem(this.btnBeginStyle,null),this.btnBeginSize=new Common.UI.ComboBox({el:$("#shape-advanced-begin-size"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnBeginSizeMenu=(new Common.UI.Menu({style:"min-width: 160px;",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(n),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuBeginSizePicker.on("item:click",_.bind(this.onSelectBeginSize,this)),this._selectStyleItem(this.btnBeginSize,null);for(r=0;r<t.length;r++)t[r].offsety+=200;for(r=0;r<n.length;r++)n[r].offsety+=200;this.btnEndStyle=new Common.UI.ComboBox({el:$("#shape-advanced-end-style"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnEndStyleMenu=(new Common.UI.Menu({style:"min-width: 105px;",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(t),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndStylePicker.on("item:click",_.bind(this.onSelectEndStyle,this)),this._selectStyleItem(this.btnEndStyle,null),this.btnEndSize=new Common.UI.ComboBox({el:$("#shape-advanced-end-size"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnEndSizeMenu=(new Common.UI.Menu({style:"min-width: 160px;",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(n),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndSizePicker.on("item:click",_.bind(this.onSelectEndSize,this)),this._selectStyleItem(this.btnEndSize,null),this.inputAltTitle=(new Common.UI.InputField({el:$("#shape-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this.updateMetricUnit(),this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e){this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(e.get_Width()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.get_Height()).toFixed(2),!0),e.get_Height()>0&&(this._nRatio=e.get_Width()/e.get_Height());var t=e.asc_getLockAspect();this.btnRatio.toggle(t),this._setShapeDefaults(e);var n=e.get_paddings();if(n){var r=n.get_Left();this.spnMarginLeft.setValue(null!==r&&undefined!==r?Common.Utils.Metric.fnRecalcFromMM(r):"",!0),r=n.get_Top(),this.spnMarginTop.setValue(null!==r&&undefined!==r?Common.Utils.Metric.fnRecalcFromMM(r):"",!0),r=n.get_Right(),this.spnMarginRight.setValue(null!==r&&undefined!==r?Common.Utils.Metric.fnRecalcFromMM(r):"",!0),r=n.get_Bottom(),this.spnMarginBottom.setValue(null!==r&&undefined!==r?Common.Utils.Metric.fnRecalcFromMM(r):"",!0)}this.btnsCategory[2].setDisabled(null===n),t=e.asc_getTitle(),this.inputAltTitle.setValue(t?t:""),t=e.asc_getDescription(),this.textareaAltDescription.val(t?t:""),this._changedProps=new Asc.asc_CShapeProperty}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),Common.localStorage.setItem("pe-settings-shaperatio",this.btnRatio.pressed?1:0),{shapeProps:this._changedProps}},_setShapeDefaults:function(e){if(e){var t=e.get_stroke();if(t){var n=t.get_linejoin();for(var r=0;r<this._arrJoinType.length;r++)if(n==this._arrJoinType[r].value){this.cmbJoinType.setValue(n);break}n=t.get_linecap();for(r=0;r<this._arrCapType.length;r++)if(n==this._arrCapType[r].value){this.cmbCapType.setValue(n);break}var i=t.get_canChangeArrows();this.btnBeginStyle.setDisabled(!i),this.btnEndStyle.setDisabled(!i),this.btnBeginSize.setDisabled(!i),this.btnEndSize.setDisabled(!i);if(i){n=t.get_linebeginsize();var s=this.mnuBeginSizePicker.store.findWhere({type:n});s?this._beginSizeIdx=s.get("value"):(this._beginSizeIdx=null,this._selectStyleItem(this.btnBeginSize,null)),n=t.get_linebeginstyle(),s=this.mnuBeginStylePicker.store.findWhere({type:n}),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),n=t.get_lineendsize(),s=this.mnuEndSizePicker.store.findWhere({type:n}),s?this._endSizeIdx=s.get("value"):(this._endSizeIdx=null,this._selectStyleItem(this.btnEndSize,null)),n=t.get_lineendstyle(),s=this.mnuEndStylePicker.store.findWhere({type:n}),s?(this.mnuEndStylePicker.selectRecord(s,!0),this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,s,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,s)):this._selectStyleItem(this.btnEndStyle,null)}else this._selectStyleItem(this.btnBeginStyle),this._selectStyleItem(this.btnEndStyle),this._selectStyleItem(this.btnBeginSize),this._selectStyleItem(this.btnEndSize)}}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01)}this.sizeMax={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.width*10),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.height*10)},this.options.sizeOriginal&&(this.sizeOriginal={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.width),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.height)})},_updateSizeArr:function(e,t,n,r){n.get("value")>0?(t.store.each(function(e){e.set({offsetx:n.get("value")*80+10})},this),e.setDisabled(!1),r!==null?(t.selectByIndex(r,!0),this._selectStyleItem(e,t.store.at(r))):this._selectStyleItem(e,null)):(this._selectStyleItem(e,null),e.setDisabled(!0))},_selectStyleItem:function(e,t){var n=$(e.el).find(".form-control");n.css("background-position",(t?-t.get("offsetx")+20+"px":"0")+" "+(t?"-"+t.get("offsety")+"px":"-30px"))},onSelectBeginStyle:function(e,t,n){this._changedProps&&(this._changedProps.get_stroke()===null&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linebeginstyle(n.get("type")));if(this._beginSizeIdx===null||this._beginSizeIdx===undefined)this._beginSizeIdx=4;this._updateSizeArr(this.btnBeginSize,this.mnuBeginSizePicker,n,this._beginSizeIdx),this._selectStyleItem(this.btnBeginStyle,n)},onSelectBeginSize:function(e,t,n){this._changedProps&&(this._changedProps.get_stroke()===null&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linebeginsize(n.get("type"))),this._beginSizeIdx=n.get("value"),this._selectStyleItem(this.btnBeginSize,n)},onSelectEndStyle:function(e,t,n){this._changedProps&&(this._changedProps.get_stroke()===null&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_lineendstyle(n.get("type")));if(this._endSizeIdx===null||this._endSizeIdx===undefined)this._endSizeIdx=4;this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,n,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,n)},onSelectEndSize:function(e,t,n){this._changedProps&&(this._changedProps.get_stroke()===null&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_lineendsize(n.get("type"))),this._endSizeIdx=n.get("value"),this._selectStyleItem(this.btnEndSize,n)},textRound:"Round",textMiter:"Miter",textSquare:"Square",textFlat:"Flat",textBevel:"Bevel",textTitle:"Shape - Advanced Settings",cancelButtonText:"Cancel",okButtonText:"Ok",txtNone:"None",textWeightArrows:"Weights & Arrows",textArrows:"Arrows",textLineStyle:"Line Style",textCapType:"Cap Type",textJoinType:"Join Type",textBeginStyle:"Begin Style",textBeginSize:"Begin Size",textEndStyle:"End Style",textEndSize:"End Size",textSize:"Size",textWidth:"Width",textHeight:"Height",textKeepRatio:"Constant Proportions",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",strMargins:"Text Padding",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."},PE.Views.ShapeSettingsAdvanced||{}))}),define("text!presentationeditor/main/app/template/TableSettingsAdvanced.template",[],function(){return'<div id="id-adv-table-cell-props" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.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">\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-small">\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-small">\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>\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="tableadv-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="tableadv-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("presentationeditor/main/app/view/TableSettingsAdvanced",["text!presentationeditor/main/app/template/TableSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner"],function(e){"use strict";PE.Views.TableSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"TableSettingsAdvanced",contentWidth:280,height:385,storageName:"pe-table-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-table-cell-props",panelCaption:this.textWidthSpaces},{panelId:"id-adv-table-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._changedProps=null,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._initialMarginsDefault=!1,this._originalProps=new Asc.CTableProp(this.options.tableProps)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this._marginsChange=function(e,t,n,r,i,s){i=="table"?this.TableMargins[s]=e.getNumberValue():this.CellMargins[s]=e.getNumberValue()},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(e,t,n,r){this._marginsChange(e,t,n,r,"table","Top"),this._changedProps&&(this._changedProps.get_DefaultMargins()===undefined&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Top(this.TableMargins.Top!==null?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(e,t,n,r){this._marginsChange(e,t,n,r,"table","Bottom"),this._changedProps&&(this._changedProps.get_DefaultMargins()===undefined&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Bottom(this.TableMargins.Bottom!==null?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(e,t,n,r){this._marginsChange(e,t,n,r,"table","Left"),this._changedProps&&(this._changedProps.get_DefaultMargins()===undefined&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Left(this.TableMargins.Left!==null?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(e,t,n,r){this._marginsChange(e,t,n,r,"table","Right"),this._changedProps&&(this._changedProps.get_DefaultMargins()===undefined&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Right(this.TableMargins.Right!==null?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Right):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginRight);var t=function(){e.CellMargins.Flag=="indeterminate"?e._changedProps.get_CellMargins().put_Flag(1):e.CellMargins.Flag=="checked"?e._changedProps.get_CellMargins().put_Flag(0):e._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(e,n,r,i){r=="checked"&&this._originalProps&&this._originalProps.get_CellMargins().get_Flag()==1&&e.setValue("indeterminate",!0),this.fillMargins.call(this,e.getValue()),this.CellMargins.Flag=e.getValue(),this._changedProps&&(this._changedProps.get_CellMargins()===undefined&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Left(this.CellMargins.Left!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left):null),this._changedProps.get_CellMargins().put_Top(this.CellMargins.Top!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top):null),this._changedProps.get_CellMargins().put_Bottom(this.CellMargins.Bottom!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom):null),this._changedProps.get_CellMargins().put_Right(this.CellMargins.Right!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right):null),t())},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(e,n,r,i){this._marginsChange(e,n,r,i,"cell","Top"),this._changedProps&&(this._changedProps.get_CellMargins()===undefined&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Top(this.CellMargins.Top!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top):null),t())},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(e,n,r,i){this._marginsChange(e,n,r,i,"cell","Bottom"),this._changedProps&&(this._changedProps.get_CellMargins()===undefined&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Bottom(this.CellMargins.Bottom!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom):null),t())},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(e,n,r,i){this._marginsChange(e,n,r,i,"cell","Left"),this._changedProps&&(this._changedProps.get_CellMargins()===undefined&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Left(this.CellMargins.Left!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left):null),t())},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(e,n,r,i){this._marginsChange(e,n,r,i,"cell","Right"),this._changedProps&&(this._changedProps.get_CellMargins()===undefined&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Right(this.CellMargins.Right!==null?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right):null),t())},this)),this.spinners.push(this.spnMarginRight),this.inputAltTitle=(new Common.UI.InputField({el:$("#tableadv-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this.updateMetricUnit(),this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.put_TableCaption(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.put_TableDescription(this.textareaAltDescription.val()),{tableProps:this._changedProps}},_setDefaults:function(e){if(e){this._allTable=!e.get_CellSelect();var t=e.get_DefaultMargins();t&&(this.TableMargins={Left:t.get_Left()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Left()):null,Right:t.get_Right()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Right()):null,Top:t.get_Top()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Top()):null,Bottom:t.get_Bottom()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Bottom()):null}),t=e.get_CellMargins();var n=undefined;t&&(this.CellMargins={Left:t.get_Left()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Left()):null,Right:t.get_Right()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Right()):null,Top:t.get_Top()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Top()):null,Bottom:t.get_Bottom()!==null?Common.Utils.Metric.fnRecalcFromMM(t.get_Bottom()):null},n=t.get_Flag(),this.CellMargins.Flag=n==1?"indeterminate":n==0?"checked":"unchecked",this.chCellMargins.setValue(this.CellMargins.Flag,!0)),n===0&&(this.CellMargins.Left===null&&(this.CellMargins.Left=this.TableMargins.Left),this.CellMargins.Top===null&&(this.CellMargins.Top=this.TableMargins.Top),this.CellMargins.Right===null&&(this.CellMargins.Right=this.TableMargins.Right),this.CellMargins.Bottom===null&&(this.CellMargins.Bottom=this.TableMargins.Bottom)),this.fillMargins(this.CellMargins.Flag);var r=e.get_TableCaption();this.inputAltTitle.setValue(r?r:""),r=e.get_TableDescription(),this.textareaAltDescription.val(r?r:""),this._changedProps=new Asc.CTableProp}},fillMargins:function(e){this._initialMarginsDefault&&e=="unchecked"&&(this.CellMargins.Left===null&&(this.CellMargins.Left=0),this.CellMargins.Top===null&&(this.CellMargins.Top=0),this.CellMargins.Right===null&&(this.CellMargins.Right=0),this.CellMargins.Bottom===null&&(this.CellMargins.Bottom=0)),this.spnMarginLeft.setValue(this.CellMargins.Left!==null?this.CellMargins.Left:"",!0),this.spnMarginTop.setValue(this.CellMargins.Top!==null?this.CellMargins.Top:"",!0),this.spnMarginRight.setValue(this.CellMargins.Right!==null?this.CellMargins.Right:"",!0),this.spnMarginBottom.setValue(this.CellMargins.Bottom!==null?this.CellMargins.Bottom:"",!0);var t=e=="checked";this.spnMarginTop.setDisabled(t),this.spnMarginBottom.setDisabled(t),this.spnMarginLeft.setDisabled(t),this.spnMarginRight.setDisabled(t),this.spnTableMarginLeft.setValue(this.TableMargins.Left!==null?this.TableMargins.Left:"",!0),this.spnTableMarginTop.setValue(this.TableMargins.Top!==null?this.TableMargins.Top:"",!0),this.spnTableMarginRight.setValue(this.TableMargins.Right!==null?this.TableMargins.Right:"",!0),this.spnTableMarginBottom.setValue(this.TableMargins.Bottom!==null?this.TableMargins.Bottom:"",!0)},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},textWidthSpaces:"Margins",textMargins:"Cell Margins",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",textTitle:"Table - Advanced Settings",textDefaultMargins:"Default Margins",textCheckMargins:"Use default margins",cancelButtonText:"Cancel",okButtonText:"Ok",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},PE.Views.TableSettingsAdvanced||{}))}),define("presentationeditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/util/utils","common/main/lib/component/Menu","common/main/lib/view/CopyWarningDialog","presentationeditor/main/app/view/HyperlinkSettingsDialog","presentationeditor/main/app/view/ParagraphSettingsAdvanced","presentationeditor/main/app/view/ShapeSettingsAdvanced","presentationeditor/main/app/view/TableSettingsAdvanced"],function(e,t,n,r){"use strict";PE.Views.DocumentHolder=n.View.extend(t.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var n=this;n.usertips=[],n._TtHeight=20,n.slidesCount=0,n.fastcoauthtips=[],n._currentMathObj=undefined,n._currentParaObjDisabled=!1;var r=PE.getCollection("Common.Collections.Users"),i=function(r,i,s,o,u){if(!t.isUndefined(r)&&r!==null){Common.UI.Menu.Manager.hideAll();var a=[s.get_X(),s.get_Y()],f=e(n.el).find(Common.Utils.String.format("#menu-container-{0}",r.id));s.get_Type()==Asc.c_oAscContextMenuTypes.Thumbnails&&(a[0]-=3,a[1]-=3),r.rendered||(f.length<1&&(f=e(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',r.id)),e(n.el).append(f)),r.render(f),r.cmpEl.attr({tabindex:"-1"})),f.css({left:a[0],top:a[1]}),r.show(),t.isFunction(r.options.initMenu)&&(r.options.initMenu(i),r.alignPosition()),t.delay(function(){r.cmpEl.focus()},10),n.currentMenu=r}},s=function(e){if(!e||!t.isArray(e))return;var r={},i=null;return t.each(e,function(e,s){var o=e.get_ObjectType(),u=e.get_ObjectValue();Asc.c_oAscTypeSelectElement.Image==o?(i=n.pictureMenu,r.imgProps={},r.imgProps.value=u,r.imgProps.locked=u?u.get_Locked():!1):Asc.c_oAscTypeSelectElement.Table==o?(i=n.tableMenu,r.tableProps={},r.tableProps.value=u,r.tableProps.locked=u?u.get_Locked():!1):Asc.c_oAscTypeSelectElement.Hyperlink==o?(r.hyperProps={},r.hyperProps.value=u):Asc.c_oAscTypeSelectElement.Shape==o?(i=n.pictureMenu,r.shapeProps={},r.shapeProps.value=u,r.shapeProps.locked=u?u.get_Locked():!1,u.get_FromChart()&&(r.shapeProps.isChart=!0)):Asc.c_oAscTypeSelectElement.Chart==o?(i=n.pictureMenu,r.chartProps={},r.chartProps.value=u,r.chartProps.locked=u?u.get_Locked():!1):Asc.c_oAscTypeSelectElement.Slide==o?(r.slideProps={},r.slideProps.value=u,r.slideProps.locked=u?u.get_LockDelete():!1):Asc.c_oAscTypeSelectElement.Paragraph==o?(r.paraProps={},r.paraProps.value=u,r.paraProps.locked=u?u.get_Locked():!1,(r.shapeProps&&r.shapeProps.value||r.chartProps&&r.chartProps.value)&&t.isUndefined(r.tableProps)&&(i=n.textMenu)):Asc.c_oAscTypeSelectElement.Math==o&&(r.mathProps={},r.mathProps.value=u,n._currentMathObj=u)}),i===null&&(t.isUndefined(r.paraProps)?t.isUndefined(r.slideProps)||(i=n.slideMenu):i=n.textMenu),{menu_to_show:i,menu_props:r}},o=function(e,t,r){if(n.api&&n.mode.isEdit){var o=s(n.api.getSelectedElements());o&&i(o.menu_to_show,o.menu_props,e,t,r)}},u=function(e){t.delay(function(){e.get_Type()==Asc.c_oAscContextMenuTypes.Thumbnails?i.call(n,n.slideMenu,{isSlideSelect:e.get_IsSlideSelect(),fromThumbs:!0},e):o.call(n,e)},10)},a=function(e){if(n.mode.isEdit&&n.currentMenu&&n.currentMenu.isVisible())if(n.api.asc_getCurrentFocusObject()===0)n.slideMenu===n.currentMenu&&(n.currentMenu.options.initMenu({isSlideSelect:n.slideMenu.items[2].isVisible(),fromThumbs:!0}),n.currentMenu.alignPosition());else{var t=s(e);t&&t.menu_to_show===n.currentMenu&&(n.currentMenu.options.initMenu(t.menu_props),n.currentMenu.alignPosition())}},f=function(e){if(n.api){var r=t.isUndefined(e.originalEvent)?e.wheelDelta:e.originalEvent.wheelDelta;t.isUndefined(r)&&(r=e.deltaY),(e.ctrlKey||e.metaKey)&&!e.altKey&&(r<0?n.api.zoomOut():r>0&&n.api.zoomIn(),e.preventDefault(),e.stopPropagation())}},l=function(t){if(n.api){var r=t.keyCode;if((t.ctrlKey||t.metaKey)&&!t.shiftKey&&!t.altKey){if(r===Common.UI.Keys.NUM_PLUS||r===Common.UI.Keys.EQUALITY||Common.Utils.isOpera&&r==43)return n.api.zoomIn(),t.preventDefault(),t.stopPropagation(),!1;if(r===Common.UI.Keys.NUM_MINUS||r===Common.UI.Keys.MINUS||Common.Utils.isOpera&&r==45)return n.api.zoomOut(),t.preventDefault(),t.stopPropagation(),!1}n.currentMenu&&n.currentMenu.isVisible()&&(r==Common.UI.Keys.UP||r==Common.UI.Keys.DOWN)&&e("ul.dropdown-menu",n.currentMenu.el).focus()}},c=function(){n._Height=n.cmpEl.height(),n._Width=n.cmpEl.width(),n._BodyWidth=e("body").width(),n.slideNumDiv&&(n.slideNumDiv.remove(),n.slideNumDiv=undefined)},h=function(t){var r=n.cmpEl;if(r){r.on("contextmenu",function(e){return e.preventDefault(),e.stopPropagation(),!1}),r.on("click",function(e){e.target.localName=="canvas"&&r.focus()}),r.on("mousedown",function(e){e.target.localName=="canvas"&&Common.UI.Menu.Manager.hideAll()});var i=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";i(n.el,s,f)}e(document).on("mousewheel",f),e(document).on("keydown",l),e(window).on("resize",c);var o=PE.getController("Viewport").getView("Viewport");o.hlayout.on("layout:resizedrag",c)},p=function(e){if(r){var t=r.findUser(e);if(t)return t.get("username")}return n.guestText},d={toolTip:new Common.UI.Tooltip({owner:this,html:!0,title:"<br><b>Press Ctrl and click link</b>"}),strTip:"",isHidden:!0,isVisible:!1},v=!0,m=function(e,t,r){v===!0&&(v=new Common.UI.Tooltip({owner:e.currentTarget,title:n.tipIsLocked}),v.show())},g=function(){if(typeof v=="object"){v.hide(),v=undefined;for(var e=0;e<n.usertips.length;e++)n.usertips[e].off("mouseover",m),n.usertips[e].off("mouseout",y)}},y=function(e,t,n){typeof v=="object"&&v.$element&&e.currentTarget===v.$element[0]&&g()};Common.NotificationCenter.on({"window:show":function(e){d.toolTip.hide(),d.isVisible=!1,g()},"modal:show":function(e){n.hideTips()},"layout:changed":function(e){d.toolTip.hide(),d.isVisible=!1,g(),n.hideTips(),c()}});var b=function(e){e&&n.api.asc_getUrlType(e)>0&&window.open(e)},w=function(){d.isHidden=!0,n.usertips.length>0&&(typeof v=="object"&&(v.hide(),v=!0),t.each(n.usertips,function(e){e.remove()})),n.usertips=[],n.usertipcount=0},E=function(){d.isHidden&&d.isVisible&&(d.isVisible=!1,d.toolTip.hide())},S=function(r){t.isUndefined(n._XY)&&(n._XY=[n.cmpEl.offset().left-e(window).scrollLeft(),n.cmpEl.offset().top-e(window).scrollTop()],n._Width=n.cmpEl.width(),n._Height=n.cmpEl.height(),n._BodyWidth=e("body").width());if(r){var i,s;if(r.get_Type()==1){var o=r.get_Hyperlink(),u=!1;if(o){d.isHidden=!1,s=t.isEmpty(o.get_ToolTip())?o.get_Value():o.get_ToolTip(),s=Common.Utils.String.htmlEncode(s);if(d.tipLength!==s.length||d.strTip.indexOf(s)<0)d.toolTip.setTitle(s+"<br><b>"+n.txtPressLink+"</b>"),d.tipLength=s.length,d.strTip=s,u=!0;i=[r.get_X(),r.get_Y()],i[1]+=n._XY[1]-15,i[0]+=n._XY[0]+5;if(!d.isVisible||u)d.isVisible=!0,d.toolTip.show([-1e4,-1e4]);u&&(d.tipHeight=d.toolTip.getBSTip().$tip.height(),d.tipWidth=d.toolTip.getBSTip().$tip.width()),i[1]-=d.tipHeight,i[0]+d.tipWidth>n._BodyWidth&&(i[0]=n._BodyWidth-d.tipWidth),d.toolTip.getBSTip().$tip.css({top:i[1]+"px",left:i[0]+"px"})}}else if(r.get_Type()==2&&n.mode.isEdit){var a;n.usertipcount>=n.usertips.length&&(a=e(document.createElement("div")),a.addClass("username-tip"),a.css({height:n._TtHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),e(document.body).append(a),v&&(a.on("mouseover",m),a.on("mouseout",y)),n.usertips.push(a)),a=n.usertips[n.usertipcount],n.usertipcount++,s=p(r.get_UserId()),i=[r.get_X()+n._XY[0],r.get_Y()+n._XY[1]],i[0]=n._BodyWidth-i[0],i[1]-=r.get_LockedObjectType()==2?n._TtHeight:0,i[1]>n._XY[1]&&i[1]+n._TtHeight<n._XY[1]+n._Height&&(a.text(s),a.css({visibility:"visible",top:i[1]+"px",right:i[0]+"px"}))}}},x=function(t,r,i,s){var o;for(var u=0;u<n.fastcoauthtips.length;u++)if(n.fastcoauthtips[u].attr("userid")==t){o=n.fastcoauthtips[u];break}o||(o=e(document.createElement("div")),o.addClass("username-tip"),o.attr("userid",t),o.css({height:n._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())}),o.text(p(t)),e("#id_main_view").append(o),n.fastcoauthtips.push(o),o.fadeIn(150)),o.css({top:i-n._TtHeight+"px",left:r+"px"})},T=function(e){for(var t=0;t<n.fastcoauthtips.length;t++)if(n.fastcoauthtips[t].attr("userid")==e){var r=n.fastcoauthtips[t];n.fastcoauthtips[t].fadeOut(150,function(){r.remove()}),n.fastcoauthtips.splice(t,1);break}},N=function(){var e,r,i;if(n.api&&n.mode.isEdit){var s=function(e,t){t=="ok"&&(r=e.getSettings(),i!==!1?n.api.add_Hyperlink(r):n.api.change_Hyperlink(r)),n.fireEvent("editcomplete",n)};i=n.api.can_AddHyperlink();var o=[];for(var u=0;u<n.api.getCountPages();u++)o.push({displayValue:u+1,value:u});if(i!==!1)e=new PE.Views.HyperlinkSettingsDialog({api:n.api,handler:s,slides:o}),r=new Asc.CHyperlinkProperty,r.put_Text(i),e.show(),e.setSettings(r);else{var a=n.api.getSelectedElements();a&&t.isArray(a)&&t.each(a,function(e,t){a[t].get_ObjectType()==Asc.c_oAscTypeSelectElement.Hyperlink&&(r=a[t].get_ObjectValue())}),r&&(e=new PE.Views.HyperlinkSettingsDialog({api:n.api,handler:s,slides:o}),e.show(),e.setSettings(r))}}Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")},C=function(r){t.isUndefined(n._XY)&&(n._XY=[n.cmpEl.offset().left-e(window).scrollLeft(),n.cmpEl.offset().top-e(window).scrollTop()],n._Width=n.cmpEl.width(),n._Height=n.cmpEl.height(),n._BodyWidth=e("body").width()),t.isUndefined(n.slideNumDiv)&&(n.slideNumDiv=e(document.createElement("div")),n.slideNumDiv.addClass("slidenum-div"),n.slideNumDiv.css({position:"absolute",display:"block",zIndex:"900",top:n._XY[1]+n._Height/2+"px",right:n._BodyWidth-n._XY[0]-n._Width+22+"px"}),e(document.body).append(n.slideNumDiv)),n.slideNumDiv.html(n.txtSlide+" "+(r+1)),n.slideNumDiv.show()},k=function(){n.slideNumDiv&&n.slideNumDiv.hide()},L=function(){n.mode.isEdit=!1},A=function(e){if(n.mode.isEdit){var t=PE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");t&&e&&(t.setEditMode(!0),t.show(),t.setChartData(new Asc.asc_CChartBinary(e)))}};this.initEquationMenu=function(){if(!n._currentMathObj)return;var e=n._currentMathObj.get_Type(),t=n._currentMathObj,r,i=[];switch(e){case Asc.c_oAscMathInterfaceType.Accent:r=new Common.UI.MenuItem({caption:n.txtRemoveAccentChar,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"remove_AccentCharacter"}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.BorderBox:r=new Common.UI.MenuItem({caption:n.txtBorderProps,equation:!0,disabled:n._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.get_HideTop()?n.txtAddTop:n.txtHideTop,equationProps:{type:e,callback:"put_HideTop",value:!t.get_HideTop()}},{caption:t.get_HideBottom()?n.txtAddBottom:n.txtHideBottom,equationProps:{type:e,callback:"put_HideBottom",value:!t.get_HideBottom()}},{caption:t.get_HideLeft()?n.txtAddLeft:n.txtHideLeft,equationProps:{type:e,callback:"put_HideLeft",value:!t.get_HideLeft()}},{caption:t.get_HideRight()?n.txtAddRight:n.txtHideRight,equationProps:{type:e,callback:"put_HideRight",value:!t.get_HideRight()}},{caption:t.get_HideHor()?n.txtAddHor:n.txtHideHor,equationProps:{type:e,callback:"put_HideHor",value:!t.get_HideHor()}},{caption:t.get_HideVer()?n.txtAddVer:n.txtHideVer,equationProps:{type:e,callback:"put_HideVer",value:!t.get_HideVer()}},{caption:t.get_HideTopLTR()?n.txtAddLT:n.txtHideLT,equationProps:{type:e,callback:"put_HideTopLTR",value:!t.get_HideTopLTR()}},{caption:t.get_HideTopRTL()?n.txtAddLB:n.txtHideLB,equationProps:{type:e,callback:"put_HideTopRTL",value:!t.get_HideTopRTL()}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Bar:r=new Common.UI.MenuItem({caption:n.txtRemoveBar,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"remove_Bar"}}),i.push(r),r=new Common.UI.MenuItem({caption:t.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?n.txtUnderbar:n.txtOverbar,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:t.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Script:var s=t.get_ScriptType();if(s==Asc.c_oAscMathInterfaceScript.PreSubSup)r=new Common.UI.MenuItem({caption:n.txtScriptsAfter,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtRemScripts,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),i.push(r);else{s==Asc.c_oAscMathInterfaceScript.SubSup&&(r=new Common.UI.MenuItem({caption:n.txtScriptsBefore,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),i.push(r));if(s==Asc.c_oAscMathInterfaceScript.SubSup||s==Asc.c_oAscMathInterfaceScript.Sub)r=new Common.UI.MenuItem({caption:n.txtRemSubscript,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),i.push(r);if(s==Asc.c_oAscMathInterfaceScript.SubSup||s==Asc.c_oAscMathInterfaceScript.Sup)r=new Common.UI.MenuItem({caption:n.txtRemSuperscript,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),i.push(r)}break;case Asc.c_oAscMathInterfaceType.Fraction:var o=t.get_FractionType();if(o==Asc.c_oAscMathInterfaceFraction.Skewed||o==Asc.c_oAscMathInterfaceFraction.Linear)r=new Common.UI.MenuItem({caption:n.txtFractionStacked,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.Linear)r=new Common.UI.MenuItem({caption:n.txtFractionSkewed,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.Skewed)r=new Common.UI.MenuItem({caption:n.txtFractionLinear,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.NoBar)r=new Common.UI.MenuItem({caption:o==Asc.c_oAscMathInterfaceFraction.Bar?n.txtRemFractionBar:n.txtAddFractionBar,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_FractionType",value:o==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Limit:r=new Common.UI.MenuItem({caption:t.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?n.txtLimitUnder:n.txtLimitOver,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:t.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtRemLimit,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Matrix:r=new Common.UI.MenuItem({caption:t.get_HidePlaceholder()?n.txtShowPlaceholder:n.txtHidePlaceholder,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_HidePlaceholder",value:!t.get_HidePlaceholder()}}),i.push(r),r=new Common.UI.MenuItem({caption:n.insertText,equation:!0,disabled:n._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.insertRowAboveText,equationProps:{type:e,callback:"insert_MatrixRow",value:!0}},{caption:n.insertRowBelowText,equationProps:{type:e,callback:"insert_MatrixRow",value:!1}},{caption:n.insertColumnLeftText,equationProps:{type:e,callback:"insert_MatrixColumn",value:!0}},{caption:n.insertColumnRightText,equationProps:{type:e,callback:"insert_MatrixColumn",value:!1}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:n.deleteText,equation:!0,disabled:n._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.deleteRowText,equationProps:{type:e,callback:"delete_MatrixRow"}},{caption:n.deleteColumnText,equationProps:{type:e,callback:"delete_MatrixColumn"}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtMatrixAlign,equation:!0,disabled:n._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.txtTop,checkable:!0,checked:t.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top,equationProps:{type:e,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:n.centerText,checkable:!0,checked:t.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:e,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:n.txtBottom,checkable:!0,checked:t.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:e,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtColumnAlign,equation:!0,disabled:n._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.leftText,checkable:!0,checked:t.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left,equationProps:{type:e,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:n.centerText,checkable:!0,checked:t.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:e,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:n.rightText,checkable:!0,checked:t.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:e,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.EqArray:r=new Common.UI.MenuItem({caption:n.txtInsertEqBefore,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"insert_Equation",value:!0}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtInsertEqAfter,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"insert_Equation",value:!1}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtDeleteEq,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"delete_Equation"}}),i.push(r),r=new Common.UI.MenuItem({caption:n.alignmentText,equation:!0,disabled:n._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.txtTop,checkable:!0,checked:t.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top,equationProps:{type:e,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:n.centerText,checkable:!0,checked:t.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:e,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:n.txtBottom,checkable:!0,checked:t.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:e,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.LargeOperator:r=new Common.UI.MenuItem({caption:n.txtLimitChange,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_LimitLocation",value:t.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),i.push(r),t.get_HideUpper()!==undefined&&(r=new Common.UI.MenuItem({caption:t.get_HideUpper()?n.txtShowTopLimit:n.txtHideTopLimit,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideUpper",value:!t.get_HideUpper()}}),i.push(r)),t.get_HideLower()!==undefined&&(r=new Common.UI.MenuItem({caption:t.get_HideLower()?n.txtShowBottomLimit:n.txtHideBottomLimit,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideLower",value:!t.get_HideLower()}}),i.push(r));break;case Asc.c_oAscMathInterfaceType.Delimiter:r=new Common.UI.MenuItem({caption:n.txtInsertArgBefore,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"insert_DelimiterArgument",value:!0}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtInsertArgAfter,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"insert_DelimiterArgument",value:!1}}),i.push(r),t.can_DeleteArgument()&&(r=new Common.UI.MenuItem({caption:n.txtDeleteArg,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"delete_DelimiterArgument"}}),i.push(r)),r=new Common.UI.MenuItem({caption:t.has_Separators()?n.txtDeleteCharsAndSeparators:n.txtDeleteChars,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"remove_DelimiterCharacters"}}),i.push(r),r=new Common.UI.MenuItem({caption:t.get_HideOpeningBracket()?n.txtShowOpenBracket:n.txtHideOpenBracket,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideOpeningBracket",value:!t.get_HideOpeningBracket()}}),i.push(r),r=new Common.UI.MenuItem({caption:t.get_HideClosingBracket()?n.txtShowCloseBracket:n.txtHideCloseBracket,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideClosingBracket",value:!t.get_HideClosingBracket()}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtStretchBrackets,equation:!0,disabled:n._currentParaObjDisabled,checkable:!0,checked:t.get_StretchBrackets(),equationProps:{type:e,callback:"put_StretchBrackets",value:!t.get_StretchBrackets()}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtMatchBrackets,equation:!0,disabled:!t.get_StretchBrackets()||n._currentParaObjDisabled,checkable:!0,checked:t.get_StretchBrackets()&&t.get_MatchBrackets(),equationProps:{type:e,callback:"put_MatchBrackets",value:!t.get_MatchBrackets()}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.GroupChar:t.can_ChangePos()&&(r=new Common.UI.MenuItem({caption:t.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?n.txtGroupCharUnder:n.txtGroupCharOver,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:t.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),i.push(r),r=new Common.UI.MenuItem({caption:n.txtDeleteGroupChar,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),i.push(r));break;case Asc.c_oAscMathInterfaceType.Radical:t.get_HideDegree()!==undefined&&(r=new Common.UI.MenuItem({caption:t.get_HideDegree()?n.txtShowDegree:n.txtHideDegree,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"put_HideDegree",value:!t.get_HideDegree()}}),i.push(r)),r=new Common.UI.MenuItem({caption:n.txtDeleteRadical,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"remove_Radical"}}),i.push(r)}return t.can_IncreaseArgumentSize()&&(r=new Common.UI.MenuItem({caption:n.txtIncreaseArg,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"increase_ArgumentSize"}}),i.push(r)),t.can_DecreaseArgumentSize()&&(r=new Common.UI.MenuItem({caption:n.txtDecreaseArg,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"decrease_ArgumentSize"}}),i.push(r)),t.can_InsertManualBreak()&&(r=new Common.UI.MenuItem({caption:n.txtInsertBreak,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"insert_ManualBreak"}}),i.push(r)),t.can_DeleteManualBreak()&&(r=new Common.UI.MenuItem({caption:n.txtDeleteBreak,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"delete_ManualBreak"}}),i.push(r)),t.can_AlignToCharacter()&&(r=new Common.UI.MenuItem({caption:n.txtAlignToChar,equation:!0,disabled:n._currentParaObjDisabled,equationProps:{type:e,callback:"align_ToCharacter"}}),i.push(r)),i},this.addEquationMenu=function(e,r){t.isUndefined(e)&&(e=n.textMenu.isVisible()),n.clearEquationMenu(e,r);var i=e?n.textMenu:n.tableMenu,s=n.initEquationMenu();return s.length>0&&t.each(s,function(e,s){e.menu?t.each(e.menu.items,function(e){e.on("click",t.bind(n.equationCallback,n,e.options.equationProps))}):e.on("click",t.bind(n.equationCallback,n,e.options.equationProps)),i.insertItem(r,e),r++}),s.length},this.clearEquationMenu=function(e,r){var i=e?n.textMenu:n.tableMenu;for(var s=r;s<i.items.length;s++){if(!i.items[s].options.equation)break;i.items[s].menu?t.each(i.items[s].menu.items,function(e){e.off("click")}):i.items[s].off("click"),i.removeItem(i.items[s]),s--}},this.equationCallback=function(e){if(e){var t;switch(e.type){case Asc.c_oAscMathInterfaceType.Accent:t=new CMathMenuAccent;break;case Asc.c_oAscMathInterfaceType.BorderBox:t=new CMathMenuBorderBox;break;case Asc.c_oAscMathInterfaceType.Box:t=new CMathMenuBox;break;case Asc.c_oAscMathInterfaceType.Bar:t=new CMathMenuBar;break;case Asc.c_oAscMathInterfaceType.Script:t=new CMathMenuScript;break;case Asc.c_oAscMathInterfaceType.Fraction:t=new CMathMenuFraction;break;case Asc.c_oAscMathInterfaceType.Limit:t=new CMathMenuLimit;break;case Asc.c_oAscMathInterfaceType.Matrix:t=new CMathMenuMatrix;break;case Asc.c_oAscMathInterfaceType.EqArray:t=new CMathMenuEqArray;break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new CMathMenuNary;break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new CMathMenuDelimiter;break;case Asc.c_oAscMathInterfaceType.GroupChar:t=new CMathMenuGroupCharacter;break;case Asc.c_oAscMathInterfaceType.Radical:t=new CMathMenuRadical;break;case Asc.c_oAscMathInterfaceType.Common:t=new CMathMenuBase}t&&(t[e.callback](e.value),n.api.asc_SetMathProps(t))}n.fireEvent("editcomplete",n)},this.changePosition=function(){n._XY=[n.cmpEl.offset().left-e(window).scrollLeft(),n.cmpEl.offset().top-e(window).scrollTop()],w()},this.hideTips=function(){typeof v=="object"&&(v.hide(),v=!0),t.each(n.usertips,function(e){e.remove()}),n.usertips=[],n.usertipcount=0};var O={},M="alt+h";O[M]=function(){n.api.can_AddQuotedComment()!==!1&&n.slidesCount>0&&n.addComment()};var D="command+f5,ctrl+f5";O[D]=function(e){var t=!1;e.preventDefault(),e.stopPropagation();if(n.slidesCount>0){var r=PE.getController("Viewport").getView("DocumentPreview");if(r&&!r.isVisible()&&n.api){r.show();var i=function(){if(t)return;t=!0,Common.NotificationCenter.off("window:resize",i),n.api.StartDemonstration("presentation-preview",0)};!n.mode.isDesktopApp&&!Common.Utils.isIE11?(Common.NotificationCenter.on("window:resize",i),n.fullScreen(document.documentElement),setTimeout(function(){i()},100)):i()}}},Common.util.Shortcuts.delegateShortcuts({shortcuts:O});var P=function(e){n.slidesCount=e},H=function(e){n.currentMenu&&n.currentMenu.isVisible()&&n._isFromSlideMenu!==!0&&n._isFromSlideMenu!==e&&n.currentMenu.hide(),n._isFromSlideMenu=e};this.setApi=function(e){return n.api=e,n.api&&(n.api.asc_registerCallback("asc_onContextMenu",t.bind(u,n)),n.api.asc_registerCallback("asc_onMouseMoveStart",t.bind(w,n)),n.api.asc_registerCallback("asc_onMouseMoveEnd",t.bind(E,n)),n.api.asc_registerCallback("asc_onPaintSlideNum",t.bind(C,n)),n.api.asc_registerCallback("asc_onEndPaintSlideNum",t.bind(k,n)),n.api.asc_registerCallback("asc_onCountPages",t.bind(P,n)),n.api.asc_registerCallback("asc_onCurrentPage",t.bind(H,n)),n.slidesCount=n.api.getCountPages(),n.api.asc_registerCallback("asc_onHyperlinkClick",t.bind(b,n)),n.api.asc_registerCallback("asc_onMouseMove",t.bind(S,n)),n.mode.isEdit===!0&&(n.api.asc_registerCallback("asc_onDialogAddHyperlink",t.bind(N,n)),n.api.asc_registerCallback("asc_doubleClickOnChart",A)),n.api.asc_registerCallback("asc_onCoAuthoringDisconnect",t.bind(L,n)),Common.NotificationCenter.on("api:disconnect",t.bind(L,n)),n.api.asc_registerCallback("asc_onShowForeignCursorLabel",t.bind(x,n)),n.api.asc_registerCallback("asc_onHideForeignCursorLabel",t.bind(T,n)),n.api.asc_registerCallback("asc_onFocusObject",t.bind(a,n))),n},this.mode={},this.setMode=function(e){n.api&&e.isEdit&&(n.api.asc_registerCallback("asc_onDialogAddHyperlink",t.bind(N,n)),n.api.asc_registerCallback("asc_doubleClickOnChart",A)),n.mode=e,n.mode.canCoAuthoring&&n.mode.isEdit&&n.mode.canComments?Common.util.Shortcuts.resumeEvents(M):Common.util.Shortcuts.suspendEvents(M),n.editorConfig={user:e.user}},n.on("render:after",h,n)},render:function(){return this.fireEvent("render:before",this),this.cmpEl=e(this.el),this.fireEvent("render:after",this),this},focus:function(){var e=this;t.defer(function(){e.cmpEl.focus()},50)},addHyperlink:function(e){var t,n=this;if(n.api){var r=[];for(var i=0;i<n.api.getCountPages();i++)r.push({displayValue:i+1,value:i});t=new PE.Views.HyperlinkSettingsDialog({api:n.api,handler:function(e,t){t=="ok"&&n.api.add_Hyperlink(e.getSettings()),n.fireEvent("editcomplete",n)},slides:r}),t.show(),t.setSettings(e.hyperProps.value),Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")}},editHyperlink:function(e,t){var n,r=this;if(r.api){var i=[];for(var s=0;s<r.api.getCountPages();s++)i.push({displayValue:s+1,value:s});n=new PE.Views.HyperlinkSettingsDialog({api:r.api,handler:function(e,t){t=="ok"&&r.api.change_Hyperlink(n.getSettings()),r.fireEvent("editcomplete",r)},slides:i}),n.show(),n.setSettings(e.hyperProps.value),Common.component.Analytics.trackEvent("DocumentHolder","Edit Hyperlink")}},addComment:function(e,t,n){if(this.api&&this.mode.canCoAuthoring&&this.mode.isEdit&&this.mode.canComments){this.suppressEditComplete=!0;var r=PE.getController("Common.Controllers.Comments");r&&r.addDummyComment()}},editChartClick:function(){var e=PE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(e){e.setEditMode(!0),e.show();var t=this.api.asc_getChartObject();t&&e.setChartData(new Asc.asc_CChartBinary(t))}},onCutCopyPaste:function(e,t){var n=this;if(n.api){var r=e.value=="cut"?n.api.Cut():e.value=="copy"?n.api.Copy():n.api.Paste();if(!r){var i=Common.localStorage.getItem("pe-hide-copywarning");(!i||parseInt(i)!=1)&&(new Common.Views.CopyWarningDialog({handler:function(e){e&&Common.localStorage.setItem("pe-hide-copywarning",1),n.fireEvent("editcomplete",n)}})).show()}}n.fireEvent("editcomplete",n)},fullScreen:function(e){e&&(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},onSlidePickerShowAfter:function(t){if(!t._needRecalcSlideLayout)return;if(t.cmpEl&&t.dataViewItems.length>0){var n=t.dataViewItems,r=e(n[0].el),i=r.outerWidth()+parseInt(r.css("margin-left"))+parseInt(r.css("margin-right")),s=Math.floor(t.cmpEl.width()/i),o=0,u=0;for(var a=0;a<n.length;a++){var f=e(n[a].el).find(".title"),l=f.height();l>u?u=l:f.css({height:u}),o++,o>s-1&&(o=0,u=0)}t._needRecalcSlideLayout=!1}},createDelayedElements:function(){var n=this,r=(new Common.UI.MenuItem({caption:n.txtDeleteSlide})).on("click",function(e){n.api&&(n._isFromSlideMenu=!0,n.api.DeleteSlide(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Delete Slide"))}),i=new Common.UI.MenuItem({caption:n.txtChangeLayout,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:t.template('<div id="id-docholder-menu-changeslide" class="menu-layouts" style="width: 302px; margin: 0 4px;"></div>')}]})}),s=(new Common.UI.MenuItem({caption:n.txtPreview})).on("click",function(e){var r=PE.getController("Viewport").getView("DocumentPreview"),i=!1;if(r&&n.api){r.show();var s=function(){if(i)return;i=!0,Common.NotificationCenter.off("window:resize",s);var e=n.api.getCurrentPage();n.api.StartDemonstration("presentation-preview",t.isNumber(e)?e:0),Common.component.Analytics.trackEvent("DocumentHolder","Preview")};!n.mode.isDesktopApp&&!Common.Utils.isIE11?(Common.NotificationCenter.on("window:resize",s),n.fullScreen(document.documentElement),setTimeout(function(){s()},100)):s()}}),o=(new Common.UI.MenuItem({caption:n.txtSelectAll})).on("click",function(e){n.api&&(n.api.SelectAllSlides(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Select All Slides"))}),u=(new Common.UI.MenuItem({caption:n.textPaste,value:"paste"})).on("click",t.bind(n.onCutCopyPaste,n)),a=(new Common.UI.MenuItem({caption:n.textSlideSettings,value:null})).on("click",function(e){PE.getController("RightMenu").onDoubleClickOnObject(e.options.value)});n.slideMenu=(new Common.UI.Menu({initMenu:function(e){u.setVisible(e.fromThumbs!==!0),n.slideMenu.items[1].setVisible(e.fromThumbs===!0),n.slideMenu.items[2].setVisible(e.isSlideSelect===!0),r.setVisible(e.isSlideSelect===!0),n.slideMenu.items[4].setVisible(e.isSlideSelect===!0||e.fromThumbs!==!0),i.setVisible(e.isSlideSelect===!0||e.fromThumbs!==!0),a.setVisible(e.fromThumbs!==!0),a.options.value=null;for(var f=7;f<11;f++)n.slideMenu.items[f].setVisible(e.fromThumbs===!0);var l=n.api.getSelectedElements(),c=!1,h=!1,p=!1;l&&t.isArray(l)&&t.each(l,function(e,t){if(Asc.c_oAscTypeSelectElement.Slide==e.get_ObjectType()){var n=e.get_ObjectValue();return c=n.get_LockDelete(),h=n.get_LockRemove(),p=n.get_LockLayout(),a.options.value=e,!1}});for(var f=0;f<3;f++)n.slideMenu.items[f].setDisabled(c);s.setDisabled(n.slidesCount<1),o.setDisabled(c||n.slidesCount<2),r.setDisabled(h||c),i.setDisabled(p||c)},items:[u,(new Common.UI.MenuItem({caption:n.txtNewSlide})).on("click",function(e){n.api&&(n._isFromSlideMenu=!0,n.api.AddSlide(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Add Slide"))}),(new Common.UI.MenuItem({caption:n.txtDuplicateSlide})).on("click",function(e){n.api&&(n._isFromSlideMenu=!0,n.api.DublicateSlide(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Dublicate Hyperlink"))}),r,{caption:"--"},i,a,{caption:"--"},o,{caption:"--"},s]})).on("hide:after",function(e,t,r){if(n.suppressEditComplete){n.suppressEditComplete=!1;return}r||n.fireEvent("editcomplete",n),n.currentMenu=null}).on("render:after",function(r){n.slideLayoutMenu=(new Common.UI.DataView({el:e("#id-docholder-menu-changeslide"),parentMenu:i.menu,showLast:!1,restoreHeight:300,style:"max-height: 300px;",store:PE.getCollection("SlideLayouts"),itemTemplate:t.template(['<div class="layout" id="<%= id %>" style="width: <%= itemWidth %>px;">','<div style="background-image: url(<%= imageUrl %>); width: <%= itemWidth %>px; height: <%= itemHeight %>px;"/>','<div class="title"><%= title %></div> ',"</div>"].join(""))})).on("item:click",function(e,t,r,i){n.api&&(n.api.ChangeLayout(r.get("data").idx),i.type!=="click"&&n.slideMenu.hide(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Change Layout"))}),n.slideMenu&&i.menu.on("show:after",function(e){n.onSlidePickerShowAfter(n.slideLayoutMenu),n.slideLayoutMenu.scroller.update({alwaysVisibleY:!0}),n.slideLayoutMenu.scroller.scrollTop(0)}),n.slideLayoutMenu._needRecalcSlideLayout=!0,n.listenTo(PE.getCollection("SlideLayouts"),"reset",function(){n.slideLayoutMenu._needRecalcSlideLayout=!0})});var f=(new Common.UI.MenuItem({caption:n.mergeCellsText})).on("click",function(e){n.api&&n.api.MergeCells()}),l=(new Common.UI.MenuItem({caption:n.splitCellsText})).on("click",function(e){n.api&&(new Common.Views.InsertTableDialog({handler:function(e,t){e=="ok"&&(n.api&&n.api.SplitCell(t.columns,t.rows),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Table Split"))}})).show()}),c=new Common.UI.MenuItem({caption:n.cellAlignText,menu:function(){function e(e,t){if(n.api){var r=new Asc.CTableProp;r.put_CellsVAlign(e.value),n.api.tblApply(r)}n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Table Cell Align")}return new Common.UI.Menu({menuAlign:"tl-tr",items:[n.menuTableCellTop=(new Common.UI.MenuItem({caption:n.topCellText,checkable:!0,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Top})).on("click",t.bind(e,n)),n.menuTableCellCenter=(new Common.UI.MenuItem({caption:n.centerCellText,checkable:!0,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Center})).on("click",t.bind(e,n)),n.menuTableCellBottom=(new Common.UI.MenuItem({caption:n.bottomCellText,checkable:!0,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Bottom})).on("click",t.bind(e,n))]})}()}),h=(new Common.UI.MenuItem({caption:n.advancedTableText})).on("click",function(e){if(n.api){var t=n.api.getSelectedElements();if(t&&t.length>0){var r,i;for(var s=t.length-1;s>=0;s--){r=t[s].get_ObjectType(),i=t[s].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Table==r){(new PE.Views.TableSettingsAdvanced({tableProps:i,handler:function(e,t){e=="ok"&&n.api&&n.api.tblApply(t.tableProps),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Table Settings Advanced")}})).show();break}}}}}),p=(new Common.UI.MenuItem({caption:n.advancedImageText})).on("click",function(e){if(n.api){var t=n.api.getSelectedElements();if(t&&t.length>0){var r,i;for(var s=t.length-1;s>=0;s--){r=t[s].get_ObjectType(),i=t[s].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Image==r){var o;B.isDisabled()||(o=n.api.get_OriginalSizeImage(),o&&(o={width:o.get_ImageWidth(),height:o.get_ImageHeight()})),(new PE.Views.ImageSettingsAdvanced({imageProps:i,sizeOriginal:o,handler:function(e,t){e=="ok"&&n.api&&n.api.ImgApply(t.imageProps),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Image Settings Advanced")}})).show();break}}}}}),d=(new Common.UI.MenuItem({caption:n.advancedShapeText})).on("click",function(e){if(n.api){var t=n.api.getSelectedElements();if(t&&t.length>0){var r,i;for(var s=t.length-1;s>=0;s--){r=t[s].get_ObjectType(),i=t[s].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Shape==r){(new PE.Views.ShapeSettingsAdvanced({shapeProps:i,handler:function(e,t){e=="ok"&&n.api&&n.api.ShapeApply(t.shapeProps),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Image Shape Advanced")}})).show();break}}}}}),v=(new Common.UI.MenuItem({caption:n.advancedParagraphText})).on("click",function(e){if(n.api){var t=n.api.getSelectedElements();if(t&&t.length>0){var r,i;for(var s=t.length-1;s>=0;s--){r=t[s].get_ObjectType(),i=t[s].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Paragraph==r){(new PE.Views.ParagraphSettingsAdvanced({paragraphProps:i,api:n.api,handler:function(e,t){e=="ok"&&n.api&&n.api.paraApply(t.paragraphProps),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Image Paragraph Advanced")}})).show();break}}}}}),m=new Common.UI.MenuItem({caption:"--"}),g=(new Common.UI.MenuItem({caption:n.hyperlinkText})).on("click",t.bind(n.addHyperlink,n)),y=(new Common.UI.MenuItem({caption:n.editHyperlinkText})).on("click",t.bind(n.editHyperlink,n)),b=(new Common.UI.MenuItem({caption:n.removeHyperlinkText})).on("click",function(e){n.api&&n.api.remove_Hyperlink(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink")}),w=new Common.UI.MenuItem({caption:n.hyperlinkText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[y,b]})}),E=(new Common.UI.MenuItem({caption:n.hyperlinkText})).on("click",t.bind(n.addHyperlink,n)),S=(new Common.UI.MenuItem({caption:n.editHyperlinkText})).on("click",t.bind(n.editHyperlink,n)),x=(new Common.UI.MenuItem({caption:n.removeHyperlinkText})).on("click",function(e){n.api&&n.api.remove_Hyperlink(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink Table")}),T=new Common.UI.MenuItem({caption:n.hyperlinkText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[S,x]})}),N=new Common.UI.MenuItem({caption:"--"}),C=(new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"mnu-group"})).on("click",function(e){n.api&&n.api.groupShapes(),n.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Group Image")}),k=(new Common.UI.MenuItem({caption:this.txtUngroup,iconCls:"mnu-ungroup"})).on("click",function(e){n.api&&n.api.unGroupShapes(),n.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Ungroup Image")}),L=new Common.UI.MenuItem({caption:n.txtArrange,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[(new Common.UI.MenuItem({caption:this.textArrangeFront,iconCls:"mnu-arrange-front"})).on("click",function(e){n.api&&n.api.shapes_bringToFront(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Bring To Front")}),(new Common.UI.MenuItem({caption:this.textArrangeBack,iconCls:"mnu-arrange-back"})).on("click",function(e){n.api&&n.api.shapes_bringToBack(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Bring To Back")}),(new Common.UI.MenuItem({caption:this.textArrangeForward,iconCls:"mnu-arrange-forward"})).on("click",function(e){n.api&&n.api.shapes_bringForward(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Send Forward")}),(new Common.UI.MenuItem({caption:this.textArrangeBackward,iconCls:"mnu-arrange-backward"})).on("click",function(e){n.api&&n.api.shapes_bringBackward(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Send Backward")}),{caption:"--"},C,k]})}),A=new Common.UI.MenuItem({caption:n.txtAlign,menu:function(){function e(e){n.api&&n.api.put_ShapesAlign(e.value),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Image Shape Align")}return new Common.UI.Menu({menuAlign:"tl-tr",items:[(new Common.UI.MenuItem({caption:n.textShapeAlignLeft,iconCls:"mnu-shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT})).on("click",t.bind(e,n)),(new Common.UI.MenuItem({caption:n.textShapeAlignCenter,iconCls:"mnu-shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER})).on("click",t.bind(e,n)),(new Common.UI.MenuItem({caption:n.textShapeAlignRight,iconCls:"mnu-shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT})).on("click",t.bind(e,n)),(new Common.UI.MenuItem({caption:n.textShapeAlignTop,iconCls:"mnu-shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP})).on("click",t.bind(e,n)),(new Common.UI.MenuItem({caption:n.textShapeAlignMiddle,iconCls:"mnu-shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE})).on("click",t.bind(e,n)),(new Common.UI.MenuItem({caption:n.textShapeAlignBottom,iconCls:"mnu-shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM})).on("click",t.bind(e,n)),{caption:"--"},(new Common.UI.MenuItem({caption:n.txtDistribHor,iconCls:"mnu-distrib-hor"})).on("click",function(e){n.api&&n.api.DistributeHorizontally(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Horizontally")}),(new Common.UI.MenuItem({caption:n.txtDistribVert,iconCls:"mnu-distrib-vert"})).on("click",function(e){n.api&&n.api.DistributeVertically(),n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Vertically")})]})}()}),O=(new Common.UI.MenuItem({caption:n.editChartText})).on("click",t.bind(n.editChartClick,n)),M=new Common.UI.MenuItem({caption:n.vertAlignText,menu:function(){function e(e){if(n.api){var t=new Asc.asc_CShapeProperty;t.put_VerticalTextAlign(e.value),n.api.ShapeApply(t)}n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Text Vertical Align")}return new Common.UI.Menu({menuAlign:"tl-tr",items:[n.menuParagraphTop=(new Common.UI.MenuItem({caption:n.topCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Top})).on("click",t.bind(e,n)),n.menuParagraphCenter=(new Common.UI.MenuItem({caption:n.centerCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Center})).on("click",t.bind(e,n)),n.menuParagraphBottom=(new Common.UI.MenuItem({caption:n.bottomCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Bottom})).on("click",t.bind(e,n))]})}()}),D=function(e,t){if(n.api){var r=new Asc.asc_CShapeProperty;r.put_Vert(e.options.direction),n.api.ShapeApply(r)}n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")},P=new Common.UI.MenuItem({caption:n.directionText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[n.menuParagraphDirectH=(new Common.UI.MenuItem({caption:n.directHText,iconCls:"mnu-direct-horiz",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal})).on("click",t.bind(D,n)),n.menuParagraphDirect90=(new Common.UI.MenuItem({caption:n.direct90Text,iconCls:"mnu-direct-rdown",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert})).on("click",t.bind(D,n)),n.menuParagraphDirect270=(new Common.UI.MenuItem({caption:n.direct270Text,iconCls:"mnu-direct-rup",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270})).on("click",t.bind(D,n))]})}),H=new Common.UI.MenuItem({caption:"--"}),B=(new Common.UI.MenuItem({caption:n.originalSizeText})).on("click",function(e){if(n.api){var t=n.api.get_OriginalSizeImage();if(t){var r=new Asc.asc_CImgProperty;r.put_Width(t.get_ImageWidth()),r.put_Height(t.get_ImageHeight()),n.api.ImgApply(r)}n.fireEvent("editcomplete",n),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}}),j=(new Common.UI.MenuItem({caption:n.addCommentText})).on("click",t.bind(n.addComment,n));j.hide();var F=(new Common.UI.MenuItem({caption:n.addCommentText})).on("click",t.bind(n.addComment,n));F.hide();var I=new Common.UI.MenuItem({caption:"--"});I.hide();var q=(new Common.UI.MenuItem({caption:n.addCommentText})).on("click",t.bind(n.addComment,n));q.hide();var R=(new Common.UI.MenuItem({caption:n.textCopy,value:"copy"})).on("click",t.bind(n.onCutCopyPaste,n)),U=(new Common.UI.MenuItem({caption:n.textPaste,value:"paste"})).on("click",t.bind(n.onCutCopyPaste,n)),z=(new Common.UI.MenuItem({caption:n.textCut,value:"cut"})).on("click",t.bind(n.onCutCopyPaste,n)),W=(new Common.UI.MenuItem({caption:n.textCopy,value:"copy"})).on("click",t.bind(n.onCutCopyPaste,n)),X=(new Common.UI.MenuItem({caption:n.textPaste,value:"paste"})).on("click",t.bind(n.onCutCopyPaste,n)),V=(new Common.UI.MenuItem({caption:n.textCut,value:"cut"})).on("click",t.bind(n.onCutCopyPaste,n)),J=(new Common.UI.MenuItem({caption:n.textCopy,value:"copy"})).on("click",t.bind(n.onCutCopyPaste,n)),K=(new Common.UI.MenuItem({caption:n.textPaste,value:"paste"})).on("click",t.bind(n.onCutCopyPaste,n)),Q=(new Common.UI.MenuItem({caption:n.textCut,value:"cut"})).on("click",t.bind(n.onCutCopyPaste,n)),G=new Common.UI.MenuItem({caption:"--"}),Y=new Common.UI.MenuItem({caption:"--"});n.textMenu=(new Common.UI.Menu({initMenu:function(e){var r=e.shapeProps&&!t.isNull(e.shapeProps.value),i=e.chartProps&&!t.isNull(e.chartProps.value),s=e.paraProps!==undefined&&e.paraProps.locked||e.slideProps!==undefined&&e.slideProps.locked||r&&e.shapeProps.locked,o=e.mathProps&&e.mathProps.value;n._currentParaObjDisabled=s,M.setVisible(r&&!i&&!o),P.setVisible(r&&!i&&!o);if(r||i){var u=e.shapeProps.value.get_VerticalTextAlign();n.menuParagraphTop.setChecked(u==Asc.c_oAscVAlign.Top),n.menuParagraphCenter.setChecked(u==Asc.c_oAscVAlign.Center),n.menuParagraphBottom.setChecked(u==Asc.c_oAscVAlign.Bottom);var a=e.shapeProps.value.get_Vert();n.menuParagraphDirectH.setChecked(a==Asc.c_oAscVertDrawingText.normal),n.menuParagraphDirect90.setChecked(a==Asc.c_oAscVertDrawingText.vert),n.menuParagraphDirect270.setChecked(a==Asc.c_oAscVertDrawingText.vert270)}M.setDisabled(s),P.setDisabled(s);var f=null;n.api&&(f=n.api.can_AddHyperlink()),g.setVisible(e.hyperProps===undefined&&f!==!1),w.setVisible(e.hyperProps!==undefined),y.hyperProps=e.hyperProps,f!==!1&&(g.hyperProps={},g.hyperProps.value=new Asc.CHyperlinkProperty,g.hyperProps.value.put_Text(f)),j.setVisible(!i&&n.api.can_AddQuotedComment()!==!1&&n.mode.canCoAuthoring&&n.mode.canComments),m.setVisible(j.isVisible()||g.isVisible()||w.isVisible()),g.setDisabled(s),w.setDisabled(s),j.setDisabled(s),v.setDisabled(s),z.setDisabled(s),U.setDisabled(s);var l=0;o?l=n.addEquationMenu(!0,4):n.clearEquationMenu(!0,4),G.setVisible(o&&l>0)},items:[z,R,U,G,{caption:"--"},M,P,v,m,j,g,w]})).on("hide:after",function(e,t,r){if(n.suppressEditComplete){n.suppressEditComplete=!1;return}r||n.fireEvent("editcomplete",n),n.currentMenu=null}),n.tableMenu=(new Common.UI.Menu({initMenu:function(e){if(t.isUndefined(e.tableProps))return;var r=e.mathProps&&e.mathProps.value;for(var i=4;i<14;i++)n.tableMenu.items[i].setVisible(!r);var s=e.slideProps!==undefined&&e.slideProps.locked;n.menuTableCellTop.setChecked(e.tableProps.value.get_CellsVAlign()==Asc.c_oAscVertAlignJc.Top),n.menuTableCellCenter.setChecked(e.tableProps.value.get_CellsVAlign()==Asc.c_oAscVertAlignJc.Center),n.menuTableCellBottom.setChecked(e.tableProps.value.get_CellsVAlign()==Asc.c_oAscVertAlignJc.Bottom),n.api&&(f.setDisabled(e.tableProps.locked||s||!n.api.CheckBeforeMergeCells()),l.setDisabled(e.tableProps.locked||s||!n.api.CheckBeforeSplitCells())),n.tableMenu.items[5].setDisabled(e.tableProps.locked||s),n.tableMenu.items[6].setDisabled(e.tableProps.locked||s),c.setDisabled(e.tableProps.locked||s),h.setDisabled(e.tableProps.locked||s),Q.setDisabled(e.tableProps.locked||s),K.setDisabled(e.tableProps.locked||s);var o=null;n.api&&(o=n.api.can_AddHyperlink()),E.setVisible(!t.isUndefined(e.paraProps)&&t.isUndefined(e.hyperProps)&&o!==!1),T.setVisible(!t.isUndefined(e.paraProps)&&!t.isUndefined(e.hyperProps)),S.hyperProps=e.hyperProps,o!==!1&&(E.hyperProps={},E.hyperProps.value=new Asc.CHyperlinkProperty,E.hyperProps.value.put_Text(o)),t.isUndefined(e.paraProps)||(E.setDisabled(e.paraProps.locked||s),T.setDisabled(e.paraProps.locked||s),n._currentParaObjDisabled=e.paraProps.locked||s),F.setVisible(n.api.can_AddQuotedComment()!==!1&&n.mode.canCoAuthoring&&n.mode.canComments),F.setDisabled(!t.isUndefined(e.paraProps)&&e.paraProps.locked||s),N.setVisible(E.isVisible()||T.isVisible()||F.isVisible());var u=0;r?(u=n.addEquationMenu(!1,4),N.setVisible(N.isVisible()&&u>0)):n.clearEquationMenu(!1,4)},items:[Q,J,K,{caption:"--"},new Common.UI.MenuItem({caption:n.selectText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[(new Common.UI.MenuItem({caption:n.rowText})).on("click",function(){n.api&&n.api.selectRow()}),(new Common.UI.MenuItem({caption:n.columnText})).on("click",function(){n.api&&n.api.selectColumn()}),(new Common.UI.MenuItem({caption:n.cellText})).on("click",function(){n.api&&n.api.selectCell()}),(new Common.UI.MenuItem({caption:n.tableText})).on("click",function(){n.api&&n.api.selectTable()})]})}),{caption:n.insertText,menu:new Common.UI.Menu({menuAlign:"tl-tr",style:"width: 100px",items:[(new Common.UI.MenuItem({caption:n.insertColumnLeftText})).on("click",function(e){n.api&&n.api.addColumnLeft()}),(new Common.UI.MenuItem({caption:n.insertColumnRightText})).on("click",function(e){n.api&&n.api.addColumnRight()}),(new Common.UI.MenuItem({caption:n.insertRowAboveText})).on("click",function(e){n.api&&n.api.addRowAbove()}),(new Common.UI.MenuItem({caption:n.insertRowBelowText})).on("click",function(e){n.api&&n.api.addRowBelow()})]})},new Common.UI.MenuItem({caption:n.deleteText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[(new Common.UI.MenuItem({caption:n.rowText})).on("click",function(){n.api&&n.api.remRow()}),(new Common.UI.MenuItem({caption:n.columnText})).on("click",function(){n.api&&n.api.remColumn()}),(new Common.UI.MenuItem({caption:n.tableText})).on("click",function(){n.api&&n.api.remTable()})]})}),{caption:"--"},f,l,{caption:"--"},c,{caption:"--"},h,N,F,E,T]})).on("hide:after",function(e,t,r){if(n.suppressEditComplete){n.suppressEditComplete=!1;return}r||n.fireEvent("editcomplete",n),n.currentMenu=null}),n.pictureMenu=(new Common.UI.Menu({initMenu:function(e){n.api&&(k.setDisabled(!n.api.canUnGroup()),C.setDisabled(!n.api.canGroup()));var r=e.imgProps!==undefined&&e.imgProps.locked,i=e.shapeProps!==undefined&&e.shapeProps.locked,s=e.chartProps!==undefined&&e.chartProps.locked,o=r||i||s||e.slideProps!==undefined&&e.slideProps.locked;B.setVisible(t.isUndefined(e.shapeProps)&&t.isUndefined(e.chartProps)),B.isVisible()&&B.setDisabled(o||t.isNull(e.imgProps.value.get_ImageUrl())||t.isUndefined(e.imgProps.value.get_ImageUrl())),p.setVisible(t.isUndefined(e.shapeProps)&&t.isUndefined(e.chartProps)),d.setVisible(t.isUndefined(e.imgProps)&&t.isUndefined(e.chartProps)),O.setVisible(t.isUndefined(e.imgProps)&&!t.isUndefined(e.chartProps)&&(t.isUndefined(e.shapeProps)||e.shapeProps.isChart)),H.setVisible(p.isVisible()||d.isVisible()||O.isVisible()),q.setVisible(n.api.can_AddQuotedComment()!==!1&&n.mode.canCoAuthoring&&n.mode.canComments),I.setVisible(q.isVisible()),q.setDisabled(o),A.setDisabled(o),p.setDisabled(o),d.setDisabled(o),O.isVisible()&&O.setDisabled(o),V.setDisabled(o),X.setDisabled(o)},items:[V,W,X,{caption:"--"},L,A,H,B,p,d,O,I,q]})).on("hide:after",function(e,t,r){if(n.suppressEditComplete){n.suppressEditComplete=!1;return}r||n.fireEvent("editcomplete",n),n.currentMenu=null});var Z=e("#id_buttonNextPage");Z.attr("data-toggle","tooltip"),Z.tooltip({title:n.textNextPage+Common.Utils.String.platformKey("PgDn"),placement:"top-right"});var et=e("#id_buttonPrevPage");et.attr("data-toggle","tooltip"),et.tooltip({title:n.textPrevPage+Common.Utils.String.platformKey("PgUp"),placement:"top-right"})},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",originalSizeText:"Default Size",advancedImageText:"Image Advanced Settings",hyperlinkText:"Hyperlink",editHyperlinkText:"Edit Hyperlink",removeHyperlinkText:"Remove Hyperlink",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",txtSelectAll:"Select All",txtNewSlide:"New Slide",txtDuplicateSlide:"Duplicate Slide",txtDeleteSlide:"Delete Slide",txtBackground:"Background",txtChangeLayout:"Change Layout",txtPreview:"Start slideshow",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",txtArrange:"Arrange",txtAlign:"Align",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",txtSlide:"Slide",topCellText:"Align Top",centerCellText:"Align Center",bottomCellText:"Align Bottom",cellAlignText:"Cell Vertical Alignment",advancedShapeText:"Shape Advanced Settings",addCommentText:"Add Comment",editChartText:"Edit Data",vertAlignText:"Vertical Alignment",advancedParagraphText:"Text Advanced Settings",tipIsLocked:"This element is currently being edited by another user.",textNextPage:"Next Slide",textPrevPage:"Previous Slide",insertText:"Insert",textCopy:"Copy",textPaste:"Paste",textCut:"Cut",textSlideSettings:"Slide Settings",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",alignmentText:"Alignment",leftText:"Left",rightText:"Right",centerText:"Center"},PE.Views.DocumentHolder||{}))});var c_paragraphLinerule={LINERULE_LEAST:0,LINERULE_AUTO:1,LINERULE_EXACT: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};define("presentationeditor/main/app/controller/DocumentHolder",["core","presentationeditor/main/app/view/DocumentHolder"],function(){"use strict";PE.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(e){this.api=e},createDelayedElements:function(){var e=this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");e&&(e.on("internalmessage",_.bind(function(t,n){var r=n.data.command,i=n.data.data;this.api&&(e.isEditMode()?this.api.asc_editChartDrawingObject(i):this.api.asc_addChartDrawingObject(i))},this)),e.on("hide",_.bind(function(e,t){this.documentHolder.fireEvent("editcomplete",this.documentHolder),this.api&&(this.api.asc_onCloseChartFrame(),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(e){_.extend(this.options,e||{}),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 e=this;e.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:e.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(t){return/((^https?)|(^ftp)):\/\/.+/i.test(t)?!0:e.txtNotUrl}});var t=this.getChild();t.find(".btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.getChild("input").focus()},500)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputUrl.checkValidate()!==!0){this.inputUrl.cmpEl.find("input").focus();return}this.options.handler.call(this,e,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",cancelButtonText:"Cancel",okButtonText:"Ok",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/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(e){_.extend(this.options,e||{}),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 e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.udColumns=new Common.UI.MetricSpinner({el:e.find(".columns-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:63,minValue:1,allowDecimal:!1}),this.udRows=new Common.UI.MetricSpinner({el:e.find(".rows-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:100,minValue:1,allowDecimal:!1})},onBtnClick:function(e){this.options.handler&&this.options.handler.call(this,e.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||{}))});if(Common===undefined)var Common={};define("common/main/lib/util/define",[],function(){"use strict";Common.define={},Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521}}),define("text!presentationeditor/main/app/template/Toolbar.template",[],function(){return'<div class="toolbar" style="<%= isCompactView ? \'height: 41px;\' : \'height: 67px;\' %>">\n<!---------------------->\n<!--Short view toolbar-->\n<!---------------------->\n<div id="id-toolbar-short" style="<%= isCompactView ? \'display: table;\' : \'display: none;\' %> width: 100%;" >\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-addslide"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-preview"></span>\n </div>\n </div>\n <div class="separator short"></div>\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-fontcolor"></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-halign"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-valign"></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-linespace"></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-arrange-shape"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-align-shape"></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-inserttext"></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" id="id-toolbar-short-placeholder-btn-copystyle"></span>\n </div>\n </div>\n <div class="toolbar-group" style="width: 100%;"></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<!---------------------->\n<!--Fully view toolbar-->\n<!---------------------->\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="separator long toolbar-group-native"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder large split" id="id-toolbar-full-placeholder-btn-addslide"></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-changeslide"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-preview"></span>\n </div>\n </div>\n <div class="separator long" style="margin-left: 5px;"></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:202px;">\n <span class="btn-placeholder" style="float: left; width: 148px;" 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 </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-fontcolor"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-superscript"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-subscript"></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-decoffset"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-incoffset"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-halign"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-valign"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-linespace"></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-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 </div>\n <div class="toolbar-row">\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 </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-arrange-shape"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-shape"></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 split" id="id-toolbar-full-placeholder-btn-slidesize"></span>\n </div>\n </div>\n <div class="toolbar-group" id="id-toolbar-full-placeholder-field-styles" style="width: 100%; min-width: 140px;">\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>'});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(e){"use strict";Common.Models.Font=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(e){"use strict";Common.Collections.Fonts=e.Collection.extend({model:Common.Models.Font,comparator:function(e,t){var n=e.get("name").toLowerCase(),r=t.get("name").toLowerCase();return n==r?0:n<r?-1:1}})});if(Common===undefined)var Common={};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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.id=t.options.id||Common.UI.getId(),t.hint=t.options.hint,t.enableToggle=t.options.enableToggle,t.allowDepress=t.options.allowDepress,t.cls=t.options.cls,t.iconCls=t.options.iconCls,t.menu=t.options.menu,t.split=t.options.split,t.toggleGroup=t.options.toggleGroup,t.disabled=t.options.disabled,t.pressed=t.options.pressed,t.caption=t.options.caption,t.template=t.options.template||t.template,t.style=t.options.style,t.rendered=!1,t.options.el&&t.render()},render:function(e){var t=this;t.trigger("render:before",t),t.cmpEl=$(t.el),e&&(t.setElement(e,!1),t.rendered||(t.cmpEl=$(this.template({id:t.id,cls:t.cls,iconCls:t.iconCls,menu:t.menu,split:t.split,disabled:t.disabled,pressed:t.pressed,caption:t.caption,style:t.style})),t.menu&&_.isObject(t.menu)&&_.isFunction(t.menu.render)&&t.menu.render(t.cmpEl),e.html(t.cmpEl)));if(!t.rendered){var n=t.cmpEl,r=n.hasClass("btn-group"),i=n.hasClass("split");if(t.options.hint){var s=t.cmpEl.closest(".asc-window");t.cmpEl.attr("data-toggle","tooltip"),t.cmpEl.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"}),s.length>0&&t.cmpEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10)}_.isString(t.toggleGroup)&&(t.enableToggle=!0);var o=function(e){if(!t.disabled&&e.which==1){t.doToggle();if(t.options.hint){var n=t.cmpEl.data("bs.tooltip");n&&(n.dontShow===undefined&&(n.dontShow=!0),n.hide())}t.trigger("click",t,e)}},u=function(e,r){if(!e){var s=!1;_.each($("button",n),function(e){if($(e).is(":hover"))return s=!0,!1}),s||(n.removeClass("over"),$("button",n).removeClass("over"))}if(!e&&t.enableToggle&&t.allowDepress&&t.pressed)return;if(e&&!i&&t.enableToggle&&t.allowDepress&&!t.pressed){r.preventDefault();return}$("button:first",n).toggleClass("active",e),$("[data-toggle^=dropdown]",n).toggleClass("active",e),n.toggleClass("active",e)},a=function(e){if(!t.disabled&&e.which==1&&i){if(t.options.hint){var r=t.cmpEl.data("bs.tooltip");r&&(r.dontShow===undefined&&(r.dontShow=!0),r.hide())}var s=n.hasClass("open");u(!s,e)}},f=function(e,t){i?u(t,e):(n.toggleClass("active",t),$("button",n).toggleClass("active",t))},l=function(e){u(!0,e),$(document).on("mouseup",c)},c=function(e){u(!1,e),$(document).off("mouseup",c)},h=function(e,n){t.cmpEl.find(".dropdown-toggle").blur(),t.cmpEl.hasClass("active")!==t.pressed&&t.cmpEl.trigger("button.internal.active",[t.pressed])};r?(i&&($("[data-toggle^=dropdown]",n).on("mousedown",_.bind(a,this)),$("button",n).on("mousedown",_.bind(l,this))),n.on("hide.bs.dropdown",_.bind(u,t,!1)),n.on("show.bs.dropdown",_.bind(u,t,!0)),n.on("hidden.bs.dropdown",_.bind(h,t)),$("button:first",n).on("click",o)):n.on("click",o),n.on("button.internal.active",_.bind(f,t)),n.on("mouseover",function(e){t.disabled||(t.cmpEl.addClass("over"),t.trigger("mouseover",t,e))}),n.on("mouseout",function(e){t.disabled||(t.cmpEl.removeClass("over"),t.trigger("mouseout",t,e))}),Common.UI.ToggleManager.register(t)}return t.rendered=!0,t.pressed&&t.toggle(t.pressed,!0),t.disabled&&t.setDisabled(!(t.disabled=!1)),t.trigger("render:after",t),this},doToggle:function(){var e=this;e.enableToggle&&(e.allowDepress!==!1||!e.pressed)&&e.toggle()},toggle:function(e,t){var n=e===undefined?!this.pressed:!!e;this.pressed=n,this.cmpEl&&this.cmpEl.trigger("button.internal.active",[n]),t||this.trigger("toggle",this,n)},isActive:function(){return this.enableToggle?this.pressed:this.cmpEl.hasClass("active")},setDisabled:function(e){if(this.rendered&&this.disabled!=e){var t=this.cmpEl,n=t.hasClass("btn-group"),r=this;e=e===!0;if(e!==t.hasClass("disabled")){var i=function(t){t.toggleClass("disabled",e),r.options.allowMouseEventsOnDisabled||(e?t.attr({disabled:e}):t.removeAttr("disabled"))};i(t),n&&i(t.children("button"))}if(e||!Common.Utils.isGecko){var s=this.cmpEl.data("bs.tooltip");s&&(e&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!e))}}this.disabled=e},isDisabled:function(){return this.disabled},setIconCls:function(e){var t=$(this.el).find("span.btn-icon"),n=this.iconCls;this.iconCls=e,t.removeClass(n),t.addClass(e||"")},setVisible:function(e){this.cmpEl&&this.cmpEl.toggleClass("hidden",!e)},updateHint:function(e){this.options.hint=e;if(!this.rendered)return;var t=this.cmpEl,n=t.closest(".asc-window");t.data("bs.tooltip")&&t.removeData("bs.tooltip"),t.attr("data-toggle","tooltip"),t.tooltip({title:e,placement:this.options.hintAnchor||"cursor"}),n.length>0&&t.data("bs.tooltip").tip().css("z-index",parseInt(n.css("z-index"))+10)},setCaption:function(e){if(this.caption!=e){this.caption=e;if(this.rendered){var t=this.cmpEl.find("button:first > .caption").andSelf().filter("button > .caption");t.length>0?t.text(e):this.cmpEl.find("button:first").andSelf().filter("button").text(e)}}},setMenu:function(e){e&&_.isObject(e)&&_.isFunction(e.render)&&(this.menu=e,this.rendered&&this.menu.render(this.cmpEl))}})});if(Common===undefined)var Common={};define("common/main/lib/component/ColorPalette",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.ColorPalette=Common.UI.BaseView.extend({options:{allowReselect:!0,cls:"",style:""},template:_.template(['<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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;this.id=t.options.id,this.cls=t.options.cls,this.style=t.options.style,this.colors=t.options.colors||[],this.value=t.options.value,t.options.el&&t.render()},render:function(e){var t=this;t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));if(!t.rendered){var n=this.cmpEl;n.on("click","span.color-item",_.bind(this.itemClick,this))}return t.rendered=!0,this},itemClick:function(e){var t=$(e.target);this.select(t.attr("data-color"))},select:function(e,t){if(this.value!=e){var n=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=e,e&&/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),$("span[data-color="+e+"]",this.cmpEl).addClass("selected"),t||n.trigger("select",n,this.value))}}})}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'<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'});if(Common===undefined)var Common={};define("common/main/lib/component/HSBColorPicker",["common/main/lib/component/BaseView","common/main/lib/util/utils"],function(){"use strict";Common.UI.HSBColorPicker=Common.UI.BaseView.extend({template:_.template('<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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el),r,i,s,o,u,a,f,l,c=0,h=100,p=100;t.allowEmptyColor=t.options.allowEmptyColor,t.changeSaturation=t.options.changeSaturation,t.showCurrentColor=t.options.showCurrentColor;var d=function(e,n){var r=new Common.Utils.RGBColor("hsb("+e.h+","+e.s+","+e.b+")"),i=r.toHex();t.color=n?"transparent":i,v(),t.trigger("changecolor",t,t.color)},v=function(){u.length>0&&a.length>0&&(t.color=="transparent"?a.show():(u.css("background-color",t.color),a.hide())),s.length>0&&s.css("background-color",(new Common.Utils.RGBColor("hsb("+c+", 100, 100)")).toHex()),f.length>0&&(f[0].innerHTML=t.color=="transparent"?t.textNoColor:t.color.toUpperCase()),r.length>0&&i.length>0&&(r.css("left",h+"%"),r.css("top",100-p+"%"),i.css("top",parseInt(c*100/360)+"%"))},m=function(e,t,n){if(r.length>0&&s.length>0){var i=[Math.max(0,Math.min(100,parseInt((e.pageX*Common.Utils.zoom()-s.offset().left)/s.width()*100))),Math.max(0,Math.min(100,parseInt((e.pageY*Common.Utils.zoom()-s.offset().top)/s.height()*100)))];r.css("left",i[0]+"%"),r.css("top",i[1]+"%"),h=i[0],p=100-i[1],d({h:c,s:h,b:p})}},g=function(e,t,n){if(i&&o){var r=Math.max(0,Math.min(100,parseInt((e.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",r+"%"),c=parseInt(360*r/100),d({h:c,s:h,b:p})}},y=function(e,t,n){$(document).on("mouseup",b),$(document).on("mousemove",m)},b=function(e,t,n){$(document).off("mouseup",b),$(document).off("mousemove",m),m(e,t,n)},w=function(e,t,n){$(document).on("mouseup",E),$(document).on("mousemove",g),g(e,t,n)},E=function(e,t,n){$(document).off("mouseup",E),$(document).off("mousemove",g)},S=function(e){var n=(new Common.util.RGBColor(t.color)).toHSB();d(n,!0)},x=function(e){var n=$(t.el),d;n&&(r=n.find(".cnt-hb-arrow"),i=n.find(".cnt-sat-arrow"),s=n.find(".cnt-hb"),o=n.find(".cnt-sat"),u=n.find(".color-value"),f=n.find(".color-text"),l=n.find(".empty-color"),u.length>0&&(a=u.find(".transparent-color")),s.length>0&&(s.off("mousedown"),s.on("mousedown",y)),o.length>0&&(o.off("mousedown"),o.on("mousedown",w)),l.length>0&&(l.off("click"),l.on("click",S)),t.color=="transparent"?d={h:0,s:100,b:100}:d=(new Common.Utils.RGBColor(t.color)).toHSB(),c=d.h,h=d.s,p=d.b,c==h&&c==p&&c==0&&(h=100),v())};t.setColor=function(e){if(t.color==e)return;var n;e=="transparent"?n={h:0,s:100,b:100}:n=(new Common.Utils.RGBColor(e)).toHSB(),c=n.h,h=n.s,p=n.b,c==h&&c==p&&c==0&&(h=100),t.color=e,v()},t.getColor=function(){return t.color},t.on("render:after",x),t.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})});if(Common===undefined)var Common={};define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);n.addClass("masked-field user-select"),n.attr("maxlength",t.options.maxLength),n.on("keypress",function(e){var r=String.fromCharCode(e.which);!t.options.maskExp.test(r)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB&&(e.keyCode==Common.UI.Keys.RETURN&&t.trigger("changed",t,n.val()),e.preventDefault(),e.stopPropagation())}),n.on("input",function(e){t.trigger("change",t,n.val())}),n.on("blur",function(e){t.trigger("changed",t,n.val())})},render:function(){return this},setValue:function(e){this.options.maskExp.test(e)&&e.length<=this.options.maxLength&&$(this.el).val(e)},getValue:function(){$(this.el).val()}})});if(Common===undefined)var Common={};define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(e){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(e),options:{},rendered:!1,initialize:function(e){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:1,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:2,maskExp:/[0-9]/,allowDecimal:!1}),this.spinB=new Common.UI.MetricSpinner({el:$("#extended-spin-b"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:3,maskExp:/[0-9]/,allowDecimal:!1}),this.textColor=new Common.UI.MaskedField({el:$("#extended-text-color"),width:55,maskExp:/[a-fA-F0-9]/,maxLength:6}),this.spinR.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,1)),this.spinG.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,2)),this.spinB.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,3)),this.textColor.on("change",_.bind(this.onChangeMaskedField,this)),this.textColor.on("changed",_.bind(this.onChangedMaskedField,this)),this.textColor.$el.attr("tabindex",4),this.spinR.$el.find("input").attr("maxlength",3),this.spinG.$el.find("input").attr("maxlength",3),this.spinB.$el.find("input").attr("maxlength",3),this.on("close",function(){e.trigger("onmodalresult",0)}),$(this)[0].getChild(".footer .dlg-btn").on("click",t),this.rendered=!0,this.color!==undefined&&this.setColor(this.color),this},onChangeColor:function(e,t){this.colorNew.css({"background-color":t}),this.stopevents=!0;var n=t.match(this.hexRe);this.spinR.setValue(parseInt(n[1],16)),this.spinG.setValue(parseInt(n[2],16)),this.spinB.setValue(parseInt(n[3],16)),this.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),this.stopevents=!1},showColor:function(e,t){if(!this.stopevents){var n=this.spinR.getNumberValue(),r=n==null||n<0?0:n>255?255:n;t&&this.spinR.setValue(r,!0),r=r.toString(16),n=this.spinG.getNumberValue();var i=n==null||n<0?0:n>255?255:n;t&&this.spinG.setValue(i,!0),i=i.toString(16),n=this.spinB.getNumberValue();var s=n==null||n<0?0:n>255?255:n;t&&this.spinB.setValue(s,!0),s=s.toString(16);var o=(r.length==1?"0"+r:r)+(i.length==1?"0"+i:i)+(s.length==1?"0"+s:s);this.colorsPicker.setColor("#"+o),e!="hex"&&this.textColor.setValue(o.toUpperCase()),this.colorNew.css("background-color","#"+o)}},onChangingRGB:function(e,t,n,r){if(!this.stopevents){var i,s,o,u;n=_.isEmpty(n)||isNaN(parseInt(n))?parseInt(t.getValue()):parseInt(n);switch(e){case 1:i=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16),u=this.spinG.getNumberValue(),s=(u==null||u<0?0:u>255?255:u).toString(16),u=this.spinB.getNumberValue(),o=(u==null||u<0?0:u>255?255:u).toString(16);break;case 2:u=this.spinR.getNumberValue(),i=(u==null||u<0?0:u>255?255:u).toString(16),s=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16),u=this.spinB.getNumberValue(),o=(u==null||u<0?0:u>255?255:u).toString(16);break;case 3:u=this.spinR.getNumberValue(),i=(u==null||u<0?0:u>255?255:u).toString(16),u=this.spinG.getNumberValue(),s=(u==null||u<0?0:u>255?255:u).toString(16),o=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16)}var a=(i.length==1?"0"+i:i)+(s.length==1?"0"+s:s)+(o.length==1?"0"+o:o);this.colorsPicker.setColor("#"+a),this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangeMaskedField:function(e,t){t=/^[a-fA-F0-9]{0,6}$/.test(t)?t:"000000",t="000000"+t;var n=t.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(n[1],16)),this.spinG.setValue(parseInt(n[2],16)),this.spinB.setValue(parseInt(n[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(e,t){var n=this;(!/^[a-fA-F0-9]{0,6}$/.test(t)||_.isEmpty(t))&&e.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var e=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return e?e[1]:null},setColor:function(e){function r(){e=="transparent"?t.colorSaved.addClass("color-transparent"):(t.colorSaved.removeClass("color-transparent"),t.colorSaved.css("background-color","#"+e)),t.colorNew.css("background-color","#"+n)}var t=this;if(this.rendered!==!0){this.color=e;return}var n=/#?([a-fA-F0-9]{6})/.test(e)?e:"ff0000";t.colorsPicker.setColor("#"+n),r(),t.stopevents=!0;var i=t.hexRe.exec(n);t.spinR.setValue(parseInt(i[1],16)),t.spinG.setValue(parseInt(i[2],16)),t.spinB.setValue(parseInt(i[3],16)),t.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),t.stopevents=!1},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.getChild("#extended-text-color").focus()},50)},cancelButtonText:"Cancel",addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.<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||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ThemeColorPalette",["common/main/lib/component/BaseView","common/main/lib/view/ExtendedColorDialog"],function(){"use strict";Common.UI.ThemeColorPalette=Common.UI.BaseView.extend(_.extend({options:{dynamiccolors:10,standardcolors:10,themecolors:10,effects:5,allowReselect:!0,transparent:!1,value:"000000"},template:_.template('<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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.colors=t.options.colors||this.generateColorData(t.options.themecolors,t.options.effects,t.options.standardcolors,t.options.transparent),n.addClass("theme-colorpalette"),this.render(),this.options.updateColorsArr&&this.updateColors(this.options.updateColorsArr[0],this.options.updateColorsArr[1]),this.options.value&&this.select(this.options.value,!0),this.updateCustomColors(),n.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),n.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),n.on("click",_.bind(this.handleClick,this))},render:function(){return $(this.el).html(this.template({colors:this.colors})),this},isBlankSeparator:function(e){return typeof e=="string"&&e=="-"},isSeparator:function(e){return typeof e=="string"&&e=="--"},isColor:function(e){return typeof e=="string"&&/[0-9A-F]{6}/.test(e)},isTransparent:function(e){return typeof e=="string"&&e=="transparent"},isCaption:function(e){return typeof e=="string"&&e!="-"&&e!="--"&&!/[0-9A-F]{6}|transparent/.test(e)},isEffect:function(e){return typeof e=="object"&&e.effectId!==undefined},getColor:function(){return this.value},updateCustomColors:function(){var e=$(this.el);if(e){var t=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");t=t?t.split(","):[];var n=-1,r,i=t.length<this.options.dynamiccolors?t.length:this.options.dynamiccolors;while(++n<i)r=e.find(".color-dynamic-"+n),r.removeClass("dynamic-empty-color").attr("color",t[n]),r.find("span").css({"background-color":"#"+t[n]})}},handleClick:function(e){var t=this,n=$(e.target).closest("a"),r,i;if(n.length==0)return;if(n.hasClass("color-transparent"))$(t.el).find("a."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),t.value="transparent",t.trigger("select",t,"transparent");else if(n[0].className.search("color-dynamic")<0){if(!/^[a-fA-F0-9]{6}$/.test(t.value)||_.indexOf(t.colors,t.value)<0)t.value=!1;$(t.el).find("a."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),r=n[0].className.match(t.colorRe)[1];if(n.hasClass("palette-color-effect")){var s=parseInt(n.attr("effectid"));r&&(t.value=r.toUpperCase(),t.trigger("select",t,{color:r,effectId:s}))}else/#?[a-fA-F0-9]{6}/.test(r)&&(r=/#?([a-fA-F0-9]{6})/.exec(r)[1].toUpperCase(),t.value=r,t.trigger("select",t,r))}else/dynamic-empty-color/.test(n[0].className)?setTimeout(function(){t.addNewColor()},10):($(t.el).find("a."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),r=n.attr("color"),r&&t.trigger("select",t,r),t.value=r.toUpperCase())},setCustomColor:function(e){var t=$(this.el);e=/#?([a-fA-F0-9]{6})/.exec(e);if(e){this.saveCustomColor(e[1]),t.find("a."+this.selectedCls).removeClass(this.selectedCls);var n=t.find(".dynamic-empty-color");n.length==0&&(this.updateCustomColors(),n=t.find(".color-dynamic-"+(this.options.dynamiccolors-1))),n.first().removeClass("dynamic-empty-color").addClass(this.selectedCls).attr("color",e[1]),n.first().find("span").css({"background-color":"#"+e[1]}),this.select(e[1],!0)}},saveCustomColor:function(e){var t="asc."+Common.localStorage.getId()+".colors.custom",n=Common.localStorage.getItem(t);n=n?n.split(","):[],n.push(e)>this.options.dynamiccolors&&n.shift(),Common.localStorage.setItem(t,n.join().toUpperCase())},addNewColor:function(e){var t=this,n=new Common.UI.ExtendedColorDialog({});n.on("onmodalresult",function(e){t._isdlgopen=!1,e==1&&(t.setCustomColor(n.getColor()),t.fireEvent("select",t,n.getColor()))}),t._isdlgopen=!0,n.setColor(t.value!==undefined&&t.value!==!1?t.value:e!==undefined?e:"000000"),n.show()},isDialogOpen:function(){return this._isdlgopen==1},select:function(e,t){var n=$(this.el);n.find("a."+this.selectedCls).removeClass(this.selectedCls);if(typeof e=="object"){var r;e.effectId!==undefined?(r=n.find('a[effectid="'+e.effectId+'"]').first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):e.effectValue!==undefined&&(r=n.find('a[effectvalue="'+e.effectValue+'"].color-'+e.color.toUpperCase()).first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else{/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),this.value=e);if(/^[a-fA-F0-9]{6}|transparent$/.test(e)&&_.indexOf(this.colors,e)>=0){_.indexOf(this.colors,this.value)<0&&(this.value=!1);if(e!=this.value||this.options.allowReselect)e=="transparent"?n.find("a.color-transparent").addClass(this.selectedCls):n.find("a.palette-color.color-"+e).first().addClass(this.selectedCls),this.value=e,t!==!0&&this.fireEvent("select",this,e)}else{var i=n.find("#"+e).first();i.length==0&&(i=n.find('a[color="'+e+'"]').first()),i.length>0&&(i.addClass(this.selectedCls),this.value=e.toUpperCase())}}},updateColors:function(e,t,n){if(e===undefined||t===undefined)return;var r=this,i=$(this.el);r.aColorElements===undefined&&(r.aColorElements=i.find("a.palette-color")),r.aEffectElements===undefined&&(r.aEffectElements=i.find("a.palette-color-effect"));var s,o=0,u=0;for(var a=0;a<r.colors.length;a++)if(typeof r.colors[a]=="string"&&/[0-9A-F]{6}/.test(r.colors[a])){if(o>=t.length)continue;s=$(r.aColorElements[o]),s.removeClass("color-"+r.colors[a]),r.colors[a]=t[o].toUpperCase(),s.addClass("color-"+r.colors[a]),s.css({background:"#"+r.colors[a]}),s.find("span").first().css({background:"#"+r.colors[a]}),o++}else if(typeof r.colors[a]=="object"&&r.colors[a].effectId!==undefined){if(u>=e.length)continue;s=$(r.aEffectElements[u]),e[u].color=e[u].color.toUpperCase(),r.colors[a].color!==e[u].color&&(s.removeClass("color-"+r.colors[a].color),s.addClass("color-"+e[u].color),s.css({background:"#"+e[u].color}),s.find("span").first().css({background:"#"+e[u].color})),r.colors[a].effectId!==e[u].effectId&&s.attr("effectid",""+e[u].effectId),r.colors[a].effectValue!==e[u].effectValue&&s.attr("effectvalue",""+e[u].effectValue),r.colors[a]=e[u],u++}if(n)this.select(n,!0);else{var f=$(this.el).find("a."+this.selectedCls);f.length&&f.hasClass("palette-color-effect")&&(this.value=f[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=undefined},clearSelection:function(e){$(this.el).find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=undefined},generateColorData:function(e,t,n,r){var i=[],s=e>0&&t>0?e*t:0;if(e>0){i=[this.textThemeColors,"-"];for(var o=0;o<e;o++)i.push({color:"FFFFFF",effectId:1});t>0&&i.push("-");for(var o=0;o<s;o++)i.push({color:"FFFFFF",effectId:1});n&&i.push("-","--","-")}if(n){i.push(this.textStandartColors,"-"),r&&(i.push("transparent"),n--);for(var o=0;o<n;o++)i.push("FFFFFF")}return this.options.dynamiccolors&&(e||n)&&i.push("-","--"),i},textThemeColors:"Theme Colors",textStandartColors:"Standart Colors"},Common.UI.ThemeColorPalette||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){var e,t,n,r,i,s,o=0,u=0,a=function(t){e.setTableSize(Math.ceil((t.offsetX===undefined?t.originalEvent.layerX:t.offsetX*Common.Utils.zoom())/e.itemSize),Math.ceil((t.offsetY===undefined?t.originalEvent.layerY:t.offsetY*Common.Utils.zoom())/e.itemSize),t)},f=function(t){e.setTableSize(0,0,t)},l=function(t){e.trigger("select",e,o,u,t)};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(c){Common.UI.BaseView.prototype.initialize.call(this,c),e=this,t=$(this.el),e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,this.render(),t&&(n=t.find(".dimension-picker-mousecatcher"),r=t.find(".dimension-picker-unhighlighted"),i=t.find(".dimension-picker-highlighted"),s=t.find(".dimension-picker-status"),t.css({width:e.minColumns+"em"}),n.css("z-index",1),n.width(e.maxColumns+"em").height(e.maxRows+"em"),r.width(e.minColumns+"em").height(e.minRows+"em"),s.html(o+" x "+u),s.width(r.width())),n.on("mousemove",a),i.on("mousemove",a),r.on("mousemove",a),n.on("mouseleave",f),i.on("mouseleave",f),r.on("mouseleave",f),n.on("click",l),i.on("click",l),r.on("click",l)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(n,a,f){n>this.maxColumns&&(n=this.maxColumns),a>this.maxRows&&(a=this.maxRows);if(o!=n||u!=a)o=n,u=a,i.width(o+"em").height(u+"em"),r.width((o<e.minColumns?e.minColumns:o+1>e.maxColumns?e.maxColumns:o+1)+"em").height((u<e.minRows?e.minRows:u+1>e.maxRows?e.maxRows:u+1)+"em"),t.width(r.width()),s.html(o+" x "+u),s.width(r.width()),e.trigger("change",e,o,u,f)},getColumnsCount:function(){return o},getRowsCount:function(){return u}}}())});if(Common===undefined)var Common={};var FONT_TYPE_RECENT=4;define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var e=302,t=Asc.FONT_THUMBNAIL_HEIGHT||26,n=window.devicePixelRatio>1,r=document.createElement("canvas"),i=r.getContext("2d"),s="../../../../sdkjs/common/Images/fonts_thumbnail.png",o="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png",u=36;return typeof window["AscDesktopEditor"]=="object"&&(s=window.AscDesktopEditor.getFontsSprite(),o=window.AscDesktopEditor.getFontsSprite(!0)),r.height=n?t*2:t,r.width=n?e*2:e,{template:_.template(['<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(e){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(e,{displayField:"name",scroller:{alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(e.recent)?e.recent:3,Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(e){var t=null;return _.isUndefined(this._input)||(t=this._input.val()),Common.UI.ComboBox.prototype.render.call(this,e),this.setRawValue(t),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this},onAfterKeydownMenu:function(e){var t=this;if(e.keyCode==Common.UI.Keys.RETURN)return $(e.target).closest("input").length?this.lastValue!==this._input.val()&&this._input.trigger("change"):($(e.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur())),!1;if(e.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this._input.val(this.lastValue),setTimeout(function(){t.closeMenu(),t.onAfterHideMenu(e)},10),!1;(e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.BACKSPACE)&&this.isMenuOpen()&&(t._input.focus(),setTimeout(function(){t._input[0].selectionStart=t._input[0].selectionEnd=e.keyCode==Common.UI.Keys.HOME?0:t._input[0].value.length},10)),this.updateVisibleFontsTiles()},onInputKeyUp:function(e){if(e.keyCode!=Common.UI.Keys.RETURN&&e.keyCode!==Common.UI.Keys.SHIFT&&e.keyCode!==Common.UI.Keys.CTRL&&e.keyCode!==Common.UI.Keys.ALT&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB){e.stopPropagation(),this.selectCandidate(e.keyCode==Common.UI.Keys.DELETE||e.keyCode==Common.UI.Keys.BACKSPACE);if(this._selectedItem){var t=this;t._timerSelection===undefined&&(t._timerSelection=setInterval(function(){if(new Date-t._inInputKeyDown<100||!t._selectedItem)return;clearInterval(t._timerSelection),t._timerSelection=undefined;var e=t._input[0],n=t._selectedItem.get(t.displayField),r=e.value;if(t.rendered)if(document.selection)document.selection.createRange().text=n;else if(e.selectionStart||e.selectionStart=="0")e.value=n,e.selectionStart=r.length,e.selectionEnd=n.length},10))}}},onInputKeyDown:function(e){this._inInputKeyDown=new Date;var t=this;e.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){t.closeMenu(),t.onAfterHideMenu(e)},10)):e.keyCode!=Common.UI.Keys.RETURN&&e.keyCode!=Common.UI.Keys.CTRL&&e.keyCode!=Common.UI.Keys.SHIFT&&e.keyCode!=Common.UI.Keys.ALT&&(!this.isMenuOpen()&&!e.ctrlKey&&this.openMenu(),e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var n=e.keyCode==Common.UI.Keys.DOWN?t.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):t.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");n=n.length>0?n.eq(0):e.keyCode==Common.UI.Keys.DOWN?t.cmpEl.find("ul li:not(.divider):first"):t.cmpEl.find("ul li:not(.divider):last"),n=n.find("a"),t._skipInputChange=!0,n.focus(),t.updateVisibleFontsTiles()},10):t._skipInputChange=!1)},onInputChanged:function(e,t){if(t&&t.synthetic)return;if(this._skipInputChange){this._skipInputChange=!1;return}if(this._isMouseDownMenu){this._isMouseDownMenu=!1;return}var n=$(e.target).val(),r={};if(this.lastValue===n){t&&t.onkeydown&&this.trigger("combo:blur",this,e);return}r[this.valueField]=n,r[this.displayField]=n,this.trigger("changed:before",this,r,e);if(e.isDefaultPrevented())return;this._selectedItem?(r[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(r[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(r[this.valueField]),r.isNewFont=!0,this.trigger("selected",this,r,e),this.closeMenu()),this.trigger("changed:after",this,r,e)},getImageUri:function(s){if(s.cloneid){var o=$(this.el).find("ul > li#"+s.cloneid+" img");return o!=null?o[0].src:undefined}return n?(i.clearRect(0,0,e*2,t*2),i.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*2*s.imgidx)):(i.clearRect(0,0,e,t),i.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*s.imgidx)),r.toDataURL()},getImageWidth:function(){return e},getImageHeight:function(){return t},getListItemHeight:function(){return u},loadSprite:function(e){e&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=e,this.spriteThumbs.src=window.devicePixelRatio>1?o:s)},fillFonts:function(e,t){var n=this;this.loadSprite(function(){n.store.set(e.toJSON()),n.rendered=!1,n.render($(n.el)),n._fontsArray=n.store.toJSON(),n.recent>0&&(n.store.on("add",n.onInsertItem,n),n.store.on("remove",n.onRemoveItem,n))})},onApiChangeFont:function(e){var t=_.isFunction(e.get_Name)?e.get_Name():e.asc_getName();if(this.getRawValue()!==t){var n=this.store.findWhere({name:t});$(".selected",$(this.el)).removeClass("selected");if(n){this.setRawValue(n.get(this.displayField));var r=$("#"+n.get("id"),$(this.el)),i=$("ul.dropdown-menu",this.cmpEl);r&&i&&(r.addClass("selected"),this.recent<=0&&i.scrollTop(r.offset().top-i.offset().top))}else this.setRawValue(t)}},itemClicked:function(e){var t=$(e.target).closest("li"),n=this.store.findWhere({id:t.attr("id")});this.addItemToRecent(n),Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments)},onInsertItem:function(e){$(this.el).find("ul").prepend(_.template(['<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:e.attributes,scope:this}))},onRemoveItem:function(e,t,n){$(this.el).find("ul > li#"+e.id).remove()},onBeforeShowMenu:function(e){Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments);if(!this.getSelectedRecord()&&!!this.getRawValue()){var t=this.store.where({name:this.getRawValue()});t&&t.length&&this.selectRecord(t[t.length-1])}},onAfterShowMenu:function(e){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,e)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)},onAfterHideMenu:function(e){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(e){if(e.get("type")!=FONT_TYPE_RECENT&&!this.store.findWhere({name:e.get("name"),type:FONT_TYPE_RECENT})){var t=this.store.where({type:FONT_TYPE_RECENT});t.length<this.recent||this.store.remove(t[this.recent-1]);var n=e.clone();n.set({type:FONT_TYPE_RECENT,id:Common.UI.getId(),cloneid:e.id}),this.store.add(n,{at:0})}},selectCandidate:function(e){var t=this,n=this._input.val().toLowerCase();this._fontsArray||(this._fontsArray=this.store.toJSON());var r=_.find(this._fontsArray,function(r){return e?r[t.displayField].toLowerCase()==n:r[t.displayField].toLowerCase().indexOf(n)==0});r?this._selectedItem=this.store.findWhere({id:r.id}):this._selectedItem=null,$(".selected",$(this.el)).removeClass("selected");if(this._selectedItem){var i=$("#"+this._selectedItem.get("id"),$(this.el)),s=$("ul[role=menu]",$(this.el));if(i.length>0&&s.length>0){i.addClass("selected");var o=i.position().top,u=s.scrollTop();o!=0&&s.scrollTop(u+o)}}},updateVisibleFontsTiles:function(r,i){var s=this,o=0,a=s.store.length,f=0;s.tiles||(s.tiles=[]);if(a!==s.tiles.length)for(o=s.tiles.length;o<a;++o)s.tiles.unshift(null);_.isUndefined(i)&&(i=parseInt($(s.el).find(".ps-scrollbar-x-rail").css("bottom")));var l=$(s.el).find(".dropdown-menu").height(),c=Math.max(Math.floor(l/u)+3,0),h=Math.max(Math.floor(-(i/u))-1,0),p=h+c,d=$(s.el).find("a");for(o=0;o<a;++o)if(h<=o&&o<p){if(null===s.tiles[o]){var v=document.createElement("canvas"),m=v.getContext("2d");v.height=n?t*2:t,v.width=n?e*2:e,v.style.width=e+"px",v.style.height=t+"px",f=s.store.at(o).get("imgidx"),n?(m.clearRect(0,0,e*2,t*2),m.drawImage(s.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*2*f)):(m.clearRect(0,0,e,t),m.drawImage(s.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*f)),s.tiles[o]=v,$(d[o]).get(0).appendChild(v)}}else s.tiles[o]&&(s.tiles[o].parentNode.removeChild(s.tiles[o]),s.tiles[o]=null)},flushVisibleFontsTiles:function(){for(var e=this.tiles.length-1;e>=0;--e)this.tiles[e]&&(this.tiles[e].parentNode.removeChild(this.tiles[e]),this.tiles[e]=null)}}}())});if(Common===undefined)var Common={};define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0},template:_.template(['<div id="<%= id %>" class="combo-dataview <%= cls %>" style="<%= style %>">','<div class="view"></div> ','<div class="button"></div> ',"</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['<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>')}]})}),this.options.additionalMenuItems!=null&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,itemTemplate:_.template(['<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(e){if(!this.rendered){var t=this;t.trigger("render:before",t),t.cmpEl=$(t.el);var n=t.template({id:t.id,cls:t.cls,style:t.style});e?(t.setElement(e,!1),t.cmpEl=$(n),e.html(t.cmpEl)):t.cmpEl.html(n),t.rootWidth=t.cmpEl.width(),t.rootHeight=t.cmpEl.height(),t.fieldPicker.render($(".view",t.cmpEl)),t.openButton.render($(".button",t.cmpEl)),t.menuPicker.render($(".menu-picker-container",t.cmpEl)),t.openButton.menu.cmpEl&&t.openButton.menu.cmpEl&&(t.openButton.menu.menuAlignEl=t.cmpEl,t.openButton.menu.cmpEl.css("min-width",t.itemWidth),t.openButton.menu.on("show:before",_.bind(t.onBeforeShowMenu,t)),t.openButton.menu.on("show:after",_.bind(t.onAfterShowMenu,t)),t.openButton.cmpEl.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),t.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t))),t.options.hint&&(t.cmpEl.attr("data-toggle","tooltip"),t.cmpEl.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"})),t.fieldPicker.on("item:select",_.bind(t.onFieldPickerSelect,t)),t.menuPicker.on("item:select",_.bind(t.onMenuPickerSelect,t)),t.fieldPicker.on("item:click",_.bind(t.onFieldPickerClick,t)),t.menuPicker.on("item:click",_.bind(t.onMenuPickerClick,t)),t.fieldPicker.on("item:contextmenu",_.bind(t.onPickerItemContextMenu,t)),t.menuPicker.on("item:contextmenu",_.bind(t.onPickerItemContextMenu,t)),t.fieldPicker.el.addEventListener("contextmenu",_.bind(t.onPickerComboContextMenu,t),!1),t.menuPicker.el.addEventListener("contextmenu",_.bind(t.onPickerComboContextMenu,t),!1),t.onResize(),t.rendered=!0,t.trigger("render:after",t)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var e=this,t=this.cmpEl.width(),n=this.cmpEl.height();if(this.rootWidth!=t||this.rootHeight!=n)this.rootWidth=t,this.rootHeight=n,setTimeout(function(){e.openButton.menu.cmpEl.outerWidth(),e.rootWidth=e.cmpEl.width()},10),this.onResize()}},onResize:function(){if(this.openButton){var e=$("button",this.openButton.cmpEl);e&&e.css({width:$(".button",this.cmpEl).width(),height:$(".button",this.cmpEl).height()}),this.openButton.menu.hide();var t=this.menuPicker;if(t){var n=t.getSelectedRec();n&&(n=n[0],this.fillComboView(n||t.store.at(0),!!n,!0)),t.onResize()}}this.isSuspendEvents||this.trigger("resize",this)},onBeforeShowMenu:function(e){var t=this;if(_.isFunction(t.beforeOpenHandler))t.beforeOpenHandler(t,e);else if(t.openButton.menu.cmpEl){var n=0;try{var r=$($(".dropdown-menu .dataview.inner .style",t.cmpEl)[0]);n=r?parseInt(r.css("margin-left"))+parseInt(r.css("margin-right")):0}catch(e){}t.openButton.menu.cmpEl.css({width:Math.round((t.cmpEl.width()+n*t.fieldPicker.store.length)/t.itemWidth-.2)*(t.itemWidth+n),"min-height":this.cmpEl.height()})}if(t.options.hint){var i=t.cmpEl.data("bs.tooltip");i&&(i.dontShow===undefined&&(i.dontShow=!0),i.hide())}this.menuPicker.selectedBeforeHideRec=null},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault();if(this.isStylesNotClosable)return!1},onAfterShowMenu:function(e){var t=this;t.menuPicker.scroller&&t.menuPicker.scroller.update({includePadding:!0,suppressScrollX:!0,alwaysVisibleY:!0})},onAfterHideMenu:function(e,t){this.menuPicker.selectedBeforeHideRec=this.menuPicker.getSelectedRec()[0],this.showLast?this.menuPicker.showLastSelected():this.menuPicker.deselectAll(),this.trigger("hide:after",this,e,t)},onFieldPickerSelect:function(e,t,n){},onMenuPickerSelect:function(e,t,n,r){this.needFillComboView=this.disabled;if(this.disabled||r===!0)return;this.fillComboView(n,!1),n&&!this.isSuspendEvents&&this.trigger("select",this,n)},onFieldPickerClick:function(e,t,n){if(this.disabled)return;this.isSuspendEvents||this.trigger("click",this,n);if(this.options.hint){var r=this.cmpEl.data("bs.tooltip");r&&(r.dontShow===undefined&&(r.dontShow=!0),r.hide())}this.showLast||this.fieldPicker.deselectAll()},onMenuPickerClick:function(e,t,n){if(this.disabled)return;this.isSuspendEvents||this.trigger("click",this,n)},onPickerItemContextMenu:function(e,t,n,r){if(this.disabled)return;return this.isSuspendEvents||this.trigger("contextmenu",this,n,r),r.preventDefault(),r.stopPropagation(),!1},onPickerComboContextMenu:function(e){if(this.disabled)return;this.isSuspendEvents||this.trigger("contextmenu",this,undefined,e)},setDisabled:function(e){this.disabled=e;if(!this.rendered)return;this.cmpEl.toggleClass("disabled",e),$("button",this.openButton.cmpEl).toggleClass("disabled",e),this.fieldPicker.setDisabled(e);if(this.needFillComboView&&!e){var t=this.menuPicker;if(t){var n=t.getSelectedRec();n&&(n=n[0],this.fillComboView(n||t.store.at(0),!1))}}},isDisabled:function(){return this.disabled},fillComboView:function(e,t,n){if(!_.isUndefined(e)&&e instanceof Backbone.Model){this.needFillComboView=!1;var r=this,i=r.menuPicker.store,s=$(r.fieldPicker.el);if(i){if(n||!r.fieldPicker.store.findWhere({id:e.get("id")})){if(r.itemMarginLeft===undefined){var o=$($(this.menuPicker.el).find(".inner > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);o.length>0&&(r.itemMarginLeft=parseInt(o.css("margin-left")),r.itemMarginRight=parseInt(o.css("margin-right")),r.itemPaddingLeft=parseInt(o.css("padding-left")),r.itemPaddingRight=parseInt(o.css("padding-right")),r.itemBorderLeft=parseInt(o.css("border-left-width")),r.itemBorderRight=parseInt(o.css("border-right-width")))}r.fieldPicker.store.reset([]);var u=i.indexOf(e),a=i.length,f=Math.floor(s.width()/(r.itemWidth+(r.itemMarginLeft||0)+(r.itemMarginRight||0)+(r.itemPaddingLeft||0)+(r.itemPaddingRight||0)+(r.itemBorderLeft||0)+(r.itemBorderRight||0))),l=[];s.height()/r.itemHeight>2&&(f*=Math.floor(s.height()/r.itemHeight));if(u<0)return;u=Math.floor(u/f)*f,a-u<f&&(u=Math.max(a-f,0));for(var c=u,h=0;c<a&&h<f;c++,h++)l.push(i.at(c));r.fieldPicker.store.add(l)}if(t){var p=r.fieldPicker.store.findWhere({id:e.get("id")});p&&(r.suspendEvents(),r.fieldPicker.selectRecord(p,!0),r.resumeEvents())}}}},selectByIndex:function(e){e<0&&this.fieldPicker.deselectAll(),this.menuPicker.selectByIndex(e)},setItemWidth:function(e){this.itemWidth!=e&&(this.itemWidth=window.devicePixelRatio>1?e/2:e)},setItemHeight:function(e){this.itemHeight!=e&&(this.itemHeight=window.devicePixelRatio>1?e/2:e)},removeTips:function(){var e=this.menuPicker;_.each(e.dataViewItems,function(e){var t=e.$el.data("bs.tooltip");t&&t.tip().remove()},e)}})});if(Common===undefined)var Common={};define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){var e;return{options:{target:$(document.body),text:"",placement:"right"},template:_.template(['<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(e){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,e),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.placement=this.options.placement},render:function(){return e=$(this.template({scope:this})),e.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),e.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this)),$(document.body).append(e),this.applyPlacement(),this},show:function(){e?(this.applyPlacement(),e.show()):this.render()},hide:function(){e&&e.hide()},applyPlacement:function(){var t=this.target.offset();this.placement=="top"?e.css({bottom:Common.Utils.innerHeight()-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"}):e.css({top:t.top+this.target.height()/2+"px",left:t.left+this.target.width()+"px"})},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.<br/>Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("presentationeditor/main/app/view/Toolbar",["backbone","text!presentationeditor/main/app/template/Toolbar.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip"],function(e,t){"use strict";PE.enumLock={paragraphLock:"para-lock",shapeLock:"shape-lock",slideLock:"slide-lock",slideDeleted:"slide-deleted",noSlides:"no-slides",lostConnect:"disconnect",incIndentLock:"can-inc-indent",decIndentLock:"can-dec-indent",hyperlinkLock:"can-hyperlink",undoLock:"can-undo",redoLock:"can-redo",docPropsLock:"doc-props-lock",themeLock:"theme-lock",menuFileOpen:"menu-file-open",noParagraphSelected:"no-paragraph",noObjectSelected:"no-object",disableOnStart:"on-start",cantPrint:"cant-print",noTextSelected:"no-text",inEquation:"in-equation"},PE.Views.Toolbar=e.View.extend(_.extend({el:"#toolbar",template:_.template(t),events:{},initialize:function(){var e=this;e.paragraphControls=[],e.shapeControls=[],e.slideOnlyControls=[],e.synchTooltip=undefined,e.schemeNames=[e.txtScheme1,e.txtScheme2,e.txtScheme3,e.txtScheme4,e.txtScheme5,e.txtScheme6,e.txtScheme7,e.txtScheme8,e.txtScheme9,e.txtScheme10,e.txtScheme11,e.txtScheme12,e.txtScheme13,e.txtScheme14,e.txtScheme15,e.txtScheme16,e.txtScheme17,e.txtScheme18,e.txtScheme19,e.txtScheme20,e.txtScheme21],e._state={hasCollaborativeChanges:undefined},e.btnSaveCls="btn-save",e.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S");var t=PE.enumLock;e.btnNewDocument=new Common.UI.Button({id:"id-toolbar-btn-newdocument",cls:"btn-toolbar",iconCls:"btn-newdocument",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides]}),e.paragraphControls.push(e.btnNewDocument),e.btnOpenDocument=new Common.UI.Button({id:"id-toolbar-btn-opendocument",cls:"btn-toolbar",iconCls:"btn-opendocument",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides]}),e.paragraphControls.push(e.btnOpenDocument),e.btnAddSlide=new Common.UI.Button({id:"id-toolbar-button-add-slide",cls:"btn-toolbar",iconCls:"btn-addslide",split:!0,lock:[t.menuFileOpen,t.slideDeleted,t.lostConnect,t.disableOnStart],menu:!0}),e.slideOnlyControls.push(e.btnAddSlide),e.btnChangeSlide=new Common.UI.Button({id:"id-toolbar-button-change-slide",cls:"btn-toolbar",iconCls:"btn-changeslide",lock:[t.menuFileOpen,t.slideDeleted,t.slideLock,t.lostConnect,t.noSlides,t.disableOnStart],menu:!0}),e.slideOnlyControls.push(e.btnChangeSlide),e.btnPreview=new Common.UI.Button({id:"id-toolbar-button-preview",cls:"btn-toolbar",iconCls:"btn-preview",lock:[t.menuFileOpen,t.slideDeleted,t.noSlides,t.disableOnStart],split:!0,menu:new Common.UI.Menu({items:[{caption:this.textShowBegin,value:0},{caption:this.textShowCurrent,value:1},{caption:"--"},e.mnuShowSettings=new Common.UI.MenuItem({caption:this.textShowSettings,value:2,lock:[t.lostConnect]})]})}),e.slideOnlyControls.push(e.btnPreview),e.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print",lock:[t.slideDeleted,t.noSlides,t.cantPrint]}),e.paragraphControls.push(e.btnPrint),e.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:e.btnSaveCls,lock:[t.lostConnect]}),e.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo",lock:[t.undoLock,t.slideDeleted,t.lostConnect,t.disableOnStart]}),e.slideOnlyControls.push(e.btnUndo),e.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo",lock:[t.redoLock,t.slideDeleted,t.lostConnect,t.disableOnStart]}),e.slideOnlyControls.push(e.btnRedo),e.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart]}),e.slideOnlyControls.push(e.btnCopy),e.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides]}),e.paragraphControls.push(e.btnPaste),e.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:e.tipFontName,lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],store:new Common.Collections.Fonts}),e.paragraphControls.push(e.cmbFontName),e.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:e.tipFontSize,lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],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"}]}),e.paragraphControls.push(e.cmbFontSize),e.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],enableToggle:!0}),e.paragraphControls.push(e.btnBold),e.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],enableToggle:!0}),e.paragraphControls.push(e.btnItalic),e.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],enableToggle:!0}),e.paragraphControls.push(e.btnUnderline),e.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"btn-strikeout",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],enableToggle:!0}),e.paragraphControls.push(e.btnStrikeout),e.btnSuperscript=new Common.UI.Button({id:"id-toolbar-btn-superscript",cls:"btn-toolbar",iconCls:"btn-superscript",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock,t.inEquation],enableToggle:!0,toggleGroup:"superscriptGroup"}),e.paragraphControls.push(e.btnSuperscript),e.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"btn-subscript",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock,t.inEquation],enableToggle:!0,toggleGroup:"superscriptGroup"}),e.paragraphControls.push(e.btnSubscript),e.btnFontColor=(new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noTextSelected,t.shapeLock],split:!0,menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-toolbar-menu-new-fontcolor" style="padding-left:12px;">'+e.textNewColor+"</a>")}]})})).on("render:after",function(t){var n=$('<div class="btn-color-value-line"></div>');$("button:first-child",t.cmpEl).append(n),n.css("background-color",t.currentColor||"transparent"),e.mnuFontColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-fontcolor")})}),e.paragraphControls.push(e.btnFontColor),e.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clearstyle",cls:"btn-toolbar",iconCls:"btn-clearstyle",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected]}),e.paragraphControls.push(e.btnClearStyle),e.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.noParagraphSelected,t.disableOnStart],enableToggle:!0}),e.slideOnlyControls.push(e.btnCopyStyle),e.btnMarkers=new Common.UI.Button({id:"id-toolbar-btn-markers",cls:"btn-toolbar",iconCls:"btn-setmarkers",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected],enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),e.paragraphControls.push(e.btnMarkers),e.btnNumbers=new Common.UI.Button({id:"id-toolbar-btn-numbering",cls:"btn-toolbar",iconCls:"btn-numbering",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected],enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),e.paragraphControls.push(e.btnNumbers);var n=function(e){var t={};for(var r in e)t[r]=typeof e[r]=="object"?n(e[r]):e[r];return t};return this.mnuMarkersPicker={conf:{index:0},selectByIndex:function(e){this.conf.index=e}},this.mnuNumbersPicker=n(this.mnuMarkersPicker),e.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected],menu:new Common.UI.Menu({items:[{caption:e.textAlignLeft+Common.Utils.String.platformKey("Ctrl+L"),iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,toggleGroup:"halignGroup",checked:!0,value:1},{caption:e.textAlignCenter+Common.Utils.String.platformKey("Ctrl+E"),iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,toggleGroup:"halignGroup",value:2},{caption:e.textAlignRight+Common.Utils.String.platformKey("Ctrl+R"),iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,toggleGroup:"halignGroup",value:0},{caption:e.textAlignJust+Common.Utils.String.platformKey("Ctrl+J"),iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,toggleGroup:"halignGroup",value:3}]})}),e.paragraphControls.push(e.btnHorizontalAlign),e.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected],iconCls:"btn-align-middle",icls:"btn-align-middle",menu:new Common.UI.Menu({items:[{caption:e.textAlignTop,iconCls:"mnu-align-top",icls:"btn-align-top",checkable:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Top},{caption:e.textAlignMiddle,iconCls:"mnu-align-middle",icls:"btn-align-middle",checkable:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Center,checked:!0},{caption:e.textAlignBottom,iconCls:"mnu-align-bottom",icls:"btn-align-bottom",checkable:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Bottom}]})}),e.paragraphControls.push(e.btnVerticalAlign),e.btnDecLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-decoffset",cls:"btn-toolbar",iconCls:"btn-decoffset",lock:[t.decIndentLock,t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected]}),e.paragraphControls.push(e.btnDecLeftOffset),e.btnIncLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-incoffset",cls:"btn-toolbar",iconCls:"btn-incoffset",lock:[t.incIndentLock,t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected]}),e.paragraphControls.push(e.btnIncLeftOffset),e.btnLineSpace=new Common.UI.Button({id:"id-toolbar-btn-linespace",cls:"btn-toolbar",iconCls:"btn-linespace",lock:[t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected],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"}]})}),e.paragraphControls.push(e.btnLineSpace),e.btnInsertTable=(new Common.UI.Button({id:"id-toolbar-btn-inserttable",cls:"btn-toolbar",iconCls:"btn-inserttable",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],menu:new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-tablepicker" class="dimension-picker" style="margin: 5px 10px;"></div>')},{caption:e.mniCustomTable,value:"custom"}]})})).on("render:after",function(t){e.mnuTablePicker=new Common.UI.DimensionPicker({el:$("#id-toolbar-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10})}),e.slideOnlyControls.push(e.btnInsertTable),e.btnInsertImage=new Common.UI.Button({id:"id-toolbar-btn-insertimage",cls:"btn-toolbar",iconCls:"btn-insertimage",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],menu:new Common.UI.Menu({items:[{caption:e.mniImageFromFile,value:"file"},{caption:e.mniImageFromUrl,value:"url"}]})}),e.slideOnlyControls.push(e.btnInsertImage),e.btnInsertChart=(new Common.UI.Button({id:"id-toolbar-btn-insertchart",cls:"btn-toolbar",iconCls:"btn-insertchart",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:_.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})})).on("render:after",function(t){e.mnuInsertChartPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insertchart"),parentMenu:t.menu,showLast:!1,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn,headername:e.textCharts},{id:"menu-chart-group-line",caption:e.textLine},{id:"menu-chart-group-pie",caption:e.textPie},{id:"menu-chart-group-hbar",caption:e.textBar},{id:"menu-chart-group-area",caption:e.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:e.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:e.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,allowSelected:!0,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,allowSelected:!0,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,allowSelected:!0,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,allowSelected:!0,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,allowSelected:!0,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,allowSelected:!0,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,allowSelected:!0,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,allowSelected:!0,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,allowSelected:!0,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,allowSelected:!0,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,allowSelected:!0,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,allowSelected:!0,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,allowSelected:!0,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,allowSelected:!0,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,allowSelected:!0,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,allowSelected:!0,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,allowSelected:!0,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,allowSelected:!0,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,allowSelected:!0,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,allowSelected:!0,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,allowSelected:!0,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,allowSelected:!0,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,allowSelected:!0,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,allowSelected:!0,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,allowSelected:!0,iconCls:"stock-normal"}]),itemTemplate:_.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),e.slideOnlyControls.push(e.btnInsertChart),e.btnInsertText=new Common.UI.Button({id:"id-toolbar-btn-inserttext",cls:"btn-toolbar",iconCls:"btn-inserttext",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],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:_.template('<div id="id-toolbar-menu-insart" style="width: 239px; margin-left: 5px;"></div>')}]})})]})}),e.slideOnlyControls.push(e.btnInsertText),this.btnInsertEquation=new Common.UI.Button({id:"id-toolbar-btn-insertequation",cls:"btn-toolbar",iconCls:"btn-insertequation",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],split:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.slideOnlyControls.push(this.btnInsertEquation),e.btnInsertHyperlink=new Common.UI.Button({id:"id-toolbar-btn-inserthyperlink",cls:"btn-toolbar",iconCls:"btn-inserthyperlink",lock:[t.hyperlinkLock,t.slideDeleted,t.paragraphLock,t.lostConnect,t.noSlides,t.noParagraphSelected]}),e.paragraphControls.push(e.btnInsertHyperlink),e.btnInsertShape=new Common.UI.Button({id:"id-toolbar-btn-insertshape",cls:"btn-toolbar",iconCls:"btn-insertshape",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],enableToggle:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),e.slideOnlyControls.push(e.btnInsertShape),e.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",lock:[t.themeLock,t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],menu:(new Common.UI.Menu({items:[],maxHeight:600,restoreHeight:600})).on("show:before",function(e){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(e,t){var n=$(this.el).find(".dropdown-menu "),r=Common.Utils.innerHeight(),i=n.outerHeight(),s=parseInt(n.css("top"));i>r?(n.css("max-height",r-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(r-parseInt(n.css("padding-top"))-parseInt(n.css("padding-bottom"))-5,this.options.restoreHeight)+"px"),i=n.outerHeight(),s+i>r&&n.css("top",0),this.scroller.update({minScrollbarLength:40}))})}),e.slideOnlyControls.push(e.btnColorSchemas),e.btnHide=new Common.UI.Button({id:"id-toolbar-btn-hidebars",cls:"btn-toolbar",iconCls:"btn-hidebars",lock:[t.menuFileOpen,t.slideDeleted,t.disableOnStart],menu:!0}),e.slideOnlyControls.push(e.btnHide),this.btnFitPage={conf:{checked:!1},setChecked:function(e){this.conf.checked=e},isChecked:function(){return this.conf.checked}},this.btnFitWidth=n(this.btnFitPage),this.mnuZoom={options:{value:100}},e.btnAdvSettings=new Common.UI.Button({id:"id-toolbar-btn-settings",cls:"btn-toolbar",iconCls:"btn-settings",lock:[t.slideDeleted,t.disableOnStart]}),e.slideOnlyControls.push(e.btnAdvSettings),e.btnShapeAlign=new Common.UI.Button({id:"id-toolbar-btn-shape-align",cls:"btn-toolbar",iconCls:"btn-align-shape",lock:[t.slideDeleted,t.shapeLock,t.lostConnect,t.noSlides,t.noObjectSelected,t.disableOnStart],menu:new Common.UI.Menu({items:[{caption:e.textShapeAlignLeft,iconCls:"mnu-shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT},{caption:e.textShapeAlignCenter,iconCls:"mnu-shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER},{caption:e.textShapeAlignRight,iconCls:"mnu-shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT},{caption:e.textShapeAlignTop,iconCls:"mnu-shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP},{caption:e.textShapeAlignMiddle,iconCls:"mnu-shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE},{caption:e.textShapeAlignBottom,iconCls:"mnu-shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM},{caption:"--"},{caption:e.txtDistribHor,iconCls:"mnu-distrib-hor",value:6},{caption:e.txtDistribVert,iconCls:"mnu-distrib-vert",value:7}]})}),e.shapeControls.push(e.btnShapeAlign),e.slideOnlyControls.push(e.btnShapeAlign),e.btnShapeArrange=new Common.UI.Button({id:"id-toolbar-btn-shape-arrange",cls:"btn-toolbar",iconCls:"btn-arrange-shape",lock:[t.slideDeleted,t.lostConnect,t.noSlides,t.noObjectSelected,t.disableOnStart],menu:new Common.UI.Menu({items:[{caption:e.textArrangeFront,iconCls:"mnu-arrange-front",value:1},{caption:e.textArrangeBack,iconCls:"mnu-arrange-back",value:2},{caption:e.textArrangeForward,iconCls:"mnu-arrange-forward",value:3},{caption:e.textArrangeBackward,iconCls:"mnu-arrange-backward",value:4},{caption:"--"},e.mnuGroupShapes=new Common.UI.MenuItem({caption:e.txtGroup,iconCls:"mnu-group",value:5}),e.mnuUnGroupShapes=new Common.UI.MenuItem({caption:e.txtUngroup,iconCls:"mnu-ungroup",value:6})]})}),e.slideOnlyControls.push(e.btnShapeArrange),e.btnSlideSize=new Common.UI.Button({id:"id-toolbar-btn-slide-size",cls:"btn-toolbar",iconCls:"btn-slidesize",lock:[t.docPropsLock,t.slideDeleted,t.lostConnect,t.noSlides,t.disableOnStart],menu:new Common.UI.Menu({items:[{caption:e.mniSlideStandard,checkable:!0,toggleGroup:"slidesize",value:0},{caption:e.mniSlideWide,checkable:!0,toggleGroup:"slidesize",value:1},{caption:"--"},{caption:e.mniSlideAdvanced,value:"advanced"}]})}),e.slideOnlyControls.push(e.btnSlideSize),e.listTheme=new Common.UI.ComboDataView({cls:"combo-styles",itemWidth:85,enableKeyEvents:!0,itemHeight:38,hint:this.tipSlideTheme,lock:[t.themeLock,t.lostConnect,t.noSlides],beforeOpenHandler:function(e){var t=this,n=t.openButton.menu,r=6;if(n.cmpEl){var i=$(t.cmpEl.find(".dataview.inner .style").get(0)).parent(),s=-1,o=i.is(":visible")?parseInt(i.css("width")):t.itemWidth+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right"))+parseInt(i.css("border-left-width"))+parseInt(i.css("border-right-width")),u=t.menuPicker.store.length>=r?r:t.menuPicker.store.length,a=Math.min(t.menuPicker.store.length,Math.round($(".dataview",$(t.fieldPicker.el)).width()/(s+o)+.5));a=a<u?u:a,n.menuAlignEl=t.cmpEl,n.menuAlign="tl-tl";var f=t.cmpEl.width()-t.openButton.$el.width()-a*(s+o)-1;n.setOffset(Math.min(f,0)),n.cmpEl.css({width:a*(o+s),"min-height":t.cmpEl.height()})}t.menuPicker.scroller&&t.menuPicker.scroller.update({includePadding:!0,suppressScrollX:!0})}}),e.listTheme.fieldPicker.itemTemplate=_.template(['<div class="style" id="<%= id %>">','<div style="background-image: url(<%= imageUrl %>); width: '+e.listTheme.itemWidth+"px; height: "+e.listTheme.itemHeight+'px;"/>',"</div>"].join("")),e.listTheme.menuPicker.itemTemplate=_.template(['<div class="style" id="<%= id %>">','<div style="background-image: url(<%= imageUrl %>); width: '+e.listTheme.itemWidth+"px; height: "+e.listTheme.itemHeight+'px;"/>',"</div>"].join("")),this.lockControls=[this.btnNewDocument,this.btnOpenDocument,this.btnAddSlide,this.btnChangeSlide,this.btnSave,this.btnCopy,this.btnPaste,this.btnUndo,this.btnRedo,this.cmbFontName,this.cmbFontSize,this.btnBold,this.btnItalic,this.btnUnderline,this.btnStrikeout,this.btnSuperscript,this.btnSubscript,this.btnFontColor,this.btnClearStyle,this.btnCopyStyle,this.btnMarkers,this.btnNumbers,this.btnDecLeftOffset,this.btnIncLeftOffset,this.btnLineSpace,this.btnHorizontalAlign,this.btnVerticalAlign,this.btnShapeArrange,this.btnShapeAlign,this.btnInsertTable,this.btnInsertImage,this.btnInsertChart,this.btnInsertText,this.btnInsertEquation,this.btnInsertHyperlink,this.btnInsertShape,this.btnColorSchemas,this.btnSlideSize,this.listTheme,this.mnuShowSettings],_.each([e.btnSave].concat(e.paragraphControls),function(e){_.isFunction(e.setDisabled)&&e.setDisabled(!0)}),this.lockToolbar(PE.enumLock.disableOnStart,!0,{array:e.slideOnlyControls.concat(e.shapeControls)}),this},lockToolbar:function(e,t,n){function i(e,n){if(_.contains(e.options.lock,n)){var r=e.keepState.indexOf(n);t?r<0&&e.keepState.push(n):r<0||e.keepState.splice(r,1)}}!n&&(n={});var r=n.array||this.lockControls;n.merge&&(r=_.union(this.lockControls,r)),_.each(r,function(t){_.isFunction(t.setDisabled)&&(!t.keepState&&(t.keepState=[]),n.clear&&n.clear.length>0&&t.keepState.length>0&&(t.keepState=_.difference(t.keepState,n.clear)),_.isArray(e)?_.each(e,function(e){i(t,e)}):i(t,e),t.keepState.length>0?!t.isDisabled()&&t.setDisabled(!0):t.isDisabled()&&t.setDisabled(!1))})},render:function(e){var t=this,n=$(this.el);this.trigger("render:before",this);var r=Common.localStorage.getItem("pe-compact-toolbar"),i=!!(r!==null&&parseInt(r)==1||r===null&&e.customization&&e.customization.compactToolbar);return n.html(this.template({isCompactView:i})),t.rendererComponents(i?"short":"full"),t.isCompactView=i,this.trigger("render:after",this),this},rendererComponents:function(e){var t=e==="short"?"short":"full",n=function(e,t){var n=$(e),r=n.get(0);r&&t&&(t.rendered?(t.el=document.getElementById(t.id),r.appendChild(document.getElementById(t.id))):t.render(n))};n("#id-toolbar-"+t+"-placeholder-field-fontname",this.cmbFontName),n("#id-toolbar-"+t+"-placeholder-field-fontsize",this.cmbFontSize),n("#id-toolbar-"+t+"-placeholder-btn-newdocument",this.btnNewDocument),n("#id-toolbar-"+t+"-placeholder-btn-opendocument",this.btnOpenDocument),n("#id-toolbar-"+t+"-placeholder-btn-addslide",this.btnAddSlide),e==="short"?$("button",this.btnAddSlide.cmpEl).removeClass("large"):$("button",this.btnAddSlide.cmpEl).addClass("large"),n("#id-toolbar-"+t+"-placeholder-btn-changeslide",this.btnChangeSlide),n("#id-toolbar-"+t+"-placeholder-btn-preview",this.btnPreview),n("#id-toolbar-"+t+"-placeholder-btn-print",this.btnPrint),n("#id-toolbar-"+t+"-placeholder-btn-save",this.btnSave),n("#id-toolbar-"+t+"-placeholder-btn-undo",this.btnUndo),n("#id-toolbar-"+t+"-placeholder-btn-redo",this.btnRedo),n("#id-toolbar-"+t+"-placeholder-btn-copy",this.btnCopy),n("#id-toolbar-"+t+"-placeholder-btn-paste",this.btnPaste),n("#id-toolbar-"+t+"-placeholder-btn-bold",this.btnBold),n("#id-toolbar-"+t+"-placeholder-btn-italic",this.btnItalic),n("#id-toolbar-"+t+"-placeholder-btn-underline",this.btnUnderline),n("#id-toolbar-"+t+"-placeholder-btn-strikeout",this.btnStrikeout),n("#id-toolbar-"+t+"-placeholder-btn-superscript",this.btnSuperscript),n("#id-toolbar-"+t+"-placeholder-btn-subscript",this.btnSubscript),n("#id-toolbar-"+t+"-placeholder-btn-fontcolor",this.btnFontColor),n("#id-toolbar-"+t+"-placeholder-btn-clearstyle",this.btnClearStyle),n("#id-toolbar-"+t+"-placeholder-btn-copystyle",this.btnCopyStyle),n("#id-toolbar-"+t+"-placeholder-btn-markers",this.btnMarkers),n("#id-toolbar-"+t+"-placeholder-btn-numbering",this.btnNumbers),n("#id-toolbar-"+t+"-placeholder-btn-incoffset",this.btnIncLeftOffset),n("#id-toolbar-"+t+"-placeholder-btn-decoffset",this.btnDecLeftOffset),n("#id-toolbar-"+t+"-placeholder-btn-halign",this.btnHorizontalAlign),n("#id-toolbar-"+t+"-placeholder-btn-valign",this.btnVerticalAlign),n("#id-toolbar-"+t+"-placeholder-btn-linespace",this.btnLineSpace),n("#id-toolbar-"+t+"-placeholder-btn-arrange-shape",this.btnShapeArrange),n("#id-toolbar-"+t+"-placeholder-btn-align-shape",this.btnShapeAlign),n("#id-toolbar-"+t+"-placeholder-btn-insertshape",this.btnInsertShape),n("#id-toolbar-"+t+"-placeholder-btn-inserttext",this.btnInsertText),n("#id-toolbar-"+t+"-placeholder-btn-insertequation",this.btnInsertEquation),n("#id-toolbar-"+t+"-placeholder-btn-inserthyperlink",this.btnInsertHyperlink),n("#id-toolbar-"+t+"-placeholder-btn-inserttable",this.btnInsertTable),n("#id-toolbar-"+t+"-placeholder-btn-insertimage",this.btnInsertImage),n("#id-toolbar-"+t+"-placeholder-btn-insertchart",this.btnInsertChart),n("#id-toolbar-"+t+"-placeholder-btn-colorschemas",this.btnColorSchemas),n("#id-toolbar-"+t+"-placeholder-btn-slidesize",this.btnSlideSize),n("#id-toolbar-full-placeholder-field-styles",this.listTheme),n("#id-toolbar-"+t+"-placeholder-btn-hidebars",this.btnHide),n("#id-toolbar-"+t+"-placeholder-btn-settings",this.btnAdvSettings),n("#id-toolbar-full-placeholder-field-styles",this.listTheme)},createDelayedElements:function(){this.btnNewDocument.updateHint(this.tipNewDocument),this.btnOpenDocument.updateHint(this.tipOpenDocument),this.btnAddSlide.updateHint(this.tipAddSlide+Common.Utils.String.platformKey("Ctrl+M")),this.btnChangeSlide.updateHint(this.tipChangeSlide),this.btnPreview.updateHint(this.tipPreview),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.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.btnFontColor.updateHint(this.tipFontColor),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnVerticalAlign.updateHint(this.tipVAligh),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnHide.updateHint(this.tipViewSettings),this.btnAdvSettings.updateHint(this.tipAdvSettings),this.btnShapeAlign.updateHint(this.tipShapeAlign),this.btnShapeArrange.updateHint(this.tipShapeArrange),this.btnSlideSize.updateHint(this.tipSlideSize);var e=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:_.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&&this.mode.customization.header===!1)&&this.mnuitemHideTitleBar.hide(),this.mode.canBrandingExt&&this.mode.customization&&this.mode.customization.statusBar===!1&&this.mnuitemHideStatusBar.hide(),this.mnuZoomOut=new Common.UI.Button({el:$("#id-menu-zoom-out"),cls:"btn-toolbar"}),this.mnuZoomIn=new Common.UI.Button({el:$("#id-menu-zoom-in"),cls:"btn-toolbar"}),this.btnMarkers.setMenu(new Common.UI.Menu({items:[{template:_.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:_.template('<div id="id-toolbar-menu-numbering" class="menu-markers" style="width: 330px; margin: 0 5px;"></div>')}]})),this.btnAddSlide.setMenu(new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-addslide" class="menu-layouts" style="width: 302px; margin: 0 4px;"></div>')}]})),this.btnChangeSlide.setMenu(new Common.UI.Menu({items:[{template:_.template('<div id="id-toolbar-menu-changeslide" class="menu-layouts" style="width: 302px; margin: 0 4px;"></div>')}]}));var t=this.mnuMarkersPicker.conf;this.mnuMarkersPicker=new Common.UI.DataView({el:$("#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:_.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')}),t&&this.mnuMarkersPicker.selectByIndex(t.index,!0),t=this.mnuNumbersPicker.conf,this.mnuNumbersPicker=new Common.UI.DataView({el:$("#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:296,data:{type:1,subtype:4}},{offsety:370,data:{type:1,subtype:5}},{offsety:444,data:{type:1,subtype:6}},{offsety:74,data:{type:1,subtype:1}},{offsety:148,data:{type:1,subtype:2}},{offsety:222,data:{type:1,subtype:3}},{offsety:518,data:{type:1,subtype:7}}]),itemTemplate:_.template('<div id="<%= id %>" class="item-numberlist" style="background-position: 0 -<%= offsety %>px;"></div>')}),t&&this.mnuNumbersPicker.selectByIndex(t.index,!0),this.mnuAddSlidePicker=new Common.UI.DataView({el:$("#id-toolbar-menu-addslide"),parentMenu:this.btnAddSlide.menu,showLast:!1,restoreHeight:300,style:"max-height: 300px;",store:PE.getCollection("SlideLayouts"),itemTemplate:_.template(['<div class="layout" id="<%= id %>" style="width: <%= itemWidth %>px;">','<div style="background-image: url(<%= imageUrl %>); width: <%= itemWidth %>px; height: <%= itemHeight %>px;"/>','<div class="title"><%= title %></div> ',"</div>"].join(""))}),this.btnAddSlide.menu&&this.btnAddSlide.menu.on("show:after",function(){e.onSlidePickerShowAfter(e.mnuAddSlidePicker),e.mnuAddSlidePicker.scroller.update({alwaysVisibleY:!0}),e.mnuAddSlidePicker.scroller.scrollTop(0)}),this.mnuAddSlidePicker._needRecalcSlideLayout=!0;var n=function(t){e.mnuChangeSlidePicker=new Common.UI.DataView({el:$("#id-toolbar-menu-changeslide"),parentMenu:e.btnChangeSlide.menu,showLast:!1,restoreHeight:300,style:"max-height: 300px;",store:PE.getCollection("SlideLayouts"),itemTemplate:_.template(['<div class="layout" id="<%= id %>" style="width: <%= itemWidth %>px;">','<div style="background-image: url(<%= imageUrl %>); width: <%= itemWidth %>px; height: <%= itemHeight %>px;"/>','<div class="title"><%= title %></div> ',"</div>"].join(""))}),e.btnChangeSlide.menu&&e.btnChangeSlide.menu.on("show:after",function(){e.onSlidePickerShowAfter(e.mnuChangeSlidePicker),e.mnuChangeSlidePicker.scroller.update({alwaysVisibleY:!0}),e.mnuChangeSlidePicker.scroller.scrollTop(0)}),e.mnuChangeSlidePicker._needRecalcSlideLayout=!0};this.btnChangeSlide.rendered?n(this.btnChangeSlide):this.btnChangeSlide.on("render:after",n),this.listenTo(PE.getCollection("SlideLayouts"),"reset",function(){e.mnuAddSlidePicker._needRecalcSlideLayout=!0,e.mnuChangeSlidePicker&&(e.mnuChangeSlidePicker._needRecalcSlideLayout=!0)});var r=this.mode,i=Common.localStorage.getItem("pe-compact-toolbar"),s=!!(i!==null&&parseInt(i)==1||i===null&&r.customization&&r.customization.compactToolbar);i=Common.localStorage.getItem("pe-hidden-title");var o=i!==null&&parseInt(i)==1;i=Common.localStorage.getItem("pe-hidden-status");var u=i!==null&&parseInt(i)==1;i=Common.localStorage.getItem("pe-hidden-rulers");var a=i!==null&&parseInt(i)==1;this.mnuitemCompactToolbar.setChecked(s,!0),this.mnuitemCompactToolbar.on("toggle",_.bind(this.changeViewMode,this)),this.mnuitemHideTitleBar.setChecked(o,!0),this.mnuitemHideStatusBar.setChecked(u,!0),this.mnuitemHideRulers.setChecked(a,!0),this.lockToolbar(PE.enumLock.disableOnStart,!1,{array:this.slideOnlyControls.concat(this.shapeControls)});var f=Common.localStorage.getItem("pe-hide-synch");this.showSynchTip=!f||parseInt(f)!=1,this.needShowSynchTip=!1,this.needShowSynchTip&&(this.needShowSynchTip=!1,this.onCollaborativeChanges())},setApi:function(e){return this.api=e,this.api&&(this.api.asc_registerCallback("asc_onSendThemeColorSchemes",_.bind(this.onSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(this.onCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onApiUsersChanged,this))),this},setMode:function(e){e.isDisconnected&&this.lockToolbar(PE.enumLock.lostConnect,!0),this.mode=e;if(!e.nativeApp){var t=$(".toolbar-group-native");t&&t.hide()}e.isDesktopApp&&$(".toolbar-group-native").hide(),this.lockToolbar(PE.enumLock.cantPrint,!e.canPrint||e.disableDownload,{array:[this.btnPrint]})},changeViewMode:function(e,t){var n=this,r=$("#id-toolbar-full"),i=$("#id-toolbar-short");n.isCompactView=t,r&&i&&(t?(i.css({display:"table"}),r.css({display:"none"}),i.parent().css({height:"41px"}),this.rendererComponents("short")):(i.css({display:"none"}),r.css({display:"table"}),i.parent().css({height:"67px"}),this.rendererComponents("full"),_.defer(function(){var e=n.listTheme.rendered;n.listTheme.menuPicker.store.length>0&&e&&n.listTheme.fillComboView(n.listTheme.menuPicker.getSelectedRec(),!0),n.btnInsertEquation.rendered&&PE.getController("Toolbar").fillEquations()},100)),this.fireEvent("changecompact",[this,t]))},onSendThemeColorSchemes:function(e){var t=this,n=t.btnColorSchemas.menu;if(n){n&&n.items.length>0&&_.each(n.items,function(e){e.remove()}),n==null&&(n=(new Common.UI.Menu({maxHeight:600,restoreHeight:600})).on("render:after",function(e){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40})})),n.items=[];var r=_.template(['<a id="<%= id %>" class="<%= options.cls %>" tabindex="-1" type="menuitem">','<span class="colors">',"<% _.each(options.colors, function(color) { %>",'<span class="color" style="background: <%= color %>;"></span>',"<% }) %>","</span>",'<span class="text"><%= caption %></span>',"</a>"].join(""));_.each(e,function(e,i){var s=e.get_colors(),o=[];for(var u=2;u<7;u++){var a="#"+Common.Utils.ThemeColor.getHexColor(s[u].get_r(),s[u].get_g(),s[u].get_b());o.push(a)}i==21?n.addItem({caption:"--"}):n.addItem({template:r,cls:"color-schemas-menu",colors:o,caption:i<21?t.schemeNames[i]||e.get_name():e.get_name(),value:i})},this)}},onCollaborativeChanges:function(){if(this._state.hasCollaborativeChanges)return;if(!this.btnSave.rendered){this.needShowSynchTip=!0;return}var e=PE.getController("Viewport").getView("DocumentPreview");if(e&&e.isVisible()){this.needShowSynchTip=!0;return}this._state.hasCollaborativeChanges=!0;var t=$(".btn-icon",this.btnSave.cmpEl);t.removeClass(this.btnSaveCls),t.addClass("btn-synch"),this.showSynchTip?(this.btnSave.updateHint(""),this.synchTooltip===undefined&&this.createSynchTip(),this.synchTooltip.show()):this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({target:$("#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("pe-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=$(".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(e){var t=[];_.each(e,function(e){e.asc_getView()||t.push(e)});var n=_.size(t),r=n>1?"btn-save-coauth":"btn-save";if(r!==this.btnSaveCls&&this.btnSave.rendered){this.btnSaveTip=(n>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S");var i=$(".btn-icon",this.btnSave.cmpEl);i.hasClass("btn-synch")||(i.removeClass(this.btnSaveCls),i.addClass(r),this.btnSave.updateHint(this.btnSaveTip)),this.btnSaveCls=r}},onSlidePickerShowAfter:function(e){if(!e._needRecalcSlideLayout)return;if(e.cmpEl&&e.dataViewItems.length>0){var t=e.dataViewItems,n=$(t[0].el),r=n.outerWidth()+parseInt(n.css("margin-left"))+parseInt(n.css("margin-right")),i=Math.floor(e.cmpEl.width()/r),s=0,o=0;for(var u=0;u<t.length;u++){var a=$(t[u].el).find(".title"),f=a.height();f>o?o=f:a.css({height:o}),s++,s>i-1&&(s=0,o=0)}e._needRecalcSlideLayout=!1}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",tipFontName:"Font Name",tipFontSize:"Font Size",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipFontColor:"Font color",tipMarkers:"Bullets",tipNumbers:"Numbering",tipBack:"Back",tipClearStyle:"Clear Style",tipCopyStyle:"Copy Style",textTitleError:"Error",tipHAligh:"Horizontal Align",tipVAligh:"Vertical Align",textAlignTop:"Align text to the top",textAlignMiddle:"Align text to the middle",textAlignBottom:"Align text to the bottom",textAlignLeft:"Left align text",textAlignRight:"Right align text",textAlignCenter:"Center text",textAlignJust:"Justify",tipDecPrLeft:"Decrease Indent",tipIncPrLeft:"Increase Indent",tipLineSpace:"Line Spacing",tipInsertTable:"Insert Table",tipInsertImage:"Insert Picture",mniImageFromFile:"Picture from file",mniImageFromUrl:"Picture from url",mniCustomTable:"Insert Custom Table",tipInsertHyperlink:"Add Hyperlink",tipInsertText:"Insert Text",tipInsertShape:"Insert Autoshape",tipPreview:"Start Slideshow",tipAddSlide:"Add Slide",tipNewDocument:"New Document",tipOpenDocument:"Open Document",tipShapeAlign:"Align Shape",tipShapeArrange:"Arrange Shape",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",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",tipChangeSlide:"Change Slide Layout",textOK:"OK",textCancel:"Cancel",tipColorSchemas:"Change Color Scheme",textNewColor:"Add New Custom Color",mniSlideStandard:"Standard (4:3)",mniSlideWide:"Widescreen (16:9)",mniSlideAdvanced:"Advanced Settings",tipSlideSize:"Select Slide Size",tipViewSettings:"View Settings",tipAdvSettings:"Advanced Settings",textCompactView:"View Compact Toolbar",textHideTitleBar:"Hide Title Bar",textHideStatusBar:"Hide Status Bar",textHideLines:"Hide Rulers",textFitPage:"Fit to Slide",textFitWidth:"Fit to Width",textZoom:"Zoom",tipInsertChart:"Insert Chart",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",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",tipSlideTheme:"Slide Theme",tipSaveCoauth:"Save your changes for the other users to see them.",textInsText:"Insert text box",textInsTextArt:"Insert Text Art",textShowBegin:"Show from Beginning",textShowCurrent:"Show from Current slide",textShowSettings:"Show Settings",tipInsertEquation:"Insert Equation",textCharts:"Charts",tipChangeChart:"Change Chart Type"},PE.Views.Toolbar||{}))}),define("presentationeditor/main/app/view/SlideSizeSettings",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";PE.Views.SlideSizeSettings=Common.UI.Window.extend(_.extend({options:{width:250,header:!0,style:"min-width: 250px;",cls:"modal-dlg",id:"window-slide-size-settings"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<div class="box" style="height: 148px;">','<div class="input-row">','<label class="text columns-text" style="font-weight: bold;">'+this.textSlideSize+"</label>","</div>",'<div id="slide-size-combo" class="" style="margin-bottom: 10px;"></div>','<table cols="2" style="width: 100%;margin-bottom: 7px;">',"<tr>",'<td class="padding-small" style="padding-right: 10px;">','<label class="input-label" style="font-weight: bold;">'+this.textWidth+"</label>",'<div id="slide-size-spin-width"></div>',"</td>",'<td class="padding-small" style="padding-left: 10px;">','<label class="input-label" style="font-weight: bold;">'+this.textHeight+"</label>",'<div id="slide-size-spin-height"></div>',"</td>","</tr>","</table>",'<div class="input-row">','<label class="text columns-text" style="font-weight: bold;">'+this.textSlideOrientation+"</label>","</div>",'<div id="slide-orientation-combo" class="" style="margin-bottom: 10px;"></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(""),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.cmbSlideSize=new Common.UI.ComboBox({el:$("#slide-size-combo"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 218px;",editable:!1,data:[{value:0,displayValue:this.txtStandard,size:[254,190.5]},{value:1,displayValue:this.txtWidescreen1,size:[254,143]},{value:2,displayValue:this.txtWidescreen2,size:[254,158.7]},{value:3,displayValue:this.txtLetter,size:[254,190.5]},{value:4,displayValue:this.txtLedger,size:[338.3,253.7]},{value:5,displayValue:this.txtA3,size:[355.6,266.7]},{value:6,displayValue:this.txtA4,size:[275,190.5]},{value:7,displayValue:this.txtB4,size:[300.7,225.5]},{value:8,displayValue:this.txtB5,size:[199.1,149.3]},{value:9,displayValue:this.txt35,size:[285.7,190.5]},{value:10,displayValue:this.txtOverhead,size:[254,190.5]},{value:11,displayValue:this.txtBanner,size:[203.2,25.4]},{value:-1,displayValue:this.txtCustom,size:[]}]}),this.cmbSlideSize.setValue(0),this.cmbSlideSize.on("selected",_.bind(function(e,t){this._noApply=!0;if(!(t.value<0)){var n=t.size[0],r=t.size[1],i=this.cmbSlideOrientation.getValue(),s=i==0&&n>r||i==1&&r>n;this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(s?r:n),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(s?n:r),!0)}this._noApply=!1},this)),this.spnWidth=new Common.UI.MetricSpinner({el:$("#slide-size-spin-width"),step:.1,width:98,defaultUnit:"cm",value:"25.4 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.spnWidth.on("change",_.bind(function(e,t,n,r){if(!this._noApply){this.cmbSlideSize.getValue()>-1&&this.cmbSlideSize.setValue(-1);var i=this.spnWidth.getNumberValue(),s=this.spnHeight.getNumberValue();this.cmbSlideOrientation.setValue(s>i?0:1)}},this)),this.spnHeight=new Common.UI.MetricSpinner({el:$("#slide-size-spin-height"),step:.1,width:98,defaultUnit:"cm",value:"19.05 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.spnHeight.on("change",_.bind(function(e,t,n,r){if(!this._noApply){this.cmbSlideSize.getValue()>-1&&this.cmbSlideSize.setValue(-1);var i=this.spnWidth.getNumberValue(),s=this.spnHeight.getNumberValue();this.cmbSlideOrientation.setValue(s>i?0:1)}},this)),this.cmbSlideOrientation=new Common.UI.ComboBox({el:$("#slide-orientation-combo"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 218px;",editable:!1,data:[{value:0,displayValue:this.strPortrait},{value:1,displayValue:this.strLandscape}]}),this.cmbSlideOrientation.setValue(1),this.cmbSlideOrientation.on("selected",_.bind(function(e,t){this._noApply=!0;var n=this.spnWidth.getNumberValue(),r=this.spnHeight.getNumberValue();if(t.value==0&&n>r||t.value==1&&r>n)this.spnWidth.setValue(r,!0),this.spnHeight.setValue(n,!0);this._noApply=!1},this));var e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.updateMetricUnit()},_handleInput:function(e){this.options.handler&&this.options.handler.call(this,this,e),this.close()},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},setSettings:function(e,t,n){this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(t),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(n),!0),this.cmbSlideSize.setValue(e),this.cmbSlideOrientation.setValue(n>t?0:1)},getSettings:function(){var e=[this.cmbSlideSize.getValue(),Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()),Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())];return e},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},textTitle:"Slide Size Settings",textSlideSize:"Slide Size",textWidth:"Width",textHeight:"Height",cancelButtonText:"Cancel",okButtonText:"Ok",txtStandard:"Standard (4:3)",txtWidescreen1:"Widescreen (16:9)",txtWidescreen2:"Widescreen (16:10)",txtLetter:"Letter Paper (8.5x11 in)",txtLedger:"Ledger Paper (11x17 in)",txtA3:"A3 Paper (297x420 mm)",txtA4:"A4 Paper (210x297 mm)",txtB4:"B4 (ICO) Paper (250x353 mm)",txtB5:"B5 (ICO) Paper (176x250 mm)",txt35:"35 mm Slides",txtOverhead:"Overhead",txtBanner:"Banner",txtCustom:"Custom",textSlideOrientation:"Slide Orientation",strPortrait:"Portrait",strLandscape:"Landscape"},PE.Views.SlideSizeSettings||{}))}),define("presentationeditor/main/app/view/SlideshowSettings",["common/main/lib/component/Window","common/main/lib/component/CheckBox"],function(){"use strict";PE.Views.SlideshowSettings=Common.UI.Window.extend(_.extend({options:{width:315,header:!0,style:"min-width: 315px;",cls:"modal-dlg",id:"window-slideshow-settings"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<div class="box" style="height: 20px;">','<div id="slideshow-checkbox-loop"></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(""),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.chLoop=new Common.UI.CheckBox({el:$("#slideshow-checkbox-loop"),labelText:this.textLoop});var e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this))},_handleInput:function(e){this.options.handler&&this.options.handler.call(this,this,e),this.close()},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},setSettings:function(e){this.chLoop.setValue(e)},getSettings:function(){return this.chLoop.getValue()=="checked"},textTitle:"Show Settings",textLoop:"Loop continuously until 'Esc' is pressed",cancelButtonText:"Cancel",okButtonText:"Ok"},PE.Views.SlideshowSettings||{}))}),define("presentationeditor/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","presentationeditor/main/app/view/Toolbar","presentationeditor/main/app/view/HyperlinkSettingsDialog","presentationeditor/main/app/view/SlideSizeSettings","presentationeditor/main/app/view/SlideshowSettings"],function(){"use strict";PE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){this._state={activated:!1,themeId:undefined,bullets:{type:undefined,subtype:undefined},prcontrolsdisable:undefined,slidecontrolsdisable:undefined,slidelayoutdisable:undefined,shapecontrolsdisable:undefined,no_paragraph:undefined,no_text:undefined,no_object:undefined,clrtext:undefined,linespace:undefined,pralign:undefined,valign:undefined,vtextalign:undefined,can_undo:undefined,can_redo:undefined,bold:undefined,italic:undefined,strike:undefined,underline:undefined,can_group:undefined,can_ungroup:undefined,lock_doc:undefined,changeslide_inited:!1,no_slides:undefined,can_increase:undefined,can_decrease:undefined,can_hyper:undefined,zoom_type:undefined,zoom_percent:undefined,fontsize:undefined,in_equation:undefined,in_chart:!1},this._isAddingShape=!1,this.slideSizeArr=[[254,190.5],[254,143],[254,158.7],[254,190.5],[338.3,253.7],[355.6,266.7],[275,190.5],[300.7,225.5],[199.1,149.3],[285.7,190.5],[254,190.5],[203.2,25.4]],this.currentPageSize={type:-1,width:0,height:0},this.flg={},this.diagramEditor=null,this.editMode=!0,this.addListeners({Toolbar:{changecompact:this.onChangeCompactView}});var e=this,t=function(t){var n=$(t.target),r=n.closest("#editor_sdk"),i=n.closest("button").attr("id");i===undefined&&(i=n.closest(".btn-group").attr("id")),n.attr("id")!="editor_sdk"&&r.length<=0&&(e.toolbar.btnInsertText.pressed&&i!=e.toolbar.btnInsertText.id||e.toolbar.btnInsertShape.pressed&&i!=e.toolbar.btnInsertShape.id?(e._isAddingShape=!1,e._addAutoshape(!1),e.toolbar.btnInsertShape.toggle(!1,!0),e.toolbar.btnInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",e.toolbar)):e.toolbar.btnInsertShape.pressed&&i==e.toolbar.btnInsertShape.id&&_.defer(function(){e.api.StartAddShape("",!1),Common.NotificationCenter.trigger("edit:complete",e.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",t)},this._addAutoshape=function(e,n){this.api&&(e?(this.api.StartAddShape(n,!0),$(document.body).on("mouseup",t)):(this.api.StartAddShape("",!1),$(document.body).off("mouseup",t)))}},onLaunch:function(){this.toolbar=this.createView("Toolbar")},onToolbarAfterRender:function(e){e.btnNewDocument.on("click",_.bind(this.onNewDocument,this)),e.btnOpenDocument.on("click",_.bind(this.onOpenDocument,this)),e.btnAddSlide.on("click",_.bind(this.onBtnAddSlide,this)),e.mnuAddSlidePicker.on("item:click",_.bind(this.onAddSlide,this)),e.mnuChangeSlidePicker&&e.mnuChangeSlidePicker.on("item:click",_.bind(this.onChangeSlide,this)),e.btnPreview.on("click",_.bind(this.onPreviewBtnClick,this)),e.btnPreview.menu.on("item:click",_.bind(this.onPreviewItemClick,this)),e.btnPrint.on("click",_.bind(this.onPrint,this)),e.btnSave.on("click",_.bind(this.onSave,this)),e.btnUndo.on("click",_.bind(this.onUndo,this)),e.btnRedo.on("click",_.bind(this.onRedo,this)),e.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),e.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),e.btnBold.on("click",_.bind(this.onBold,this)),e.btnItalic.on("click",_.bind(this.onItalic,this)),e.btnUnderline.on("click",_.bind(this.onUnderline,this)),e.btnStrikeout.on("click",_.bind(this.onStrikeout,this)),e.btnSuperscript.on("click",_.bind(this.onSuperscript,this)),e.btnSubscript.on("click",_.bind(this.onSubscript,this)),e.btnHorizontalAlign.menu.on("item:click",_.bind(this.onMenuHorizontalAlignSelect,this)),e.btnVerticalAlign.menu.on("item:click",_.bind(this.onMenuVerticalAlignSelect,this)),e.btnDecLeftOffset.on("click",_.bind(this.onDecOffset,this)),e.btnIncLeftOffset.on("click",_.bind(this.onIncOffset,this)),e.btnMarkers.on("click",_.bind(this.onMarkers,this)),e.btnNumbers.on("click",_.bind(this.onNumbers,this)),e.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),e.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),e.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),e.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),e.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),e.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),e.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),e.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),e.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),e.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),e.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),e.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),e.mnuMarkersPicker.on("item:click",_.bind(this.onSelectBullets,this,e.btnMarkers)),e.mnuNumbersPicker.on("item:click",_.bind(this.onSelectBullets,this,e.btnNumbers)),e.btnFontColor.on("click",_.bind(this.onBtnFontColor,this)),e.mnuFontColorPicker.on("select",_.bind(this.onSelectFontColor,this)),$("#id-toolbar-menu-new-fontcolor").on("click",_.bind(this.onNewFontColor,this)),e.btnLineSpace.menu.on("item:toggle",_.bind(this.onLineSpaceToggle,this)),e.btnShapeAlign.menu.on("item:click",_.bind(this.onShapeAlign,this)),e.btnShapeArrange.menu.on("item:click",_.bind(this.onShapeArrange,this)),e.btnInsertHyperlink.on("click",_.bind(this.onHyperlinkClick,this)),e.mnuTablePicker.on("select",_.bind(this.onTablePickerSelect,this)),e.btnInsertTable.menu.on("item:click",_.bind(this.onInsertTableClick,this)),e.btnInsertImage.menu.on("item:click",_.bind(this.onInsertImageClick,this)),e.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),e.btnInsertText.menu.on("item:click",_.bind(this.onInsertTextClick,this)),e.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),e.btnClearStyle.on("click",_.bind(this.onClearStyleClick,this)),e.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),e.btnAdvSettings.on("click",_.bind(this.onAdvSettingsClick,this)),e.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),e.btnSlideSize.menu.on("item:click",_.bind(this.onSlideSize,this)),e.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),e.listTheme.on("click",_.bind(this.onListThemeSelect,this)),e.mnuitemHideTitleBar.on("toggle",_.bind(this.onHideTitleBar,this)),e.mnuitemHideStatusBar.on("toggle",_.bind(this.onHideStatusBar,this)),e.mnuitemHideRulers.on("toggle",_.bind(this.onHideRulers,this)),e.btnFitPage.on("toggle",_.bind(this.onZoomToPageToggle,this)),e.btnFitWidth.on("toggle",_.bind(this.onZoomToWidthToggle,this)),e.mnuZoomIn.on("click",_.bind(this.onZoomInClick,this)),e.mnuZoomOut.on("click",_.bind(this.onZoomOutClick,this)),e.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this))},setApi:function(e){this.api=e,this.toolbar.setApi(e),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_onPaintFormatChanged",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onListType",_.bind(this.onApiBullets,this)),this.api.asc_registerCallback("asc_canIncreaseIndent",_.bind(this.onApiCanIncreaseIndent,this)),this.api.asc_registerCallback("asc_canDecreaseIndent",_.bind(this.onApiCanDecreaseIndent,this)),this.api.asc_registerCallback("asc_onLineSpacing",_.bind(this.onApiLineSpacing,this)),this.api.asc_registerCallback("asc_onPrAlign",_.bind(this.onApiParagraphAlign,this)),this.api.asc_registerCallback("asc_onVerticalTextAlign",_.bind(this.onApiVerticalTextAlign,this)),this.api.asc_registerCallback("asc_onCanAddHyperlink",_.bind(this.onApiCanAddHyperlink,this)),this.api.asc_registerCallback("asc_onTextColor",_.bind(this.onApiTextColor,this)),this.api.asc_registerCallback("asc_onUpdateThemeIndex",_.bind(this.onApiUpdateThemeIndex,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onCanGroup",_.bind(this.onApiCanGroup,this)),this.api.asc_registerCallback("asc_onCanUnGroup",_.bind(this.onApiCanUnGroup,this)),this.api.asc_registerCallback("asc_onPresentationSize",_.bind(this.onApiPageSize,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_onZoomChange",_.bind(this.onApiZoomChange,this)),this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onApiFocusObject,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_onLockDocumentTheme",_.bind(this.onApiLockDocumentTheme,this)),this.api.asc_registerCallback("asc_onUnLockDocumentTheme",_.bind(this.onApiUnLockDocumentTheme,this)),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,this)),this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this)),this.onSetupCopyStyleButton()},onChangeCompactView:function(e,t){Common.localStorage.setItem("pe-compact-toolbar",t?1:0),!t&&!this._state.changeslide_inited&&this.toolbar.mnuChangeSlidePicker.on("item:click",_.bind(this.onChangeSlide,this)),this._state.changeslide_inited=!0,Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onApiFontSize:function(e){this._state.fontsize!==e&&(this.toolbar.cmbFontSize.setValue(e),this._state.fontsize=e)},onApiBold:function(e){this._state.bold!==e&&(this.toolbar.btnBold.toggle(e===!0,!0),this._state.bold=e)},onApiItalic:function(e){this._state.italic!==e&&(this.toolbar.btnItalic.toggle(e===!0,!0),this._state.italic=e)},onApiUnderline:function(e){this._state.underline!==e&&(this.toolbar.btnUnderline.toggle(e===!0,!0),this._state.underline=e)},onApiStrikeout:function(e){this._state.strike!==e&&(this.toolbar.btnStrikeout.toggle(e===!0,!0),this._state.strike=e)},onApiVerticalAlign:function(e){this._state.valign!==e&&(this.toolbar.btnSuperscript.toggle(e==1,!0),this.toolbar.btnSubscript.toggle(e==2,!0),this._state.valign=e)},onApiCanRevert:function(e,t){e=="undo"?this._state.can_undo!==t&&(this.toolbar.lockToolbar(PE.enumLock.undoLock,!t,{array:[this.toolbar.btnUndo]}),this._state.activated&&(this._state.can_undo=t)):this._state.can_redo!==t&&(this.toolbar.lockToolbar(PE.enumLock.redoLock,!t,{array:[this.toolbar.btnRedo]}),this._state.activated&&(this._state.can_redo=t))},onApiCanIncreaseIndent:function(e){this._state.can_increase!==e&&(this.toolbar.lockToolbar(PE.enumLock.incIndentLock,!e,{array:[this.toolbar.btnIncLeftOffset]}),this._state.activated&&(this._state.can_increase=e))},onApiCanDecreaseIndent:function(e){this._state.can_decrease!==e&&(this.toolbar.lockToolbar(PE.enumLock.decIndentLock,!e,{array:[this.toolbar.btnDecLeftOffset]}),this._state.activated&&(this._state.can_decrease=e))},onApiBullets:function(e){if(this._state.bullets.type!=e.get_ListType()||this._state.bullets.subtype!=e.get_ListSubType()){this._state.bullets.type=e.get_ListType(),this._state.bullets.subtype=e.get_ListSubType(),this._clearBullets();switch(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 t=0;switch(this._state.bullets.subtype){case 1:t=4;break;case 2:t=5;break;case 3:t=6;break;case 4:t=1;break;case 5:t=2;break;case 6:t=3;break;case 7:t=7}this.toolbar.btnNumbers.toggle(!0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(t,!0)}}},onApiParagraphAlign:function(e){if(this._state.pralign!==e){this._state.pralign=e;var t=-1,n,r=this.toolbar.btnHorizontalAlign;switch(e){case 0:t=2,n="btn-align-right";break;case 1:t=0,n="btn-align-left";break;case 2:t=1,n="btn-align-center";break;case 3:t=3,n="btn-align-just";break;default:t=-255,n="btn-align-left"}t<0?t==-255&&this._clearChecked(r.menu):r.menu.items[t].setChecked(!0);if(r.rendered){var i=$(".btn-icon",r.cmpEl);i&&(i.removeClass(r.options.icls),r.options.icls=n,i.addClass(r.options.icls))}}},onApiVerticalTextAlign:function(e){if(this._state.vtextalign!==e){this._state.vtextalign=e;var t=-1,n="",r=this.toolbar.btnVerticalAlign;switch(e){case Asc.c_oAscVAlign.Top:t=0,n="btn-align-top";break;case Asc.c_oAscVAlign.Center:t=1,n="btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:t=2,n="btn-align-bottom";break;default:t=-255,n="btn-align-middle"}t<0?t==-255&&this._clearChecked(r.menu):r.menu.items[t].setChecked(!0);if(r.rendered){var i=$(".btn-icon",r.cmpEl);i&&(i.removeClass(r.options.icls),r.options.icls=n,i.addClass(r.options.icls))}}},onApiLineSpacing:function(e){var t=e.get_Line()===null||e.get_LineRule()===null||e.get_LineRule()!=1?-1:e.get_Line();if(this._state.linespace!==t){this._state.linespace=t;var n=this.toolbar.btnLineSpace.menu;_.each(n.items,function(e){e.setChecked(!1,!0)});if(t<0)return;Math.abs(t-1)<1e-4?n.items[0].setChecked(!0,!0):Math.abs(t-1.15)<1e-4?n.items[1].setChecked(!0,!0):Math.abs(t-1.5)<1e-4?n.items[2].setChecked(!0,!0):Math.abs(t-2)<1e-4?n.items[3].setChecked(!0,!0):Math.abs(t-2.5)<1e-4?n.items[4].setChecked(!0,!0):Math.abs(t-3)<1e-4&&n.items[5].setChecked(!0,!0)}},onApiCanAddHyperlink:function(e){this._state.can_hyper!==e&&this.editMode&&(this.toolbar.lockToolbar(PE.enumLock.hyperlinkLock,!e,{array:[this.toolbar.btnInsertHyperlink]}),this._state.activated&&(this._state.can_hyper=e))},onApiPageSize:function(e,t){if(Math.abs(this.currentPageSize.width-e)>.001||Math.abs(this.currentPageSize.height-t)>.001){this.currentPageSize.width=e,this.currentPageSize.height=t,this.currentPageSize.type=-1;var n=t>e;for(var r=0;r<this.slideSizeArr.length;r++)if(Math.abs(this.slideSizeArr[r][n?1:0]-this.currentPageSize.width)<.001&&Math.abs(this.slideSizeArr[r][n?0:1]-this.currentPageSize.height)<.001){this.currentPageSize.type=r;break}this.toolbar.btnSlideSize.menu.items[0].setChecked(this.currentPageSize.type==0),this.toolbar.btnSlideSize.menu.items[1].setChecked(this.currentPageSize.type==1)}},onApiCountPages:function(e){this._state.no_slides!==e<=0&&(this._state.no_slides=e<=0,this.toolbar.lockToolbar(PE.enumLock.noSlides,this._state.no_slides,{array:this.toolbar.paragraphControls}),this.toolbar.lockToolbar(PE.enumLock.noSlides,this._state.no_slides,{array:[this.toolbar.btnChangeSlide,this.toolbar.btnPreview,this.toolbar.btnCopy,this.toolbar.btnPaste,this.toolbar.btnCopyStyle,this.toolbar.btnInsertTable,this.toolbar.btnInsertImage,this.toolbar.btnInsertChart,this.toolbar.btnInsertText,this.toolbar.btnInsertShape,this.toolbar.btnColorSchemas,this.toolbar.btnShapeAlign,this.toolbar.btnShapeArrange,this.toolbar.btnSlideSize,this.toolbar.listTheme]}))},onApiFocusObject:function(e){if(!this.editMode)return;var t=this,n,r,i=-1,s,o=undefined,u=undefined,a=undefined,f=undefined,l=!0,c=!0,h=!0,p=!1,d=!1;while(++i<e.length)s=e[i].get_ObjectType(),n=e[i].get_ObjectValue(),s==Asc.c_oAscTypeSelectElement.Paragraph?(o=n.get_Locked(),l=!1,c=!1,h=!1):s==Asc.c_oAscTypeSelectElement.Slide?(a=n.get_LockDelete(),f=n.get_LockLayout()):s==Asc.c_oAscTypeSelectElement.Image||s==Asc.c_oAscTypeSelectElement.Shape||s==Asc.c_oAscTypeSelectElement.Chart||s==Asc.c_oAscTypeSelectElement.Table?(u=n.get_Locked(),h=!1,s!==Asc.c_oAscTypeSelectElement.Image&&(c=!1),d=s==Asc.c_oAscTypeSelectElement.Chart):s===Asc.c_oAscTypeSelectElement.Math&&(p=!0);d!==this._state.in_chart&&(this.toolbar.btnInsertChart.updateHint(d?this.toolbar.tipChangeChart:this.toolbar.tipInsertChart),this._state.in_chart=d),o!==undefined&&this._state.prcontrolsdisable!==o&&(this._state.activated&&(this._state.prcontrolsdisable=o),this.toolbar.lockToolbar(PE.enumLock.paragraphLock,o,{array:t.toolbar.paragraphControls})),this._state.no_paragraph!==l&&(this._state.activated&&(this._state.no_paragraph=l),this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected,l,{array:t.toolbar.paragraphControls}),this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected,l,{array:[t.toolbar.btnCopyStyle]})),this._state.no_text!==c&&(this._state.activated&&(this._state.no_text=c),this.toolbar.lockToolbar(PE.enumLock.noTextSelected,c,{array:t.toolbar.paragraphControls})),u!==undefined&&this._state.shapecontrolsdisable!==u&&(this._state.activated&&(this._state.shapecontrolsdisable=u),this.toolbar.lockToolbar(PE.enumLock.shapeLock,u,{array:t.toolbar.shapeControls.concat(t.toolbar.paragraphControls)})),this._state.no_object!==h&&(this._state.activated&&(this._state.no_object=h),this.toolbar.lockToolbar(PE.enumLock.noObjectSelected,h,{array:[t.toolbar.btnShapeAlign,t.toolbar.btnShapeArrange]})),f!==undefined&&this._state.slidelayoutdisable!==f&&(this._state.activated&&(this._state.slidelayoutdisable=f),this.toolbar.lockToolbar(PE.enumLock.slideLock,f,{array:[t.toolbar.btnChangeSlide]})),a!==undefined&&this._state.slidecontrolsdisable!==a&&(this._state.activated&&(this._state.slidecontrolsdisable=a),this.toolbar.lockToolbar(PE.enumLock.slideDeleted,a,{array:t.toolbar.slideOnlyControls.concat(t.toolbar.paragraphControls)})),this._state.in_equation!==p&&(this._state.activated&&(this._state.in_equation=p),this.toolbar.lockToolbar(PE.enumLock.inEquation,p,{array:[t.toolbar.btnSuperscript,t.toolbar.btnSubscript]}))},onApiStyleChange:function(e){this.toolbar.btnCopyStyle.toggle(e,!0),this.modeAlwaysSetStyle=!1},onApiUpdateThemeIndex:function(e){if(this._state.themeId!==e){var t=this.toolbar.listTheme,n=t.rendered;if(n){t.suspendEvents();var r=t.menuPicker.store.findWhere({themeId:e});this._state.themeId=t.menuPicker.store.length>0?e:undefined,t.menuPicker.selectRecord(r),t.resumeEvents()}}},onApiCanGroup:function(e){this._state.can_group!==e&&(this.toolbar.mnuGroupShapes.setDisabled(!e),this._state.activated&&(this._state.can_group=e))},onApiCanUnGroup:function(e){this._state.can_ungroup!==e&&(this.toolbar.mnuUnGroupShapes.setDisabled(!e),this._state.activated&&(this._state.can_ungroup=e))},onApiLockDocumentProps:function(){this._state.lock_doc!==!0&&(this.toolbar.lockToolbar(PE.enumLock.docPropsLock,!0,{array:[this.toolbar.btnSlideSize]}),this._state.activated&&(this._state.lock_doc=!0))},onApiUnLockDocumentProps:function(){this._state.lock_doc!==!1&&(this.toolbar.lockToolbar(PE.enumLock.docPropsLock,!1,{array:[this.toolbar.btnSlideSize]}),this._state.activated&&(this._state.lock_doc=!1))},onApiLockDocumentTheme:function(){this.toolbar.lockToolbar(PE.enumLock.themeLock,!0,{array:[this.toolbar.btnColorSchemas,this.toolbar.listTheme]})},onApiUnLockDocumentTheme:function(){this.toolbar.lockToolbar(PE.enumLock.themeLock,!1,{array:[this.toolbar.btnColorSchemas,this.toolbar.listTheme]})},onApiCoAuthoringDisconnect:function(e){this.toolbar.setMode({isDisconnected:!0,disableDownload:!!e}),this.editMode=!1},onApiZoomChange:function(e,t){this._state.zoom_type!==t&&(this.toolbar.btnFitPage.setChecked(t==2,!0),this.toolbar.btnFitWidth.setChecked(t==1,!0),this._state.zoom_type=t),this._state.zoom_percent!==e&&($(".menu-zoom .zoom",this.toolbar.el).html(e+"%"),this._state.zoom_percent=e),this.toolbar.mnuZoom.options.value=e},onApiInitEditorStyles:function(e){e&&this._onInitEditorThemes(e[0],e[1])},onNewDocument:function(e,t){this.api&&this.api.OpenNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(e,t){this.api&&this.api.LoadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onAddSlide:function(e,t,n){this.api&&(this.api.AddSlide(n.get("data").idx),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Add Slide"))},onBtnAddSlide:function(){this.api.AddSlide(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Add Slide")},onChangeSlide:function(e,t,n){this.api&&(this.api.ChangeLayout(n.get("data").idx),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Change Layout"))},onPreview:function(e){var t=PE.getController("Viewport").getView("DocumentPreview"),n=this,r=!1;if(t&&n.api){t.show();var i=function(){if(r)return;r=!0,Common.NotificationCenter.off("window:resize",i),n.api.StartDemonstration("presentation-preview",_.isNumber(e)?e:0),Common.component.Analytics.trackEvent("ToolBar","Preview")};!n.toolbar.mode.isDesktopApp&&!Common.Utils.isIE11?(Common.NotificationCenter.on("window:resize",i),n.fullScreen(document.documentElement),setTimeout(function(){i()},100)):i()}},fullScreen:function(e){e&&(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},onPreviewBtnClick:function(e,t){this.onPreview(this.api.getCurrentPage())},onPreviewItemClick:function(e,t){switch(t.value){case 0:this.onPreview(0);break;case 1:this.onPreview(this.api.getCurrentPage());break;case 2:var n,r=this,i=r.api.getSelectedElements(),s=!1;if(i&&_.isArray(i))for(var o=0;o<i.length;o++)if(Asc.c_oAscTypeSelectElement.Slide==i[o].get_ObjectType()){var u=i[o].get_ObjectValue(),a=u.get_timing();a&&(s=a.get_ShowLoop())}var f=function(e,t){if(t=="ok"){s=e.getSettings();if(r.api){var n=new Asc.CAscSlideProps,i=new Asc.CAscSlideTiming;i.put_ShowLoop(s),n.put_timing(i),r.api.SetSlideProps(n)}}Common.NotificationCenter.trigger("edit:complete",r.toolbar)};n=new PE.Views.SlideshowSettings({handler:f}),n.show(),n.setSettings(s)}},onPrint:function(e){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(e){if(this.api&&this.api.asc_isDocumentCanSave){var t=this.api.asc_isDocumentCanSave(),n=$(".btn-icon",this.toolbar.btnSave.cmpEl).hasClass("btn-synch");if(!t&&!n&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}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(e,t){this.api&&this.api.Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(e,t){this.api&&this.api.Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(e,t){var n=this;if(n.api){var r=e?n.api.Copy():n.api.Paste();if(!r){var i=Common.localStorage.getItem("pe-hide-copywarning");(!i||parseInt(i)!=1)&&(new Common.Views.CopyWarningDialog({handler:function(e){e&&Common.localStorage.setItem("pe-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",n.toolbar)}})).show()}else Common.component.Analytics.trackEvent("ToolBar","Copy Warning")}Common.NotificationCenter.trigger("edit:complete",n.toolbar)},onBold:function(e,t){this._state.bold=undefined,this.api&&this.api.put_TextPrBold(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(e,t){this._state.italic=undefined,this.api&&this.api.put_TextPrItalic(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(e,t){this._state.underline=undefined,this.api&&this.api.put_TextPrUnderline(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Underline")},onStrikeout:function(e,t){this._state.strike=undefined,this.api&&this.api.put_TextPrStrikeout(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Strikeout")},onSuperscript:function(e,t){this.toolbar.btnSubscript.pressed||(this._state.valign=undefined,this.api&&this.api.put_TextPrBaseline(e.pressed?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Superscript"))},onSubscript:function(e,t){this.toolbar.btnSuperscript.pressed||(this._state.valign=undefined,this.api&&this.api.put_TextPrBaseline(e.pressed?2:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Subscript"))},onDecOffset:function(e,t){this.api&&this.api.DecreaseIndent(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Indent")},onIncOffset:function(e,t){this.api&&this.api.IncreaseIndent(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Indent")},onMenuHorizontalAlignSelect:function(e,t){this._state.pralign=undefined;var n=this.toolbar.btnHorizontalAlign,r=$(".btn-icon",n.cmpEl);r&&(r.removeClass(n.options.icls),n.options.icls=t.checked?t.options.icls:"btn-align-left",r.addClass(n.options.icls)),this.api&&t.checked&&this.api.put_PrAlign(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onMenuVerticalAlignSelect:function(e,t){var n=this.toolbar.btnVerticalAlign,r=$(".btn-icon",n.cmpEl);r&&(r.removeClass(n.options.icls),n.options.icls=t.checked?t.options.icls:"btn-align-middle",r.addClass(n.options.icls)),this._state.vtextalign=undefined,this.api&&t.checked&&this.api.setVerticalAlign(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical Align")},onMarkers:function(e,t){var n={data:{type:0,subtype:e.pressed?0:-1}};this.onSelectBullets(null,null,null,n),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onNumbers:function(e,t){var n={data:{type:1,subtype:e.pressed?0:-1}};this.onSelectBullets(null,null,null,n),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onFontNameSelect:function(e,t){this.api&&(t.isNewFont?Common.UI.warning({width:500,closable:!1,msg:this.confirmAddFontName,buttons:["yes","no"],primary:"yes",callback:_.bind(function(e){e=="yes"?(this.api.put_TextPrFontName(t.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(t.name),Common.component.Analytics.trackEvent("ToolBar","Font Name"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onComboOpen:function(e,t){_.delay(function(){var n=$("input",t.cmpEl).select();e?n.focus():t.isMenuOpen()||n.one("mouseup",function(e){e.preventDefault()})},10)},onFontSizeSelect:function(e,t){this._state.fontsize=undefined,this.api&&this.api.put_TextPrFontSize(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onFontSizeChanged:function(e,t,n,r){var i,s=this;if(e){var o=t.store.findWhere({displayValue:n.value});if(!o){i=/^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(n.value);if(!i)return i=this._getApiTextSize(),Common.UI.warning({msg:this.textFontSizeErr,callback:function(){_.defer(function(e){$("input",t.cmpEl).focus()})}}),t.setRawValue(i),r.preventDefault(),!1}}else i=parseFloat(n.value),i=i>300?300:i<1?1:Math.floor((i+.4)*2)/2,t.setRawValue(i),this._state.fontsize=undefined,this.api&&this.api.put_TextPrFontSize(i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSelectBullets:function(e,t,n,r){var i={},s=_.isFunction(r.toJSON);if(s){if(!r.get("selected"))return;i=r.toJSON()}else i=r;e&&e.toggle(i.data.subtype>-1,!0),this.api&&this.api.put_ListType(i.data.type,i.data.subtype),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","List Type")},onLineSpaceToggle:function(e,t,n,r){!n||(this._state.linespace=undefined,this.api&&this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO,t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Line Spacing"))},onShapeAlign:function(e,t){this.api&&(t.value<6?(this.api.put_ShapesAlign(t.value),Common.component.Analytics.trackEvent("ToolBar","Shape Align")):t.value==6?(this.api.DistributeHorizontally(),Common.component.Analytics.trackEvent("ToolBar","Distribute")):(this.api.DistributeVertically(),Common.component.Analytics.trackEvent("ToolBar","Distribute")),Common.NotificationCenter.trigger("edit:complete",this.toolbar))},onShapeArrange:function(e,t){if(this.api){switch(t.value){case 1:this.api.shapes_bringToFront(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 2:this.api.shapes_bringToBack(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 3:this.api.shapes_bringForward(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 4:this.api.shapes_bringBackward(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 5:this.api.groupShapes(),Common.component.Analytics.trackEvent("ToolBar","Shape Group");break;case 6:this.api.unGroupShapes(),Common.component.Analytics.trackEvent("ToolBar","Shape UnGroup")}Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onHyperlinkClick:function(e){var t=this,n,r,i;if(t.api){var s=function(e,n){n=="ok"&&(r=e.getSettings(),i!==!1?t.api.add_Hyperlink(r):t.api.change_Hyperlink(r)),Common.NotificationCenter.trigger("edit:complete",t.toolbar)};i=t.api.can_AddHyperlink();if(i!==!1){var o=[];for(var u=0;u<t.api.getCountPages();u++)o.push({displayValue:u+1,value:u});n=new PE.Views.HyperlinkSettingsDialog({api:t.api,handler:s,slides:o}),r=new Asc.CHyperlinkProperty,r.put_Text(i),n.show(),n.setSettings(r)}}Common.component.Analytics.trackEvent("ToolBar","Add Hyperlink")},onTablePickerSelect:function(e,t,n,r){this.api&&(this.toolbar.fireEvent("inserttable",this.toolbar),this.api.put_Table(t,n)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table")},onInsertTableClick:function(e,t,n){if(t.value==="custom"){var r=this;(new Common.Views.InsertTableDialog({handler:function(e,t){e=="ok"&&(r.api&&(r.toolbar.fireEvent("inserttable",r.toolbar),r.api.put_Table(t.columns,t.rows)),Common.NotificationCenter.trigger("edit:complete",r.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table"))}})).show()}},onInsertImageClick:function(e,t,n){if(t.value==="file")this.toolbar.fireEvent("insertimage",this.toolbar),this.api&&this.api.asc_addImage(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Image");else{var r=this;(new Common.Views.ImageFromUrlDialog({handler:function(e,t){if(e=="ok"){if(r.api){var n=t.replace(/ /g,"");_.isEmpty(n)?Common.UI.warning({msg:this.textEmptyImgUrl}):(r.toolbar.fireEvent("insertimage",r.toolbar),r.api.AddImageUrl(n),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",r.toolbar)}}})).show()}},onBtnInsertTextClick:function(e,t){this.api&&this._addAutoshape(e.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(e,t,n){t.value==="text"&&(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(e,t){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)},onClearStyleClick:function(e,t){this.api&&this.api.ClearFormating(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onCopyStyleToggle:function(e,t,n){this.api&&this.api.SetPaintFormat(t?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),this.modeAlwaysSetStyle=t},onAdvSettingsClick:function(e,t){this.toolbar.fireEvent("file:settings",this),e.cmpEl.blur()},onColorSchemaClick:function(e,t){this.api&&(this.api.ChangeColorScheme(t.value),Common.component.Analytics.trackEvent("ToolBar","Color Scheme")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSlideSize:function(e,t){if(t.value!=="advanced"){var n=this.currentPageSize.height>this.currentPageSize.width;this.currentPageSize={type:t.value,width:this.slideSizeArr[t.value][n?1:0],height:this.slideSizeArr[t.value][n?0:1]},this.api&&this.api.changeSlideSize(this.slideSizeArr[t.value][n?1:0],this.slideSizeArr[t.value][n?0:1]),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Slide Size")}else{var r,i,s=this,o=function(e,t){t=="ok"&&(i=e.getSettings(),s.currentPageSize={type:i[0],width:i[1],height:i[2]},s.toolbar.btnSlideSize.menu.items[0].setChecked(i[0]==0),s.toolbar.btnSlideSize.menu.items[1].setChecked(i[0]==1),s.api&&s.api.changeSlideSize(i[1],i[2])),Common.NotificationCenter.trigger("edit:complete",s.toolbar)};r=new PE.Views.SlideSizeSettings({handler:o}),r.show(),r.setSettings(s.currentPageSize.type,s.currentPageSize.width,s.currentPageSize.height),Common.component.Analytics.trackEvent("ToolBar","Slide Size")}},onSelectChart:function(e,t,n){var r=this,i=n.get("type"),s=!1,o=r.api.getSelectedElements();if(o&&_.isArray(o))for(var u=0;u<o.length;u++)if(Asc.c_oAscTypeSelectElement.Chart==o[u].get_ObjectType()){s=!0;break}if(s){var a=new Asc.CAscChartProp;a.changeType(i),this.api.ChartApply(a),Common.NotificationCenter.trigger("edit:complete",this.toolbar)}else this.diagramEditor||(this.diagramEditor=this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor")),this.diagramEditor&&r.api&&(this.diagramEditor.setEditMode(!1),this.diagramEditor.show(),s=r.api.asc_getChartObject(i),s&&this.diagramEditor.setChartData(new Asc.asc_CChartBinary(s)),r.toolbar.fireEvent("insertchart",r.toolbar))},onListThemeSelect:function(e,t){this._state.themeId=undefined,this.api&&this.api.ChangeTheme(t.get("themeId")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style")},onHideTitleBar:function(e,t){var n=this.getApplication().getController("Viewport").getView("Common.Views.Header");n&&n.setVisible(!t),Common.localStorage.setItem("pe-hidden-title",t?1:0),Common.NotificationCenter.trigger("layout:changed","header"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideStatusBar:function(e,t){var n=this.getApplication().getController("Statusbar").getView("Statusbar");n&&n.setVisible(!t),Common.localStorage.setItem("pe-hidden-status",t?1:0),Common.NotificationCenter.trigger("layout:changed","status"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideRulers:function(e,t){this.api&&this.api.asc_SetViewRulers(!t),Common.localStorage.setItem("pe-hidden-rulers",t?1:0),Common.NotificationCenter.trigger("layout:changed","rulers"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomToPageToggle:function(e,t){this.api&&(this._state.zoom_type=undefined,this._state.zoom_percent=undefined,t?this.api.zoomFitToPage():this.api.zoomCustomMode()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomToWidthToggle:function(e,t){this.api&&(this._state.zoom_type=undefined,this._state.zoom_percent=undefined,t?this.api.zoomFitToWidth():this.api.zoomCustomMode()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomInClick:function(e){this._state.zoom_type=undefined,this._state.zoom_percent=undefined,this.api&&this.api.zoomIn(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomOutClick:function(e){this._state.zoom_type=undefined,this._state.zoom_percent=undefined,this.api&&this.api.zoomOut(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},_clearBullets:function(){this.toolbar.btnMarkers.toggle(!1,!0),this.toolbar.btnNumbers.toggle(!1,!0),this.toolbar.mnuMarkersPicker.selectByIndex(0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(0,!0)},_getApiTextSize:function(){var e=12,t=this.api.get_TextProps();return t&&t.get_TextPr&&(e=t.get_TextPr().get_FontSize()),e},onNewFontColor:function(e,t){this.toolbar.mnuFontColorPicker.addNewColor()},onSelectFontColor:function(e,t){this._state.clrtext=this._state.clrtext_asccolor=undefined;var n=typeof t=="object"?t.color:t;this.toolbar.btnFontColor.currentColor=t,$(".btn-color-value-line",this.toolbar.btnFontColor.cmpEl).css("background-color","#"+n),this.toolbar.mnuFontColorPicker.currentColor=t,this.api&&this.api.put_TextColor(Common.Utils.ThemeColor.getRgbColor(t)),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onBtnFontColor:function(){this.toolbar.mnuFontColorPicker.trigger("select",this.toolbar.mnuFontColorPicker,this.toolbar.mnuFontColorPicker.currentColor)},onApiTextColor:function(e){var t,n=this.toolbar.mnuFontColorPicker;e&&(e.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?t={color:Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()),effectValue:e.get_value()}:t=Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()));var r=typeof t,i=typeof this._state.clrtext;if(r!==i||r=="object"&&(t.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(t.color)<0)||r!="object"&&this._state.clrtext.indexOf(t)<0){if(typeof t=="object"){var s=!1;for(var o=0;o<10;o++)if(Common.Utils.ThemeColor.ThemeValues[o]==t.effectValue){n.select(t,!0),s=!0;break}s||n.clearSelection()}else n.select(t,!0);this._state.clrtext=t}this._state.clrtext_asccolor=e},fillAutoShapes:function(){var e=this,t=this.getApplication().getCollection("ShapeGroups");for(var n=0;n<t.length;n++){var r=t.at(n),i=new Common.UI.MenuItem({caption:r.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-shapegroup'+n+'" class="menu-shape" style="width: '+(r.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});e.toolbar.btnInsertShape.menu.addItem(i);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-shapegroup"+n),store:r.get("groupStore"),parentMenu:i.menu,showLast:!1,itemTemplate:_.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",function(t,n,r,i){e.api&&(e._addAutoshape(!0,r.get("data").shapeType),e._isAddingShape=!0,e.toolbar.btnInsertText.pressed&&e.toolbar.btnInsertText.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertShape.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Shape"))})}},fillTextArt:function(){var e=this;if(this.toolbar.mnuTextArtPicker){var t=this.getApplication().getCollection("Common.Collections.TextArt").models,n=this.toolbar.mnuTextArtPicker.store.length;if(n>0&&n==t.length){var r=this.toolbar.mnuTextArtPicker.store.models;_.each(t,function(e,t){r[t].set("imageUrl",e.get("imageUrl"))})}else this.toolbar.mnuTextArtPicker.store.reset(t)}else this.toolbar.mnuTextArtPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insart"),store:this.getApplication().getCollection("Common.Collections.TextArt"),parentMenu:this.toolbar.mnuInsertTextArt.menu,showLast:!1,itemTemplate:_.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>"></div>')}),this.toolbar.mnuTextArtPicker.on("item:click",function(t,n,r,i){e.api&&(e.toolbar.fireEvent("inserttextart",e.toolbar),e.api.AddTextArt(r.get("data")),e.toolbar.btnInsertShape.pressed&&e.toolbar.btnInsertShape.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertText.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertText),Common.component.Analytics.trackEvent("ToolBar","Add Text Art"))})},fillEquations:function(){if(!this.toolbar.btnInsertEquation.rendered||this.toolbar.btnInsertEquation.menu.items.length>0)return;var e=this,t=this.getApplication().getCollection("EquationGroups");e.equationPickers=[],e.toolbar.btnInsertEquation.menu.removeAll();for(var n=0;n<t.length;++n){var r=t.at(n),i=new Common.UI.MenuItem({caption:r.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-equationgroup'+n+'" class="menu-shape" style="width:'+(r.get("groupWidth")+8)+"px; "+r.get("groupHeight")+'margin-left:5px;"></div>')}]})});e.toolbar.btnInsertEquation.menu.addItem(i);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-equationgroup"+n),store:r.get("groupStore"),parentMenu:i.menu,showLast:!1,itemTemplate:_.template('<div class="item-equation" style="background-position:<%= posX %>px <%= posY %>px;" ><div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">')});r.get("groupHeight").length&&(e.equationPickers.push(s),e.toolbar.btnInsertEquation.menu.on("show:after",function(){if(e.equationPickers.length){var t=$(this.el).find(".over").find(".menu-shape");if(t.length)for(var n=0;n<e.equationPickers.length;++n)if(t[0].id==e.equationPickers[n].el.id){e.equationPickers[n].scroller.update({alwaysVisibleY:!0}),e.equationPickers.splice(n,1);return}}})),s.on("item:click",function(t,n,r,i){e.api&&(e.api.asc_AddMath(r.get("data").equationType),e.toolbar.btnInsertText.pressed&&e.toolbar.btnInsertText.toggle(!1,!0),e.toolbar.btnInsertShape.pressed&&e.toolbar.btnInsertShape.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertEquation.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertEquation),Common.component.Analytics.trackEvent("ToolBar","Add Equation"))})}},onInsertEquationClick:function(){this.api&&(this.api.asc_AddMath(),Common.component.Analytics.trackEvent("ToolBar","Add Equation")),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertEquation)},onMathTypes:function(e){var t=[],n=this.getCollection("EquationGroups");n.reset();var r={};r[Common.define.c_oAscMathMainType.Symbol]=[this.textSymbols,11],r[Common.define.c_oAscMathMainType.Fraction]=[this.textFraction,4],r[Common.define.c_oAscMathMainType.Script]=[this.textScript,4],r[Common.define.c_oAscMathMainType.Radical]=[this.textRadical,4],r[Common.define.c_oAscMathMainType.Integral]=[this.textIntegral,3,!0],r[Common.define.c_oAscMathMainType.LargeOperator]=[this.textLargeOperator,5,!0],r[Common.define.c_oAscMathMainType.Bracket]=[this.textBracket,4,!0],r[Common.define.c_oAscMathMainType.Function]=[this.textFunction,3,!0],r[Common.define.c_oAscMathMainType.Accent]=[this.textAccent,4],r[Common.define.c_oAscMathMainType.LimitLog]=[this.textLimitAndLog,3],r[Common.define.c_oAscMathMainType.Operator]=[this.textOperator,4],r[Common.define.c_oAscMathMainType.Matrix]=[this.textMatrix,4,!0];var i={},s="",o="";for(s in Common.define.c_oAscMathType)if(Common.define.c_oAscMathType.hasOwnProperty(s)){var u=s.split("_");u.length==2&&u[0]=="Symbol"?o="txt"+u[0]+"_"+u[1].toLocaleLowerCase():o="txt"+s,i[Common.define.c_oAscMathType[s]]=this[o]}var a,f=0,l=0,c=0,h=0,p=0,d=null,v=null,m=null,g=null;if(e){l=e.get_Data().length;if(l){for(var y=0;y<l;++y){f=e.get_Data()[y].get_Id(),h=e.get_Data()[y].get_W(),p=e.get_Data()[y].get_H(),d=new Backbone.Collection([],{model:PE.Models.EquationModel});if(d){var b=0,w=0,E=0;c=e.get_Data()[y].get_Data().length;for(a=0;a<c;++a){m=e.get_Data()[y].get_Data()[a],w=m.get_Data().length;for(var S=0;S<w;++S)g=m.get_Data()[S],E=g.get_Id(),o="",i.hasOwnProperty(E)&&(o=i[E]),d.add({data:{equationType:E},tip:o,allowSelected:!0,selected:!1,width:m.get_W(),height:m.get_H(),posX:-g.get_X(),posY:-g.get_Y()});b+=w}h=r[f][1]*(h+10);var x=parseInt(370/(p+10))*(p+10);t.push({groupName:r[f][0],groupStore:d,groupWidth:h,groupHeight:r[f][2]?" height:"+x+"px!important; ":""})}}n.add(t),this.fillEquations()}}},updateThemeColors:function(){if(Common.Utils.ThemeColor.getEffectColors()===undefined)return;var e=function(e,t){if(e){var n,r=Common.Utils.ThemeColor.getEffectColors();for(var i=0;i<r.length;i++)typeof e.currentColor=="object"&&n===undefined&&e.currentColor.effectId==r[i].effectId&&(n=r[i]);e.updateColors(r,Common.Utils.ThemeColor.getStandartColors()),e.currentColor===undefined?e.currentColor=r[t]:n!==undefined&&(e.currentColor=n)}};e(this.toolbar.mnuFontColorPicker,1),this.toolbar.btnFontColor.currentColor===undefined&&(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)),this._state.clrtext_asccolor!==undefined&&(this._state.clrtext=undefined,this.onApiTextColor(this._state.clrtext_asccolor)),this._state.clrtext_asccolor=undefined},_clearChecked:function(e){_.each(e.items,function(e){e.setChecked&&e.setChecked(!1,!0)})},_onInitEditorThemes:function(e,t){var n=this;window.styles_loaded=!1;if(!n.toolbar.listTheme){n.themes=[e,t];return}var r=e||[],i=t||[];n.toolbar.listTheme.menuPicker.store.reset([]),_.each(r.concat(i),function(e){n.toolbar.listTheme.menuPicker.store.add({imageUrl:e.get_Image(),uid:Common.UI.getId(),themeId:e.get_Index()})}),n.toolbar.listTheme.menuPicker.store.length>0&&n.toolbar.listTheme.rendered&&(n.toolbar.listTheme.fillComboView(n.toolbar.listTheme.menuPicker.store.at(0),!0),Common.NotificationCenter.trigger("edit:complete",this)),window.styles_loaded=!0},onHideMenus:function(e){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSetupCopyStyleButton:function(){this.modeAlwaysSetStyle=!1;var e={kOff:0,kOn:1,kMultiple:2},t=this;Common.NotificationCenter.on({"edit:complete":function(){t.api&&t.modeAlwaysSetStyle&&(t.api.SetPaintFormat(e.kOff),t.toolbar.btnCopyStyle.toggle(!1,!0),t.modeAlwaysSetStyle=!1)}}),$(t.toolbar.btnCopyStyle.cmpEl).dblclick(function(){t.api&&(t.modeAlwaysSetStyle=!0,t.toolbar.btnCopyStyle.toggle(!0,!0),t.api.SetPaintFormat(e.kMultiple))})},activateControls:function(){this.onApiPageSize(this.api.get_PresentationWidth(),this.api.get_PresentationHeight()),this.toolbar.lockToolbar(PE.enumLock.disableOnStart,!1,{array:this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)}),this._state.activated=!0},DisableToolbar:function(e){var t=$(".toolbar-mask");if(e&&t.length>0||!e&&t.length==0)return;var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",e),this.toolbar.lockToolbar(PE.enumLock.menuFileOpen,e,{array:[n.btnAddSlide,n.btnChangeSlide,n.btnPreview,n.btnHide]});if(e){t=$("<div class='toolbar-mask'>").appendTo(n.$el);var r=n.isCompactView?150:n.mode.nativeApp?190:145;t.css("left",r+"px"),t.css("right",(n.isCompactView?0:45)+"px"),Common.util.Shortcuts.suspendEvents("command+k, ctrl+k, alt+h, command+f5, ctrl+f5")}else t.remove(),Common.util.Shortcuts.resumeEvents("command+k, ctrl+k, alt+h, command+f5, ctrl+f5")},createDelayedElements:function(){this.toolbar.createDelayedElements(),this.onToolbarAfterRender(this.toolbar)},textEmptyImgUrl:"You need to specify image URL.",textWarning:"Warning",textFontSizeErr:"The entered value must be more than 0",confirmAddFontName:"The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?",textSymbols:"Symbols",textFraction:"Fraction",textScript:"Script",textRadical:"Radical",textIntegral:"Integral",textLargeOperator:"Large Operator",textBracket:"Bracket",textFunction:"Function",textAccent:"Accent",textLimitAndLog:"Limit And Log",textOperator:"Operator",textMatrix:"Matrix",txtSymbol_pm:"Plus Minus",txtSymbol_infinity:"Infinity",txtSymbol_equals:"Equal",txtSymbol_neq:"Not Equal To",txtSymbol_about:"Approximately",txtSymbol_times:"Multiplication Sign",txtSymbol_div:"Division Sign",txtSymbol_factorial:"Factorial",txtSymbol_propto:"Proportional To",txtSymbol_less:"Less Than",txtSymbol_ll:"Much Less Than",txtSymbol_greater:"Greater Than",txtSymbol_gg:"Much Greater Than",txtSymbol_leq:"Less Than or Equal To",txtSymbol_geq:"Greater Than or Equal To",txtSymbol_mp:"Minus Plus",txtSymbol_cong:"Approximately Equal To",txtSymbol_approx:"Almost Equal To",txtSymbol_equiv:"Identical To",txtSymbol_forall:"For All",txtSymbol_additional:"Complement",txtSymbol_partial:"Partial Differential",txtSymbol_sqrt:"Radical Sign",txtSymbol_cbrt:"Cube Root",txtSymbol_qdrt:"Fourth Root",txtSymbol_cup:"Union",txtSymbol_cap:"Intersection",txtSymbol_emptyset:"Empty Set",txtSymbol_percent:"Percentage",txtSymbol_degree:"Degrees",txtSymbol_fahrenheit:"Degrees Fahrenheit",txtSymbol_celsius:"Degrees Celsius",txtSymbol_inc:"Increment",txtSymbol_nabla:"Nabla",txtSymbol_exists:"There Exist",txtSymbol_notexists:"There Does Not Exist",txtSymbol_in:"Element Of",txtSymbol_ni:"Contains as Member",txtSymbol_leftarrow:"Left Arrow",txtSymbol_uparrow:"Up Arrow",txtSymbol_rightarrow:"Right Arrow",txtSymbol_downarrow:"Down Arrow",txtSymbol_leftrightarrow:"Left-Right Arrow",txtSymbol_therefore:"Therefore",txtSymbol_plus:"Plus",txtSymbol_minus:"Minus",txtSymbol_not:"Not Sign",txtSymbol_ast:"Asterisk Operator",txtSymbol_bullet:"Bulet Operator",txtSymbol_vdots:"Vertical Ellipsis",txtSymbol_cdots:"Midline Horizontal Ellipsis",txtSymbol_rddots:"Up Right Diagonal Ellipsis",txtSymbol_ddots:"Down Right Diagonal Ellipsis",txtSymbol_aleph:"Alef",txtSymbol_beth:"Bet",txtSymbol_qed:"End of Proof",txtSymbol_alpha:"Alpha",txtSymbol_beta:"Beta",txtSymbol_gamma:"Gamma",txtSymbol_delta:"Delta",txtSymbol_varepsilon:"Epsilon Variant",txtSymbol_epsilon:"Epsilon",txtSymbol_zeta:"Zeta",txtSymbol_eta:"Eta",txtSymbol_theta:"Theta",txtSymbol_vartheta:"Theta Variant",txtSymbol_iota:"Iota",txtSymbol_kappa:"Kappa",txtSymbol_lambda:"Lambda",txtSymbol_mu:"Mu",txtSymbol_nu:"Nu",txtSymbol_xsi:"Xi",txtSymbol_o:"Omicron",txtSymbol_pi:"Pi",txtSymbol_varpi:"Pi Variant",txtSymbol_rho:"Rho",txtSymbol_varrho:"Rho Variant",txtSymbol_sigma:"Sigma",txtSymbol_varsigma:"Sigma Variant",txtSymbol_tau:"Tau",txtSymbol_upsilon:"Upsilon",txtSymbol_varphi:"Phi Variant",txtSymbol_phi:"Phi",txtSymbol_chi:"Chi",txtSymbol_psi:"Psi",txtSymbol_omega:"Omega",txtFractionVertical:"Stacked Fraction",txtFractionDiagonal:"Skewed Fraction",txtFractionHorizontal:"Linear Fraction",txtFractionSmall:"Small Fraction",txtFractionDifferential_1:"Differential",txtFractionDifferential_2:"Differential",txtFractionDifferential_3:"Differential",txtFractionDifferential_4:"Differential",txtFractionPi_2:"Pi Over 2",txtScriptSup:"Superscript",txtScriptSub:"Subscript",txtScriptSubSup:"Subscript-Superscript",txtScriptSubSupLeft:"Left Subscript-Superscript",txtScriptCustom_1:"Script",txtScriptCustom_2:"Script",txtScriptCustom_3:"Script",txtScriptCustom_4:"Script",txtRadicalSqrt:"Square Root",txtRadicalRoot_n:"Radical With Degree",txtRadicalRoot_2:"Square Root With Degree",txtRadicalRoot_3:"Cubic Root",txtRadicalCustom_1:"Radical",txtRadicalCustom_2:"Radical",txtIntegral:"Integral",txtIntegralSubSup:"Integral",txtIntegralCenterSubSup:"Integral",txtIntegralDouble:"Double Integral",txtIntegralDoubleSubSup:"Double Integral",txtIntegralDoubleCenterSubSup:"Double Integral",txtIntegralTriple:"Triple Integral",txtIntegralTripleSubSup:"Triple Integral",txtIntegralTripleCenterSubSup:"Triple Integral",txtIntegralOriented:"Contour Integral",txtIntegralOrientedSubSup:"Contour Integral",txtIntegralOrientedCenterSubSup:"Contour Integral",txtIntegralOrientedDouble:"Surface Integral",txtIntegralOrientedDoubleSubSup:"Surface Integral",txtIntegralOrientedDoubleCenterSubSup:"Surface Integral",txtIntegralOrientedTriple:"Volume Integral",txtIntegralOrientedTripleSubSup:"Volume Integral",txtIntegralOrientedTripleCenterSubSup:"Volume Integral",txtIntegral_dx:"Differential x",txtIntegral_dy:"Differential y",txtIntegral_dtheta:"Differential theta",txtLargeOperator_Sum:"Summation",txtLargeOperator_Sum_CenterSubSup:"Summation",txtLargeOperator_Sum_SubSup:"Summation",txtLargeOperator_Sum_CenterSub:"Summation",txtLargeOperator_Sum_Sub:"Summation",txtLargeOperator_Prod:"Product",txtLargeOperator_Prod_CenterSubSup:"Product",txtLargeOperator_Prod_SubSup:"Product",txtLargeOperator_Prod_CenterSub:"Product",txtLargeOperator_Prod_Sub:"Product",txtLargeOperator_CoProd:"Co-Product",txtLargeOperator_CoProd_CenterSubSup:"Co-Product",txtLargeOperator_CoProd_SubSup:"Co-Product",txtLargeOperator_CoProd_CenterSub:"Co-Product",txtLargeOperator_CoProd_Sub:"Co-Product",txtLargeOperator_Union:"Union",txtLargeOperator_Union_CenterSubSup:"Union",txtLargeOperator_Union_SubSup:"Union",txtLargeOperator_Union_CenterSub:"Union",txtLargeOperator_Union_Sub:"Union",txtLargeOperator_Intersection:"Intersection",txtLargeOperator_Intersection_CenterSubSup:"Intersection",txtLargeOperator_Intersection_SubSup:"Intersection",txtLargeOperator_Intersection_CenterSub:"Intersection",txtLargeOperator_Intersection_Sub:"Intersection",txtLargeOperator_Disjunction:"Vee",txtLargeOperator_Disjunction_CenterSubSup:"Vee",txtLargeOperator_Disjunction_SubSup:"Vee",txtLargeOperator_Disjunction_CenterSub:"Vee",txtLargeOperator_Disjunction_Sub:"Vee",txtLargeOperator_Conjunction:"Wedge",txtLargeOperator_Conjunction_CenterSubSup:"Wedge",txtLargeOperator_Conjunction_SubSup:"Wedge",txtLargeOperator_Conjunction_CenterSub:"Wedge",txtLargeOperator_Conjunction_Sub:"Wedge",txtLargeOperator_Custom_1:"Summation",txtLargeOperator_Custom_2:"Summation",txtLargeOperator_Custom_3:"Summation",txtLargeOperator_Custom_4:"Product",txtLargeOperator_Custom_5:"Union",txtBracket_Round:"Brackets",txtBracket_Square:"Brackets",txtBracket_Curve:"Brackets",txtBracket_Angle:"Brackets",txtBracket_LowLim:"Brackets",txtBracket_UppLim:"Brackets",txtBracket_Line:"Brackets",txtBracket_LineDouble:"Brackets",txtBracket_Square_OpenOpen:"Brackets",txtBracket_Square_CloseClose:"Brackets",txtBracket_Square_CloseOpen:"Brackets",txtBracket_SquareDouble:"Brackets",txtBracket_Round_Delimiter_2:"Brackets with Separators",txtBracket_Curve_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_3:"Brackets with Separators",txtBracket_Round_OpenNone:"Single Bracket",txtBracket_Round_NoneOpen:"Single Bracket",txtBracket_Square_OpenNone:"Single Bracket",txtBracket_Square_NoneOpen:"Single Bracket",txtBracket_Curve_OpenNone:"Single Bracket",txtBracket_Curve_NoneOpen:"Single Bracket",txtBracket_Angle_OpenNone:"Single Bracket",txtBracket_Angle_NoneOpen:"Single Bracket",txtBracket_LowLim_OpenNone:"Single Bracket",txtBracket_LowLim_NoneNone:"Single Bracket",txtBracket_UppLim_OpenNone:"Single Bracket",txtBracket_UppLim_NoneOpen:"Single Bracket",txtBracket_Line_OpenNone:"Single Bracket",txtBracket_Line_NoneOpen:"Single Bracket",txtBracket_LineDouble_OpenNone:"Single Bracket",txtBracket_LineDouble_NoneOpen:"Single Bracket",txtBracket_SquareDouble_OpenNone:"Single Bracket",txtBracket_SquareDouble_NoneOpen:"Single Bracket",txtBracket_Custom_1:"Case (Two Conditions)",txtBracket_Custom_2:"Cases (Three Conditions)",txtBracket_Custom_3:"Stack Object",txtBracket_Custom_4:"Stack Object",txtBracket_Custom_5:"Cases Example",txtBracket_Custom_6:"Binomial Coefficient",txtBracket_Custom_7:"Binomial Coefficient",txtFunction_Sin:"Sine Function",txtFunction_Cos:"Cosine Function",txtFunction_Tan:"Tangent Function",txtFunction_Csc:"Cosecant Function",txtFunction_Sec:"Secant Function",txtFunction_Cot:"Cotangent Function",txtFunction_1_Sin:"Inverse Sine Function",txtFunction_1_Cos:"Inverse Cosine Function",txtFunction_1_Tan:"Inverse Tangent Function",txtFunction_1_Csc:"Inverse Cosecant Function",txtFunction_1_Sec:"Inverse Secant Function",txtFunction_1_Cot:"Inverse Cotangent Function",txtFunction_Sinh:"Hyperbolic Sine Function",txtFunction_Cosh:"Hyperbolic Cosine Function",txtFunction_Tanh:"Hyperbolic Tangent Function",txtFunction_Csch:"Hyperbolic Cosecant Function",txtFunction_Sech:"Hyperbolic Secant Function",txtFunction_Coth:"Hyperbolic Cotangent Function",txtFunction_1_Sinh:"Hyperbolic Inverse Sine Function",txtFunction_1_Cosh:"Hyperbolic Inverse Cosine Function",txtFunction_1_Tanh:"Hyperbolic Inverse Tangent Function",txtFunction_1_Csch:"Hyperbolic Inverse Cosecant Function",txtFunction_1_Sech:"Hyperbolic Inverse Secant Function",txtFunction_1_Coth:"Hyperbolic Inverse Cotangent Function",txtFunction_Custom_1:"Sine theta",txtFunction_Custom_2:"Cos 2x",txtFunction_Custom_3:"Tangent formula",txtAccent_Dot:"Dot",txtAccent_DDot:"Double Dot",txtAccent_DDDot:"Triple Dot",txtAccent_Hat:"Hat",txtAccent_Check:"Check",txtAccent_Accent:"Acute",txtAccent_Grave:"Grave",txtAccent_Smile:"Breve",txtAccent_Tilde:"Tilde",txtAccent_Bar:"Bar",txtAccent_DoubleBar:"Double Overbar",txtAccent_CurveBracketTop:"Overbrace",txtAccent_CurveBracketBot:"Underbrace",txtAccent_GroupTop:"Grouping Character Above",txtAccent_GroupBot:"Grouping Character Below",txtAccent_ArrowL:"Leftwards Arrow Above",txtAccent_ArrowR:"Rightwards Arrow Above",txtAccent_ArrowD:"Right-Left Arrow Above",txtAccent_HarpoonL:"Leftwards Harpoon Above",txtAccent_HarpoonR:"Rightwards Harpoon Above",txtAccent_BorderBox:"Boxed Formula (With Placeholder)",txtAccent_BorderBoxCustom:"Boxed Formula (Example)",txtAccent_BarTop:"Overbar",txtAccent_BarBot:"Underbar",txtAccent_Custom_1:"Vector A",txtAccent_Custom_2:"ABC With Overbar",txtAccent_Custom_3:"x XOR y With Overbar",txtLimitLog_LogBase:"Logarithm",txtLimitLog_Log:"Logarithm",txtLimitLog_Lim:"Limit",txtLimitLog_Min:"Minimum",txtLimitLog_Max:"Maximum",txtLimitLog_Ln:"Natural Logarithm",txtLimitLog_Custom_1:"Limit Example",txtLimitLog_Custom_2:"Maximum Example",txtOperator_ColonEquals:"Colon Equal",txtOperator_EqualsEquals:"Equal Equal",txtOperator_PlusEquals:"Plus Equal",txtOperator_MinusEquals:"Minus Equal",txtOperator_Definition:"Equal to By Definition",txtOperator_UnitOfMeasure:"Measured By",txtOperator_DeltaEquals:"Delta Equal To",txtOperator_ArrowL_Top:"Leftwards Arrow Above",txtOperator_ArrowR_Top:"Rightwards Arrow Above",txtOperator_ArrowL_Bot:"Leftwards Arrow Below",txtOperator_ArrowR_Bot:"Rightwards Arrow Below",txtOperator_DoubleArrowL_Top:"Leftwards Arrow Above",txtOperator_DoubleArrowR_Top:"Rightwards Arrow Above",txtOperator_DoubleArrowL_Bot:"Leftwards Arrow Below",txtOperator_DoubleArrowR_Bot:"Rightwards Arrow Below",txtOperator_ArrowD_Top:"Right-Left Arrow Above",txtOperator_ArrowD_Bot:"Right-Left Arrow Above",txtOperator_DoubleArrowD_Top:"Right-Left Arrow Below",txtOperator_DoubleArrowD_Bot:"Right-Left Arrow Below",txtOperator_Custom_1:"Yileds",txtOperator_Custom_2:"Delta Yields",txtMatrix_1_2:"1x2 Empty Matrix",txtMatrix_2_1:"2x1 Empty Matrix",txtMatrix_1_3:"1x3 Empty Matrix",txtMatrix_3_1:"3x1 Empty Matrix",txtMatrix_2_2:"2x2 Empty Matrix",txtMatrix_2_3:"2x3 Empty Matrix",txtMatrix_3_2:"3x2 Empty Matrix",txtMatrix_3_3:"3x3 Empty Matrix",txtMatrix_Dots_Center:"Midline Dots",txtMatrix_Dots_Baseline:"Baseline Dots",txtMatrix_Dots_Vertical:"Vertical Dots",txtMatrix_Dots_Diagonal:"Diagonal Dots",txtMatrix_Identity_2:"2x2 Identity Matrix",txtMatrix_Identity_2_NoZeros:"3x3 Identity Matrix",txtMatrix_Identity_3:"3x3 Identity Matrix",txtMatrix_Identity_3_NoZeros:"3x3 Identity Matrix",txtMatrix_2_2_RoundBracket:"Empty Matrix with Brackets",txtMatrix_2_2_SquareBracket:"Empty Matrix with Brackets",txtMatrix_2_2_LineBracket:"Empty Matrix with Brackets",txtMatrix_2_2_DLineBracket:"Empty Matrix with Brackets",txtMatrix_Flat_Round:"Sparse Matrix",txtMatrix_Flat_Square:"Sparse Matrix"},PE.Controllers.Toolbar||{}))}),define("text!presentationeditor/main/app/template/StatusBar.template",[],function(){return'\r\n<div class="statusbar" style="display:table;">\r\n <div class="status-group dropup">\r\n <button id="status-btn-preview" type="button" class="btn small btn-toolbar" style="margin-left: 9px;"><span class="btn-icon"> </span></button>\r\n <label id="status-label-pages" class="status-label dropdown-toggle" style="margin-left: 7px;" 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 <!-- /** coauthoring begin **/ -->\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="status-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 <!-- /** coauthoring end **/ -->\r\n <div class="status-group" style="width:100%; text-align:center;">\r\n <label id="status-label-action" class="status-label"></label>\r\n </div>\r\n <div class="status-group" style="">\r\n <button id="btn-zoom-topage" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>\r\n <button id="btn-zoom-towidth" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>\r\n <button id="btn-zoom-down" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>\r\n <div class="cnt-zoom">\r\n <div class="dropdown-toggle" data-toggle="dropdown">\r\n <label id="status-label-zoom" class="status-label">Zoom 100%</label>\r\n </div>\r\n </div>\r\n <button id="btn-zoom-up" type="button" class="btn small btn-toolbar" style="margin-right:40px;"><span class="btn-icon"> </span></button>\r\n </div>\r\n</div>\r\n'}),define("presentationeditor/main/app/view/Statusbar",["text!presentationeditor/main/app/template/StatusBar.template","backbone","tip","common/main/lib/component/Menu","common/main/lib/component/Window","presentationeditor/main/app/model/Pages"],function(e,t){"use strict";function n(e){this.pages.set("count",e);var t=e<=0;this.btnPreview.isDisabled()!==t&&this.btnPreview.setDisabled(t)}function r(e){this.pages.set("current",e+1)}function s(e,t,n){$("#status-label-pages").text(Common.Utils.String.format(this.pageIndexText,e.get("current"),e.get("count")))}var i=_.template("Slide <%= current %> of <%= count %>");PE.Views.Statusbar=t.View.extend(_.extend({el:"#statusbar",template:_.template(e),storeUsers:undefined,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:_.template("<ul><% _.each(users, function(item) { %><%= _.template(usertpl, {user: item, scope: scope}) %><% }); %></ul>"),events:{},api:undefined,pages:undefined,initialize:function(e){_.extend(this,e),this.pages=new PE.Models.Pages({current:1,count:1}),this.pages.on("change",_.bind(s,this))},render:function(){var e=this;$(this.el).html(this.template({scope:this})),this.btnZoomToPage=new Common.UI.Button({el:$("#btn-zoom-topage",this.el),hint:this.tipFitPage,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomToWidth=new Common.UI.Button({el:$("#btn-zoom-towidth",this.el),hint:this.tipFitWidth,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomDown=new Common.UI.Button({el:$("#btn-zoom-down",this.el),hint:this.tipZoomOut+Common.Utils.String.platformKey("Ctrl+-"),hintAnchor:"top"}),this.btnZoomUp=new Common.UI.Button({el:$("#btn-zoom-up",this.el),hint:this.tipZoomIn+Common.Utils.String.platformKey("Ctrl++"),hintAnchor:"top-right"}),this.cntZoom=new Common.UI.Button({el:$(".cnt-zoom",this.el),hint:this.tipZoomFactor,hintAnchor:"top"}),this.cntZoom.cmpEl.on("show.bs.dropdown",function(){_.defer(function(){e.cntZoom.cmpEl.find("ul").focus()},100)}),this.cntZoom.cmpEl.on("hide.bs.dropdown",function(){_.defer(function(){e.api.asc_enableKeyEvents(!0)},100)}),this.zoomMenu=new Common.UI.Menu({style:"margin-top:-5px;",menuAlign:"bl-tl",items:[{caption:"50%",value:50},{caption:"75%",value:75},{caption:"100%",value:100},{caption:"125%",value:125},{caption:"150%",value:150},{caption:"175%",value:175},{caption:"200%",value:200}]}),this.zoomMenu.render($(".cnt-zoom",this.el)),this.zoomMenu.cmpEl.attr({tabindex:-1}),this.panelUsersList=$("#status-users-list",this.el),this.storeUsers.bind({add:_.bind(this._onAddUser,this),change:_.bind(this._onUsersChanged,this),reset:_.bind(this._onResetUsers,this)}),this.panelUsers=$("#status-users-ct",this.el),this.panelUsers.on("shown.bs.dropdown",function(){e.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0});var t=e.panelUsersBlock.data("bs.tooltip");t&&t.hide()}),this.panelUsersBlock=this.panelUsers.find("#status-users-block"),this.panelUsersBlock.tooltip({title:this.tipAccessRights,html:!0,placement:"top"}),this.panelUsersBlock.on("click",_.bind(this.onUsersClick,this)),this.lblUserCount=this.panelUsers.find("#status-users-count"),this.lblChangeRights=this.panelUsers.find("#status-change-rights"),this.lblChangeRights.on("click",_.bind(this.onUsersClick,this)),this.$el.find("#status-users-menu").on("click",function(){return!1}),this.txtGoToPage=(new Common.UI.InputField({el:$("#status-goto-page"),allowBlank:!0,validateOnChange:!0,style:"width: 60px;",maskExp:/[0-9]/,validation:function(t){if(/(^[0-9]+$)/.test(t)){t=parseInt(t);if(undefined!==t&&t>0&&t<=e.pages.get("count"))return!0}return e.txtPageNumInvalid}})).on("keypress:after",function(t,n){if(n.keyCode===Common.UI.Keys.RETURN){var r=e.$el.find("#status-goto-box"),i=r.find("input[type=text]"),s=parseInt(i.val());return!s||s-->e.pages.get("count")||s<0?(i.select(),!1):(r.focus(),r.parent().removeClass("open"),e.api.goToPage(s),e.api.asc_enableKeyEvents(!0),!1)}}).on("keyup:after",function(t,n){if(n.keyCode===Common.UI.Keys.ESC){var r=e.$el.find("#status-goto-box");return r.focus(),r.parent().removeClass("open"),e.api.asc_enableKeyEvents(!0),!1}});var t=this.$el.find("#status-goto-box");return t.on("click",function(){return!1}),t.parent().on("show.bs.dropdown",function(){e.txtGoToPage.setValue(e.api.getCurrentPage()+1),e.txtGoToPage.checkValidate();var t=e.txtGoToPage.$el.find("input");_.defer(function(){t.focus(),t.select()},100)}),t.parent().on("hide.bs.dropdown",function(){var t=e.$el.find("#status-goto-box");e.api&&t&&(t.focus(),t.parent().removeClass("open"),e.api.asc_enableKeyEvents(!0))}),this.btnPreview=new Common.UI.Button({el:$("#status-btn-preview",this.el),hint:this.tipPreview,hintAnchor:"top"}),this},setApi:function(e){return this.api=e,this.api&&(this.api.asc_registerCallback("asc_onCountPages",_.bind(n,this)),this.api.asc_registerCallback("asc_onCurrentPage",_.bind(r,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onApiUsersChanged,this))),this},setMode:function(e){this.mode=e,this.$el.find(".el-edit")[this.mode.isEdit?"show":"hide"](),this.lblChangeRights[!this.mode.isOffline&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.panelUsers[!this.mode.isOffline&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"]()},setVisible:function(e){e?this.show():this.hide()},onUsersClick:function(){this.panelUsers.removeClass("open"),this.fireEvent("click:users",this)},onApiUsersChanged:function(e){var t=0;_.each(e,function(e){e.asc_getView()||t++}),this.panelUsers[t>1||this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.lblUserCount.css({"font-size":t>1?"11px":"14px","font-weight":t>1?"bold":"normal","margin-top":t>1?"0":"-1px"}),this.lblUserCount.text(t>1?t:"+"),$("#status-users-icon").css("margin-bottom",t>1?"0":"2px");var n=this.panelUsersBlock.data("bs.tooltip");n&&(n.options.title=t>1?this.tipViewUsers:this.tipAccessRights,n.setContent()),t>1?this.panelUsersBlock.attr("data-toggle","dropdown"):this.panelUsersBlock.removeAttr("data-toggle"),this.panelUsersBlock.toggleClass("dropdown-toggle",t>1),t>1?this.panelUsersBlock.off("click"):this.panelUsersBlock.on("click",_.bind(this.onUsersClick,this))},_onAddUser:function(e,t,n){this.panelUsersList&&(this.panelUsersList.find("ul").append(_.template(this.tplUser,{user:e,scope:this})),this.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},_onUsersChanged:function(e){e.changed.online!=undefined&&this.panelUsersList&&(this.panelUsersList.find("#status-chat-user-"+e.get("id"))[e.changed.online?"removeClass":"addClass"]("offline"),this.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},_onResetUsers:function(e,t){this.panelUsersList&&(this.panelUsersList.html(this.templateUserList({users:e.models,usertpl:this.tplUser,scope:this})),this.panelUsersList.scroller=new Common.UI.Scroller({el:$("#status-users-list ul"),useKeyboard:!0,minScrollbarLength:40,alwaysVisibleY:!0}))},getUserName:function(e){return Common.Utils.String.htmlEncode(e)},showStatusMessage:function(e){$("#status-label-action").text(e)},clearStatusMessage:function(){$("#status-label-action").text("")},pageIndexText:"Slide {0} of {1}",goToPageText:"Go to Slide",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 Slide",tipFitWidth:"Fit to Width",tipZoomIn:"Zoom In",tipZoomOut:"Zoom Out",tipZoomFactor:"Magnification",txtPageNumInvalid:"Slide number invalid",tipPreview:"Start Slideshow",tipAccessRights:"Manage document access rights",tipViewUsers:"View users and manage document access rights",txAccessRights:"Change access rights"},PE.Views.Statusbar||{}))}),define("presentationeditor/main/app/controller/Statusbar",["core","presentationeditor/main/app/view/Statusbar"],function(){"use strict";PE.Controllers.Statusbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Statusbar"],initialize:function(){this.addListeners({Statusbar:{}}),this._state={zoom_type:undefined,zoom_percent:undefined}},events:function(){return{"click #btn-zoom-down":_.bind(this.zoomDocument,this,"down"),"click #btn-zoom-up":_.bind(this.zoomDocument,this,"up")}},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),$("#status-label-zoom").css("min-width",70),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.btnPreview.on("click",_.bind(this.onPreview,this))},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onZoomChange",_.bind(this._onZoomChange,this)),this.statusbar.setApi(e)},onBtnZoomTo:function(e,t,n){this._state.zoom_type=undefined,this._state.zoom_percent=undefined,t.pressed?this.api[e=="topage"?"zoomFitToPage":"zoomFitToWidth"]():this.api.zoomCustomMode(),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},zoomDocument:function(e,t){this._state.zoom_type=undefined,this._state.zoom_percent=undefined;switch(e){case"up":this.api.zoomIn();break;case"down":this.api.zoomOut()}Common.NotificationCenter.trigger("edit:complete",this.statusbar)},menuZoomClick:function(e,t){this._state.zoom_type=undefined,this._state.zoom_percent=undefined,this.api.zoom(t.value),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},onPreview:function(e,t){var n=PE.getController("Viewport").getView("DocumentPreview"),r=this,i=!1;if(n&&r.api){n.show();var s=function(){if(i)return;i=!0,Common.NotificationCenter.off("window:resize",s);var e=r.api.getCurrentPage();r.api.StartDemonstration("presentation-preview",_.isNumber(e)?e:0),Common.component.Analytics.trackEvent("Status Bar","Preview")};!r.statusbar.mode.isDesktopApp&&!Common.Utils.isIE11?(Common.NotificationCenter.on("window:resize",s),r.fullScreen(document.documentElement),setTimeout(function(){s()},100)):s()}},fullScreen:function(e){e&&(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},_onZoomChange:function(e,t){this._state.zoom_type!==t&&(this.statusbar.btnZoomToPage.toggle(t==2,!0),this.statusbar.btnZoomToWidth.toggle(t==1,!0),this._state.zoom_type=t),this._state.zoom_percent!==e&&($("#status-label-zoom").text(Common.Utils.String.format(this.zoomText,e)),this._state.zoom_percent=e)},setStatusCaption:function(e,t,n){if(this.timerCaption&&(new Date<this.timerCaption||e.length==0)&&!t)return;this.timerCaption=undefined,e.length?(this.statusbar.showStatusMessage(e),n>0&&(this.timerCaption=(new Date).getTime()+n)):this.statusbar.clearStatusMessage()},createDelayedElements:function(){this.statusbar.$el.css("z-index","")},zoomText:"Zoom {0}%"},PE.Controllers.Statusbar||{}))}),define("text!presentationeditor/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-slide-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-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-slide" class="btn btn-category arrow-left" content-target="id-slide-settings"><span class="btn-icon img-toolbarmenu btn-menu-slide"> </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-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-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-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 </div>\n</div>'}),define("text!presentationeditor/main/app/template/ParagraphSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.strLineHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <div id="paragraph-combo-line-rule" style="width: 85px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <div id="paragraph-spin-line-height"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.strParagraphSpacing %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.strSpacingBefore %></label>\r\n <div id="paragraph-spin-spacing-before"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.strSpacingAfter %></label>\r\n <div id="paragraph-spin-spacing-after"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center" colspan=2>\r\n <label class="link" id="paragraph-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("presentationeditor/main/app/view/ParagraphSettings",["text!presentationeditor/main/app/template/ParagraphSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","presentationeditor/main/app/view/ParagraphSettingsAdvanced"],function(e,t,n,r){"use strict";PE.Views.ParagraphSettings=r.View.extend(n.extend({el:"#id-paragraph-settings",template:n.template(e),events:{},options:{alias:"ParagraphSettings"},initialize:function(){this._initSettings=!0,this._state={LineRule:c_paragraphLinerule.LINERULE_AUTO,LineHeight:1.5,LineSpacingBefore:0,LineSpacingAfter:.35,DisabledControls:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this.render()},render:function(){var e=t(this.el);e.html(this.template({scope:this})),this.linkAdvanced=t("#paragraph-advanced-link")},setApi:function(e){return this.api=e,this.api&&this.api.asc_registerCallback("asc_onParaSpacingLine",n.bind(this._onLineSpacing,this)),this},onNumLineHeightChange:function(e,t,n,r){if(this.cmbLineRule.getRawValue()==="")return;this.api&&this.api.put_PrLineSpacing(this.cmbLineRule.getValue(),this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?e.getNumberValue():Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this.fireEvent("editcomplete",this)},onNumSpacingBeforeChange:function(e,t,n,r){if(this.api){var i=e.getNumberValue();i<0?this.api.put_LineSpacingBeforeAfter(0,-1):this.api.put_LineSpacingBeforeAfter(0,Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))}this.fireEvent("editcomplete",this)},onNumSpacingAfterChange:function(e,t,n,r){if(this.api){var i=e.getNumberValue();i<0?this.api.put_LineSpacingBeforeAfter(1,-1):this.api.put_LineSpacingBeforeAfter(1,Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))}this.fireEvent("editcomplete",this)},onLineRuleSelect:function(e,t){this.api&&this.api.put_PrLineSpacing(t.value,t.defaultValue),this.numLineHeight.setDefaultUnit(t.defaultUnit),this.numLineHeight.setMinValue(t.minValue),this.numLineHeight.setStep(t.step),this.fireEvent("editcomplete",this)},_onLineSpacing:function(e){if(this._initSettings)return;var t=e.get_LineRule(),n=e.get_Line();if(this._state.LineRule!==t){var r,i=this.cmbLineRule.store.findWhere((r={},r.value=t,r));i||(i=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(t!==null?t:""),this.numLineHeight.setMinValue(i.get("minValue")),this.numLineHeight.setDefaultUnit(i.get("defaultUnit")),this.numLineHeight.setStep(i.get("step")),this._state.LineRule=t}if(Math.abs(this._state.LineHeight-n)>.001||(this._state.LineHeight===null||n===null)&&this._state.LineHeight!==n){var s="";t==c_paragraphLinerule.LINERULE_AUTO?s=n:t!==null&&n!==null&&(s=Common.Utils.Metric.fnRecalcFromMM(n)),this.numLineHeight.setValue(s!==null?s:"",!0),this._state.LineHeight=n}},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked);if(e){var t={Line:e.get_Spacing().get_Line(),Before:e.get_Spacing().get_Before(),After:e.get_Spacing().get_After(),LineRule:e.get_Spacing().get_LineRule()},n={ContextualSpacing:e.get_ContextualSpacing()};if(this._state.LineRule!==t.LineRule){var r,i=this.cmbLineRule.store.findWhere((r={},r.value=t.LineRule,r));i||(i=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(t.LineRule!==null?t.LineRule:""),this.numLineHeight.setMinValue(i.get("minValue")),this.numLineHeight.setDefaultUnit(i.get("defaultUnit")),this.numLineHeight.setStep(i.get("step")),this._state.LineRule=t.LineRule}if(Math.abs(this._state.LineHeight-t.Line)>.001||(this._state.LineHeight===null||t.Line===null)&&this._state.LineHeight!==t.Line){var s="";t.LineRule==c_paragraphLinerule.LINERULE_AUTO?s=t.Line:t.LineRule!==null&&t.Line!==null&&(s=Common.Utils.Metric.fnRecalcFromMM(t.Line)),this.numLineHeight.setValue(s!==null?s:"",!0),this._state.LineHeight=t.Line}if(Math.abs(this._state.LineSpacingBefore-t.Before)>.001||(this._state.LineSpacingBefore===null||t.Before===null)&&this._state.LineSpacingBefore!==t.Before)this.numSpacingBefore.setValue(t.Before!==null?t.Before<0?t.Before:Common.Utils.Metric.fnRecalcFromMM(t.Before):"",!0),this._state.LineSpacingBefore=t.Before;if(Math.abs(this._state.LineSpacingAfter-t.After)>.001||(this._state.LineSpacingAfter===null||t.After===null)&&this._state.LineSpacingAfter!==t.After)this.numSpacingAfter.setValue(t.After!==null?t.After<0?t.After:Common.Utils.Metric.fnRecalcFromMM(t.After):"",!0),this._state.LineSpacingAfter=t.After}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01)}if(this.cmbLineRule){var n=this.cmbLineRule.store.at(1);n.set({defaultUnit:Common.Utils.Metric.getCurrentMetricName(),minValue:parseFloat(Common.Utils.Metric.fnRecalcFromMM(.3).toFixed(2)),step:Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01});if(this._state.LineRule!==null){var r;n=this.cmbLineRule.store.findWhere((r={},r.value=this._state.LineRule,r)),n||(n=this.cmbLineRule.store.at(0)),this.numLineHeight.setDefaultUnit(n.get("defaultUnit")),this.numLineHeight.setStep(n.get("step"))}}},createDelayedControls:function(){var e=this;this._arrLineRule=[{displayValue:this.textAuto,defaultValue:1,value:c_paragraphLinerule.LINERULE_AUTO,minValue:.5,step:.01,defaultUnit:""},{displayValue:this.textExact,defaultValue:5,value:c_paragraphLinerule.LINERULE_EXACT,minValue:.03,step:.01,defaultUnit:"cm"}],this.cmbLineRule=new Common.UI.ComboBox({el:t("#paragraph-combo-line-rule"),cls:"input-group-nr",menuStyle:"min-width: 85px;",editable:!1,data:this._arrLineRule}),this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO),this.lockedControls.push(this.cmbLineRule),this.numLineHeight=new Common.UI.MetricSpinner({el:t("#paragraph-spin-line-height"),step:.01,width:85,value:"1.5",defaultUnit:"",maxValue:132,minValue:.5}),this.lockedControls.push(this.numLineHeight),this.numSpacingBefore=new Common.UI.MetricSpinner({el:t("#paragraph-spin-spacing-before"),step:.1,width:85,value:"0 cm",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.spinners.push(this.numSpacingBefore),this.lockedControls.push(this.numSpacingBefore),this.numSpacingAfter=new Common.UI.MetricSpinner({el:t("#paragraph-spin-spacing-after"),step:.1,width:85,value:"0.35 cm",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.spinners.push(this.numSpacingAfter),this.lockedControls.push(this.numSpacingAfter),this.numLineHeight.on("change",n.bind(this.onNumLineHeightChange,this)),this.numSpacingBefore.on("change",n.bind(this.onNumSpacingBeforeChange,this)),this.numSpacingAfter.on("change",n.bind(this.onNumSpacingAfterChange,this)),this.cmbLineRule.on("selected",n.bind(this.onLineRuleSelect,this)),this.cmbLineRule.on("hide:after",n.bind(this.onHideMenus,this)),t(this.el).on("click","#paragraph-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;if(t.api&&!this._locked){var r=t.api.getSelectedElements();if(r&&r.length>0){var i,s;for(var o=r.length-1;o>=0;o--){i=r[o].get_ObjectType(),s=r[o].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Paragraph==i){(new PE.Views.ParagraphSettingsAdvanced({paragraphProps:s,api:t.api,handler:function(e,n){e=="ok"&&t.api&&t.api.paraApply(n.paragraphProps),t.fireEvent("editcomplete",t)}})).show();break}}}}},onHideMenus:function(e,t,n){n||this.fireEvent("editcomplete",this)},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},strParagraphSpacing:"Paragraph Spacing",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto"},PE.Views.ParagraphSettings||{}))}),define("text!presentationeditor/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" 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!presentationeditor/main/app/template/ImageSettingsAdvanced.template",[],function(){return'<div id="id-adv-image-size" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="4" width="100%">\r\n <tr>\r\n <td colspan="4" width="88px" class="padding-small">\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="88px" class="padding-large">\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;" class="padding-large">\r\n <div id="image-advanced-button-ratio"></div>\r\n </td>\r\n <td width="88px" class="padding-large">\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;" class="padding-large">\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 class="padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan="4" width="88px" class="padding-small">\r\n <label class="header"><%= scope.textPosition %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="115px">\r\n <label class="input-label">X</label>\r\n <div id="image-advanced-spin-x"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label">Y</label>\r\n <div id="image-advanced-spin-y"></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: 70px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("presentationeditor/main/app/view/ImageSettingsAdvanced",["text!presentationeditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner"],function(e){"use strict";PE.Views.ImageSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"ImageSettingsAdvanced",contentWidth:340,height:342,sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},storageName:"pe-img-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-size",panelCaption:this.textPlacement},{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._nRatio=1,this._originalProps=this.options.imageProps},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=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(e,t,n,r){if(this.btnRatio.pressed){var i=e.getNumberValue(),s=i/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,i=s*this._nRatio,this.spnWidth.setValue(i,!0)),this.spnHeight.setValue(s,!0)}},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(e,t,n,r){var i=e.getNumberValue(),s=null;this.btnRatio.pressed&&(s=i*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,i=s/this._nRatio,this.spnHeight.setValue(i,!0)),this.spnWidth.setValue(s,!0))},this)),this.spinners.push(this.spnHeight),this.btnOriginalSize=new Common.UI.Button({el:$("#image-advanced-button-original-size")}),this.btnOriginalSize.on("click",_.bind(function(e,t){this.spnWidth.setValue(this.sizeOriginal.width,!0),this.spnHeight.setValue(this.sizeOriginal.height,!0),this._nRatio=this.sizeOriginal.width/this.sizeOriginal.height},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(e,t){e.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue())},this)),this.spnX=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-x"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spinners.push(this.spnX),this.spnY=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-y"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spinners.push(this.spnY),this.inputAltTitle=(new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this.updateMetricUnit(),this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e){this.spnWidth.setMaxValue(this.sizeMax.width),this.spnHeight.setMaxValue(this.sizeMax.height),this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(e.get_Width()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.get_Height()).toFixed(2),!0),this.btnOriginalSize.setDisabled(e.get_ImageUrl()===null||e.get_ImageUrl()===undefined);var t=e.asc_getLockAspect();this.btnRatio.toggle(t),e.get_Height()>0&&(this._nRatio=e.get_Width()/e.get_Height());if(e.get_Position()){var n={X:e.get_Position().get_X(),Y:e.get_Position().get_Y()};this.spnX.setValue(n.X!==null&&n.X!==undefined?Common.Utils.Metric.fnRecalcFromMM(n.X):"",!0),this.spnY.setValue(n.Y!==null&&n.Y!==undefined?Common.Utils.Metric.fnRecalcFromMM(n.Y):"",!0)}else this.spnX.setValue("",!0),this.spnY.setValue("",!0);t=e.asc_getTitle(),this.inputAltTitle.setValue(t?t:""),t=e.asc_getDescription(),this.textareaAltDescription.val(t?t:"")}},getSettings:function(){var e=new Asc.asc_CImgProperty;this.spnHeight.getValue()!==""&&e.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())),this.spnWidth.getValue()!==""&&e.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())),e.asc_putLockAspect(this.btnRatio.pressed);var t=new Asc.CPosition;return this.spnX.getValue()!==""&&t.put_X(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())),this.spnY.getValue()!==""&&t.put_Y(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),e.put_Position(t),this.isAltTitleChanged&&e.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&e.asc_putDescription(this.textareaAltDescription.val()),{imageProps:e}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}this.sizeMax={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.width*10),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.height*10)},this.options.sizeOriginal&&(this.sizeOriginal={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.width),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.height)})},textOriginalSize:"Default Size",textPosition:"Position",textSize:"Size",textWidth:"Width",textHeight:"Height",textTitle:"Image - Advanced Settings",textKeepRatio:"Constant Proportions",cancelButtonText:"Cancel",okButtonText:"Ok",textPlacement:"Placement",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."},PE.Views.ImageSettingsAdvanced||{}))}),define("presentationeditor/main/app/view/ImageSettings",["text!presentationeditor/main/app/template/ImageSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/view/ImageFromUrlDialog","presentationeditor/main/app/view/ImageSettingsAdvanced"],function(e,t,n,r){"use strict";PE.Views.ImageSettings=r.View.extend(n.extend({el:"#id-image-settings",template:n.template(e),events:{},options:{alias:"ImageSettings"},initialize:function(){this._initSettings=!0,this._state={Width:0,Height:0,DisabledControls:!1,isOleObject:!1},this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render(),this.labelWidth=t(this.el).find("#image-label-width"),this.labelHeight=t(this.el).find("#image-label-height")},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this},updateMetricUnit:function(){var e=Common.Utils.Metric.fnRecalcFromMM(this._state.Width);this.labelWidth[0].innerHTML=this.textWidth+": "+e.toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),e=Common.Utils.Metric.fnRecalcFromMM(this._state.Height),this.labelHeight[0].innerHTML=this.textHeight+": "+e.toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName()},createDelayedControls:function(){this.btnOriginalSize=new Common.UI.Button({el:t("#image-button-original-size")}),this.lockedControls.push(this.btnOriginalSize),this.btnInsertFromFile=new Common.UI.Button({el:t("#image-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#image-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnEditObject=new Common.UI.Button({el:t("#image-button-edit-object")}),this.lockedControls.push(this.btnEditObject),this.btnOriginalSize.on("click",n.bind(this.setOriginalSize,this)),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.ChangeImageFromFile(),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",n.bind(this.insertFromUrl,this)),this.btnEditObject.on("click",n.bind(function(e){this.api&&this.api.asc_startEditCurrentOleObject(),this.fireEvent("editcomplete",this)},this)),this.linkAdvanced=t("#image-advanced-link"),this.lblReplace=t("#image-lbl-replace"),t(this.el).on("click","#image-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked);if(e){this._originalProps=new Asc.asc_CImgProperty(e);var t=e.get_Width();Math.abs(this._state.Width-t)>.001&&(this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(t).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Width=t),t=e.get_Height(),Math.abs(this._state.Height-t)>.001&&(this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(t).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Height=t),this.btnOriginalSize.setDisabled(e.get_ImageUrl()===null||e.get_ImageUrl()===undefined||this._locked);var n=e.asc_getPluginGuid();t=n!==null&&n!==undefined,this._state.isOleObject!==t&&(this.btnInsertFromUrl.setVisible(!t),this.btnInsertFromFile.setVisible(!t),this.btnEditObject.setVisible(t),this.lblReplace.text(t?this.textEditObject:this.textInsert),this._state.isOleObject=t);if(this._state.isOleObject){var r=PE.getCollection("Common.Collections.Plugins").findWhere({guid:n});this.btnEditObject.setDisabled(r===null||r===undefined||this._locked)}else this.btnInsertFromUrl.setDisabled(n===null||this._locked),this.btnInsertFromFile.setDisabled(n===null||this._locked)}},setOriginalSize:function(){if(this.api){var e=this.api.get_OriginalSizeImage(),t=e.get_ImageWidth(),n=e.get_ImageHeight();this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(t).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName(),this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(n).toFixed(1)+" "+Common.Utils.Metric.getCurrentMetricName();var r=new Asc.asc_CImgProperty;r.put_Width(t),r.put_Height(n),this.api.ImgApply(r),this.fireEvent("editcomplete",this)}},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)){var s=new Asc.asc_CImgProperty;s.put_ImageUrl(i),e.api.ImgApply(s)}}e.fireEvent("editcomplete",e)}})).show()},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this;if(t.api&&!this._locked){var n=t.api.getSelectedElements();if(n&&n.length>0){var r,i;for(var s=n.length-1;s>=0;s--){r=n[s].get_ObjectType(),i=n[s].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Image==r){var o;t.btnOriginalSize.isDisabled()||(o=t.api.get_OriginalSizeImage(),o&&(o={width:o.get_ImageWidth(),height:o.get_ImageHeight()})),(new PE.Views.ImageSettingsAdvanced({imageProps:i,sizeOriginal:o,handler:function(e,n){e=="ok"&&t.api&&t.api.ImgApply(n.imageProps),t.fireEvent("editcomplete",t)}})).show();break}}}}},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},textSize:"Size",textWidth:"Width",textHeight:"Height",textOriginalSize:"Default Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textAdvanced:"Show advanced settings",textEditObject:"Edit Object",textEdit:"Edit"},PE.Views.ImageSettings||{}))}),define("text!presentationeditor/main/app/template/ChartSettings.template",[],function(){return'<table cols="3">\r\n <tr>\r\n <td colspan=3>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="chart-spin-width"></div>\r\n </td>\r\n <td class="padding-small" width="28px" style="vertical-align: bottom;">\r\n <div id="chart-button-ratio"></div>\r\n </td>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="chart-spin-height"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1">\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.textChartType %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="chart-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="chart-combo-style" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\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">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center">\r\n <label class="link" id="chart-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("text!presentationeditor/main/app/template/ChartSettingsAdvanced.template",[],function(){return'<div id="id-adv-chart-alttext" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" width="100%">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.textAltTitle %></label>\n <div id="chart-advanced-alt-title"></div>\n </td>\n </tr>\n <tr>\n <td>\n <label class="header"><%= scope.textAltDescription %></label>\n <textarea id="chart-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\n </td>\n </tr>\n <tr>\n <td>\n <label><%= scope.textAltTip %></label>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),define("presentationeditor/main/app/view/ChartSettingsAdvanced",["text!presentationeditor/main/app/template/ChartSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(e){"use strict";PE.Views.ChartSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"chart-adv-settings-group",properties:null,storageName:"pe-chart-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-chart-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.chartProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.inputAltTitle=(new Common.UI.InputField({el:$("#chart-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e){var t=e.asc_getTitle();this.inputAltTitle.setValue(t?t:""),t=e.asc_getDescription(),this.textareaAltDescription.val(t?t:""),this._changedProps=new Asc.CAscChartProp}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),{chartProps:this._changedProps}},textTitle:"Chart - Advanced Settings",cancelButtonText:"Cancel",okButtonText:"Ok",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},PE.Views.ChartSettingsAdvanced||{}))}),define("presentationeditor/main/app/view/ChartSettings",["text!presentationeditor/main/app/template/ChartSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/ComboDataView","presentationeditor/main/app/view/ChartSettingsAdvanced"],function(e,t,n,r){"use strict";PE.Views.ChartSettings=r.View.extend(n.extend({el:"#id-chart-settings",template:n.template(e),events:{},options:{alias:"ChartSettings"},initialize:function(){this._initSettings=!0,this._state={Width:0,Height:0,ChartStyle:1,ChartType:-1,SeveralCharts:!1,DisabledControls:!1,keepRatio:!1},this._nRatio=1,this.spinners=[],this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render()},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&this.api.asc_registerCallback("asc_onUpdateChartStyles",n.bind(this._onUpdateChartStyles,this)),this},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked);if(e){this._originalProps=new Asc.CAscChartProp(e),this._noApply=!0;var t=e.get_SeveralCharts()||this._locked;this._state.SeveralCharts!==t&&(this.btnEditData.setDisabled(t),this._state.SeveralCharts=t),t=e.get_SeveralChartTypes();if(this._state.SeveralCharts&&t)this.btnChartType.setIconCls(""),this._state.ChartType=null;else{var n=e.getType();if(this._state.ChartType!==n){var r=this.mnuChartTypePicker.store.findWhere({type:n});this.mnuChartTypePicker.selectRecord(r,!0),r&&this.btnChartType.setIconCls("item-chartlist "+r.get("iconCls")),this.updateChartStyles(this.api.asc_getChartPreviews(n)),this._state.ChartType=n}}t=e.get_SeveralChartStyles();if(this._state.SeveralCharts&&t)this.cmbChartStyle.fieldPicker.deselectAll(),this.cmbChartStyle.menuPicker.deselectAll(),this._state.ChartStyle=null;else{t=e.getStyle();if(this._state.ChartStyle!==t||this._isChartStylesChanged){this.cmbChartStyle.suspendEvents();var i=this.cmbChartStyle.menuPicker.store.findWhere({data:t});this.cmbChartStyle.menuPicker.selectRecord(i),this.cmbChartStyle.resumeEvents(),this._isChartStylesChanged&&(i?this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec()[0],!0):this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0),!0)),this._state.ChartStyle=t}}this._isChartStylesChanged=!1,this._noApply=!1,t=e.get_Width();if(Math.abs(this._state.Width-t)>.001||(this._state.Width===null||t===null)&&this._state.Width!==t)this.spnWidth.setValue(t!==null?Common.Utils.Metric.fnRecalcFromMM(t):"",!0),this._state.Width=t;t=e.get_Height();if(Math.abs(this._state.Height-t)>.001||(this._state.Height===null||t===null)&&this._state.Height!==t)this.spnHeight.setValue(t!==null?Common.Utils.Metric.fnRecalcFromMM(t):"",!0),this._state.Height=t;e.get_Height()>0&&(this._nRatio=e.get_Width()/e.get_Height()),t=e.asc_getLockAspect(),this._state.keepRatio!==t&&(this.btnRatio.toggle(t),this._state.keepRatio=t)}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},createDelayedControls:function(){var e=this;this.btnChartType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist bar-normal",menu:new Common.UI.Menu({style:"width: 435px; padding-top: 12px;",items:[{template:n.template('<div id="id-chart-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),this.btnChartType.on("render:after",function(r){e.mnuChartTypePicker=new Common.UI.DataView({el:t("#id-chart-menu-type"),parentMenu:r.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn},{id:"menu-chart-group-line",caption:e.textLine},{id:"menu-chart-group-pie",caption:e.textPie},{id:"menu-chart-group-hbar",caption:e.textBar},{id:"menu-chart-group-area",caption:e.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:e.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:e.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,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:n.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnChartType.render(t("#chart-button-type")),this.mnuChartTypePicker.on("item:click",n.bind(this.onSelectType,this,this.btnChartType)),this.lockedControls.push(this.btnChartType),this.btnEditData=new Common.UI.Button({el:t("#chart-button-edit-data")}),this.btnEditData.on("click",n.bind(this.setEditData,this)),this.lockedControls.push(this.btnEditData),this.spnWidth=new Common.UI.MetricSpinner({el:t("#chart-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:t("#chart-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.spnWidth.on("change",n.bind(this.onWidthChange,this)),this.spnHeight.on("change",n.bind(this.onHeightChange,this)),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render(t("#chart-button-ratio")),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",n.bind(function(e,t){e.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue());if(this.api){var n=new Asc.CAscChartProp;n.asc_putLockAspect(e.pressed),this.api.ChartApply(n)}this.fireEvent("editcomplete",this)},this)),this.linkAdvanced=t("#chart-advanced-link"),t(this.el).on("click","#chart-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},setEditData:function(){var e=PE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(e){e.setEditMode(!0),e.show();var t=this.api.asc_getChartObject();t&&e.setChartData(new Asc.asc_CChartBinary(t))}},onSelectType:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnChartType.setIconCls("item-chartlist "+s.iconCls),this._state.ChartType=-1;if(this.api&&!this._noApply){var u=new Asc.CAscChartProp;u.changeType(s.type),this.api.ChartApply(u)}this.fireEvent("editcomplete",this)},onSelectStyle:function(e,t){if(this._noApply)return;if(this.api&&!this._noApply){var n=new Asc.CAscChartProp;n.putStyle(t.get("data")),this.api.ChartApply(n)}this.fireEvent("editcomplete",this)},_onUpdateChartStyles:function(){this.api&&this._state.ChartType!==null&&this._state.ChartType>-1&&this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType))},updateChartStyles:function(e){var r=this;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(t("#chart-combo-style")),this.cmbChartStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbChartStyle.on("click",n.bind(this.onSelectStyle,this)),this.cmbChartStyle.openButton.menu.on("show:after",function(){r.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbChartStyle));if(e&&e.length>0){var i=this.cmbChartStyle.menuPicker.store;if(i){var s=i.length;if(s>0&&s==e.length){var o=i.models;n.each(e,function(e,t){o[t].set("imageUrl",e.asc_getImageUrl())})}else{var u=[],a=-1;n.each(e,function(e,t){u.push({imageUrl:e.asc_getImageUrl(),data:e.asc_getStyle(),tip:r.textStyle+" "+e.asc_getStyle()})}),i.reset(u,{silent:!1})}}}},onWidthChange:function(e,t,n,r){var i=e.getNumberValue(),s=this.spnHeight.getNumberValue();this.btnRatio.pressed&&(s=i/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,i=s*this._nRatio,this.spnWidth.setValue(i,!0)),this.spnHeight.setValue(s,!0));if(this.api){var o=new Asc.CAscChartProp;o.put_Width(Common.Utils.Metric.fnRecalcToMM(i)),o.put_Height(Common.Utils.Metric.fnRecalcToMM(s)),this.api.ChartApply(o)}this.fireEvent("editcomplete",this)},onHeightChange:function(e,t,n,r){var i=e.getNumberValue(),s=this.spnWidth.getNumberValue();this.btnRatio.pressed&&(s=i*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,i=s/this._nRatio,this.spnHeight.setValue(i,!0)),this.spnWidth.setValue(s,!0));if(this.api){var o=new Asc.CAscChartProp;o.put_Width(Common.Utils.Metric.fnRecalcToMM(s)),o.put_Height(Common.Utils.Metric.fnRecalcToMM(i)),this.api.ChartApply(o)}this.fireEvent("editcomplete",this)},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;if(t.api&&!this._locked){var r=t.api.getSelectedElements();if(r&&r.length>0){var i,s;for(var o=r.length-1;o>=0;o--){i=r[o].get_ObjectType(),s=r[o].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Chart==i){(new PE.Views.ChartSettingsAdvanced({chartProps:s,handler:function(e,n){e=="ok"&&t.api&&t.api.ChartApply(n.chartProps),t.fireEvent("editcomplete",t)}})).show();break}}}}},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textEditData:"Edit Data",textChartType:"Change Chart Type",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textStyle:"Style",textAdvanced:"Show advanced settings"},PE.Views.ChartSettings||{}))}),define("text!presentationeditor/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 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 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>'});if(Common===undefined)var Common={};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(e){var t,n,r=$(this.cmpEl).find("button span");this.color=e,e=="transparent"?(t="#BEBEBE",n=e,r.addClass("color-transparent")):(t="transparent",n=typeof e=="object"?"#"+e.color:"#"+e,r.removeClass("color-transparent")),r.css({"background-color":n,"border-color":t})}})});if(Common===undefined)var Common={};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:undefined}}}),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(e){var t=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),n=[{displayValue:"0.5 "+t,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+t,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+t,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+t,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+t,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+t,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+t,value:6,pxValue:6,offsety:120}];e.allowNoBorders!==!1&&n.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!1,store:new Common.UI.BordersStore,data:n,menuStyle:"min-width: 150px;"},e))},render:function(e){return Common.UI.ComboBox.prototype.render.call(this,e),this},itemClicked:function(e){var t=$(e.currentTarget).parent();this._selectedItem=this.store.findWhere({id:t.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),t.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),e.preventDefault())},updateFormControl:function(e){var t=$(this.el).find(".form-control");e.get("value")>0?(t[0].innerHTML="",t.removeClass("text").addClass("image"),t.css("background-position","0 -"+e.get("offsety")+"px")):(t[0].innerHTML=this.txtNoBorders,t.removeClass("image").addClass("text"))},setValue:function(e){this._selectedItem=e===null||e===undefined?undefined:_.find(this.store.models,function(t){if(e<t.attributes.value+.01&&e>t.attributes.value-.01)return!0}),$(".selected",$(this.el)).removeClass("selected");if(this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var t=$(this.el).find(".form-control");t[0].innerHTML="",t.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(e){this.txtNoBorders=e.txtNoBorders||this.txtNoBorders;var t=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),n=[{displayValue:"0.5 "+t,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+t,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+t,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+t,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+t,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+t,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+t,value:6,pxValue:6,offsety:120}];e.allowNoBorders!==!1&&n.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!0,store:new Common.UI.BordersStore,data:n,menuStyle:"min-width: 150px;"},e))},render:function(e){return Common.UI.ComboBox.prototype.render.call(this,e),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(e){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}]},e))},render:function(e){return Common.UI.ComboBorderSize.prototype.render.call(this,e),this},updateFormControl:function(e){var t=$(this.el).find(".form-control");t[0].innerHTML="",t.removeClass("text").addClass("image"),t.css("background-position","0 -"+e.get("offsety")+"px")}},Common.UI.ComboBorderType||{}))}),define("presentationeditor/main/app/view/TableSettings",["text!presentationeditor/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","presentationeditor/main/app/view/TableSettingsAdvanced"],function(e,t,n,r){"use strict";PE.Views.TableSettings=r.View.extend(n.extend({el:"#id-table-settings",template:n.template(e),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,BackColor:"#000000",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.render()},onCheckTemplateChange:function(e,t,n,r,i){if(this.api){var s=new Asc.CTableProp,o=this._originalLook?this._originalLook:new Asc.CTablePropLook;switch(e){case 0:o.put_FirstRow(t.getValue()=="checked");break;case 1:o.put_LastRow(t.getValue()=="checked");break;case 2:o.put_BandHor(t.getValue()=="checked");break;case 3:o.put_FirstCol(t.getValue()=="checked");break;case 4:o.put_LastCol(t.getValue()=="checked");break;case 5:o.put_BandVer(t.getValue()=="checked")}s.put_TableLook(o),this.api.tblApply(s)}this.fireEvent("editcomplete",this)},onTableTemplateSelect:function(e,t){if(this.api&&!this._noApply){var n=new Asc.CTableProp;n.put_TableStyle(t.get("templateId")),this.api.tblApply(n)}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(e,t){this.btnBackColor.setColor(t),this.CellColor={Value:1,Color:t};if(this.api){var n=new Asc.CTableProp,r=new Asc.CBackground;n.put_CellsBackground(r),this.CellColor.Color=="transparent"?r.put_Value(1):(r.put_Value(0),r.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color))),n.put_CellSelect(!0),this.api.tblApply(n)}this.fireEvent("editcomplete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onColorsBorderSelect:function(e,t){this.btnBorderColor.setColor(t)},onBtnBordersClick:function(e,t){this._UpdateBordersStyle(e.options.strId,!0);if(this.api){var n=new Asc.CTableProp;n.put_CellBorders(this.CellBorders),n.put_CellSelect(!0),this.api.tblApply(n)}this.fireEvent("editcomplete",this)},onBorderSizeSelect:function(e,t){this.BorderSize=t.value},onEditClick:function(e,t,n){if(this.api)switch(t.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(e,t,n)}this.fireEvent("editcomplete",this)},splitCells:function(e,t,n){var r=this;(new Common.Views.InsertTableDialog({handler:function(e,t){e=="ok"&&(r.api&&r.api.SplitCell(t.columns,t.rows),r.fireEvent("editcomplete",r))}})).show()},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,e&&this.api.asc_registerCallback("asc_onInitTableTemplates",n.bind(this._onInitTemplates,this)),this},createDelayedControls:function(){var e=this;this.chHeader=new Common.UI.CheckBox({el:t("#table-checkbox-header"),labelText:this.textHeader}),this.lockedControls.push(this.chHeader),this.chTotal=new Common.UI.CheckBox({el:t("#table-checkbox-total"),labelText:this.textTotal}),this.lockedControls.push(this.chTotal),this.chBanded=new Common.UI.CheckBox({el:t("#table-checkbox-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chBanded),this.chFirst=new Common.UI.CheckBox({el:t("#table-checkbox-first"),labelText:this.textFirst}),this.lockedControls.push(this.chFirst),this.chLast=new Common.UI.CheckBox({el:t("#table-checkbox-last"),labelText:this.textLast}),this.lockedControls.push(this.chLast),this.chColBanded=new Common.UI.CheckBox({el:t("#table-checkbox-col-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chColBanded),this.chHeader.on("change",n.bind(this.onCheckTemplateChange,this,0)),this.chTotal.on("change",n.bind(this.onCheckTemplateChange,this,1)),this.chBanded.on("change",n.bind(this.onCheckTemplateChange,this,2)),this.chFirst.on("change",n.bind(this.onCheckTemplateChange,this,3)),this.chLast.on("change",n.bind(this.onCheckTemplateChange,this,4)),this.chColBanded.on("change",n.bind(this.onCheckTemplateChange,this,5));var r=[["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=[],n.each(r,function(e,r,i){var s=new Common.UI.Button({cls:"btn-toolbar",iconCls:e[1],strId:e[0],hint:e[3]});s.render(t("#"+e[2])),s.on("click",n.bind(this.onBtnBordersClick,this)),this._btnsBorderPosition.push(s),this.lockedControls.push(s)},this),this.cmbBorderSize=new Common.UI.ComboBorderSize({el:t("#table-combo-border-size"),style:"width: 93px;"}),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.cmbBorderSize.on("selected",n.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(t("#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",n.bind(function(){this.api&&(this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()),this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()))},this)),this.btnEdit.menu.on("item:click",n.bind(this.onEditClick,this)),this.lockedControls.push(this.btnEdit),this.linkAdvanced=t("#table-advanced-link"),t(this.el).on("click","#table-advanced-link",n.bind(this.openAdvancedSettings,this))},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked);if(e){this._originalProps=new Asc.CTableProp(e),this._originalProps.put_CellSelect(!0);var t=e.get_TableStyle();if(this._state.TemplateId!==t||this._isTemplatesChanged){this.cmbTableTemplate.suspendEvents();var n=this.cmbTableTemplate.menuPicker.store.findWhere({templateId:t});this.cmbTableTemplate.menuPicker.selectRecord(n),this.cmbTableTemplate.resumeEvents(),this._isTemplatesChanged&&(n?this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec()[0],!0):this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0),!0)),this._state.TemplateId=t}this._isTemplatesChanged=!1;var r=e.get_TableLook();r&&(t=r.get_FirstRow(),this._state.CheckHeader!==t&&(this.chHeader.setValue(t,!0),this._state.CheckHeader=t,this._originalLook.put_FirstRow(t)),t=r.get_LastRow(),this._state.CheckTotal!==t&&(this.chTotal.setValue(t,!0),this._state.CheckTotal=t,this._originalLook.put_LastRow(t)),t=r.get_BandHor(),this._state.CheckBanded!==t&&(this.chBanded.setValue(t,!0),this._state.CheckBanded=t,this._originalLook.put_BandHor(t)),t=r.get_FirstCol(),this._state.CheckFirst!==t&&(this.chFirst.setValue(t,!0),this._state.CheckFirst=t,this._originalLook.put_FirstCol(t)),t=r.get_LastCol(),this._state.CheckLast!==t&&(this.chLast.setValue(t,!0),this._state.CheckLast=t,this._originalLook.put_LastCol(t)),t=r.get_BandVer(),this._state.CheckColBanded!==t&&(this.chColBanded.setValue(t,!0),this._state.CheckColBanded=t,this._originalLook.put_BandVer(t)));var i=e.get_CellsBackground();if(i)if(i.get_Value()==0){var s=i.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 o=typeof this.CellColor.Color,u=typeof this._state.BackColor;if(o!==u||o=="object"&&(this.CellColor.Color.effectValue!==this._state.BackColor.effectValue||this._state.BackColor.color.indexOf(this.CellColor.Color.color)<0)||o!="object"&&this._state.BackColor.indexOf(this.CellColor.Color)<0){this.btnBackColor.setColor(this.CellColor.Color);if(typeof this.CellColor.Color=="object"){var a=!1;for(var f=0;f<10;f++)if(Common.Utils.ThemeColor.ThemeValues[f]==this.CellColor.Color.effectValue){this.colorsBack.select(this.CellColor.Color,!0),a=!0;break}a||this.colorsBack.clearSelection()}else this.colorsBack.select(this.CellColor.Color,!0);this._state.BackColor=this.CellColor.Color}}},_UpdateBordersStyle:function(e){this.CellBorders=new Asc.CBorders;var t=this.CellBorders,n=e!="";if(e.indexOf("l")>-1||!n)(t.get_Left()===null||t.get_Left()===undefined)&&t.put_Left(new Asc.asc_CTextBorder),this._UpdateBorderStyle(t.get_Left(),n);if(e.indexOf("t")>-1||!n)(t.get_Top()===null||t.get_Top()===undefined)&&t.put_Top(new Asc.asc_CTextBorder),this._UpdateBorderStyle(t.get_Top(),n);if(e.indexOf("r")>-1||!n)(t.get_Right()===null||t.get_Right()===undefined)&&t.put_Right(new Asc.asc_CTextBorder),this._UpdateBorderStyle(t.get_Right(),n);if(e.indexOf("b")>-1||!n)(t.get_Bottom()===null||t.get_Bottom()===undefined)&&t.put_Bottom(new Asc.asc_CTextBorder),this._UpdateBorderStyle(t.get_Bottom(),n);if(e.indexOf("c")>-1||!n)(t.get_InsideV()===null||t.get_InsideV()===undefined)&&t.put_InsideV(new Asc.asc_CTextBorder),this._UpdateBorderStyle(t.get_InsideV(),n);if(e.indexOf("m")>-1||!n)(t.get_InsideH()===null||t.get_InsideH()===undefined)&&t.put_InsideH(new Asc.asc_CTextBorder),this._UpdateBorderStyle(t.get_InsideH(),n)},_UpdateBorderStyle:function(e,t){null==e&&(e=new Asc.asc_CTextBorder);if(t&&this.BorderSize>0){var n=parseFloat(this.BorderSize);e.put_Value(1),e.put_Size(n*25.4/72);var r=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);e.put_Color(r)}else e.put_Value(0)},createDelayedElements:function(){this.createDelayedControls(),this.UpdateThemeColors(),this._initSettings=!1},UpdateThemeColors:function(){this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="table-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="table-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(t("#table-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.borderColor=new Common.UI.ThemeColorPalette({el:t("#table-border-color-menu")}),this.borderColor.on("select",n.bind(this.onColorsBorderSelect,this)),t(this.el).on("click","#table-border-color-new",n.bind(this.addNewColor,this,this.borderColor,this.btnBorderColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="table-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="table-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(t("#table-back-color-btn")),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:t("#table-back-color-menu"),transparent:!0}),this.colorsBack.on("select",n.bind(this.onColorsBackSelect,this)),t(this.el).on("click","#table-back-color-new",n.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor))),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.btnBorderColor.setColor(this.borderColor.getColor())},_onInitTemplates:function(e){var r=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(t("#table-combo-template")),this.cmbTableTemplate.openButton.menu.cmpEl.css({"min-width":175,"max-width":175}),this.cmbTableTemplate.on("click",n.bind(this.onTableTemplateSelect,this)),this.cmbTableTemplate.openButton.menu.on("show:after",function(){r.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTableTemplate));var i=r.cmbTableTemplate.menuPicker.store.length;if(i>0&&i==e.length){var s=r.cmbTableTemplate.menuPicker.store.models;n.each(e,function(e,t){s[t].set("imageUrl",e.get_Image())})}else{r.cmbTableTemplate.menuPicker.store.reset([]);var o=[];n.each(e,function(e){o.push({imageUrl:e.get_Image(),id:Common.UI.getId(),templateId:e.get_Id()})}),r.cmbTableTemplate.menuPicker.store.add(o)}},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this;if(t.api&&!this._locked){var n=t.api.getSelectedElements();if(n&&n.length>0){var r,i;for(var s=n.length-1;s>=0;s--){r=n[s].get_ObjectType(),i=n[s].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Table==r){(new PE.Views.TableSettingsAdvanced({tableProps:i,handler:function(e,n){e=="ok"&&t.api&&t.api.tblApply(n.tableProps),t.fireEvent("editcomplete",t)}})).show();break}}}}},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},textBorders:"Border's Style",textBorderColor:"Color",textBackColor:"Background color",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",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",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"},PE.Views.TableSettings||{}))}),define("text!presentationeditor/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>\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"></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>'});if(Common===undefined)var Common={};define("common/main/lib/component/Slider",["common/main/lib/component/BaseView","underscore"],function(e,t){"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:t.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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);t.width=t.options.width,t.minValue=t.options.minValue,t.maxValue=t.options.maxValue,t.delta=100/(t.maxValue-t.minValue),t.step=t.options.step,t.options.el&&t.render(),this.setValue(t.options.value)},render:function(e){var n=this;n.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl)),this.cmpEl.find(".track-center").width(n.options.width-14),this.cmpEl.width(n.options.width),this.thumb=this.cmpEl.find(".thumb");var r=function(e){e.preventDefault(),e.stopPropagation();var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100)));n.setThumbPosition(t),n.lastValue=n.value,n.value=t/n.delta+n.minValue,n.thumb.removeClass("active"),$(document).off("mouseup",r),$(document).off("mousemove",i),n._dragstart=undefined,n.trigger("changecomplete",n,n.value,n.lastValue)},i=function(e){if(n.disabled)return;if(n._dragstart===undefined)return;e.preventDefault(),e.stopPropagation();var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100)));n.setThumbPosition(t),n.lastValue=n.value,n.value=t/n.delta+n.minValue,Math.abs(n.value-n.lastValue)>.001&&n.trigger("change",n,n.value,n.lastValue)},s=function(e){if(n.disabled)return;n._dragstart=e.pageX*Common.Utils.zoom()-n.thumb.offset().left-7,n.thumb.addClass("active"),$(document).on("mouseup",r),$(document).on("mousemove",i),n.options.enableKeyEvents&&setTimeout(function(){n.input.focus()},10)},o=function(e){if(n.disabled)return;var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left)/n.width*100)));n.setThumbPosition(t),n.lastValue=n.value,n.value=t/n.delta+n.minValue,n.trigger("change",n,n.value,n.lastValue),n.trigger("changecomplete",n,n.value,n.lastValue)},u,a=function(e){n.lastValue=n.value,n.value=Math.max(n.minValue,Math.min(n.maxValue,n.value+(e?n.step:-n.step))),n.setThumbPosition(Math.round((n.value-n.minValue)*n.delta)),n.trigger("change",n,n.value,n.lastValue)},f=function(e){if(n.disabled)return;if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN||e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.RIGHT)e.preventDefault(),e.stopPropagation(),c.off("keydown","input",f),u=setInterval(t.bind(a,n,e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.RIGHT),100)},l=function(e){if(n.disabled)return;if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN||Common.UI.Keys.LEFT||Common.UI.Keys.RIGHT)e.stopPropagation(),e.preventDefault(),clearInterval(u),a(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.RIGHT),c.on("keydown","input",f),n.trigger("changecomplete",n,n.value,n.lastValue)};if(!n.rendered){var c=n.cmpEl;c.on("mousedown",".thumb",s),c.on("mousedown",".track",o),this.options.enableKeyEvents&&(c.on("keydown","input",f),c.on("keyup","input",l))}return n.rendered=!0,this},setThumbPosition:function(e){this.thumb.css({left:e+"%"})},setValue:function(e){this.lastValue=this.value,this.value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(Math.round((e-this.minValue)*this.delta))},getValue:function(){return this.value},setDisabled:function(e){e!==this.disabled&&this.cmpEl.toggleClass("disabled",e),this.disabled=e}}),Common.UI.MultiSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100]},disabled:!1,template:t.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(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);t.width=t.options.width,t.minValue=t.options.minValue,t.maxValue=t.options.maxValue,t.delta=100/(t.maxValue-t.minValue),t.thumbs=[],t.options.el&&t.render()},render:function(e){var n=this;n.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({items:this.options.values})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));var r=this.cmpEl;r.find(".track-center").width(n.options.width-14),r.width(n.options.width);var i=function(e){e.preventDefault(),e.stopPropagation();var t=e.data,r=n.thumbs[t].value,o=t-1<0?0:n.thumbs[t-1].position,u=t+1<n.thumbs.length?n.thumbs[t+1].position:100,a=Math.max(o,Math.min(u,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100))),f=a/n.delta+n.minValue;n.setThumbPosition(t,a),n.thumbs[t].value=f,$(document).off("mouseup",i),$(document).off("mousemove",s),n._dragstart=undefined,n.trigger("changecomplete",n,f,r)},s=function(e){if(n.disabled)return;if(n._dragstart===undefined)return;e.preventDefault(),e.stopPropagation();var t=e.data,r=n.thumbs[t].value,i=t-1<0?0:n.thumbs[t-1].position,s=t+1<n.thumbs.length?n.thumbs[t+1].position:100,o=Math.max(i,Math.min(s,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100))),u=o/n.delta+n.minValue;n.setThumbPosition(t,o),n.thumbs[t].value=u,Math.abs(u-r)>.001&&n.trigger("change",n,u,r)},o=function(e){if(n.disabled)return;var r=e.data,o=n.thumbs[r].thumb;n._dragstart=e.pageX*Common.Utils.zoom()-o.offset().left-o.width()/2,n.setActiveThumb(r),t.each(n.thumbs,function(e,t){r==t?e.thumb.css("z-index",500):e.thumb.css("z-index","")}),$(document).on("mouseup",null,r,i),$(document).on("mousemove",null,r,s)},u=function(e){if(n.disabled)return;var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left)/n.width*100))),r=a(t),i=n.thumbs[r].value,s=t/n.delta+n.minValue;n.setThumbPosition(r,t),n.thumbs[r].value=s,n.trigger("change",n,s,i),n.trigger("changecomplete",n,s,i)},a=function(e){var t=100,r=0,i=n.thumbs.length,s;for(var o=0;o<i;o++){s=Math.abs(n.thumbs[o].position-e);if(Math.abs(s<=t)){var u=n.thumbs[o+1],a=n.thumbs[o-1];if(a!==undefined&&e<a.position)continue;if(u!==undefined&&e>u.position)continue;r=o,t=s}}return r};return this.$thumbs=r.find(".thumb"),t.each(this.$thumbs,function(e,t){var r=$(e);n.thumbs.push({thumb:r,index:t}),n.setValue(t,n.options.values[t]),r.on("mousedown",null,t,o)}),n.setActiveThumb(0,!0),n.rendered||r.on("mousedown",".track",u),n.rendered=!0,this},setActiveThumb:function(e,t){this.currentThumb=e,this.$thumbs.removeClass("active"),this.thumbs[e].thumb.addClass("active"),t!==!0&&this.trigger("thumbclick",this,e)},setThumbPosition:function(e,t){this.thumbs[e].position=t,this.thumbs[e].thumb.css({left:t+"%"})},setValue:function(e,t){this.thumbs[e].value=Math.max(this.minValue,Math.min(this.maxValue,t)),this.setThumbPosition(e,Math.round((t-this.minValue)*this.delta))},getValue:function(e){return this.thumbs[e].value},getValues:function(){var e=[];return t.each(this.thumbs,function(t){e.push(t.value)}),e},setDisabled:function(e){e!==this.disabled&&this.cmpEl.toggleClass("disabled",e),this.disabled=e}})});if(Common===undefined)var Common={};define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(e,t){"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:t.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(e){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,e)},render:function(e){Common.UI.MultiSlider.prototype.render.call(this,e);var n=this,r="";n.trackEl=n.cmpEl.find(".track");for(var i=0;i<n.thumbs.length;i++)n.thumbs[i].thumb.on("dblclick",null,function(){n.trigger("thumbdblclick",n)}),n.thumbs[i].thumbcolor=n.thumbs[i].thumb.find("> div");n.styleStr!==""&&(r=Common.Utils.String.format(n.styleStr,n.colorValues[0],0,n.colorValues[1],100),n.trackEl.css("background",r)),Common.Utils.isIE&&(r=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",n.colorValues[0],n.colorValues[1]),n.trackEl.css("filter",r)),r=Common.Utils.String.format("linear-gradient(to right, {0} {1}%, {2} {3}%)",n.colorValues[0],0,n.colorValues[1],100),n.trackEl.css("background",r),n.on("change",t.bind(n.changeGradientStyle,n))},setColorValue:function(e,t){var n=t!==undefined?t:this.currentThumb;this.colorValues[n]=e,this.thumbs[n].thumbcolor.css("background-color",e),this.changeGradientStyle()},getColorValue:function(e){var t=e!==undefined?e:this.currentThumb;return this.colorValues[t]},setValue:function(e,t){Common.UI.MultiSlider.prototype.setValue.call(this,e,t),this.changeGradientStyle()},changeGradientStyle:function(){if(!this.rendered)return;var e;this.styleStr!==""&&(e=Common.Utils.String.format(this.styleStr,this.colorValues[0],this.getValue(0),this.colorValues[1],this.getValue(1)),this.trackEl.css("background",e)),Common.Utils.isIE&&(e=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.colorValues[0],this.colorValues[1]),this.trackEl.css("filter",e)),e=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",e)}})}),define("presentationeditor/main/app/view/ShapeSettings",["text!presentationeditor/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","presentationeditor/main/app/view/ShapeSettingsAdvanced"],function(e,t,n,r){"use strict";PE.Views.ShapeSettings=r.View.extend(n.extend({el:"#id-shape-settings",template:n.template(e),events:{},options:{alias:"ShapeSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,this._noApply=!0,this._sendUndoPoint=!0,this._sliderChanged=!1,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,DisabledFillPanels:!1,DisabledControls:!1,HideShapeOnlySettings:!1,HideChangeTypeSettings:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.fillControls=[],this.render(),this.FillColorContainer=t("#shape-panel-color-fill"),this.FillImageContainer=t("#shape-panel-image-fill"),this.FillPatternContainer=t("#shape-panel-pattern-fill"),this.FillGradientContainer=t("#shape-panel-gradient-fill"),this.TransparencyContainer=t("#shape-panel-transparent-fill"),this.ShapeOnlySettings=t(".shape-only"),this.CanChangeType=t(".change-type")},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&(this.api.asc_setInterfaceDrawImagePlaceShape("shape-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",n.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(e,t){this.ShowHideElem(t.value);switch(t.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),r.put_fill(new Asc.asc_CFillSolid),r.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color=="transparent"?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),n.put_fill(r),this.api.ShapeApply(n)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD;if(!this._noApply){var n=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),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0));if(this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){var i=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();i==="ffffff"&&s==="ffffff"?i={color:"4f81bd",effectId:24}:i=this.GradColor.colors[0],r.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),r.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(i),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}n.put_fill(r),this.api.ShapeApply(n)}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:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_pattern_type(this.PatternFillType);var o=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex(),u=Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex();u==="ffffff"&&o==="ffffff"?o={color:"4f81bd",effectId:24}:o=this.FGColor.Color,r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(o)),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.put_fill(r),this.api.ShapeApply(n)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.put_fill(null),n.put_fill(r),this.api.ShapeApply(n)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(e,t){this.btnBackColor.setColor(t),this.ShapeColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;this.ShapeColor.Color=="transparent"?(r.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.put_fill(null)):(r.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),r.put_fill(new Asc.asc_CFillSolid),r.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onPatternSelect:function(e,t){if(this.api&&!this._noApply){this.PatternFillType=t.get("type");var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(e,t){this.btnFGColor.setColor(t),this.FGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_pattern_type(this.PatternFillType),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(e,t){this.btnBGColor.setColor(t),this.BGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_pattern_type(this.PatternFillType),r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(e,t){this.BlipFillType=t.value;if(this.api&&this._fromTextureCmb!==!0&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),r.put_fill(new Asc.asc_CFillBlip),r.get_fill().put_type(this.BlipFillType),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onNumTransparencyChange:function(e,t,n,r){this.sldrTransparency.setValue(e.getNumberValue(),!0);if(this.api){var i=e.getNumberValue(),s=new Asc.asc_CShapeProperty,o=new Asc.asc_CShapeFill;o.put_transparent(i*2.55),s.put_fill(o),this.api.ShapeApply(s)}this.fireEvent("editcomplete",this)},onTransparencyChange:function(e,t,r){this._sliderChanged=t,this.numTransparency.setValue(t,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=t,this.api.setEndPointHistory(),this._transparencyApplyFunc(),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(this._sliderChanged!==undefined){var e=new Asc.asc_CShapeProperty,t=new Asc.asc_CShapeFill;t.put_transparent(this._sliderChanged*2.55),e.put_fill(t),this.api.ShapeApply(e),this._sliderChanged=undefined}},onGradTypeSelect:function(e,t){this.GradFillType=t.value;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var t=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(t,!0),t?this.btnDirection.setIconCls("item-gradient "+t.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 n=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),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0)),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onSelectGradient:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0;if(this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var u=new Asc.asc_CShapeProperty,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType),a.get_fill().put_linear_angle(s.type*6e4),a.get_fill().put_linear_scale(!0),u.put_fill(a),this.api.ShapeApply(u)}this.fireEvent("editcomplete",this)},onColorsGradientSelect:function(e,t){this.btnGradColor.setColor(t),this.GradColor.colors[this.GradColor.currentIdx]=t,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof t=="object"?t.color:t));if(this.api&&!this._noApply){var n=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_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&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0)),r.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3])),n.put_fill(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onGradientChange:function(e,t,r){this.GradColor.values=e.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=!0,this.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var e=new Asc.asc_CShapeProperty,t=new Asc.asc_CShapeFill;t.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),t.put_fill(new Asc.asc_CFillGrad),t.get_fill().put_grad_type(this.GradFillType),t.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(t.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),t.get_fill().put_linear_scale(!0)),t.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),e.put_fill(t),this.api.ShapeApply(e),this._sliderChanged=!1}},applyBorderSize:function(e){e=parseFloat(e),e=isNaN(e)?0:Math.max(0,Math.min(1584,e)),this.BorderSize=e;if(this.api&&!this._noApply){var t=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<.01?(n.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),this.BorderColor.Color=="transparent"||this.BorderColor.Color.color=="transparent"?n.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):(this._state.StrokeType==Asc.c_oAscStrokeType.STROKE_NONE||this._state.StrokeType===null)&&n.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),n.asc_putPrstDash(this.BorderType),n.put_width(this._pt2mm(this.BorderSize))),t.put_stroke(n),this.api.ShapeApply(t)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(e,t,r,i){var s=this;if(e){var o=parseFloat(r.value),u=new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$");if(!u.exec(r.value)||o<0||o>1584)this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){n.defer(function(e){s.fireEvent("editcomplete",s)})}})}else this.applyBorderSize(r.value)},onBorderSizeSelect:function(e,t){this.applyBorderSize(t.value)},onBorderTypeSelect:function(e,t){this.BorderType=t.value;if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CStroke;this.BorderSize<.01?r.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(r.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),r.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.put_width(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.put_stroke(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(e,t){this.btnBorderColor.setColor(t),this.BorderColor={Value:1,Color:t};if(this.api&&this.BorderSize>0&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CStroke;this.BorderSize<.01?r.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(r.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),r.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.put_width(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.put_stroke(r),this.api.ShapeApply(n)}this.fireEvent("editcomplete",this)},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)&&e.BlipFillType!==null){var s=new Asc.asc_CShapeProperty,o=new Asc.asc_CShapeFill;o.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),o.put_fill(new Asc.asc_CFillBlip),o.get_fill().put_type(e.BlipFillType),o.get_fill().put_url(i),s.put_fill(o),e.api.ShapeApply(s)}}e.fireEvent("editcomplete",e)}})).show()},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;if(t.api&&!this._locked){var r=t.api.getSelectedElements();if(r&&r.length>0){var i,s;for(var o=r.length-1;o>=0;o--){i=r[o].get_ObjectType(),s=r[o].get_ObjectValue();if(Asc.c_oAscTypeSelectElement.Shape==i){(new PE.Views.ShapeSettingsAdvanced({shapeProps:s,handler:function(e,n){e=="ok"&&t.api&&t.api.ShapeApply(n.shapeProps),t.fireEvent("editcomplete",t)}})).show();break}}}}},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements();if(e){this._originalProps=e,this._noApply=!0;var r=e.asc_getType();this.disableControls(this._locked==1,e.get_CanFill()!==!0),this.hideShapeOnlySettings(e.get_FromChart()),this.hideChangeTypeSettings(r=="line"||r=="bentConnector2"||r=="bentConnector3"||r=="bentConnector4"||r=="bentConnector5"||r=="curvedConnector2"||r=="curvedConnector3"||r=="curvedConnector4"||r=="curvedConnector5"||r=="straightConnector1");var i=null,s=e.get_fill(),o=s.get_type(),u=null,a=s.get_transparent();if(Math.abs(this._state.Transparency-a)>.001||Math.abs(this.numTransparency.getNumberValue()-a)>.001||(this._state.Transparency===null||a===null)&&(this._state.Transparency!==a||this.numTransparency.getNumberValue()!==a))a!==undefined&&(this.sldrTransparency.setValue(a===null?100:a/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=a;if(s===null||o===null)this.OriginalFillType=null;else if(o==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(o==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.get_fill(),u=s.get_color(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor=this.ShapeColor.Color!=="transparent"?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]=this.ShapeColor.Color!=="transparent"?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[1]="ffffff";else if(o==Asc.c_oAscFill.FILL_TYPE_BLIP)s=s.get_fill(),this.BlipFillType=s.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(o==Asc.c_oAscFill.FILL_TYPE_PATT){s=s.get_fill(),this.PatternFillType=s.get_pattern_type();if(this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var i=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(i),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}u=s.get_color_fg(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b())}:this.FGColor={Value:1,Color:"000000"},u=s.get_color_bg(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.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(o==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.get_fill();var f=s.get_grad_type();if(this._state.GradFillType!==f||this.GradFillType!==f)this.GradFillType=f,i=undefined,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),i=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,i.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var l=Math.floor(s.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-l)>.001){this.GradLinearDirectionType=l;var c=this.mnuDirectionPicker.store.findWhere({type:l});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls("")}}var h=s.get_colors();h&&h.length>0&&(u=h[0],u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()):this.GradColor.colors[0]="000000",u=h[1],u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()):this.GradColor.colors[1]="ffffff");var p=s.get_positions();if(p&&p.length>0){var d=p[0];d!==null&&(d/=1e3,this.GradColor.values[0]=d),d=p[1],d!==null&&(d/=1e3,this.GradColor.values[1]=d)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[0]=="object"?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[1]=="object"?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(this.OriginalFillType===null?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),t(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var v=typeof this.ShapeColor.Color,m=typeof this._state.ShapeColor;if(v!==m||v=="object"&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||v!="object"&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){this.btnBackColor.setColor(this.ShapeColor.Color);if(typeof this.ShapeColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),g=!0;break}g||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var b=e.get_stroke(),w=b.get_type(),E;b?(w==Asc.c_oAscStrokeType.STROKE_COLOR?(u=b.get_color(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},E=b.asc_getPrstDash()):(w=null,this.BorderColor={Value:0,Color:"transparent"}),v=typeof this.BorderColor.Color,m=typeof this._state.StrokeColor;if(v!==m||v=="object"&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||v!="object"&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||typeof this.btnBorderColor.color=="object")){this.btnBorderColor.setColor(this.BorderColor.Color);if(typeof this.BorderColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),g=!0;break}g||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==w||w==Asc.c_oAscStrokeType.STROKE_COLOR){if(w==Asc.c_oAscStrokeType.STROKE_COLOR){var S=b.get_width(),x=Math.abs(this._state.StrokeWidth-S)<.001&&!(new RegExp(this.txtPt+"\\s*$")).test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-S)>.001||x||(this._state.StrokeWidth===null||S===null)&&this._state.StrokeWidth!==S){this._state.StrokeWidth=S,S!==null&&(S=this._mm2pt(S));var T=S===null?S:n.find(this.cmbBorderSize.store.models,function(e){if(S<e.attributes.value+.01&&S>e.attributes.value-.01)return!0});T?this.cmbBorderSize.selectRecord(T):this.cmbBorderSize.setValue(S!==null?parseFloat(S.toFixed(2))+" "+this.txtPt:""),this.BorderSize=S}}else w==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=w}this._state.StrokeBorderType!==E&&(this.BorderType=this._state.StrokeBorderType=E,this.cmbBorderType.setValue(E)),v=typeof this.FGColor.Color,m=typeof this._state.FGColor;if(v!==m||v=="object"&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||v!="object"&&this._state.FGColor.indexOf(this.FGColor.Color)<0){this.btnFGColor.setColor(this.FGColor.Color);if(typeof this.FGColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),g=!0;break}g||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}v=typeof this.BGColor.Color,m=typeof this._state.BGColor;if(v!==m||v=="object"&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||v!="object"&&this._state.BGColor.indexOf(this.BGColor.Color)<0){this.btnBGColor.setColor(this.BGColor.Color);if(typeof this.BGColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),g=!0;break}g||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}u=this.GradColor.colors[this.GradColor.currentIdx],v=typeof u,m=typeof this._state.GradColor;if(v!==m||v=="object"&&(u.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(u.color)<0)||v!="object"&&this._state.GradColor.indexOf(u)<0){this.btnGradColor.setColor(u);if(typeof u=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==u.effectValue){this.colorsGrad.select(u,!0),g=!0;break}g||this.colorsGrad.clearSelection()}else this.colorsGrad.select(u,!0);this._state.GradColor=u}this._noApply=!1}},createDelayedControls:function(){var e=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:t("#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",n.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=n.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(t("#shape-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",n.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){e.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.fillControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:t("#shape-button-from-file")}),this.fillControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#shape-button-from-url")}),this.fillControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.ChangeShapeImageFromFile(),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",n.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:t("#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",n.bind(this.onFillTypeSelect,this)),this.fillControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:t("#shape-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",n.bind(this.onNumTransparencyChange,this)),this.fillControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:t("#shape-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",n.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",n.bind(this.onTransparencyChangeComplete,this)),this.fillControls.push(this.sldrTransparency),this.lblTransparencyStart=t(this.el).find("#shape-lbl-transparency-start"),this.lblTransparencyEnd=t(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:t("#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",n.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:n.template('<div id="id-shape-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(r){e.mnuDirectionPicker=new Common.UI.DataView({el:t("#id-shape-menu-direction"),parentMenu:r.menu,restoreHeight:174,store:new Common.UI.DataViewStore(e._viewDataLinear),itemTemplate:n.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(t("#shape-button-direction")),this.mnuDirectionPicker.on("item:click",n.bind(this.onSelectGradient,this,this.btnDirection)),this.fillControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:t("#shape-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",n.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",n.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(t,n){e.GradColor.currentIdx=n;var r=e.GradColor.colors[e.GradColor.currentIdx];e.btnGradColor.setColor(r),e.colorsGrad.select(r,!1)}),this.sldrGradient.on("thumbdblclick",function(t){e.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.fillControls.push(this.sldrGradient),this.cmbBorderSize=(new Common.UI.ComboBorderSizeEditable({el:t("#shape-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders})).on("selected",n.bind(this.onBorderSizeSelect,this)).on("changed:before",n.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",n.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",n.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:t("#shape-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"})).on("selected",n.bind(this.onBorderTypeSelect,this)).on("combo:blur",n.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnChangeShape=new Common.UI.Button({cls:"btn-icon-default",iconCls:"btn-change-shape",menu:new Common.UI.Menu({menuAlign:"tr-br",cls:"menu-shapes",items:[]})}),this.btnChangeShape.render(t("#shape-btn-change")),this.lockedControls.push(this.btnChangeShape),this.linkAdvanced=t("#shape-advanced-link"),t(this.el).on("click","#shape-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls();var e=[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 t=0;t<13;t++)for(var n=0;n<4;n++){var r=t*4+n;this.patternViewData[r]={offsetx:n*28,offsety:t*28,type:e[r]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var t=0;t<this.patternViewData.length;t++)this.patternViewData[t].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(e){var r=this;if(e&&e.length>0){this.btnTexture||(this.btnTexture=new Common.UI.ComboBox({el:t("#shape-combo-fill-texture"),template:n.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:n.template('<div id="id-shape-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(t("#shape-combo-fill-texture")),this.fillControls.push(this.btnTexture));var i=[];n.each(e,function(e){i.push({imageUrl:e.get_image(),name:r.textureNames[e.get_id()],type:e.get_id(),selected:!1})});var s=new Common.UI.DataView({el:t("#id-shape-menu-texture"),restoreHeight:174,parentMenu:r.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(i),itemTemplate:n.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",n.bind(this.onSelectTexture,this))}},onSelectTexture:function(e,n,r){this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1;if(this.api){var i=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(r.get("type")),i.put_fill(s),this.api.ShapeApply(i)}t(this.btnTexture.el).find(".form-control").prop("innerHTML",r.get("name")),this.fireEvent("editcomplete",this)},fillAutoShapes:function(){var e=this,r=this.application.getCollection("ShapeGroups"),i=r.length;for(var s=0;s<i-1;s++){var o=r.at(s),u=new Common.UI.MenuItem({caption:o.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tr-tl",items:[{template:n.template('<div id="id-shape-menu-shapegroup'+s+'" class="menu-shape" style="width: '+(o.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});e.btnChangeShape.menu.addItem(u);var a=new Common.UI.DataView({el:t("#id-shape-menu-shapegroup"+s),store:o.get("groupStore"),parentMenu:u.menu,showLast:!1,itemTemplate:n.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});a.on("item:click",function(t,n,r,i){e.api&&(e.api.ChangeShapeType(r.get("data").shapeType),e.fireEvent("editcomplete",e)),i.type!=="click"&&e.btnChangeShape.menu.hide()})}},UpdateThemeColors:function(){this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(t("#shape-back-color-btn")),this.btnBackColor.setColor("transparent"),this.fillControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:t("#shape-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",n.bind(this.onColorsBackSelect,this)),t(this.el).on("click","#shape-back-color-new",n.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(t("#shape-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.fillControls.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:t("#shape-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",n.bind(this.onColorsFGSelect,this)),t(this.el).on("click","#shape-foreground-color-new",n.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(t("#shape-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.fillControls.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:t("#shape-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",n.bind(this.onColorsBGSelect,this)),t(this.el).on("click","#shape-background-color-new",n.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(t("#shape-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.fillControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:t("#shape-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",n.bind(this.onColorsGradientSelect,this)),t(this.el).on("click","#shape-gradient-color-new",n.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor)),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(t("#shape-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:t("#shape-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",n.bind(this.onColorsBorderSelect,this)),t(this.el).on("click","#shape-border-color-new",n.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(e){return e*25.4/72},_mm2pt:function(e){return e*72/25.4},disableFillPanels:function(e){this._state.DisabledFillPanels!==e&&(this._state.DisabledFillPanels=e,n.each(this.fillControls,function(t){t.setDisabled(e)}),this.lblTransparencyStart.toggleClass("disabled",e),this.lblTransparencyEnd.toggleClass("disabled",e))},ShowHideElem:function(e){this.FillColorContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",e===Asc.c_oAscFill.FILL_TYPE_NOFILL||e===null)},setLocked:function(e){this._locked=e},disableControls:function(e,t){if(this._initSettings)return;this.disableFillPanels(e||t),this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},hideShapeOnlySettings:function(e){this._state.HideShapeOnlySettings!==e&&(this._state.HideShapeOnlySettings=e,this.ShapeOnlySettings.toggleClass("hidden",e==1))},hideChangeTypeSettings:function(e){this._state.HideChangeTypeSettings!==e&&(this._state.HideChangeTypeSettings=e,this.CanChangeType.toggleClass("hidden",e==1))},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strChange:"Change Autoshape",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textNewColor:"Add New Custom Color",textAdvanced:"Show advanced settings",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",strType:"Type"},PE.Views.ShapeSettings||{}))}),define("text!presentationeditor/main/app/template/SlideSettings.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="slide-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr class="padding-small">\r\n <td>\r\n <div id="slide-panel-color-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div id="slide-back-color-btn" style=""></div>\r\n </div>\r\n <div id="slide-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="slide-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="slide-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="slide-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="slide-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="slide-combo-fill-texture" style="width: 90px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div id="slide-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="slide-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="slide-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="slide-background-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </div>\r\n <div id="slide-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="slide-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="slide-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="slide-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="slide-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 <label class="header"><%= scope.strEffect %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="slide-combo-effect-name" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="slide-combo-effect-type" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display: inline-block;">\r\n <label class="input-label"><%= scope.strDuration %></label>\r\n <div id="slide-spin-duration" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <button type="button" class="btn btn-text-default" id="slide-button-preview" style="width:70px;display: inline-block; float:right;"><%= scope.textPreview %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="slide-checkbox-start-click"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div>\r\n <div id="slide-checkbox-delay" style="display: inline-block; width: 100px; margin-top:2px;"></div>\r\n <div id="slide-spin-delay" 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 colspan=2>\r\n <button type="button" class="btn btn-text-default" id="slide-button-apply-all" style="width:100%;"><%= scope.textApplyAll %></button>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("presentationeditor/main/app/view/SlideSettings",["text!presentationeditor/main/app/template/SlideSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(e,t,n,r){"use strict";PE.Views.SlideSettings=r.View.extend(n.extend({el:"#id-slide-settings",template:n.template(e),events:{},options:{alias:"SlideSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,this._noApply=!0,this._sendUndoPoint=!0,this._sliderChanged=!1,this.FillItems=[],this._stateDisabled={background:!0,effects:!0,timing:!0},this._state={FillType:undefined,SlideColor:"ffffff",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR},this.OriginalFillType=undefined,this.SlideColor={Value:1,Color:"ffffff"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.Effect=Asc.c_oAscSlideTransitionTypes.None,this.EffectType=undefined,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.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this._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:t("#slide-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 190px;",editable:!1,data:this._arrFillSrc,disabled:!0}),this.cmbFillSrc.setValue(""),this.cmbFillSrc.on("selected",n.bind(this.onFillSrcSelect,this)),this.FillColorContainer=t("#slide-panel-color-fill"),this.FillImageContainer=t("#slide-panel-image-fill"),this.FillPatternContainer=t("#slide-panel-pattern-fill"),this.FillGradientContainer=t("#slide-panel-gradient-fill"),this._arrEffectName=[{displayValue:this.textNone,value:Asc.c_oAscSlideTransitionTypes.None},{displayValue:this.textFade,value:Asc.c_oAscSlideTransitionTypes.Fade},{displayValue:this.textPush,value:Asc.c_oAscSlideTransitionTypes.Push},{displayValue:this.textWipe,value:Asc.c_oAscSlideTransitionTypes.Wipe},{displayValue:this.textSplit,value:Asc.c_oAscSlideTransitionTypes.Split},{displayValue:this.textUnCover,value:Asc.c_oAscSlideTransitionTypes.UnCover},{displayValue:this.textCover,value:Asc.c_oAscSlideTransitionTypes.Cover},{displayValue:this.textClock,value:Asc.c_oAscSlideTransitionTypes.Clock},{displayValue:this.textZoom,value:Asc.c_oAscSlideTransitionTypes.Zoom}],this.cmbEffectName=new Common.UI.ComboBox({el:t("#slide-combo-effect-name"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 190px;",editable:!1,data:this._arrEffectName,disabled:!0}),this.cmbEffectName.setValue(""),this.cmbEffectName.on("selected",n.bind(this.onEffectNameSelect,this)),this._arrEffectType=[{displayValue:this.textSmoothly,value:Asc.c_oAscSlideTransitionParams.Fade_Smoothly},{displayValue:this.textBlack,value:Asc.c_oAscSlideTransitionParams.Fade_Through_Black},{displayValue:this.textLeft,value:Asc.c_oAscSlideTransitionParams.Param_Left},{displayValue:this.textTop,value:Asc.c_oAscSlideTransitionParams.Param_Top},{displayValue:this.textRight,value:Asc.c_oAscSlideTransitionParams.Param_Right},{displayValue:this.textBottom,value:Asc.c_oAscSlideTransitionParams.Param_Bottom},{displayValue:this.textTopLeft,value:Asc.c_oAscSlideTransitionParams.Param_TopLeft},{displayValue:this.textTopRight,value:Asc.c_oAscSlideTransitionParams.Param_TopRight},{displayValue:this.textBottomLeft,value:Asc.c_oAscSlideTransitionParams.Param_BottomLeft},{displayValue:this.textBottomRight,value:Asc.c_oAscSlideTransitionParams.Param_BottomRight},{displayValue:this.textVerticalIn,value:Asc.c_oAscSlideTransitionParams.Split_VerticalIn},{displayValue:this.textVerticalOut,value:Asc.c_oAscSlideTransitionParams.Split_VerticalOut},{displayValue:this.textHorizontalIn,value:Asc.c_oAscSlideTransitionParams.Split_HorizontalIn},{displayValue:this.textHorizontalOut,value:Asc.c_oAscSlideTransitionParams.Split_HorizontalOut},{displayValue:this.textClockwise,value:Asc.c_oAscSlideTransitionParams.Clock_Clockwise},{displayValue:this.textCounterclockwise,value:Asc.c_oAscSlideTransitionParams.Clock_Counterclockwise},{displayValue:this.textWedge,value:Asc.c_oAscSlideTransitionParams.Clock_Wedge},{displayValue:this.textZoomIn,value:Asc.c_oAscSlideTransitionParams.Zoom_In},{displayValue:this.textZoomOut,value:Asc.c_oAscSlideTransitionParams.Zoom_Out},{displayValue:this.textZoomRotate,value:Asc.c_oAscSlideTransitionParams.Zoom_AndRotate}],this.cmbEffectType=new Common.UI.ComboBox({el:t("#slide-combo-effect-type"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 190px;",editable:!1,data:this._arrEffectType,disabled:!0}),this.cmbEffectType.setValue(""),this.cmbEffectType.on("selected",n.bind(this.onEffectTypeSelect,this)),this.numDuration=new Common.UI.MetricSpinner({el:t("#slide-spin-duration"),step:1,width:65,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDuration.on("change",n.bind(this.onDurationChange,this)),this.numDelay=new Common.UI.MetricSpinner({el:t("#slide-spin-delay"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDelay.on("change",n.bind(this.onDelayChange,this)),this.chStartOnClick=new Common.UI.CheckBox({el:t("#slide-checkbox-start-click"),labelText:this.strStartOnClick,disabled:!0}),this.chStartOnClick.on("change",n.bind(this.onStartOnClickChange,this)),this.chDelay=new Common.UI.CheckBox({el:t("#slide-checkbox-delay"),labelText:this.strDelay,disabled:!0}),this.chDelay.on("change",n.bind(this.onCheckDelayChange,this)),this.btnPreview=new Common.UI.Button({el:t("#slide-button-preview"),disabled:!0}),this.btnPreview.on("click",n.bind(function(e){this.api&&this.api.SlideTransitionPlay(),this.fireEvent("editcomplete",this)},this)),this.btnApplyToAll=new Common.UI.Button({el:t("#slide-button-apply-all"),disabled:!0}),this.btnApplyToAll.on("click",n.bind(function(e){this.api&&this.api.SlideTimingApplyToAll(),this.fireEvent("editcomplete",this)},this))},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&(this.api.SetInterfaceDrawImagePlaceSlide("slide-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",n.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(e,t){this.ShowHideElem(t.value);switch(t.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID;if(!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),r.put_fill(new Asc.asc_CFillSolid),r.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.SlideColor.Color=="transparent"?{color:"4f81bd",effectId:24}:this.SlideColor.Color)),n.put_background(r),this.api.SetSlideProps(n)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD;if(!this._noApply){var n=new Asc.CAscSlideProps,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),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0));if(this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){var i=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();i==="ffffff"&&s==="ffffff"?i={color:"4f81bd",effectId:24}:i=this.GradColor.colors[0],r.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),r.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(i),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}n.put_background(r),this.api.SetSlideProps(n)}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:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT;if(!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_pattern_type(this.PatternFillType);var o=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex(),u=Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex();u==="ffffff"&&o==="ffffff"?o={color:"4f81bd",effectId:24}:o=this.FGColor.Color,r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(o)),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.put_background(r),this.api.SetSlideProps(n)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;if(!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.put_fill(null),n.put_background(r),this.api.SetSlideProps(n)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(e,t){this.btnBackColor.setColor(t),this.SlideColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;this.SlideColor.Color=="transparent"?(r.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.put_fill(null)):(r.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),r.put_fill(new Asc.asc_CFillSolid),r.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.SlideColor.Color))),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onPatternSelect:function(e,t){if(this.api&&!this._noApply){this.PatternFillType=t.get("type");var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(e,t){this.btnFGColor.setColor(t),this.FGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_pattern_type(this.PatternFillType),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(e,t){this.btnBGColor.setColor(t),this.BGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_pattern_type(this.PatternFillType),r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(e,t){this.BlipFillType=t.value;if(this.api&&this._fromTextureCmb!==!0&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var n=new Asc.CAscSlideProps,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),r.put_fill(new Asc.asc_CFillBlip),r.get_fill().put_type(this.BlipFillType),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onGradTypeSelect:function(e,t){this.GradFillType=t.value;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var t=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(t,!0),t?this.btnDirection.setIconCls("item-gradient "+t.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 n=new Asc.CAscSlideProps,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),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0)),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onSelectGradient:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0;if(this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var u=new Asc.CAscSlideProps,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType),a.get_fill().put_linear_angle(s.type*6e4),a.get_fill().put_linear_scale(!0),u.put_background(a),this.api.SetSlideProps(u)}this.fireEvent("editcomplete",this)},onColorsGradientSelect:function(e,t){this.btnGradColor.setColor(t),this.GradColor.colors[this.GradColor.currentIdx]=t,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof t=="object"?t.color:t));if(this.api&&!this._noApply){var n=new Asc.CAscSlideProps,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_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&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0)),r.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3])),n.put_background(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onGradientChange:function(e,t,r){this.GradColor.values=e.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=!0,this.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var e=new Asc.CAscSlideProps,t=new Asc.asc_CShapeFill;t.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),t.put_fill(new Asc.asc_CFillGrad),t.get_fill().put_grad_type(this.GradFillType),t.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(t.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),t.get_fill().put_linear_scale(!0)),t.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),e.put_background(t),this.api.SetSlideProps(e),this._sliderChanged=!1}},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)&&e.BlipFillType!==null){var s=new Asc.CAscSlideProps,o=new Asc.asc_CShapeFill;o.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),o.put_fill(new Asc.asc_CFillBlip),o.get_fill().put_type(e.BlipFillType),o.get_fill().put_url(i),s.put_background(o),e.api.SetSlideProps(s)}}e.fireEvent("editcomplete",e)}})).show()},createDelayedControls:function(){var e=this;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=n.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(t("#slide-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",n.bind(this.onPatternSelect,this)),this.FillItems.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:t("#slide-button-from-file")}),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.ChangeSlideImageFromFile(),this.fireEvent("editcomplete",this)},this)),this.FillItems.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#slide-button-from-url")}),this.btnInsertFromUrl.on("click",n.bind(this.insertFromUrl,this)),this.FillItems.push(this.btnInsertFromUrl),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:t("#slide-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",n.bind(this.onFillTypeSelect,this)),this.FillItems.push(this.cmbFillType),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:t("#slide-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",n.bind(this.onGradTypeSelect,this)),this.FillItems.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:n.template('<div id="id-slide-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(r){e.mnuDirectionPicker=new Common.UI.DataView({el:t("#id-slide-menu-direction"),parentMenu:r.menu,restoreHeight:174,store:new Common.UI.DataViewStore(e._viewDataLinear),itemTemplate:n.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(t("#slide-button-direction")),this.mnuDirectionPicker.on("item:click",n.bind(this.onSelectGradient,this,this.btnDirection)),this.FillItems.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:t("#slide-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",n.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",n.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(t,n){e.GradColor.currentIdx=n;var r=e.GradColor.colors[e.GradColor.currentIdx];e.btnGradColor.setColor(r),e.colorsGrad.select(r,!1)}),this.sldrGradient.on("thumbdblclick",function(t){e.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.FillItems.push(this.sldrGradient)},createDelayedElements:function(){this.createDelayedControls();var e=[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 t=0;t<13;t++)for(var n=0;n<4;n++){var r=t*4+n;this.patternViewData[r]={offsetx:n*28,offsety:t*28,type:e[r]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var t=0;t<this.patternViewData.length;t++)this.patternViewData[t].id=Common.UI.getId();this.cmbPattern.menuPicker.store.add(this.patternViewData),this.cmbPattern.menuPicker.store.length>0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this._initSettings=!1},onInitStandartTextures:function(e){var r=this;if(e&&e.length>0){this.btnTexture||(this.btnTexture=new Common.UI.ComboBox({el:t("#slide-combo-fill-texture"),template:n.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:n.template('<div id="id-slide-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(t("#slide-combo-fill-texture")),this.FillItems.push(this.btnTexture));var i=[];n.each(e,function(e){i.push({imageUrl:e.get_image(),name:r.textureNames[e.get_id()],type:e.get_id(),selected:!1})});var s=new Common.UI.DataView({el:t("#id-slide-menu-texture"),restoreHeight:174,parentMenu:r.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(i),itemTemplate:n.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",n.bind(this.onSelectTexture,this))}},onSelectTexture:function(e,n,r){this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1;if(this.api){var i=new Asc.CAscSlideProps,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(r.get("type")),i.put_background(s),this.api.SetSlideProps(i)}t(this.btnTexture.el).find(".form-control").prop("innerHTML",r.get("name")),this.fireEvent("editcomplete",this)},fillEffectTypeCombo:function(e){var t=[];switch(e){case Asc.c_oAscSlideTransitionTypes.Fade:t.push(this._arrEffectType[0],this._arrEffectType[1]);break;case Asc.c_oAscSlideTransitionTypes.Push:t=this._arrEffectType.slice(2,6);break;case Asc.c_oAscSlideTransitionTypes.Wipe:t=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Split:t=this._arrEffectType.slice(10,14);break;case Asc.c_oAscSlideTransitionTypes.UnCover:t=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Cover:t=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Clock:t=this._arrEffectType.slice(14,17);break;case Asc.c_oAscSlideTransitionTypes.Zoom:t=this._arrEffectType.slice(17)}t.length>0?(this.cmbEffectType.store.reset(t),this.cmbEffectType.setValue(t[0].value),this.EffectType=t[0].value):(this.cmbEffectType.store.reset(),this.EffectType=undefined),this.cmbEffectType.setDisabled(t.length<1||this._stateDisabled.effects),this.numDuration.setDisabled(t.length<1||this._stateDisabled.effects),this.btnPreview.setDisabled(t.length<1||this._stateDisabled.effects)},onEffectNameSelect:function(e,t){var n=t.value;this.Effect!==n&&(this.Effect!==Asc.c_oAscSlideTransitionTypes.Wipe&&this.Effect!==Asc.c_oAscSlideTransitionTypes.UnCover&&this.Effect!==Asc.c_oAscSlideTransitionTypes.Cover||n!==Asc.c_oAscSlideTransitionTypes.Wipe&&n!==Asc.c_oAscSlideTransitionTypes.UnCover&&n!==Asc.c_oAscSlideTransitionTypes.Cover)&&this.fillEffectTypeCombo(n),this.Effect=n;if(this.api&&!this._noApply){var r=new Asc.CAscSlideProps,i=new Asc.CAscSlideTiming;i.put_TransitionType(n),i.put_TransitionOption(this.EffectType),r.put_timing(i),this.api.SetSlideProps(r)}this.fireEvent("editcomplete",this)},onEffectTypeSelect:function(e,t){this.EffectType=t.value;if(this.api&&!this._noApply){var n=new Asc.CAscSlideProps,r=new Asc.CAscSlideTiming;r.put_TransitionType(this.Effect),r.put_TransitionOption(this.EffectType),n.put_timing(r),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onDurationChange:function(e,t,n,r){if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_TransitionDuration(e.getNumberValue()*1e3),i.put_timing(s),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onDelayChange:function(e,t,n,r){if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceDuration(e.getNumberValue()*1e3),i.put_timing(s),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onStartOnClickChange:function(e,t,n,r){if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceOnMouseClick(e.getValue()=="checked"),i.put_timing(s),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onCheckDelayChange:function(e,t,n,r){this.numDelay.setDisabled(e.getValue()!=="checked");if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceAfter(e.getValue()=="checked"),i.put_timing(s),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",disabled:!0,menu:new Common.UI.Menu({items:[{template:n.template('<div id="slide-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="slide-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(t("#slide-back-color-btn")),this.btnBackColor.setColor("ffffff"),this.FillItems.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:t("#slide-back-color-menu"),value:"ffffff",transparent:!0}),this.colorsBack.on("select",n.bind(this.onColorsBackSelect,this)),t(this.el).on("click","#slide-back-color-new",n.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="slide-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="slide-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(t("#slide-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.FillItems.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:t("#slide-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",n.bind(this.onColorsFGSelect,this)),t(this.el).on("click","#slide-foreground-color-new",n.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="slide-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="slide-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(t("#slide-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.FillItems.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:t("#slide-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",n.bind(this.onColorsBGSelect,this)),t(this.el).on("click","#slide-background-color-new",n.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="slide-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="slide-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(t("#slide-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.FillItems.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:t("#slide-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",n.bind(this.onColorsGradientSelect,this)),t(this.el).on("click","#slide-gradient-color-new",n.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor))),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())},ShowHideElem:function(e){this.FillColorContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_GRAD)},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements();if(e){this._originalProps=e,this._noApply=!0;var n=null,r=e.get_background(),i=r.get_type(),s=null;if(r===null||i===null||i==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(i==Asc.c_oAscFill.FILL_TYPE_SOLID)r=r.get_fill(),s=r.get_color(),s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.SlideColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}}:this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}:this.SlideColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor=this.SlideColor.Color!=="transparent"?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]=this.SlideColor.Color!=="transparent"?Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color):"000000",this.GradColor.colors[1]="ffffff";else if(i==Asc.c_oAscFill.FILL_TYPE_BLIP)r=r.get_fill(),this.BlipFillType=r.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(i==Asc.c_oAscFill.FILL_TYPE_PATT){r=r.get_fill(),this.PatternFillType=r.get_pattern_type();if(this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var n=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(n),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}s=r.get_color_fg(),s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}:this.FGColor={Value:1,Color:"000000"},s=r.get_color_bg(),s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.SlideColor={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(i==Asc.c_oAscFill.FILL_TYPE_GRAD){r=r.get_fill();var o=r.get_grad_type();if(this._state.GradFillType!==o||this.GradFillType!==o)this.GradFillType=o,n=undefined,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;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var u=Math.floor(r.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-u)>.001){this.GradLinearDirectionType=u;var a=this.mnuDirectionPicker.store.findWhere({type:u});this.mnuDirectionPicker.selectRecord(a,!0),a?this.btnDirection.setIconCls("item-gradient "+a.get("iconcls")):this.btnDirection.setIconCls("")}}var f=r.get_colors();f&&f.length>0&&(s=f[0],s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()):this.GradColor.colors[0]="000000",s=f[1],s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()):this.GradColor.colors[1]="ffffff");var l=r.get_positions();if(l&&l.length>0){var c=l[0];c!==null&&(c/=1e3,this.GradColor.values[0]=c),c=l[1],c!==null&&(c/=1e3,this.GradColor.values[1]=c)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[0]=="object"?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[1]=="object"?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.SlideColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),t(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var h=typeof this.SlideColor.Color,p=typeof this._state.SlideColor;if(h!==p||h=="object"&&(this.SlideColor.Color.effectValue!==this._state.SlideColor.effectValue||this._state.SlideColor.color.indexOf(this.SlideColor.Color.color)<0)||h!="object"&&this._state.SlideColor.indexOf(this.SlideColor.Color)<0){this.btnBackColor.setColor(this.SlideColor.Color);if(typeof this.SlideColor.Color=="object"){var d=!1;for(var v=0;v<10;v++)if(Common.Utils.ThemeColor.ThemeValues[v]==this.SlideColor.Color.effectValue){this.colorsBack.select(this.SlideColor.Color,!0),d=!0;break}d||this.colorsBack.clearSelection()}else this.colorsBack.select(this.SlideColor.Color,!0);this._state.SlideColor=this.SlideColor.Color}var m=e.get_timing();if(m){var u=m.get_TransitionType(),g=!1;if(this._state.Effect!==u){var y=this.cmbEffectName.store.findWhere({value:u});y?(g=!0,this.cmbEffectName.setValue(y.get("value"))):this.cmbEffectName.setValue(""),this.fillEffectTypeCombo(g?u:undefined),this.Effect=u,this._state.Effect=u}u=m.get_TransitionOption();if(this._state.EffectType!==u||g)g=!1,y=this.cmbEffectType.store.findWhere({value:u}),y?(g=!0,this.cmbEffectType.setValue(y.get("value"))):this.cmbEffectType.setValue(""),this._state.EffectType=u;u=m.get_TransitionDuration();if(Math.abs(this._state.Duration-u)>.001||(this._state.Duration===null||u===null)&&this._state.Duration!==u||(this._state.Duration===undefined||u===undefined)&&this._state.Duration!==u)this.numDuration.setValue(u!==null&&u!==undefined?u/1e3:"",!0),this._state.Duration=u;u=m.get_SlideAdvanceDuration();if(Math.abs(this._state.Delay-u)>.001||(this._state.Delay===null||u===null)&&this._state.Delay!==u||(this._state.Delay===undefined||u===undefined)&&this._state.Delay!==u)this.numDelay.setValue(u!==null&&u!==undefined?u/1e3:"",!0),this._state.Delay=u;u=m.get_SlideAdvanceOnMouseClick(),this._state.OnMouseClick!==u&&(this.chStartOnClick.setValue(u!==null&&u!==undefined?u:"indeterminate",!0),this._state.OnMouseClick=u),u=m.get_SlideAdvanceAfter(),this._state.AdvanceAfter!==u&&(this.chDelay.setValue(u!==null&&u!==undefined?u:"indeterminate",!0),this.numDelay.setDisabled(this.chDelay.getValue()!=="checked"),this._state.AdvanceAfter=u)}h=typeof this.FGColor.Color,p=typeof this._state.FGColor;if(h!==p||h=="object"&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||h!="object"&&this._state.FGColor.indexOf(this.FGColor.Color)<0){this.btnFGColor.setColor(this.FGColor.Color);if(typeof this.FGColor.Color=="object"){var d=!1;for(var v=0;v<10;v++)if(Common.Utils.ThemeColor.ThemeValues[v]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),d=!0;break}d||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}h=typeof this.BGColor.Color,p=typeof this._state.BGColor;if(h!==p||h=="object"&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||h!="object"&&this._state.BGColor.indexOf(this.BGColor.Color)<0){this.btnBGColor.setColor(this.BGColor.Color);if(typeof this.BGColor.Color=="object"){var d=!1;for(var v=0;v<10;v++)if(Common.Utils.ThemeColor.ThemeValues[v]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),d=!0;break}d||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}s=this.GradColor.colors[this.GradColor.currentIdx],h=typeof s,p=typeof this._state.GradColor;if(h!==p||h=="object"&&(s.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(s.color)<0)||h!="object"&&this._state.GradColor.indexOf(s)<0){this.btnGradColor.setColor(s);if(typeof s=="object"){var d=!1;for(var v=0;v<10;v++)if(Common.Utils.ThemeColor.ThemeValues[v]==s.effectValue){this.colorsGrad.select(s,!0),d=!0;break}d||this.colorsGrad.clearSelection()}else this.colorsGrad.select(s,!0);this._state.GradColor=s}this._noApply=!1}},SetSlideDisabled:function(e,t,n){if(this._initSettings)return;if(e!==this._stateDisabled.background){this.cmbFillSrc.setDisabled(e);for(var r=0;r<this.FillItems.length;r++)this.FillItems[r].setDisabled(e);this._stateDisabled.background=e}if(t!==this._stateDisabled.effects){var i=this.cmbEffectType.store.length;this.cmbEffectName.setDisabled(t),this.cmbEffectType.setDisabled(i<1||t),this.numDuration.setDisabled(i<1||t),this.btnPreview.setDisabled(i<1||t),this._stateDisabled.effects=t}n!==this._stateDisabled.timing&&(this.chStartOnClick.setDisabled(n),this.chDelay.setDisabled(n),this.numDelay.setDisabled(n||this.chDelay.getValue()!=="checked"),this.btnApplyToAll.setDisabled(n),this._stateDisabled.timing=n)},strColor:"Color",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",textNoFill:"No Fill",textSelectTexture:"Select",textNone:"None",textFade:"Fade",textPush:"Push",textWipe:"Wipe",textSplit:"Split",textUnCover:"UnCover",textCover:"Cover",textClock:"Clock",textZoom:"Zoom",textSmoothly:"Smoothly",textBlack:"Through Black",textLeft:"Left",textTop:"Top",textRight:"Right",textBottom:"Bottom",textTopLeft:"Top-Left",textTopRight:"Top-Right",textBottomLeft:"Bottom-Left",textBottomRight:"Bottom-Right",textVerticalIn:"Vertical In",textVerticalOut:"Vertical Out",textHorizontalIn:"Horizontal In",textHorizontalOut:"Horizontal Out",textClockwise:"Clockwise",textCounterclockwise:"Counterclockwise",textWedge:"Wedge",textZoomIn:"Zoom In",textZoomOut:"Zoom Out",textZoomRotate:"Zoom and Rotate",strStartOnClick:"Start On Click",strDelay:"Delay",textApplyAll:"Apply to All Slides",textPreview:"Preview",strEffect:"Effect",strDuration:"Duration",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",textSec:"s"},PE.Views.SlideSettings||{}))}),define("text!presentationeditor/main/app/template/TextArtSettings.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTemplate %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-template" style="width: 100%; height: 64px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strFill %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="textart-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="textart-panel-color-fill" class="padding-small" style="width: 100%;">\r\n <div id="textart-back-color-btn" style=""></div>\r\n </div>\r\n <div id="textart-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="textart-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="textart-button-from-url" style="width:90px;float:right;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: top">\r\n <div id="textart-combo-fill-type" style="width: 90px;"></div>\r\n </td>\r\n <td rowspan="2">\r\n <div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;float:right;">\r\n <div id="textart-texture-img" style="width: 50px;height: 50px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom">\r\n <label class="input-label" style=""><%= scope.textTexture %></label>\r\n <div id="textart-combo-fill-texture" style="width: 90px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div id="textart-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>\r\n <div id="textart-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>\r\n <div id="textart-foreground-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>\r\n <div id="textart-background-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </div>\r\n <div id="textart-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div style="height:80px;">\r\n <div style="display: inline-block;">\r\n <label class="input-label" style=""><%= scope.textStyle %></label>\r\n <div id="textart-combo-grad-type" style="width: 90px;"></div>\r\n </div>\r\n <div style="display: inline-block;float: right;">\r\n <label class="input-label" style=""><%= scope.textDirection %></label>\r\n <div id="textart-button-direction" style=""></div>\r\n </div>\r\n </div>\r\n <label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <div id="textart-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="textart-gradient-color-btn" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div class="padding-small" id="textart-panel-transparent-fill" style="width: 100%;">\r\n <label class="header" style="display:block;"><%= scope.strTransparency %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <label id="textart-lbl-transparency-start">0</label>\r\n <div id="textart-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>\r\n <label id="textart-lbl-transparency-end">100</label>\r\n </div>\r\n <div id="textart-spin-transparency" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strStroke %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strSize %></label>\r\n <div id="textart-combo-border-size" style="width: 93px;"></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strColor %></label>\r\n <div id="textart-border-color-btn" style=""></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strType %></label>\r\n <div id="textart-combo-border-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTransform %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-transform" style="width: 100%; height: 42px;"></div>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("presentationeditor/main/app/view/TextArtSettings",["text!presentationeditor/main/app/template/TextArtSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(e,t,n,r){"use strict";PE.Views.TextArtSettings=r.View.extend(n.extend({el:"#id-textart-settings",template:n.template(e),events:{},options:{alias:"TextArtSettings"},initialize:function(){this._initSettings=!0,this._noApply=!0,this.shapeprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,FormId:null,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this.FillColorContainer=t("#textart-panel-color-fill"),this.FillImageContainer=t("#textart-panel-image-fill"),this.FillPatternContainer=t("#textart-panel-pattern-fill"),this.FillGradientContainer=t("#textart-panel-gradient-fill"),this.TransparencyContainer=t("#textart-panel-transparent-fill")},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&(this.api.SetInterfaceDrawImagePlaceTextArt("textart-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",n.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(e,t){this.ShowHideElem(t.value);switch(t.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),r.put_fill(new Asc.asc_CFillSolid),r.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color=="transparent"?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD;if(!this._noApply){var n=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),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0));if(this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){var i=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();i==="ffffff"&&s==="ffffff"?i={color:"4f81bd",effectId:24}:i=this.GradColor.colors[0],r.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),r.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(i),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}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:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_pattern_type(this.PatternFillType);var o=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex(),u=Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex();u==="ffffff"&&o==="ffffff"?o={color:"4f81bd",effectId:24}:o=this.FGColor.Color,r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(o)),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.put_fill(null),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(e,t){this.btnBackColor.setColor(t),this.ShapeColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;this.ShapeColor.Color=="transparent"?(r.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.put_fill(null)):(r.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),r.put_fill(new Asc.asc_CFillSolid),r.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onPatternSelect:function(e,t){if(this.api&&!this._noApply){this.PatternFillType=t.get("type");var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(e,t){this.btnFGColor.setColor(t),this.FGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_pattern_type(this.PatternFillType),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(e,t){this.btnBGColor.setColor(t),this.BGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),r.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.get_fill().put_pattern_type(this.PatternFillType),r.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),r.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(e,t){this.BlipFillType=t.value;if(this.api&&this._fromTextureCmb!==!0&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),r.put_fill(new Asc.asc_CFillBlip),r.get_fill().put_type(this.BlipFillType),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onNumTransparencyChange:function(e,t,n,r){this.sldrTransparency.setValue(e.getNumberValue(),!0);if(this.api){var i=e.getNumberValue(),s=new Asc.asc_TextArtProperties,o=new Asc.asc_CShapeFill;o.put_transparent(i*2.55),s.asc_putFill(o),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onTransparencyChange:function(e,t,r){this._sliderChanged=t,this.numTransparency.setValue(t,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=t,this.api.setEndPointHistory(),this._transparencyApplyFunc(),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(this._sliderChanged!==undefined){var e=new Asc.asc_TextArtProperties,t=new Asc.asc_CShapeFill;t.put_transparent(this._sliderChanged*2.55),e.asc_putFill(t),this.shapeprops.put_TextArtProperties(e),this.api.ShapeApply(this.shapeprops),this._sliderChanged=undefined}},onGradTypeSelect:function(e,t){this.GradFillType=t.value;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var t=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(t,!0),t?this.btnDirection.setIconCls("item-gradient "+t.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 n=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),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onSelectGradient:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0;if(this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var u=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType),a.get_fill().put_linear_angle(s.type*6e4),a.get_fill().put_linear_scale(!0),u.asc_putFill(a),this.shapeprops.put_TextArtProperties(u),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsGradientSelect:function(e,t){this.btnGradColor.setColor(t),this.GradColor.colors[this.GradColor.currentIdx]=t,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof t=="object"?t.color:t));if(this.api&&!this._noApply){var n=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_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&&(r.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),r.get_fill().put_linear_scale(!0)),r.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3])),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onGradientChange:function(e,t,r){this.GradColor.values=e.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=!0,this.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var e=new Asc.asc_TextArtProperties,t=new Asc.asc_CShapeFill;t.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),t.put_fill(new Asc.asc_CFillGrad),t.get_fill().put_grad_type(this.GradFillType),t.get_fill().put_positions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(t.get_fill().put_linear_angle(this.GradLinearDirectionType*6e4),t.get_fill().put_linear_scale(!0)),t.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),e.asc_putFill(t),this.shapeprops.put_TextArtProperties(e),this.api.ShapeApply(this.shapeprops),this._sliderChanged=!1}},applyBorderSize:function(e){e=parseFloat(e),e=isNaN(e)?0:Math.max(0,Math.min(1584,e)),this.BorderSize=e;if(this.api&&!this._noApply){var t=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<.01?(n.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),this.BorderColor.Color=="transparent"||this.BorderColor.Color.color=="transparent"?n.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):(this._state.StrokeType==Asc.c_oAscStrokeType.STROKE_NONE||this._state.StrokeType===null)&&n.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),n.asc_putPrstDash(this.BorderType),n.put_width(this._pt2mm(this.BorderSize))),t.asc_putLine(n),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(e,t,r,i){var s=this;if(e){var o=parseFloat(r.value),u=new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$");if(!u.exec(r.value)||o<0||o>1584)this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){n.defer(function(e){s.fireEvent("editcomplete",s)})}})}else this.applyBorderSize(r.value)},onBorderSizeSelect:function(e,t){this.applyBorderSize(t.value)},onBorderTypeSelect:function(e,t){this.BorderType=t.value;if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CStroke;this.BorderSize<.01?r.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(r.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),r.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.put_width(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.asc_putLine(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(e,t){this.btnBorderColor.setColor(t),this.BorderColor={Value:1,Color:t};if(this.api&&this.BorderSize>0&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CStroke;this.BorderSize<.01?r.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(r.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),r.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.put_width(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.asc_putLine(r),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)&&e.BlipFillType!==null){var s=new Asc.asc_TextArtProperties,o=new Asc.asc_CShapeFill;o.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),o.put_fill(new Asc.asc_CFillBlip),o.get_fill().put_type(e.BlipFillType),o.get_fill().put_url(i),s.asc_putFill(o),e.shapeprops.put_TextArtProperties(s),e.api.ShapeApply(e.shapeprops)}}e.fireEvent("editcomplete",e)}})).show()},ChangeSettings:function(e){this.shapeprops==null&&(this.shapeprops=new Asc.asc_CShapeProperty),this._initSettings&&this.createDelayedElements();if(e&&e.get_TextArtProperties()){var r=e.get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var i=null,s=r.asc_getFill(),o=s?s.get_type():null,u=null;if(s){var a=s.get_transparent();if(Math.abs(this._state.Transparency-a)>.001||Math.abs(this.numTransparency.getNumberValue()-a)>.001||(this._state.Transparency===null||a===null)&&(this._state.Transparency!==a||this.numTransparency.getNumberValue()!==a))a!==undefined&&(this.sldrTransparency.setValue(a===null?100:a/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=a}if(s===null||s===undefined||o===null)this.OriginalFillType=null;else if(o==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(o==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.get_fill(),u=s.get_color(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor=this.ShapeColor.Color!=="transparent"?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]=this.ShapeColor.Color!=="transparent"?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[1]="ffffff";else if(o==Asc.c_oAscFill.FILL_TYPE_BLIP)s=s.get_fill(),this.BlipFillType=s.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(o==Asc.c_oAscFill.FILL_TYPE_PATT){s=s.get_fill(),this.PatternFillType=s.get_pattern_type();if(this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var i=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(i),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}u=s.get_color_fg(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b())}:this.FGColor={Value:1,Color:"000000"},u=s.get_color_bg(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.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(o==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.get_fill();var f=s.get_grad_type();if(this._state.GradFillType!==f||this.GradFillType!==f)this.GradFillType=f,i=undefined,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),i=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,i.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var l=Math.floor(s.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-l)>.001){this.GradLinearDirectionType=l;var c=this.mnuDirectionPicker.store.findWhere({type:l});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls("")}}var h=s.get_colors();h&&h.length>0&&(u=h[0],u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()):this.GradColor.colors[0]="000000",u=h[1],u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()):this.GradColor.colors[1]="ffffff");var p=s.get_positions();if(p&&p.length>0){var d=p[0];d!==null&&(d/=1e3,this.GradColor.values[0]=d),d=p[1],d!==null&&(d/=1e3,this.GradColor.values[1]=d)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[0]=="object"?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[1]=="object"?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(this.OriginalFillType===null?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),t(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var v=typeof this.ShapeColor.Color,m=typeof this._state.ShapeColor;if(v!==m||v=="object"&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||v!="object"&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){this.btnBackColor.setColor(this.ShapeColor.Color);if(typeof this.ShapeColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),g=!0;break}g||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var b=r.asc_getLine(),w=b?b.get_type():null,E;b?(w==Asc.c_oAscStrokeType.STROKE_COLOR?(u=b.get_color(),u?u.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b()),effectValue:u.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.get_r(),u.get_g(),u.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},E=b.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},v=typeof this.BorderColor.Color,m=typeof this._state.StrokeColor;if(v!==m||v=="object"&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||v!="object"&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||typeof this.btnBorderColor.color=="object")){this.btnBorderColor.setColor(this.BorderColor.Color);if(typeof this.BorderColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),g=!0;break}g||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==w||w==Asc.c_oAscStrokeType.STROKE_COLOR){if(w==Asc.c_oAscStrokeType.STROKE_COLOR){var S=b.get_width(),x=Math.abs(this._state.StrokeWidth-S)<.001&&!(new RegExp(this.txtPt+"\\s*$")).test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-S)>.001||x||(this._state.StrokeWidth===null||S===null)&&this._state.StrokeWidth!==S){this._state.StrokeWidth=S,S!==null&&(S=this._mm2pt(S));var T=S===null?S:n.find(this.cmbBorderSize.store.models,function(e){if(S<e.attributes.value+.01&&S>e.attributes.value-.01)return!0});T?this.cmbBorderSize.selectRecord(T):this.cmbBorderSize.setValue(S!==null?parseFloat(S.toFixed(2))+" "+this.txtPt:""),this.BorderSize=S}}else w==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=w}this._state.StrokeBorderType!==E&&(this.BorderType=this._state.StrokeBorderType=E,this.cmbBorderType.setValue(E)),v=typeof this.FGColor.Color,m=typeof this._state.FGColor;if(v!==m||v=="object"&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||v!="object"&&this._state.FGColor.indexOf(this.FGColor.Color)<0){this.btnFGColor.setColor(this.FGColor.Color);if(typeof this.FGColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),g=!0;break}g||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}v=typeof this.BGColor.Color,m=typeof this._state.BGColor;if(v!==m||v=="object"&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||v!="object"&&this._state.BGColor.indexOf(this.BGColor.Color)<0){this.btnBGColor.setColor(this.BGColor.Color);if(typeof this.BGColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),g=!0;break}g||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}u=this.GradColor.colors[this.GradColor.currentIdx],v=typeof u,m=typeof this._state.GradColor;if(v!==m||v=="object"&&(u.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(u.color)<0)||v!="object"&&this._state.GradColor.indexOf(u)<0){this.btnGradColor.setColor(u);if(typeof u=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==u.effectValue){this.colorsGrad.select(u,!0),g=!0;break}g||this.colorsGrad.clearSelection()}else this.colorsGrad.select(u,!0);this._state.GradColor=u}var N=r.asc_getForm();if(this._state.FormId!==N){this.cmbTransform.suspendEvents();var i=this.cmbTransform.menuPicker.store.findWhere({type:N});this.cmbTransform.menuPicker.selectRecord(i),this.cmbTransform.resumeEvents(),this._state.FormId=N}this._noApply=!1}},createDelayedControls:function(){var e=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:t("#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",n.bind(this.onFillSrcSelect,this)),this.lockedControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=n.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(t("#textart-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",n.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){e.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:t("#textart-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#textart-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.ChangeArtImageFromFile(),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",n.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:t("#textart-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",n.bind(this.onFillTypeSelect,this)),this.lockedControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:t("#textart-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",n.bind(this.onNumTransparencyChange,this)),this.lockedControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:t("#textart-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",n.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",n.bind(this.onTransparencyChangeComplete,this)),this.lockedControls.push(this.sldrTransparency),this.lblTransparencyStart=t(this.el).find("#textart-lbl-transparency-start"),this.lblTransparencyEnd=t(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:t("#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",n.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:n.template('<div id="id-textart-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(r){e.mnuDirectionPicker=new Common.UI.DataView({el:t("#id-textart-menu-direction"),parentMenu:r.menu,restoreHeight:174,store:new Common.UI.DataViewStore(e._viewDataLinear),itemTemplate:n.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(t("#textart-button-direction")),this.mnuDirectionPicker.on("item:click",n.bind(this.onSelectGradient,this,this.btnDirection)),this.lockedControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:t("#textart-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",n.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",n.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(t,n){e.GradColor.currentIdx=n;var r=e.GradColor.colors[e.GradColor.currentIdx];e.btnGradColor.setColor(r),e.colorsGrad.select(r,!1)}),this.sldrGradient.on("thumbdblclick",function(t){e.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.lockedControls.push(this.sldrGradient),this.cmbBorderSize=(new Common.UI.ComboBorderSizeEditable({el:t("#textart-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders})).on("selected",n.bind(this.onBorderSizeSelect,this)).on("changed:before",n.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",n.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",n.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:t("#textart-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"})).on("selected",n.bind(this.onBorderTypeSelect,this)).on("combo:blur",n.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(t("#textart-combo-transform")),this.cmbTransform.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTransform.on("click",n.bind(this.onTransformSelect,this)),this.cmbTransform.openButton.menu.on("show:after",function(){e.cmbTransform.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTransform)},createDelayedElements:function(){this.createDelayedControls();var e=[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 t=0;t<13;t++)for(var n=0;n<4;n++){var r=t*4+n;this.patternViewData[r]={offsetx:n*28,offsety:t*28,type:e[r]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var t=0;t<this.patternViewData.length;t++)this.patternViewData[t].id=Common.UI.getId();this.cmbPattern.menuPicker.store.add(this.patternViewData),this.cmbPattern.menuPicker.store.length>0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this.fillTransform(this.api.asc_getPropertyEditorTextArts()),this._initSettings=!1},onInitStandartTextures:function(e){var r=this;if(e&&e.length>0){this.btnTexture||(this.btnTexture=new Common.UI.ComboBox({el:t("#textart-combo-fill-texture"),template:n.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:n.template('<div id="id-textart-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(t("#textart-combo-fill-texture")),this.lockedControls.push(this.btnTexture));var i=[];n.each(e,function(e){i.push({imageUrl:e.get_image(),name:r.textureNames[e.get_id()],type:e.get_id(),selected:!1})});var s=new Common.UI.DataView({el:t("#id-textart-menu-texture"),restoreHeight:174,parentMenu:r.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(i),itemTemplate:n.template('<div><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",n.bind(this.onSelectTexture,this))}},onSelectTexture:function(e,n,r){this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1;if(this.api){var i=new Asc.asc_TextArtProperties,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(r.get("type")),i.asc_putFill(s),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}t(this.btnTexture.el).find(".form-control").prop("innerHTML",r.get("name")),this.fireEvent("editcomplete",this)},fillTextArt:function(){var e=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(t("#textart-combo-template")),this.cmbTextArt.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTextArt.on("click",n.bind(this.onTextArtSelect,this)),this.cmbTextArt.openButton.menu.on("show:after",function(){e.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTextArt));var r=this.application.getCollection("Common.Collections.TextArt").models,i=this.cmbTextArt.menuPicker.store.length;if(i>0&&i==r.length){var s=this.cmbTextArt.menuPicker.store.models;n.each(r,function(e,t){s[t].set("imageUrl",e.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(r),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))},onTextArtSelect:function(e,t){if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties;n.asc_putStyle(t.get("data")),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},fillTransform:function(e){if(e&&e.length>1&&e[1]){var t=this,r=[],i=e[1];for(var s=0;s<i.length;s++){var o=i[s];o&&o.length>0&&n.each(o,function(e){r.push({imageUrl:e.Image,type:e.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(r),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(e,t){if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties;n.asc_putForm(t.get("type")),this.shapeprops.put_TextArtProperties(n),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(t("#textart-back-color-btn")),this.btnBackColor.setColor("transparent"),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:t("#textart-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",n.bind(this.onColorsBackSelect,this)),t(this.el).on("click","#textart-back-color-new",n.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(t("#textart-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.lockedControls.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:t("#textart-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",n.bind(this.onColorsFGSelect,this)),t(this.el).on("click","#textart-foreground-color-new",n.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(t("#textart-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.lockedControls.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:t("#textart-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",n.bind(this.onColorsBGSelect,this)),t(this.el).on("click","#textart-background-color-new",n.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(t("#textart-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.lockedControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:t("#textart-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",n.bind(this.onColorsGradientSelect,this)),t(this.el).on("click","#textart-gradient-color-new",n.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor)),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(t("#textart-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:t("#textart-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",n.bind(this.onColorsBorderSelect,this)),t(this.el).on("click","#textart-border-color-new",n.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(e){return e*25.4/72},_mm2pt:function(e){return e*72/25.4},ShowHideElem:function(e){this.FillColorContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",e===Asc.c_oAscFill.FILL_TYPE_NOFILL||e===null)},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}))},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textNewColor:"Add New Custom Color",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",textTransform:"Transform",textTemplate:"Template",strType:"Type"},PE.Views.TextArtSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;define("presentationeditor/main/app/view/RightMenu",["text!presentationeditor/main/app/template/RightMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","presentationeditor/main/app/view/ParagraphSettings","presentationeditor/main/app/view/ImageSettings","presentationeditor/main/app/view/ChartSettings","presentationeditor/main/app/view/TableSettings","presentationeditor/main/app/view/ShapeSettings","presentationeditor/main/app/view/SlideSettings","presentationeditor/main/app/view/TextArtSettings","common/main/lib/component/Scroller"],function(e,t,n,r){"use strict";PE.Views.RightMenu=r.View.extend(n.extend({el:"#right-menu",template:n.template(e),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.btnSlide=new Common.UI.Button({hint:this.txtSlideSettings,asctype:Common.Utils.documentSettingsType.Slide,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.Slide]={panel:"id-slide-settings",btn:this.btnSlide},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(){var e=t(this.el);this.trigger("render:before",this);var r=Common.localStorage.getItem("pe-hide-right-settings");return r=r===null||parseInt(r)==0,e.css("width",(r?MENU_SCALE_PART:SCALE_MIN)+"px"),e.show(),e.html(this.template({})),this.btnText.el=t("#id-right-menu-text"),this.btnText.render(),this.btnTable.el=t("#id-right-menu-table"),this.btnTable.render(),this.btnImage.el=t("#id-right-menu-image"),this.btnImage.render(),this.btnSlide.el=t("#id-right-menu-slide"),this.btnSlide.render(),this.btnChart.el=t("#id-right-menu-chart"),this.btnChart.render(),this.btnShape.el=t("#id-right-menu-shape"),this.btnShape.render(),this.btnTextArt.el=t("#id-right-menu-textart"),this.btnTextArt.render(),this.btnText.on("click",n.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",n.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",n.bind(this.onBtnMenuClick,this)),this.btnSlide.on("click",n.bind(this.onBtnMenuClick,this)),this.btnChart.on("click",n.bind(this.onBtnMenuClick,this)),this.btnShape.on("click",n.bind(this.onBtnMenuClick,this)),this.btnTextArt.on("click",n.bind(this.onBtnMenuClick,this)),this.paragraphSettings=new PE.Views.ParagraphSettings,this.slideSettings=new PE.Views.SlideSettings,this.imageSettings=new PE.Views.ImageSettings,this.chartSettings=new PE.Views.ChartSettings,this.tableSettings=new PE.Views.TableSettings,this.shapeSettings=new PE.Views.ShapeSettings,this.textartSettings=new PE.Views.TextArtSettings,n.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:t(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),r&&(t("#id-slide-settings").parent().css("display","inline-block"),t("#id-slide-settings").addClass("active")),this.trigger("render:after",this),this},setApi:function(e){this.api=e;var t=function(){this.fireEvent("editcomplete",this)};this.paragraphSettings.setApi(e).on("editcomplete",n.bind(t,this)),this.slideSettings.setApi(e).on("editcomplete",n.bind(t,this)),this.imageSettings.setApi(e).on("editcomplete",n.bind(t,this)),this.chartSettings.setApi(e).on("editcomplete",n.bind(t,this)),this.tableSettings.setApi(e).on("editcomplete",n.bind(t,this)),this.shapeSettings.setApi(e).on("editcomplete",n.bind(t,this)),this.textartSettings.setApi(e).on("editcomplete",n.bind(t,this))},setMode:function(e){},onBtnMenuClick:function(e,n){var r=t("#"+this._settings[e.options.asctype].panel),i=r.parent();e.pressed?(this.minimizedMode&&(t(this.el).width(MENU_SCALE_PART),i.css("display","inline-block"),this.minimizedMode=!1,Common.localStorage.setItem("pe-hide-right-settings",0)),i.find("> .active").removeClass("active"),r.addClass("active"),this.scroller&&this.scroller.scrollTop(0),this._settings[Common.Utils.documentSettingsType.Slide].isCurrent=e.options.asctype==Common.Utils.documentSettingsType.Slide):(i.css("display","none"),t(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.localStorage.setItem("pe-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,e.options.asctype,this.minimizedMode])},SetActivePane:function(e,n){if(this.minimizedMode&&n!==!0||this._settings[e]===undefined)return;if(this.minimizedMode)this._settings[e].btn.toggle(!0,!1),this._settings[e].btn.trigger("click",this._settings[e].btn);else{var r=t("#"+this._settings[e].panel);r.hasClass("active")||(r.parent().find("> .active").removeClass("active"),r.addClass("active"),this.scroller&&this.scroller.update()),this._settings[e].btn.isActive()||this._settings[e].btn.toggle(!0,!1)}},GetActivePane:function(){return this.minimizedMode?null:this.$el.find(".settings-panel.active")[0].id},SetDisabled:function(e,n,r){if(r)this.slideSettings.SetSlideDisabled(n,n,n),this.paragraphSettings.disableControls(n),this.shapeSettings.disableControls(n),this.tableSettings.disableControls(n),this.imageSettings.disableControls(n),this.chartSettings.disableControls(n);else{var i=t("#"+e);n!==i.hasClass("disabled")&&(i.toggleClass("disabled",n),n?i.attr({disabled:n}):i.removeAttr("disabled"))}},clearSelection:function(){var e=t(".right-panel");e.find("> .active").removeClass("active"),this._settings.forEach(function(e){e.btn.isActive()&&e.btn.toggle(!1,!0)}),e.css("display","none"),t(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.NotificationCenter.trigger("layout:changed","rightmenu")},txtParagraphSettings:"Text Settings",txtImageSettings:"Image Settings",txtTableSettings:"Table Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtSlideSettings:"Slide Settings",txtChartSettings:"Chart Settings"},PE.Views.RightMenu||{}))}),define("presentationeditor/main/app/controller/RightMenu",["core","presentationeditor/main/app/view/RightMenu"],function(){"use strict";PE.Controllers.RightMenu=Backbone.Controller.extend({models:[],collections:[],views:["RightMenu"],initialize:function(){this.editMode=!0,this._state={no_slides:undefined},this.addListeners({RightMenu:{rightmenuclick:this.onRightMenuClick}})},onLaunch:function(){this.rightmenu=this.createView("RightMenu"),this.rightmenu.on("render:after",_.bind(this.onRightMenuAfterRender,this))},onRightMenuAfterRender:function(e){e.shapeSettings.application=e.textartSettings.application=this.getApplication(),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panelId:"id-paragraph-settings",panel:e.paragraphSettings,btn:e.btnText,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Table]={panelId:"id-table-settings",panel:e.tableSettings,btn:e.btnTable,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Image]={panelId:"id-image-settings",panel:e.imageSettings,btn:e.btnImage,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Slide]={panelId:"id-slide-settings",panel:e.slideSettings,btn:e.btnSlide,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Shape]={panelId:"id-shape-settings",panel:e.shapeSettings,btn:e.btnShape,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.TextArt]={panelId:"id-textart-settings",panel:e.textartSettings,btn:e.btnTextArt,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Chart]={panelId:"id-chart-settings",panel:e.chartSettings,btn:e.btnChart,hidden:1,locked:!1}},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setMode:function(e){this.editMode=e.isEdit},onRightMenuClick:function(e,t,n){if(!n&&this.editMode){var r=this._settings[t].panel,i=this._settings[t].props;i&&r&&r.ChangeSettings.call(r,i)}Common.NotificationCenter.trigger("layout:changed","rightmenu"),this.rightmenu.fireEvent("editcomplete",this.rightmenu)},onFocusObject:function(e,t){if(!this.editMode)return;var n=!0;for(var r=0;r<this._settings.length;r++)this._settings[r]&&(this._settings[r].hidden=1,this._settings[r].locked=undefined);this._settings[Common.Utils.documentSettingsType.Slide].hidden=e.length>0?0:1;for(r=0;r<e.length;r++){var i=e[r].get_ObjectType(),s=this.getDocumentSettingsType(i);if(s===undefined||s>=this._settings.length||this._settings[s]===undefined)continue;var o=e[r].get_ObjectValue();this._settings[s].props=o,this._settings[s].hidden=0,s==Common.Utils.documentSettingsType.Slide?(this._settings[s].locked=o.get_LockDelete(),this._settings[s].lockedBackground=o.get_LockBackground(),this._settings[s].lockedEffects=o.get_LockTranzition(),this._settings[s].lockedTiming=o.get_LockTiming()):(this._settings[s].locked=o.get_Locked(),s==Common.Utils.documentSettingsType.Shape&&o.asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=o,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=o.get_Locked()))}if(this._settings[Common.Utils.documentSettingsType.Slide].locked)for(r=0;r<this._settings.length;r++)this._settings[r]&&(this._settings[r].locked=!0);var u=-1,a,f=-1,l=this.rightmenu.GetActivePane();for(r=0;r<this._settings.length;r++){var c=this._settings[r];if(c===undefined)continue;c.hidden?(c.btn.isDisabled()||c.btn.setDisabled(!0),l==c.panelId&&(a=-1)):(c.btn.isDisabled()&&c.btn.setDisabled(!1),r!=Common.Utils.documentSettingsType.Slide&&(u=r),c.needShow?(c.needShow=!1,f=r):(r!=Common.Utils.documentSettingsType.Slide||this.rightmenu._settings[r].isCurrent)&&l==c.panelId&&(a=r),r==Common.Utils.documentSettingsType.Slide?c.locked!==undefined&&this.rightmenu.slideSettings.SetSlideDisabled(this._state.no_slides||c.lockedBackground||c.locked,this._state.no_slides||c.lockedEffects||c.locked,this._state.no_slides||c.lockedTiming||c.locked):c.panel.setLocked(c.locked))}if(!this.rightmenu.minimizedMode||t){var h;f>-1?h=f:a>=0?h=a:u>=0?h=u:h=Common.Utils.documentSettingsType.Slide,h!==undefined&&(this.rightmenu.SetActivePane(h,t),this._settings[h].panel.ChangeSettings.call(this._settings[h].panel,this._settings[h].props))}this._settings[Common.Utils.documentSettingsType.Image].needShow=!1,this._settings[Common.Utils.documentSettingsType.Chart].needShow=!1,this._settings[Common.Utils.documentSettingsType.Shape].needShow=!1},onCoAuthoringDisconnect:function(){this.rightmenu&&this.rightmenu.SetDisabled("",!0,!0),this.setMode({isEdit:!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.slideSettings.UpdateThemeColors(),this.rightmenu.tableSettings.UpdateThemeColors(),this.rightmenu.shapeSettings.UpdateThemeColors(),this.rightmenu.textartSettings.UpdateThemeColors()},updateMetricUnit:function(){this.rightmenu.paragraphSettings.updateMetricUnit(),this.rightmenu.chartSettings.updateMetricUnit(),this.rightmenu.imageSettings.updateMetricUnit()},fillTextArt:function(){this.rightmenu.textartSettings.fillTextArt()},createDelayedElements:function(){if(this.editMode&&this.api){this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this)),this.rightmenu.shapeSettings.createDelayedElements();var e=this.api.getSelectedElements();if(e.length>0){var t=Common.localStorage.getItem("pe-hide-right-settings");t=t===null||parseInt(t)==0,this.onFocusObject(e,t)}}},onDoubleClickOnObject:function(e){if(!this.editMode)return;var t=e.get_ObjectType(),n=this.getDocumentSettingsType(t);if(n===undefined||n>=this._settings.length||this._settings[n]===undefined)return;n!==Common.Utils.documentSettingsType.Paragraph&&(this.rightmenu.SetActivePane(n,!0),this._settings[n].panel.ChangeSettings.call(this._settings[n].panel,this._settings[n].props))},onApiCountPages:function(e){this._state.no_slides!==e<=0&&this.editMode&&(this._state.no_slides=e<=0,this._state.no_slides&&!this.rightmenu.minimizedMode&&this.rightmenu.clearSelection(),this._settings[Common.Utils.documentSettingsType.Slide].btn.setDisabled(this._state.no_slides))},getDocumentSettingsType:function(e){switch(e){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.Shape:return Common.Utils.documentSettingsType.Shape;case Asc.c_oAscTypeSelectElement.Slide:return Common.Utils.documentSettingsType.Slide;case Asc.c_oAscTypeSelectElement.Chart:return Common.Utils.documentSettingsType.Chart}}})}),function(e){function l(e,t){var n=e.length;while(n--)if(e[n]===t)return n;return-1}function c(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function p(e){for(t in r)r[t]=e[h[t]]}function d(e){var t,i,o,u,c,h;t=e.keyCode,l(a,t)==-1&&a.push(t);if(t==93||t==224)t=91;if(t in r){r[t]=!0;for(o in s)s[o]==t&&(g[o]=!0);return}p(e);if(!g.filter.call(this,e))return;if(!(t in n))return;h=x();for(u=0;u<n[t].length;u++){i=n[t][u];if(i.scope==h||i.scope=="all"){c=i.mods.length>0;for(o in r)if(!r[o]&&l(i.mods,+o)>-1||r[o]&&l(i.mods,+o)==-1)c=!1;if(i.mods.length==0&&!r[16]&&!r[18]&&!r[17]&&!r[91]||c)if(f===!0||i.locked||i.method(e,i)===!1)e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)}}}function v(e){var t=e.keyCode,n,i=l(a,t);i>=0&&a.splice(i,1);if(t==93||t==224)t=91;if(t in r){r[t]=!1;for(n in s)s[n]==t&&(g[n]=!1)}}function m(){for(t in r)r[t]=!1;for(t in s)g[t]=!1}function g(e,t,r){var i,s;i=N(e),r===undefined&&(r=t,t="all");for(var o=0;o<i.length;o++)s=[],e=i[o].split("+"),e.length>1&&(s=C(e),e=[e[e.length-1]]),e=e[0],e=u(e),e in n||(n[e]=[]),n[e].push({shortcut:i[o],scope:t,method:r,key:i[o],mods:s})}function y(e,t){var r,i,s=[],o,a,f;r=N(e);for(a=0;a<r.length;a++){i=r[a].split("+"),i.length>1&&(s=C(i),e=i[i.length-1]),e=u(e),t===undefined&&(t=x());if(!n[e])return;for(o in n[e])f=n[e][o],f.scope===t&&c(f.mods,s)&&(n[e][o]={})}}function b(e){return typeof e=="string"&&(e=u(e)),l(a,e)!=-1}function w(){return a.slice(0)}function E(e){var t=(e.target||e.srcElement).tagName;return t!="INPUT"&&t!="SELECT"&&t!="TEXTAREA"}function S(e){i=e||"all"}function x(){return i||"all"}function T(e){var t,r,i;for(t in n){r=n[t];for(i=0;i<r.length;)r[i].scope===e?r.splice(i,1):i++}}function N(e){var t;return e=e.replace(/\s/g,""),t=e.split(","),t[t.length-1]==""&&(t[t.length-2]+=","),t}function C(e){var t=e.slice(0,e.length-1);for(var n=0;n<t.length;n++)t[n]=s[t[n]];return t}function k(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){n(window.event)})}function A(){var t=e.key;return e.key=L,t}function O(e,t,r,i){var s,o=[],a,f,l=N(e);for(var h=l.length;h--;){s=l[h].split("+"),s.length>1&&(o=C(s),e=s[s.length-1]),e=u(e),t===undefined&&(t=x());if(n[e])for(a in n[e])f=n[e][a],f.scope===t&&c(f.mods,o)&&(n[e][a][r]=i)}}function M(e,t){e?O(e,t,"locked",!0):f=!0}function _(e,t){e?O(e,t,"locked",!1):f=!1}var t,n={},r={16:!1,18:!1,17:!1,91:!1},i="all",s={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},o={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},u=function(e){return o[e]||e.toUpperCase().charCodeAt(0)},a=[],f;for(t=1;t<20;t++)o["f"+t]=111+t;var h={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(t in s)g[t]=!1;k(document,"keydown",function(e){d(e)}),k(document,"keyup",v),k(window,"focus",m);var L=e.key;e.key=g,e.key.setScope=S,e.key.getScope=x,e.key.deleteScope=T,e.key.filter=E,e.key.isPressed=b,e.key.getPressedKeyCodes=w,e.key.noConflict=A,e.key.unbind=y,e.key.suspend=M,e.key.resume=_,typeof module!="undefined"&&(module.exports=key)}(this),define("keymaster",function(){});if(Common===undefined)var Common={};Common.util=Common.util||{},define("common/main/lib/util/Shortcuts",["backbone","keymaster"],function(e){"use strict";var t=function(e){return this.cid=_.uniqueId("shortcuts"),this.initialize.apply(this,arguments),this};_.extend(t.prototype,e.Events,{initialize:function(){window.key.filter=function(e){return!0},Common.NotificationCenter.on({"modal:show":function(e){window.key.suspend()},"modal:close":function(e){window.key.resume()},"modal:hide":function(e){window.key.resume()}})},delegateShortcuts:function(e){if(!e||!e.shortcuts)return;this.removeShortcuts(e);var t,n,r,i,s,o,u=[];for(s in e.shortcuts){t=e.shortcuts[s];if(!_.isFunction(t)){r=e[t];if(!r)throw new Error("Method "+t+" does not exist")}else r=t;n=s.match(/^(\S+)\s*(.*)$/),o=n[1],i=n[2].length?n[2]:"all",r=_.bind(r,this),u.push(window.key(o,i,r))}},removeShortcuts:function(e){if(!e||!e.shortcuts)return;var t,n,r,i,s=[];for(r in e.shortcuts)t=r.match(/^(\S+)\s*(.*)$/),i=t[1],n=t[2].length?t[2]:"all",window.key.unbind(i,n)},suspendEvents:function(e,t){window.key.suspend(e,t)},resumeEvents:function(e,t){window.key.resume(e,t)}}),t.extend=e.View.extend,Common.util.Shortcuts=new t}),define("text!presentationeditor/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 <button id="left-btn-thumbs" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-thumbs"> </span></button>\r\n <!-- /** coauthoring begin **/ -->\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 <!-- /** coauthoring end **/ -->\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 <!-- /** coauthoring begin **/ -->\r\n <div id="left-panel-comments" class="" style="display: none;" />\r\n <div id="left-panel-chat" class="" style="display: none;" />\r\n <!-- /** coauthoring end **/ -->\r\n <div id="left-panel-plugins" class="" style="display: none; height: 100%;" />\r\n </div>\r\n</div>'}),define("common/main/lib/view/About",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.Views.About=Common.UI.BaseView.extend(_.extend({menu:undefined,options:{alias:"Common.Views.About"},initialize:function(e){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">'+e.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">'+e.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=e.menu},render:function(){var e=$(this.el);return e.html(this.template({scope:this})),e.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(e){if(e&&typeof e=="object"&&typeof e.customer=="object"){var t=e.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 n=t.name;n&&n.length?this.lblCompanyName.text(n):this.lblCompanyName.parents("tr").addClass("hidden"),n=t.address,n&&n.length?this.lblCompanyAddress.text(n):this.lblCompanyAddress.parents("tr").addClass("hidden"),(n=t.mail)&&n.length?this.lblCompanyMail.attr("href","mailto:"+n).text(n):this.lblCompanyMail.parents("tr").addClass("hidden");if((n=t.www)&&n.length){var r=/^https?:\/{2}/i.test(n)?"":"http://";this.lblCompanyUrl.attr("href",r+n).text(n)}else this.lblCompanyUrl.parents("tr").addClass("hidden");(n=t.info)&&n.length?this.lblCompanyLic.text(n):this.lblCompanyLic.parents("tr").addClass("hidden"),(n=t.logo)&&n.length?this.divCompanyLogo.html('<img src="'+n+'" 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(e){e.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 <!-- comment block -->\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 <!-- replys elements -->\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 <!-- add reply button -->\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 <!-- edit buttons -->\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 <!-- reply -->\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 <!-- comment block -->\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 <!-- replys elements -->\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 <!-- add reply button -->\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 <!-- edit buttons -->\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 <!-- reply -->\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 <!-- locked user -->\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>'});if(Common===undefined)var Common={};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(e,t,n){"use strict";function r(e,t){var n,r,i=e;for(n in t)undefined!==n&&(r=t[n],i=i.replace(new RegExp(n,"g"),r));return i}Common.Views.CommentsPopover=Common.UI.Window.extend({initialize:function(e){var t={};_.extend(t,{closable:!1,width:265,height:120,header:!1,modal:!1},e),this.template=e.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=e.store,this.delegate=e.delegate,t.tpl=_.template(this.template,t),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,t)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,t=this.delegate,i=this.$window;i.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var s=i.find(".body");s&&s.css("position","relative"),i.on("click",_.bind(function(){i.css({zIndex:"991"}),Common.NotificationCenter.trigger("comments:click")},this)),Common.NotificationCenter.on("review:click",function(){i.css({zIndex:"990"})});var o=Common.UI.DataView.extend(function(){var t=e;return{options:{handleSelect:!1,scrollable:!0,template:_.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></div>')},getTextBox:function(){var e=$(this.el).find("textarea");return e&&e.length?e:undefined},setFocusToTextBox:function(e){var t=$(this.el).find("textarea");if(e)t.blur();else if(t&&t.length){var n=t.val();t.focus(),t.val(""),t.val(n)}},getActiveTextBoxVal:function(){var e=$(this.el).find("textarea");return e&&e.length?e.val().trim():""},autoHeightTextBox:function(){function l(){u=$(n.scroller.el).scrollTop(),i.scrollHeight>i.clientHeight?(r.css({height:i.scrollHeight+o+"px"}),t.calculateSizeOfContent()):(a=i.clientHeight,a>=s&&(r.css({height:s+"px"}),i.scrollHeight>i.clientHeight&&(f=Math.max(i.scrollHeight+o,s),r.css({height:f+"px"})),t.calculateSizeOfContent(),t.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),t.calculateSizeOfContent())),n.scroller.scrollTop(u),n.autoScrollToEditButtons()}var n=this,r=this.$el.find("textarea"),i=null,s=50,o=0,u=0,a=0,f=0;r&&r.length&&(i=r.get(0),i&&(o=parseInt(r.css("lineHeight"),10)*.25,l(),r.bind("input propertychange",l))),this.textBox=r},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=undefined)},autoScrollToEditButtons:function(){var e=$("#id-comments-change-popover"),t=null,n=this.el.getBoundingClientRect(),r=0,i=7;e.length&&(t=e.get(0).getBoundingClientRect(),t&&n&&(r=n.bottom-(t.bottom+i),r<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-r)))}}}());if(o)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new o({el:$("#id-comments-popover"),store:e.store,itemTemplate:_.template(r(n,{textAddReply:t.textAddReply,textAdd:t.textAdd,textCancel:t.textCancel,textEdit:t.textEdit,textReply:t.textReply,textClose:t.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var u=function(e,n,r){n.tipsArray&&n.tipsArray.forEach(function(e){e.remove()});var i=[],s=$(n.el).find(".btn-resolve");s.tooltip({title:t.textResolve,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),s=$(n.el).find(".btn-resolve-check"),s.tooltip({title:t.textOpenAgain,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),n.tipsArray=i},a=function(){e._isMouseOver=!0},f=function(){e._isMouseOver=!1};this.commentsView.on("item:add",u),this.commentsView.on("item:remove",u),this.commentsView.on("item:change",u),this.commentsView.cmpEl.on("mouseover",a).on("mouseout",f),this.commentsView.on("item:click",function(n,r,i,s){function h(){e.update()}var o,u,a,f,l,c;o=$(s.target);if(o){u=i.get("editTextInPopover"),a=i.get("showReplyInPopover"),c=i.get("hideAddReply"),f=i.get("uid"),l=o.attr("data-value");if(i.get("hint")){t.fireEvent("comment:disableHint",[i]);return}if(o.hasClass("btn-edit"))_.isUndefined(l)?u||(t.fireEvent("comment:closeEditing"),i.set("editTextInPopover",!0),t.fireEvent("comment:show",[f]),this.autoHeightTextBox(),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox()):(t.fireEvent("comment:closeEditing",[f]),t.fireEvent("comment:editReply",[f,l,!0]),this.replyId=l,this.autoHeightTextBox(),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(o.hasClass("btn-delete"))_.isUndefined(l)?t.fireEvent("comment:remove",[f]):(t.fireEvent("comment:removeReply",[f,l]),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent()),t.fireEvent("comment:closeEditing"),h();else if(o.hasClass("user-reply"))t.fireEvent("comment:closeEditing"),i.set("showReplyInPopover",!0),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h(),this.autoHeightTextBox(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox();else if(o.hasClass("btn-reply",!1))a&&(this.clearTextBoxBind(),t.fireEvent("comment:addReply",[f,this.getActiveTextBoxVal()]),t.fireEvent("comment:closeEditing"),h());else if(o.hasClass("btn-close",!1))t.fireEvent("comment:closeEditing",[f]),e.calculateSizeOfContent(),t.fireEvent("comment:show",[f]),h();else if(o.hasClass("btn-inner-edit",!1)){if(i.get("dummy")){t.fireEvent("comment:addDummyComment",[this.getActiveTextBoxVal()]);return}this.clearTextBoxBind(),_.isUndefined(this.replyId)?u&&(t.fireEvent("comment:change",[f,this.getActiveTextBoxVal()]),t.fireEvent("comment:closeEditing"),e.calculateSizeOfContent()):(t.fireEvent("comment:changeReply",[f,this.replyId,this.getActiveTextBoxVal()]),this.replyId=undefined,t.fireEvent("comment:closeEditing")),h()}else if(o.hasClass("btn-inner-close",!1)){if(i.get("dummy")){e.hide();return}c&&this.getActiveTextBoxVal().length>0?(e.saveText(),i.set("hideAddReply",!1),this.getTextBox().val(e.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),t.fireEvent("comment:closeEditing",[f])),this.replyId=undefined,e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h()}else if(o.hasClass("btn-resolve",!1)){var p=o.data("bs.tooltip");p&&(p.dontShow=!0),t.fireEvent("comment:resolve",[f]),h()}else if(o.hasClass("btn-resolve-check",!1)){var p=o.data("bs.tooltip");p&&(p.dontShow=!0),t.fireEvent("comment:resolve",[f]),h()}}}),e.on({show:function(){e.commentsView.autoHeightTextBox(),e.$window.find("textarea").keydown(function(t){t.keyCode==Common.UI.Keys.ESC&&e.hide()})},"animate:before":function(){var t=e.$window.find("textarea");t&&t.length&&t.focus()}})}},show:function(e,t,n,r){this.options.animate=e;var i=this,s=this.commentsView.getTextBox();t&&this.textVal&&s&&s.val(this.textVal),r&&r.length&&s&&s.val(r),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=undefined)},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(e,t,n,r,i){this.$window||this.render(),r&&(e=this.arrowPosX,t=this.arrowPosY,n=this.leftX);if(_.isUndefined(e)&&_.isUndefined(t))return;this.arrowPosX=e,this.arrowPosY=t,this.leftX=n;var s=$("#id-comments-popover"),o=$("#id-comments-arrow"),u=$("#editor_sdk"),a=null,f=0,l=0,c=0,h="",p=0,d="",v=0,m="",g=0,y="",b=0,w=0,E=0,S=0,x=0,T=0;s&&o&&u&&u.get(0)&&(a=u.get(0).getBoundingClientRect(),a&&(f=a.height-this.sdkBounds.padding*2,this.$window.css({maxHeight:f+"px"}),this.sdkBounds.width=a.width,this.sdkBounds.height=a.height,_.isUndefined(e)||(h=$("#id_vertical_scroll"),h.length?p=h.css("display")!=="none"?h.width():0:(h=$("#ws-v-scrollbar"),h.length&&(p=h.css("display")!=="none"?h.width():0)),this.sdkBounds.width-=p,d=$("#id_panel_left"),d.length&&(v=d.css("display")!=="none"?d.width():0),m=$("#id_panel_thumbnails"),m.length&&(g=m.css("display")!=="none"?m.width():0,this.sdkBounds.width-=g),w=Math.min(c+e+this.arrow.width,c+this.sdkBounds.width-this.$window.outerWidth()-25),w=Math.max(c+v+this.arrow.width,w),o.removeClass("right").addClass("left"),_.isUndefined(n)||(E=this.$window.outerWidth(),E&&(e+E>this.sdkBounds.width-this.arrow.width+5&&this.leftX>E?(w=this.leftX-E+c-this.arrow.width,o.removeClass("left").addClass("right")):w=c+e+this.arrow.width)),this.$window.css("left",w+"px")),_.isUndefined(t)||(y=$("#id_panel_top"),T=l,y.length?(b=y.css("display")!=="none"?y.height():0,T+=this.sdkBounds.paddingTop):(y=$("#ws-h-scrollbar"),y.length&&(b=y.css("display")!=="none"?y.height():0)),this.sdkBounds.height-=b,S=this.$window.outerHeight(),x=Math.min(l+f-S,this.arrowPosY+l-this.arrow.height),x=Math.max(x,T),this.$window.css("top",x+"px")))),i||this.calculateSizeOfContent()},calculateSizeOfContent:function(e){if(e&&!this.$window.is(":visible"))return;this.$window.css({overflow:"hidden"});var t=$("#id-comments-arrow"),n=$("#id-comments-popover"),r=null,i=null,s=null,o=0,u=0,a=0,f="",l=0,c=0,h=0,p=0,d=0,v=0;n&&t&&n.get(0)&&(n.css({height:"100%"}),r=n.get(0).getBoundingClientRect(),r&&(i=$("#editor_sdk"),i&&i.get(0)&&(s=i.get(0).getBoundingClientRect(),s&&(o=s.height-this.sdkBounds.padding*2,v=u,h=this.$window.outerHeight(),f=$("#id_panel_top"),f.length?(l=f.css("display")!=="none"?f.height():0,v+=this.sdkBounds.paddingTop):(f=$("#ws-h-scrollbar"),f.length&&(l=f.css("display")!=="none"?f.height():0)),p=Math.max(n.outerHeight(),this.$window.outerHeight()),o<=p?(this.$window.css({maxHeight:o-l+"px",top:u+l+"px"}),n.css({height:o-l-3+"px"}),c=Math.min(c,o-(l+this.arrow.margin+this.arrow.width)),t.css({top:c+"px"})):(p=h,p>0&&(r.top+p>o+u||r.height===0)&&(d=Math.min(u+o-p,this.arrowPosY+u-this.arrow.height),d=Math.max(d,v),this.$window.css({top:d+"px"})),c=Math.max(this.arrow.margin,this.arrowPosY-(o-p)-this.arrow.width),c=Math.min(c,p-this.arrow.margin-this.arrow.width),t.css({top:c+"px"})))))),this.$window.css({overflow:""})},saveText:function(e){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=undefined,e?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){this.textVal&&this.commentsView&&this.commentsView.getTextBox().val(this.textVal)},getEditText:function(){return this.commentsView?this.commentsView.getActiveTextBoxVal():undefined},hookTextBox:function(){var e=this,t=this.commentsView.getTextBox();t&&t.keydown(function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey&&t.keyCode===Common.UI.Keys.RETURN){var n=$("#id-comments-change-popover");n&&n.length&&n.click(),t.stopImmediatePropagation()}else if(t.keyCode===Common.UI.Keys.TAB){var r,i,s;s=this.selectionStart,i=this.selectionEnd,r=$(this),r.val(r.val().substring(0,s)+" "+r.val().substring(i)),this.selectionStart=this.selectionEnd=s+1,t.stopImmediatePropagation(),t.preventDefault()}e.e=t})},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(e){e.tipsArray&&e.tipsArray.forEach(function(e){e.hide()})},this)},isCommentsViewMouseOver:function(){return this._isMouseOver}}),Common.Views.Comments=Common.UI.BaseView.extend(_.extend({el:"#left-panel-comments",template:_.template(t),addCommentHeight:45,newCommentHeight:110,textBoxAutoSizeLocked:undefined,initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.store=this.options.store,this.popoverComments=this.options.popoverComments},render:function(){var t=this;this.$el.html(this.template({textAddCommentToDoc:t.textAddCommentToDoc,textAddComment:t.textAddComment,textCancel:t.textCancel,textEnterCommentHint:t.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(e){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.keyCode==Common.UI.Keys.RETURN)t.onClickAddDocumentComment(),e.stopImmediatePropagation();else if(e.keyCode===Common.UI.Keys.TAB){var n,r,i;i=this.selectionStart,r=this.selectionEnd,n=$(this),n.val(n.val().substring(0,i)+" "+n.val().substring(r)),this.selectionStart=this.selectionEnd=i+1,e.stopImmediatePropagation(),e.preventDefault()}});var n=Common.UI.DataView.extend(function(){var e=t;return{options:{handleSelect:!1,scrollable:!0,listenStoreEvents:!1,template:_.template('<div class="dataview-ct inner"></div>')},getTextBox:function(){var e=$(this.el).find("textarea");return e&&e.length?e:undefined},setFocusToTextBox:function(){var e=$(this.el).find("textarea");if(e&&e.length){var t=e.val();e.focus(),e.val(""),e.val(t)}},getActiveTextBoxVal:function(){var e=$(this.el).find("textarea");return e&&e.length?e.val().trim():""},autoHeightTextBox:function(){function a(){n.scrollHeight>n.clientHeight?t.css({height:n.scrollHeight+i+"px"}):(o=n.clientHeight,o>=r&&(t.css({height:r+"px"}),n.scrollHeight>n.clientHeight&&(u=Math.max(n.scrollHeight+i,r),t.css({height:u+"px"})))),e.autoScrollToEditButtons()}var e=this,t=$(this.el).find("textarea"),n=null,r=50,i=0,s=0,o=0,u=0;t&&t.length&&(n=t.get(0),n&&(i=parseInt(t.css("lineHeight"),10)*.25,a(),t.bind("input propertychange",a))),this.textBox=t},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=undefined)},autoScrollToEditButtons:function(){var e=$("#id-comments-change"),t=null,n=this.el.getBoundingClientRect(),r=0,i=7;e.length&&(t=e.get(0).getBoundingClientRect(),t&&n&&(r=n.bottom-(t.bottom+i),r<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-r)))}}}());if(n)if(this.commentsView)this.commentsView.render($(".messages-ct",t.el)),this.commentsView.onResetItems();else{this.commentsView=new n({el:$(".messages-ct",t.el),store:t.store,itemTemplate:_.template(r(e,{textAddReply:t.textAddReply,textAdd:t.textAdd,textCancel:t.textCancel,textEdit:t.textEdit,textReply:t.textReply,textClose:t.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var i=function(e,n,r){n.tipsArray&&n.tipsArray.forEach(function(e){e.remove()});var i=[],s=$(n.el).find(".btn-resolve");s.tooltip({title:t.textResolve,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),s=$(n.el).find(".btn-resolve-check"),s.tooltip({title:t.textOpenAgain,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),n.tipsArray=i};this.commentsView.on("item:add",i),this.commentsView.on("item:remove",i),this.commentsView.on("item:change",i),this.commentsView.on("item:click",function(e,n,r,i){function c(){t.update()}var s,o,u,a,f,l;s=$(i.target);if(s){o=r.get("editText"),u=r.get("showReply"),a=r.get("uid"),f=s.attr("data-value");if(s.hasClass("btn-edit"))_.isUndefined(f)?o||(t.fireEvent("comment:closeEditing"),r.set("editText",!0),this.autoHeightTextBox(),c(),this.setFocusToTextBox(),t.hookTextBox()):(t.fireEvent("comment:closeEditing",[a]),t.fireEvent("comment:editReply",[a,f]),t.commentsView.reply=f,this.autoHeightTextBox(),c(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(s.hasClass("btn-delete"))_.isUndefined(f)?t.fireEvent("comment:remove",[a]):t.fireEvent("comment:removeReply",[a,f]),t.fireEvent("comment:closeEditing"),c();else if(s.hasClass("user-reply"))t.fireEvent("comment:closeEditing"),r.set("showReply",!0),c(),this.autoHeightTextBox(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox();else if(s.hasClass("btn-reply",!1))u&&(t.fireEvent("comment:addReply",[a,this.getActiveTextBoxVal()]),t.fireEvent("comment:closeEditing"),c());else if(s.hasClass("btn-close",!1))t.fireEvent("comment:closeEditing",[a]);else if(s.hasClass("btn-inner-edit",!1))_.isUndefined(t.commentsView.reply)?o&&t.fireEvent("comment:change",[a,this.getActiveTextBoxVal()]):(t.fireEvent("comment:changeReply",[a,t.commentsView.reply,this.getActiveTextBoxVal()]),t.commentsView.reply=undefined),t.fireEvent("comment:closeEditing"),c();else if(s.hasClass("btn-inner-close",!1))t.fireEvent("comment:closeEditing"),t.commentsView.reply=undefined,c();else if(s.hasClass("btn-resolve",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),t.fireEvent("comment:resolve",[a]),c()}else if(s.hasClass("btn-resolve-check",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),t.fireEvent("comment:resolve",[a]),c()}else!s.hasClass("msg-reply")&&!s.hasClass("btn-resolve-check")&&!s.hasClass("btn-resolve")&&t.fireEvent("comment:show",[a,!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(e){return _.isUndefined(this.popover)&&(this.popover=new Common.Views.CommentsPopover({store:this.popoverComments,delegate:this,renderTo:e})),this.popover},showEditContainer:function(e){var t=$(".add-link-ct",this.el),n=$(".new-comment-ct",this.el),r=$(".messages-ct",this.el),i=$("#comments-box",this.el);this.layout.freezePanels(!e),e?(t.css({display:"none"}),n.css({display:"table-row"}),this.txtComment.val(""),this.txtComment.focus(),this.textBoxAutoSizeLocked=undefined):(t.css({display:"table-row"}),n.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(),undefined,!1,!0]),this.txtComment.val("")},onClickCancelDocumentComment:function(){this.showEditContainer(!1)},hookTextBox:function(){var e=this,t=this.commentsView.getTextBox();t&&t.keydown(function(e){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.keyCode==Common.UI.Keys.RETURN){var t=$("#id-comments-change");t&&t.length&&t.click(),e.stopImmediatePropagation()}else if(e.keyCode===Common.UI.Keys.TAB){var n,r,i;i=this.selectionStart,r=this.selectionEnd,n=$(this),n.val(n.val().substring(0,i)+" "+n.val().substring(r)),this.selectionStart=this.selectionEnd=i+1,e.stopImmediatePropagation(),e.preventDefault()}})},setupLayout:function(){var e=this,t=$(e.el),n=$(".new-comment-ct",e.el),r=$(".add-link-ct",e.el),i=$("#comments-box",e.el),s=i.find(" > .layout-item");e.layout=new Common.UI.VBoxLayout({box:i,freeze:!0,items:[{el:s[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var t=i.height();return n.css("display")!=="none"&&t*.5<e.newCommentHeight?t-e.newCommentHeight:t*.5},fmax:function(){return n.css("display")!=="none"?i.height()-e.newCommentHeight:i.height()-e.addCommentHeight}}},{el:s[1],stretch:!0},{el:s[2],stretch:!0}]}),e.layout.on("layout:resizedrag",function(){e.updateScrolls(),e.textBoxAutoSizeLocked=!0},this),$(window).on("resize",function(){if(t.css("display")!=="none"){var n=$("#comments-box",e.el).height(),r=$(".new-comment-ct",e.el),i=$(".add-link-ct",e.el);r.css("display")!=="none"?e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,Math.min(n-(r.height()+4),n-e.newCommentHeight))):e.layout.setResizeValue(0,Math.max(-e.addCommentHeight,Math.min(n-i.height(),n-e.addCommentHeight))),e.updateScrolls()}}),this.autoHeightTextBox()},updateLayout:function(){var e=$("#comments-box",this.el),t=$(".new-comment-ct",this.el);t.css("display")!=="none"?this.layout.setResizeValue(0,e.height()-this.newCommentHeight):this.layout.setResizeValue(0,e.height()-this.addCommentHeight)},autoHeightTextBox:function(){function s(){var t,i,s,o,u,a=48;t=$("#comment-msg-new",e.el),o=$("#comments-box",e.el).height();if(0==t.val().length){e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,o-e.newCommentHeight)),e.textBoxAutoSizeLocked=undefined;return}if(!_.isUndefined(e.textBoxAutoSizeLocked))return;i=t.height(),s=t.get(0).scrollHeight,t.css({height:r+"px"}),i=t.height(),s=Math.max(t.get(0).scrollHeight+n,a),t.css({height:"100%"}),o=$("#comments-box",e.el).height(),e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,Math.min(o-s-a,o-e.newCommentHeight)))}var e=this,t=null,n=0,r=44,i=$("#comment-msg-new",this.el);n=parseInt(i.css("lineHeight"),10)*.25,s(),i.bind("input propertychange",s),this.textBox=i},getFixedQuote:function(e){return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(e),120,!0)},getUserName:function(e){return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(e),22,!0)},pickLink:function(e){var t=[],n,r;e=Common.Utils.String.htmlEncode(e),e.replace(Common.Utils.ipStrongRe,function(e){return n=arguments[arguments.length-2],t.push({start:n,end:e.length+n,str:'<a href="'+e+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),(e.length<1e3||e.search(/\S{255,}/)<0)&&e.replace(Common.Utils.hostnameStrongRe,function(e){var i=/(((^https?)|(^ftp)):\/\/)/i.test(e)?e:"http://"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),e.replace(Common.Utils.emailStrongRe,function(e){var i=/((^mailto:)\/\/)/i.test(e)?e:"mailto:"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'">'+e+"</a>"}),""}),t=_.sortBy(t,function(e){return e.start});var i=t.length>0?e.substring(0,t[0].start)+t[0].str:e;for(var s=1;s<t.length;s++)i+=e.substring(t[s-1].end,t[s].start)+t[s].str;return t.length>0&&(i+=e.substring(t[s-1].end,e.length)),i},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>'});if(Common===undefined)var Common={};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(e){"use strict";Common.Views.Chat=Common.UI.BaseView.extend(_.extend({el:"#left-panel-chat",template:_.template(e),storeUsers:undefined,storeMessages:undefined,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(e){_.extend(this,e),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(e){return e=e||this.el,$(e).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 e=this;_.defer(function(){e.txtMessage.focus()},100),this.updateLayout(!0),this.setupAutoSizingTextBox()},_onKeyDown:function(e){e.keyCode==Common.UI.Keys.RETURN?(e.ctrlKey||e.metaKey)&&!e.altKey&&this._onBtnAddMessage(e):e.keyCode==Common.UI.Keys.ESC&&this.hide()},_onAddUser:function(e,t,n){this.panelUsers&&(this.panelUsers.find("ul").append(_.template(this.tplUser,{user:e,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onUsersChanged:function(e){e.changed.online!=undefined&&this.panelUsers&&(this.panelUsers.find("#chat-user-"+e.get("id"))[e.changed.online?"removeClass":"addClass"]("offline"),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onResetUsers:function(e,t){this.panelUsers&&(this.panelUsers.html(this.templateUserList({users:e.models,usertpl:this.tplUser,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onAddMessage:function(e,t,n){if(this.panelMessages){var r=this.panelMessages.find("ul");r&&r.length&&(this._prepareMessage(e),r.append(_.template(this.tplMsg,{msg:e,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.panelMessages.scroller.scrollTop(r.get(0).getBoundingClientRect().height))}},_onResetMessages:function(e,t){if(this.panelMessages){var n,r;e.each(function(e){this._prepareMessage(e)},this),this.panelMessages.html(this.templateMsgList({messages:e.models,msgtpl:this.tplMsg,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},_onBtnAddMessage:function(e){this.txtMessage&&(this.fireEvent("message:add",[this,this.txtMessage.val().trim()]),this.txtMessage.val(""),this.focus())},_prepareMessage:function(e){var t=this.storeUsers.findUser(e.get("userid"));e.set({usercolor:t?t.get("color"):"#000",message:this._pickLink(Common.Utils.String.htmlEncode(e.get("message")))},{silent:!0})},_pickLink:function(e){var t=[],n,r;e.replace(Common.Utils.ipStrongRe,function(e){return n=arguments[arguments.length-2],t.push({start:n,end:e.length+n,str:'<a href="'+e+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),(e.length<1e3||e.search(/\S{255,}/)<0)&&e.replace(Common.Utils.hostnameStrongRe,function(e){var i=/(((^https?)|(^ftp)):\/\/)/i.test(e)?e:"http://"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),e.replace(Common.Utils.emailStrongRe,function(e){var i=/((^mailto:)\/\/)/i.test(e)?e:"mailto:"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'">'+e+"</a>"}),""}),t=_.sortBy(t,function(e){return e.start});var i=t.length>0?e.substring(0,t[0].start)+t[0].str:e;for(var s=1;s<t.length;s++)i+=e.substring(t[s-1].end,t[s].start)+t[s].str;return t.length>0&&(i+=e.substring(t[s-1].end,e.length)),i},getUserName:function(e){return Common.Utils.String.htmlEncode(e)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this),this.textBoxAutoSizeLocked=undefined},setupLayout:function(){var e=this,t=$(e.el),n=this.panelBox.find(" > .layout-item");e.layout=new Common.UI.VBoxLayout({box:this.panelBox,items:[{el:n[0],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return e.usersBoxHeight},fmax:function(){return e.panelBox.height()*.5-e.messageBoxHeight}}},{el:n[1],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return Math.max(e.messageBoxHeight+e.usersBoxHeight,e.panelBox.height()*.5)},fmax:function(){return e.panelBox.height()-e.addMessageBoxHeight}}},{el:n[2],stretch:!0}]}),e.layout.on("layout:resizedrag",function(t){e.updateScrolls(),e.usersCachedHeigt=e.panelUsers.height()+8+1,t.index||(e.textBoxAutoSizeLocked=!0)},this),$(window).on("resize",function(){t.css("display")!=="none"&&e.updateLayout()}),this.updateLayout();var r=this.panelBox.height();this.layout.setResizeValue(0,this.usersBoxHeight),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.max(r*.5,r-e.panelOptions.height()-4))),this.setupAutoSizingTextBox(),this.txtMessage.bind("input propertychange",_.bind(this.updateHeightTextBox,this))},updateLayout:function(e){var t=this,n=this.panelBox.height();t.layout.setResizeValue(1,Math.max(t.addMessageBoxHeight,Math.max(n*.5,n-t.panelOptions.height()-4)));if(e){var r=this.panelUsers.css("height");this.panelUsers.css("height","1px");var i=this.panelUsers.get(0).scrollHeight;t.layout.setResizeValue(0,Math.max(t.usersBoxHeight,Math.min(i+2,Math.floor(n*.5)-t.messageBoxHeight)))}else t.layout.setResizeValue(0,Math.max(t.usersBoxHeight,Math.min(t.usersCachedHeigt+2,Math.floor(n*.5)-t.messageBoxHeight)));t.updateScrolls(),t.updateHeightTextBox(null)},setupAutoSizingTextBox:function(){this.lineHeight=0,this.minHeight=44,this.lineHeight=parseInt(this.txtMessage.css("lineHeight"),10)*1.25,this.updateHeightTextBox(!0)},updateHeightTextBox:function(e){var t=this.txtMessage,n,r,i,s=40;i=this.panelBox.height();if(e&&0==t.val().length){this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,i-this.addMessageBoxHeight)),this.textBoxAutoSizeLocked=undefined;return}if(!_.isUndefined(this.textBoxAutoSizeLocked))return;n=t.height(),r=t.get(0).scrollHeight,t.css({height:this.minHeight+"px"}),n=t.height(),r=Math.max(t.get(0).scrollHeight+this.lineHeight,1),t.css({height:"100%"}),i=this.panelBox.height(),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.min(i-r-s,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||{}))});if(Common===undefined)var Common={};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(e){"use strict";Common.Views.Plugins=Common.UI.BaseView.extend(_.extend({el:"#left-panel-plugins",storePlugins:undefined,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(e){_.extend(this,e),this._locked=!1,this._state={DisabledControls:!0},this.lockedControls=[],Common.UI.BaseView.prototype.initialize.call(this,arguments)},render:function(e){return e=e||this.el,$(e).html(this.template({scope:this})),this.$el=$(e),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(e){this._locked=e},ChangeSettings:function(e){this.disableControls(this._locked)},disableControls:function(e){this._state.DisabledControls!==e&&(this._state.DisabledControls=e,_.each(this.lockedControls,function(t){t.setDisabled(e)}),this.pluginsMask.css("display",e?"block":"none"))},openInsideMode:function(e,t){return this.pluginsPanel?(this.pluginsPanel.toggleClass("hidden",!0),this.currentPluginPanel.toggleClass("hidden",!1),this.pluginName.text(e),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=t),!0):!1},closeInsideMode:function(){if(!this.pluginsPanel)return;this.iframePlugin&&(this.currentPluginFrame.empty(),this.iframePlugin=null),this.currentPluginPanel.toggleClass("hidden",!0),this.pluginsPanel.toggleClass("hidden",!1)},openNotVisualMode:function(e){var t=this.viewPluginsList.store.findWhere({guid:e});t&&this.viewPluginsList.cmpEl.find("#"+t.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(e){var t={};_.extend(t,{cls:"advanced-settings-dlg",header:!0,enableKeyEvents:!1},e);var n=t.buttons&&_.size(t.buttons)>0?85:34;t.width=Common.Utils.innerWidth()-t.width<0?Common.Utils.innerWidth():t.width,t.height+=n,t.height=Common.Utils.innerHeight()-t.height<0?Common.Utils.innerHeight():t.height,this.template=['<div id="id-plugin-container" class="box" style="height:'+(t.height-n)+'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(""),t.tpl=_.template(this.template,t),this.url=e.url||"",Common.UI.Window.prototype.initialize.call(this,t)},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 e=document.createElement("iframe");e.id="plugin_iframe",e.name="pluginFrameEditor",e.width="100%",e.height="100%",e.align="top",e.frameBorder=0,e.scrolling="no",e.onload=_.bind(this._onLoad,this);var t=this;setTimeout(function(){if(t.isLoaded)return;t.loadMask=new Common.UI.LoadMask({owner:$("#id-plugin-placeholder")}),t.loadMask.setTitle(t.textLoading),t.loadMask.show(),t.isLoaded&&t.loadMask.hide()},500),e.src=this.url,$("#id-plugin-placeholder").append(e),this.on("resizing",function(e){t.boxEl.css("height",parseInt(t.$window.css("height"))-t._headerFooterHeight)})},_onLoad:function(){this.isLoaded=!0,this.loadMask&&this.loadMask.hide()},setInnerSize:function(e,t){var n=Common.Utils.innerHeight(),r=Common.Utils.innerWidth(),i=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width"));n<t+this._headerFooterHeight&&(t=n-this._headerFooterHeight),r<e+i&&(e=r-i),this.boxEl.css("height",t),Common.UI.Window.prototype.setHeight.call(this,t+this._headerFooterHeight),Common.UI.Window.prototype.setWidth.call(this,e+i),this.$window.css("left",(r-e-i)/2),this.$window.css("top",(n-t-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(e){_.extend(this.options,e||{}),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(e){this.btnOptions.menu.addItem(e)},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(),this.options.mode==="search"&&$(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(e){Common.UI.Window.prototype.show.call(this),!this.mode&&!e&&(e="search"),e&&this.mode!=e&&this.setMode(e),this.options.markresult&&this.miHighlight.checked&&this.fireEvent("search:highlight",[this,!0]),this.focus()},focus:function(){var e=this;setTimeout(function(){e.txtSearch.focus(),e.txtSearch.select()},10)},onKeyPress:function(e){this.isLocked()||(e.keyCode==Common.UI.Keys.RETURN?(e.data=="search"?this.onBtnClick("next",e):e.data=="replace"&&this.mode=="replace"&&this.onBtnClick("replace",e),e.preventDefault(),e.stopPropagation()):e.keyCode==Common.UI.Keys.ESC&&$(".asc-loadmask").length<1&&(this.hide(),e.preventDefault(),e.stopPropagation()))},onBtnClick:function(e,t){if($(".asc-loadmask").length)return;var n={textsearch:this.txtSearch.val(),textreplace:this.txtReplace.val(),matchcase:this.miMatchCase.checked,matchword:this.miMatchWord.checked,highlight:this.miHighlight.checked};this.fireEvent("search:"+e,[this,n])},setMode:function(e){this.mode=e;var t=this.$window.find(".input-row");e==="no-replace"?(this.setTitle(this.textTitle2),t.eq(1).hide(),t.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),e==="search"?(t.eq(2).show(),this.lblReplace.text(this.txtBtnReplace),t.eq(1).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.setHeight(200)):(t.eq(2).show(),this.lblReplace.text(this.txtBtnHideReplace),t.eq(1).show(),this.$window.find(".btn[result=replace]").show(),this.$window.find(".btn[result=replaceall]").show(),this.setHeight(230)))},onShowReplace:function(e){this.setMode(this.mode=="replace"?"search":"replace");var t=this;_.defer(function(){t.mode=="replace"?t.txtReplace.focus():t.txtSearch.focus()},300)},onHighlight:function(e,t){this.fireEvent("search:highlight",[this,t])},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!presentationeditor/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 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("presentationeditor/main/app/view/FileMenu",["text!presentationeditor/main/app/template/FileMenu.template","underscore","common/main/lib/component/BaseView"],function(e,t){"use strict";PE.Views.FileMenu=Common.UI.BaseView.extend(t.extend({el:"#file-menu-panel",template:t.template(e),events:function(){return{"click .fm-btn":t.bind(function(e){var n=$(e.currentTarget);if(n.hasClass("disabled"))return;n.hasClass("active")||($(".fm-btn",this.el).removeClass("active"),n.addClass("active"));var r=t.findWhere(this.items,{el:e.currentTarget});if(r){var i=this.panels[r.options.action];this.fireEvent("item:click",[this,r.options.action,!!i]),i&&(this.$el.find(".content-box:visible").hide(),this.active=r.options.action,i.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-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 e=this;return e.panels={saveas:(new PE.Views.FileMenuPanels.ViewSaveAs({menu:e})).render(),opts:(new PE.Views.FileMenuPanels.Settings({menu:e})).render(),info:(new PE.Views.FileMenuPanels.DocumentInfo({menu:e})).render(),rights:(new PE.Views.FileMenuPanels.DocumentRights({menu:e})).render(),help:(new PE.Views.FileMenuPanels.Help({menu:e})).render()},e.$el.find(".content-box").hide(),this},show:function(e){if(this.isVisible()&&e===undefined)return;e||(e=this.active||(this.mode.canDownload&&(!this.mode.isDesktopApp||!this.mode.isOffline)?"saveas":"info")),this.$el.show(),this.selectMenu(e),this.mode.isEdit&&PE.getController("Toolbar").DisableToolbar(!0),this.api.asc_enableKeyEvents(!1)},hide:function(){this.$el.hide(),this.mode.isEdit&&PE.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.isDesktopApp||!this.mode.isOffline)?"show":"hide"](),this.items[4][this.mode.canDownload&&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.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 PE.Views.FileMenuPanels.CreateNew({menu:this,docs:this.mode.templates})).render()),this.mode.canOpenRecent&&this.mode.recent&&(this.panels.recent=(new PE.Views.FileMenuPanels.RecentFiles({menu:this,recent:this.mode.recent})).render()),this.mode.targetApp=="desktop"&&this.$el.find("#fm-btn-create, #fm-btn-back, #fm-btn-create+.devider").hide(),this.panels.help.setLangConfig(this.mode.lang)},setMode:function(e,t){e.isDisconnected?(this.mode.canEdit=this.mode.isEdit=!1,this.mode.canOpenRecent=this.mode.canCreateNew=!1,this.mode.isDisconnected=e.isDisconnected,this.mode.canRename=!1,this.mode.canPrint=!1,this.mode.canDownload=!1):this.mode=e,t||this.applyMode()},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onDocumentName",t.bind(this.onDocumentName,this))},loadDocument:function(e){this.document=e.doc},selectMenu:function(e){if(e){var t=this._getMenuItem(e),n=this.panels[e];t&&n&&($(".fm-btn",this.el).removeClass("active"),t.$el.addClass("active"),this.$el.find(".content-box:visible").hide(),n.show(),this.active=e)}},disableMenu:function(e,t){if(e){var n=this._getMenuItem(e);n&&n.setDisabled(t)}},_getMenuItem:function(e){return t.find(this.items,function(t){return t.options.action==e})},onDocumentName:function(e){this.document.title=e,this.panels.info.updateInfo(this.document)},btnSaveCaption:"Save",btnDownloadCaption:"Download as...",btnInfoCaption:"Document Info...",btnRightsCaption:"Access Rights...",btnCreateNewCaption:"Create New",btnRecentFilesCaption:"Open Recent...",btnPrintCaption:"Print",btnHelpCaption:"Help...",btnReturnCaption:"Back to Document",btnToEditCaption:"Edit Document",btnBackCaption:"Go to Documents",btnSettingsCaption:"Advanced Settings...",btnSaveAsCaption:"Save as",btnRenameCaption:"Rename...",btnCloseMenuCaption:"Close Menu"},PE.Views.FileMenu||{}))}),define("presentationeditor/main/app/view/LeftMenu",["text!presentationeditor/main/app/template/LeftMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/view/About","common/main/lib/view/About","common/main/lib/view/Comments","common/main/lib/view/Chat","common/main/lib/view/Plugins","common/main/lib/view/SearchDialog","presentationeditor/main/app/view/FileMenu"],function(e,t,n,r){"use strict";var i=40,s=300;PE.Views.LeftMenu=r.View.extend(n.extend({el:"#left-menu",template:n.template(e),events:function(){return{"click #left-btn-comments":n.bind(this.onCoauthOptions,this),"click #left-btn-chat":n.bind(this.onCoauthOptions,this),"click #left-btn-plugins":n.bind(this.onCoauthOptions,this),"click #left-btn-support":function(){var e=this.mode.customization;!e||!e.feedback||!e.feedback.url?window.open("http://support.onlyoffice.com"):window.open(e.feedback.url)}}},initialize:function(){this.minimizedMode=!0},render:function(){var e=t(this.el);e.html(this.template({})),this.btnFile=new Common.UI.Button({action:"file",el:t("#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:t("#left-btn-search"),hint:this.tipSearch+Common.Utils.String.platformKey("Ctrl+F"),disabled:!0,enableToggle:!0}),this.btnThumbs=new Common.UI.Button({action:"thumbs",el:t("#left-btn-thumbs"),hint:this.tipSlides,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnAbout=new Common.UI.Button({action:"about",el:t("#left-btn-about"),hint:this.tipAbout,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSupport=new Common.UI.Button({action:"support",el:t("#left-btn-support"),hint:this.tipSupport,disabled:!0}),this.btnComments=new Common.UI.Button({el:t("#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:t("#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",n.bind(this.onBtnMenuClick,this)),this.btnChat.on("click",n.bind(this.onBtnMenuClick,this)),this.btnPlugins=new Common.UI.Button({el:t("#left-btn-plugins"),hint:this.tipPlugins,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnPlugins.hide(),this.btnPlugins.on("click",n.bind(this.onBtnMenuClick,this)),this.btnSearch.on("click",n.bind(this.onBtnMenuClick,this)),this.btnThumbs.on("click",n.bind(this.onBtnMenuClick,this)),this.btnAbout.on("toggle",n.bind(this.onBtnMenuToggle,this)),this.btnFile.on("toggle",n.bind(this.onBtnMenuToggle,this)),this.btnAbout.on("click",n.bind(this.onFullMenuClick,this)),this.btnFile.on("click",n.bind(this.onFullMenuClick,this));var r=new PE.Views.FileMenu({});return r.options={alias:"FileMenu"},this.btnFile.panel=r.render(),this.btnAbout.panel=(new Common.Views.About({el:t("#about-menu-panel"),appName:"Presentation Editor"})).render(),this},onBtnMenuToggle:function(e,t){t?(e.panel.show(),this.$el.width(i),this.btnSearch.isActive()&&this.btnSearch.toggle(!1)):e.panel.hide(),this.mode.isEdit&&PE.getController("Toolbar").DisableToolbar(t==1),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onBtnMenuClick:function(e,t){var n=this.btnFile.pressed||this.btnAbout.pressed;this.btnFile.pressed&&this.btnFile.toggle(!1),this.btnAbout.pressed&&this.btnAbout.toggle(!1);if(e.options.action=="search"){n&&this.fireEvent("panel:show",[this.btnFile,"files",!1]);return}e.options.action=="thumbs"?this.$el.width()>i&&(Common.localStorage.setItem("pe-mainmenu-width",this.$el.width()),this.$el.width(i)):e.pressed?this.$el.width()>i||this.$el.width(Common.localStorage.getItem("pe-mainmenu-width")||s):(Common.localStorage.setItem("pe-mainmenu-width",this.$el.width()),this.$el.width(i)),this.fireEvent("panel:show",[this,e.options.action,e.pressed]),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onFullMenuClick:function(e,t){!e.pressed&&this.fireEvent("panel:show",[this,e.options.action,e.pressed])},onCoauthOptions:function(e){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(e,t){e=="chat"?this.panelChat=t.render("#left-panel-chat"):e=="comment"?this.panelComments=t:e=="plugins"&&!this.panelPlugins&&(this.panelPlugins=t.render("#left-panel-plugins"))},markCoauthOptions:function(e,t){e=="chat"&&this.btnChat.isVisible()&&!this.btnChat.isDisabled()&&!this.btnChat.pressed&&this.btnChat.$el.addClass("notify"),e=="comments"&&this.btnComments.isVisible()&&!this.btnComments.pressed&&(!this.btnComments.isDisabled()||t)&&this.btnComments.$el.addClass("notify")},close:function(e){this.btnFile.toggle(!1),this.btnAbout.toggle(!1),this.btnThumbs.toggle(!1),this.$el.width(i),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)),this.fireEvent("panel:show",[this,"",!1])},isOpened:function(){var e=this.btnFile.pressed||this.btnSearch.pressed;return!e&&(e=this.btnComments.pressed||this.btnChat.pressed),e},disableMenu:function(e,t){this.btnFile.setDisabled(t),this.btnSearch.setDisabled(t),this.btnThumbs.setDisabled(t),this.btnAbout.setDisabled(t),this.btnSupport.setDisabled(t),this.btnComments.setDisabled(t),this.btnChat.setDisabled(t),this.btnPlugins.setDisabled(t)},showMenu:function(e){var t=/^(\w+):?(\w*)$/.exec(e);t[1]=="file"&&this.btnFile.isVisible()?(this.btnFile.pressed||this.btnFile.toggle(!0),this.btnFile.panel.show(t[2].length?t[2]:undefined)):e=="chat"?this.btnChat.isVisible()&&!this.btnChat.isDisabled()&&!this.btnChat.pressed&&(this.btnChat.toggle(!0),this.onBtnMenuClick(this.btnChat),this.onCoauthOptions(),this.panelChat.focus()):e=="comments"&&this.btnComments.isVisible()&&!this.btnComments.isDisabled()&&!this.btnComments.pressed&&(this.btnComments.toggle(!0),this.onBtnMenuClick(this.btnComments),this.onCoauthOptions())},getMenu:function(e){switch(e){default:return null;case"file":return this.btnFile.panel;case"about":return this.btnAbout.panel}},setMode:function(e){return this.mode=e,this.btnAbout.panel.setMode(e),this},setDeveloperMode:function(e){if(!this.$el.is(":visible"))return;this.developerHint||(this.developerHint=t('<div id="developer-hint">'+this.txtDeveloper+"</div>").appendTo(this.$el),this.devHeight=this.developerHint.outerHeight(),t(window).on("resize",n.bind(this.onWindowResize,this))),this.developerHint.toggleClass("hidden",!e);var r=this.$el.find("button.btn-category:visible:last-of-type");this.minDevPosition=r.offset().top-r.offsetParent().offset().top+r.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",tipSlides:"Slides",tipPlugins:"Plugins",txtDeveloper:"DEVELOPER MODE"},PE.Views.LeftMenu||{}))}),define("presentationeditor/main/app/controller/LeftMenu",["core","common/main/lib/util/Shortcuts","presentationeditor/main/app/view/LeftMenu","presentationeditor/main/app/view/FileMenu"],function(){"use strict";PE.Controllers.LeftMenu=Backbone.Controller.extend(_.extend({views:["LeftMenu","FileMenu"],initialize:function(){this._state={no_slides:undefined},this.addListeners({"Common.Views.Chat":{hide:_.bind(this.onHideChat,this)},Statusbar:{"click:users":_.bind(this.clickStatusbarUsers,this)},LeftMenu:{"panel:show":_.bind(this.menuExpand,this),"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")}})},onLaunch:function(){this.leftMenu=this.createView("LeftMenu").render(),this.leftMenu.btnSearch.on("toggle",_.bind(this.onMenuSearch,this)),this.leftMenu.btnThumbs.on("toggle",_.bind(this.onShowTumbnails,this)),this.isThumbsShown=!0,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"),"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(e){this.api=e,this.api.asc_registerCallback("asc_onThumbnailsShow",_.bind(this.onThumbnailsShow,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiServerDisconnect,this,!0)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiServerDisconnect,this));if(this.mode.canCoAuthoring){this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onApiChatMessage,this));if(this.mode.canComments){this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this));var t=this.getApplication().getCollection("Common.Collections.Comments");for(var n=0;n<t.length;++n)if(t.at(n).get("userid")!==this.mode.user.id){this.leftMenu.markCoauthOptions("comments",!0);break}}}return this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.onApiCountPages(this.api.getCountPages()),this.leftMenu.getMenu("file").setApi(e),this},setMode:function(e){return this.mode=e,this.leftMenu.setMode(e),this.leftMenu.getMenu("file").setMode(e),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.isTrial&&this.leftMenu.setDeveloperMode(!0),Common.util.Shortcuts.resumeEvents(),this.leftMenu.btnThumbs.toggle(!0),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(e,t,n){var r=!0;switch(t){case"back":break;case"save":this.api.asc_Save();break;case"save-desktop":this.api.asc_DownloadAs();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":n?r=!1:this.onCreateNew(undefined,"blank");break;case"rename":var i=this,s=i.api.asc_getDocumentName();(new Common.Views.RenameDialog({filename:s,handler:function(e,t){e=="ok"&&!_.isEmpty(t.trim())&&s!==t.trim()&&Common.Gateway.requestRename(t),Common.NotificationCenter.trigger("edit:complete",i)}})).show();break;default:r=!1}r&&(e.hide(),this.leftMenu.btnFile.toggle(!1,!0),this.menuExpand(this.leftMenu.btnFile,"files",!1))},clickSaveAsFormat:function(e,t){this.api.asc_DownloadAs(t),e.hide(),this.leftMenu.btnFile.toggle(!1,!0),this.menuExpand(this.leftMenu.btnFile,"files",!1)},applySettings:function(e){var t=Common.localStorage.getItem("pe-settings-inputmode");this.api.SetTextBoxInputMode(parseInt(t)==1),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&(t=Common.localStorage.getItem("pe-settings-coauthmode"),this.api.asc_SetFastCollaborative(t===null||parseInt(t)==1)),t=Common.localStorage.getItem("pe-settings-autosave"),this.api.asc_setAutoSaveGap(parseInt(t)),t=Common.localStorage.getItem("pe-settings-showsnaplines"),this.api.put_ShowSnapLines(t===null||parseInt(t)==1),e.hide(),this.leftMenu.btnFile.toggle(!1,!0),this.menuExpand(this.leftMenu.btnFile,"files",!1)},onCreateNew:function(e,t){if(this.mode.nativeApp===!0)this.api.OpenNewDocument(t=="blank"?"":t);else{var n=window.open(t=="blank"?this.mode.createUrl:t,"_blank");n&&n.focus()}e&&(e.hide(),this.leftMenu.btnFile.toggle(!1,!0),this.menuExpand(this.leftMenu.btnFile,"files",!1))},onOpenRecent:function(e,t){e&&(e.hide(),this.leftMenu.btnFile.toggle(!1,!0),this.menuExpand(this.leftMenu.btnFile,"files",!1));var n=window.open(t);n&&n.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(e){this.leftMenu.btnFile.pressed&&this.leftMenu.btnFile.panel.active=="opts"?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(e,t,n){if(n.textsearch&&n.textsearch.length&&!this.api.findText(n.textsearch,e!="back")){var r=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){r.dlgSearch.focus()}})}},showSearchDlg:function(e){this.dlgSearch||(this.dlgSearch=new Common.UI.SearchDialog({})),e?this.dlgSearch.isVisible()?this.dlgSearch.focus():this.dlgSearch.show("no-replace"):this.dlgSearch.hide()},onMenuSearch:function(e,t){this.showSearchDlg(t)},onShowTumbnails:function(e,t){this.api.ShowThumbnails(t)},onThumbnailsShow:function(e){e&&!this.isThumbsShown?this.leftMenu.btnThumbs.toggle(!0,!1):!e&&this.isThumbsShown&&this.leftMenu.btnThumbs.toggle(!1,!1),this.isThumbsShown=e},onSearchDlgHide:function(){this.leftMenu.btnSearch.toggle(!1,!0),$(this.leftMenu.btnSearch.el).blur(),this.api.asc_enableKeyEvents(!0)},onApiServerDisconnect:function(e){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:!!e}),this.dlgSearch&&(this.leftMenu.btnSearch.toggle(!1,!0),this.dlgSearch.hide())},onApiCountPages:function(e){this._state.no_slides!==e<=0&&this.mode.isEdit&&(this._state.no_slides=e<=0,this.leftMenu.btnComments.setDisabled(this._state.no_slides),this.leftMenu.btnSearch.setDisabled(this._state.no_slides))},menuExpand:function(e,t,n){t=="thumbs"?this.isThumbsShown=n:!n&&this.isThumbsShown&&this.leftMenu.btnThumbs.toggle(!0,!1)},menuFilesHide:function(e){$(this.leftMenu.btnFile.el).blur()},onApiChatMessage:function(){this.leftMenu.markCoauthOptions("chat")},onApiAddComment:function(e,t){t&&t.asc_getUserId()!==this.mode.user.id&&this.leftMenu.markCoauthOptions("comments")},onApiAddComments:function(e){for(var t=0;t<e.length;++t)if(e[t].asc_getUserId()!==this.mode.user.id){this.leftMenu.markCoauthOptions("comments");break}},commentsShowHide:function(e){e==="show"&&this.getApplication().getController("Common.Controllers.Comments").onAfterShow(),$(this.leftMenu.btnComments.el).blur()},aboutShowHide:function(e){this.api&&this.api.asc_enableKeyEvents(e),e&&$(this.leftMenu.btnAbout.el).blur()},onShortcut:function(e,t){var n=PE.getController("Viewport").getView("DocumentPreview");switch(e){case"search":if((!n||!n.isVisible())&&!this._state.no_slides){Common.UI.Menu.Manager.hideAll();var r=this.leftMenu.btnFile.pressed||this.leftMenu.btnAbout.pressed;this.showSearchDlg(!0),this.leftMenu.btnSearch.toggle(!0,!0),this.leftMenu.btnFile.toggle(!1),this.leftMenu.btnAbout.toggle(!1),r&&this.menuExpand(this.leftMenu.btnFile,"files",!1)}return!1;case"save":return this.mode.canDownload&&(!n||!n.isVisible())&&(this.mode.isDesktopApp&&this.mode.isOffline?this.api.asc_DownloadAs():(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file:saveas"))),!1;case"help":if(!n||!n.isVisible())Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file:help");return!1;case"file":if(!n||!n.isVisible())Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file");return!1;case"escape":var i=PE.getController("Statusbar"),s=i.statusbar.$el.find('.open > [data-toggle="dropdown"]');if(s.length)return $.fn.dropdown.Constructor.prototype.keydown.call(s[0],t),!1;if(this.mode.canPlugins&&this.leftMenu.panelPlugins){s=this.leftMenu.panelPlugins.$el.find('#menu-plugin-container.open > [data-toggle="dropdown"]');if(s.length)return $.fn.dropdown.Constructor.prototype.keydown.call(s[0],t),!1}if(this.leftMenu.btnFile.pressed||this.leftMenu.btnAbout.pressed||this.leftMenu.btnPlugins.pressed||$(t.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&&(!n||!n.isVisible())&&(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&&(!n||!n.isVisible())&&!this._state.no_slides&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("comments"),this.getApplication().getController("Common.Controllers.Comments").onAfterShow()),!1}},textNoTextFound:"Text not found",newDocumentTitle:"Unnamed document",requestEditRightsText:"Requesting editing rights..."},PE.Controllers.LeftMenu||{}))});if(Common===undefined)var Common={};Common.IrregularStack=function(e){var t=[],n=function(e,t){return typeof e=="object"&&typeof t=="object"&&window.JSON?window.JSON.stringify(e)===window.JSON.stringify(t):e===t};e=e||{};var r=e.strongCompare||n,i=e.weakCompare||n,s=function(e,n){for(var r=t.length-1;r>=0;r--)if(n(t[r],e))return r;return-1},o=function(e){t.push(e)},u=function(e){var n=s(e,r);if(n!=-1){var i=t.splice(n,1);return i[0]}return undefined},a=function(e){var n=s(e,i);return n!=-1?t[n]:undefined},f=function(e){return!(s(e,r)<0)};return{push:o,pop:u,get:a,exist:f}},define("irregularstack",function(){});if(Common===undefined)var Common={};define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){var e,t,n;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(e){Common.UI.BaseView.prototype.initialize.call(this,e),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(t||n)return;e=this.owner instanceof Common.UI.BaseView?$(this.owner.el):$(this.owner);if(e.hasClass("masked"))return this;var r=this;return t=$('<div class="asc-loadmask"></div>'),n=$(this.template({id:r.id,cls:r.cls,style:r.style,title:r.title})),e.addClass("masked"),e.append(t),e.append(n),n.css({top:Math.round(e.height()/2-(n.height()+parseInt(n.css("padding-top"))+parseInt(n.css("padding-bottom")))/2)+"px",left:Math.round(e.width()/2-(n.width()+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right")))/2)+"px"}),Common.util.Shortcuts.suspendEvents(),this},hide:function(){e&&e.removeClass("masked"),t&&t.remove(),n&&n.remove(),t=null,n=null,Common.util.Shortcuts.resumeEvents()},setTitle:function(t){this.title=t,e&&e.hasClass("masked")&&n&&$(".asc-loadmask-title",n).html(t)},isVisible:function(){return!_.isEmpty(n)}}}())});if(Common===undefined)var Common={};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,n){var r=n.get("type")==e,i=-1,s=t.length,o,u=n.get("name");while(!r&&++i<s){o=t.at(i);if(o.get("type")!=e)break;r=o.get("name")==u}return r}function n(e,n){e.showlastused&&!t(e.store,n)}function r(e){Common.NotificationCenter.trigger("fonts:change",e)}function i(e,t){var n=[];_.each(e,function(e){var t=e.asc_getFontId();n.push({id:_.isEmpty(t)?Common.UI.getId():t,name:e.asc_getFontName(),imgidx:e.asc_getFontThumbnail(),type:e.asc_getFontType()})});var r=this.getCollection("Common.Collections.Fonts");r&&(r.add(n),r.sort()),Common.NotificationCenter.trigger("fonts:load",r,t)}var e=4;return{models:["Common.Models.Fonts"],collections:["Common.Collections.Fonts"],views:[],initialize:function(){Common.NotificationCenter.on("fonts:select",_.bind(n,this))},onLaunch:function(){},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onInitEditorFonts",_.bind(i,this)),this.api.asc_registerCallback("asc_onFontFamily",_.bind(r,this))}}}())});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/TextArt",["backbone"],function(e){"use strict";Common.Collections.TextArt=e.Collection.extend({model:e.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:undefined,initialize:function(e){var t=this,n={};_.extend(n,{closable:!1,width:250,height:e.type==Asc.c_oAscAdvancedOptionsID.CSV?205:155,contentWidth:390,header:!0,cls:"open-dlg",contentTemplate:"",title:e.type==Asc.c_oAscAdvancedOptionsID.DRM?t.txtTitleProtected:t.txtTitle.replace("%1",e.type==Asc.c_oAscAdvancedOptionsID.CSV?"CSV":"TXT")},e),this.template=e.template||['<div class="box" style="height:'+(n.height-85)+'px;">','<div class="content-panel" >',"<% if (type == Asc.c_oAscAdvancedOptionsID.DRM) { %>",'<label class="header">'+t.txtPassword+"</label>",'<div id="id-password-txt" style="margin-bottom:15px;"></div>',"<% } else { %>",'<label class="header">'+t.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">'+t.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;">'+t.okButtonText+"</button>","</div>"].join(""),this.handler=e.handler,this.type=e.type,this.codepages=e.codepages,this.settings=e.settings,n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this);if(this.$window){this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this));if(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 e=this;this.initCodePages(),this.onPrimary=function(){return e.onBtnClick(),!1}}}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);if(this.type==Asc.c_oAscAdvancedOptionsID.DRM){var e=this;setTimeout(function(){e.inputPwd.cmpEl.find("input").focus()},500)}},onBtnClick:function(e){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(e){e.keyCode==Common.UI.Keys.RETURN&&this.onBtnClick()},initCodePages:function(){var e,t,n,r=[],i=[],s=0;if(this.codepages){r=[];for(e=0;e<this.codepages.length;++e)n=this.codepages[e],t=[],t[0]=n.asc_getCodePage(),t[1]=n.asc_getCodePageName(),r.push(t)}else r=[[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)"]];s=r.length;if(s){for(e=0;e<s;++e)i.push({value:r[e][0],displayValue:r[e][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:i,editable:!1}),this.cmbEncoding.setValue(this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():r[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 e,t,n={},r=function(e){e.type=="localstorage"&&(n=e.keys)};Common.Gateway.on("internalcommand",r);var i=function(){a||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:t})},s=function(){a||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:n})},o=function(e,t,r){a?localStorage.setItem(e,t):(n[e]=t,r===!0&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:t}}))},u=function(e){return a?localStorage.getItem(e):n[e]===undefined?null:n[e]};try{var a=!!window.localStorage}catch(f){a=!1}return{getId:function(){return e},setId:function(t){e=t},getItem:u,setItem:o,setKeysFilter:function(e){t=e},sync:i,save:s}}}),define("presentationeditor/main/app/model/ShapeGroup",["backbone"],function(e){"use strict";PE.Models=PE.Models||{},PE.Models.ShapeModel=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),PE.Models.ShapeGroup=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/ShapeGroups",["backbone","presentationeditor/main/app/model/ShapeGroup"],function(e){"use strict";if(t===undefined)var t={};t.Collections=t.Collections||{},PE.Collections.ShapeGroups=e.Collection.extend({model:PE.Models.ShapeGroup})}),define("presentationeditor/main/app/model/SlideLayout",["backbone"],function(e){"use strict";PE.Models=PE.Models||{},PE.Models.SlideLayout=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,title:null,data:null}}})}),define("presentationeditor/main/app/collection/SlideLayouts",["backbone","presentationeditor/main/app/model/SlideLayout"],function(e){"use strict";PE.Collections=PE.Collections||{},PE.Collections.SlideLayouts=e.Collection.extend({model:PE.Models.SlideLayout})}),define("presentationeditor/main/app/model/EquationGroup",["backbone"],function(e){"use strict";PE.Models=PE.Models||{},PE.Models.EquationModel=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),PE.Models.EquationGroup=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/EquationGroups",["backbone","presentationeditor/main/app/model/EquationGroup"],function(e){"use strict";if(t===undefined)var t={};t.Collections=t.Collections||{},PE.Collections.EquationGroups=e.Collection.extend({model:PE.Models.EquationGroup})}),define("presentationeditor/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","presentationeditor/main/app/collection/ShapeGroups","presentationeditor/main/app/collection/SlideLayouts","presentationeditor/main/app/collection/EquationGroups"],function(){"use strict";PE.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("presentation"),Common.localStorage.setKeysFilter("pe-,asc.presentation"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","SlideLayouts","EquationGroups","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)}})},onLaunch:function(){var e=this;this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseWarning:!1},window.storagename="presentation",this.stackLongActions=new Common.IrregularStack({strongCompare:function(e,t){return e.id===t.id&&e.type===t.type},weakCompare:function(e,t){return e.type===t.type}});if(!Common.Utils.isBrowserSupported()){Common.Utils.showBrowserRestriction(),Common.Gateway.reportError(undefined,this.unsupportedBrowserErrorText);return}window.flat_desine=!0,this.api=new Asc.asc_docs_api({"id-view":"editor_sdk"}),this.api&&(this.api.SetDrawingFreeze(!0),this.api.SetThemesPath("../../../../sdkjs/slide/themes/"),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_onThumbnailsShow",_.bind(this.onThumbnailsShow,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,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=undefined,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(e.api),$(document.body).on("focus","input, textarea",function(t){/area_id/.test(t.target.id)||(/msg-reply/.test(t.target.className)?e.dontCloseDummyComment=!0:/chat-msg-text/.test(t.target.id)&&(e.dontCloseChat=!0))}),$(document.body).on("blur","input, textarea",function(t){!e.isModalShowed&&(!t.relatedTarget||!/area_id/.test(t.target.id)&&$(t.target).parent().find(t.relatedTarget).length<1&&(t.relatedTarget.localName!="input"||!/form-control/.test(t.relatedTarget.className))&&(t.relatedTarget.localName!="textarea"||/area_id/.test(t.relatedTarget.id)))&&(e.api.asc_enableKeyEvents(!0),/msg-reply/.test(t.target.className)?e.dontCloseDummyComment=!1:/chat-msg-text/.test(t.target.id)&&(e.dontCloseChat=!1))}).on("dragover",function(e){var t=e.originalEvent;if(t.target&&$(t.target).closest("#editor_sdk").length<1)return t.preventDefault(),t.dataTransfer.dropEffect="none",!1}),Common.NotificationCenter.on({"modal:show":function(t){e.isModalShowed=!0,e.api.asc_enableKeyEvents(!1)},"modal:close":function(t){t&&t.$lastmodal&&t.$lastmodal.size()<1&&(e.isModalShowed=!1,e.api.asc_enableKeyEvents(!0))},"modal:hide":function(t){t&&t.$lastmodal&&t.$lastmodal.size()<1&&(e.isModalShowed=!1,e.api.asc_enableKeyEvents(!0))},"settings:unitschanged":_.bind(this.unitsChanged,this),"dataview:focus":function(e){},"dataview:blur":function(t){e.isModalShowed||e.api.asc_enableKeyEvents(!0)},"menu:show":function(e){},"menu:hide":function(t,n){!e.isModalShowed&&!n&&e.api.asc_enableKeyEvents(!0)},"edit:complete":_.bind(e.onEditComplete,e)}),this.initNames())},loadConfig:function(e){this.editorConfig=$.extend(this.editorConfig,e.config),this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(e.config.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.nativeApp=this.editorConfig.nativeApp===!0,this.appOptions.isDesktopApp=this.editorConfig.targetApp=="desktop",this.appOptions.canCreateNew=!_.isEmpty(this.editorConfig.createUrl)&&!this.appOptions.isDesktopApp,this.appOptions.canOpenRecent=this.editorConfig.nativeApp!==!0&&this.editorConfig.recent!==undefined&&!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=typeof this.editorConfig.location=="string"?this.editorConfig.location.toLowerCase():"",this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.canAnalytics=!1,this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=this.editorConfig.canBackToFolder!==!1&&typeof this.editorConfig.customization=="object"&&typeof this.editorConfig.customization.goback=="object"&&!_.isEmpty(this.editorConfig.customization.goback.url),this.appOptions.canBack=this.editorConfig.nativeApp!==!0&&this.appOptions.canBackToFolder===!0,this.appOptions.canPlugins=!1,this.plugins=this.editorConfig.plugins,this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanBack(this.appOptions.canBackToFolder===!0),this.editorConfig.lang&&this.api.asc_setLocale(this.editorConfig.lang),(this.appOptions.location=="us"||this.appOptions.location=="ca")&&Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch)},loadDocument:function(e){this.permissions={},this.document=e.doc;var t={};if(e.doc){this.permissions=$.extend(this.permissions,e.doc.permissions);var n=new Asc.asc_CUserInfo;n.put_Id(this.appOptions.user.id),n.put_FullName(this.appOptions.user.fullname),t=new Asc.asc_CDocInfo,t.put_Id(e.doc.key),t.put_Url(e.doc.url),t.put_Title(e.doc.title),t.put_Format(e.doc.fileType),t.put_VKey(e.doc.vkey),t.put_Options(e.doc.options),t.put_UserInfo(n),t.put_CallbackUrl(this.editorConfig.callbackUrl),t.put_Token(e.doc.token)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_setDocInfo(t),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId),e.doc&&this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(e.doc.title)},onProcessSaveResult:function(e){this.api.asc_OnSaveEnd(e.result),e&&e.result===!1&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(e.message)?this.errorProcessSaveResult:e.message})},onProcessRightsChange:function(e){if(e&&e.enabled===!1){var t=this,n=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"),n||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(e.message)?this.warnProcessRightsChange:e.message,callback:function(){t._state.lostEditingRights=!1,t.onEditComplete()}})}},onDownloadAs:function(){this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX,!0)},onProcessMouse:function(e){if(e.type=="mouseup"){var t=document.getElementById("editor_sdk");if(t){var n=t.getBoundingClientRect();this.api.OnMouseUp(e.x-n.left,e.y-n.top)}}},goBack:function(e){var t=this.appOptions.customization.goback.url;e?window.open(t,"_blank"):parent.location.href=t},onEditComplete:function(e){var t=this.getApplication(),n=t.getController("Toolbar"),r=n.getView("Toolbar");t.getController("DocumentHolder").getView("DocumentHolder").focus();if(this.api&&this.api.asc_isDocumentCanSave){var i=this.api.asc_isDocumentCanSave(),s=this.appOptions.forcesave,o=$(".btn-icon",r.btnSave.cmpEl).hasClass("btn-synch");r.btnSave.isDisabled()!==(!i&&!o&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)&&r.btnSave.setDisabled(!i&&!o&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)}},onLongActionBegin:function(e,t){var n={id:t,type:e};this.stackLongActions.push(n),this.setLongActionView(n)},onLongActionEnd:function(e,t){var n={id:t,type:e};this.stackLongActions.pop(n),this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(!0),n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information});if(n)this.setLongActionView(n);else if(t==Asc.c_oAscAsyncAction["Save"]||t==Asc.c_oAscAsyncAction["ForceSaveButton"])if(this._state.fastCoauth&&this._state.usersCount>1){var r=this;r._state.timerSave=setTimeout(function(){r.getApplication().getController("Statusbar").setStatusCaption(r.textChangesSaved,!1,3e3)},500)}else this.getApplication().getController("Statusbar").setStatusCaption(this.textChangesSaved,!1,3e3);else this.getApplication().getController("Statusbar").setStatusCaption("");n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),n?this.setLongActionView(n):this.loadMask&&this.loadMask.hide(),(t==Asc.c_oAscAsyncAction["Save"]||t==Asc.c_oAscAsyncAction["ForceSaveButton"])&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.synchronizeChanges(),e==Asc.c_oAscAsyncActionType.BlockInteraction&&(t!=Asc.c_oAscAsyncAction["LoadDocumentFonts"]&&t!=Asc.c_oAscAsyncAction["ApplyChanges"]||!this.dontCloseDummyComment&&!this.dontCloseChat)&&(this.onEditComplete(this.loadMask),this.api.asc_enableKeyEvents(!0))},setLongActionView:function(e){var t="",n="",r=!1;switch(e.id){case Asc.c_oAscAsyncAction.Open:t=this.openTitleText,n=this.openTextText;break;case Asc.c_oAscAsyncAction.Save:case Asc.c_oAscAsyncAction.ForceSaveButton:clearTimeout(this._state.timerSave),r=!0,t=this.saveTitleText,n=this.saveTextText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:t=this.loadFontsTitleText,n=this.loadFontsTextText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:t=this.loadImagesTitleText,n=this.loadImagesTextText;break;case Asc.c_oAscAsyncAction.LoadFont:t=this.loadFontTitleText,n=this.loadFontTextText;break;case Asc.c_oAscAsyncAction.LoadImage:t=this.loadImageTitleText,n=this.loadImageTextText;break;case Asc.c_oAscAsyncAction.DownloadAs:t=this.downloadTitleText,n=this.downloadTextText;break;case Asc.c_oAscAsyncAction.Print:t=this.printTitleText,n=this.printTextText;break;case Asc.c_oAscAsyncAction.UploadImage:t=this.uploadImageTitleText,n=this.uploadImageTextText;break;case Asc.c_oAscAsyncAction.LoadTheme:t=this.loadThemeTitleText,n=this.loadThemeTextText;break;case Asc.c_oAscAsyncAction.ApplyChanges:t=this.applyChangesTitleText,n=this.applyChangesTextText;break;case Asc.c_oAscAsyncAction.PrepareToSave:t=this.savePreparingText,n=this.savePreparingTitle;break;case ApplyEditRights:t=this.txtEditingMode,n=this.txtEditingMode;break;case LoadingDocument:t=this.loadingDocumentTitleText,n=this.loadingDocumentTextText}e.type==Asc.c_oAscAsyncActionType["BlockInteraction"]?(this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(t),this.isShowOpenDialog||this.loadMask.show()):this.getApplication().getController("Statusbar").setStatusCaption(n,r)},onApplyEditRights:function(e){this.getApplication().getController("Statusbar").setStatusCaption(""),e&&!e.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:e.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function r(){if(!window.AscDesktopEditor){var t=[];Common.Utils.isIE9m&&t.push(e.warnBrowserIE9),t.length&&e.showTips(t)}document.removeEventListener("visibilitychange",r)}if(this._isDocReady)return;var e=this,t;e._isDocReady=!0,e.api.SetDrawingFreeze(!1),e.hidePreloader(),e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),t=Common.localStorage.getItem("pe-settings-zoom");var n=t!==null?parseInt(t):this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom):-1;n==-1?this.api.zoomFitToPage():n==-2?this.api.zoomFitToWidth():this.api.zoom(n>0?n:100),typeof document.hidden!="undefined"&&document.hidden?document.addEventListener("visibilitychange",r):r(),e.api.asc_registerCallback("asc_onStartAction",_.bind(e.onLongActionBegin,e)),e.api.asc_registerCallback("asc_onEndAction",_.bind(e.onLongActionEnd,e)),e.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(e.onCoAuthoringDisconnect,e)),e.api.asc_registerCallback("asc_onPrint",_.bind(e.onPrint,e));var i=e.getApplication();i.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(e.api.asc_getDocumentName()),e.updateWindowTitle(!0),t=Common.localStorage.getItem("pe-settings-inputmode"),e.api.SetTextBoxInputMode(t!==null&&parseInt(t)==1),e.appOptions.isEdit&&!e.appOptions.isOffline&&e.appOptions.canCoAuthoring?(t=Common.localStorage.getItem("pe-settings-coauthmode"),t===null&&Common.localStorage.getItem("pe-settings-autosave")===null&&e.appOptions.customization&&e.appOptions.customization.autosave===!1&&(t=0),e._state.fastCoauth=t===null||parseInt(t)==1):e._state.fastCoauth=!1,e.api.asc_SetFastCollaborative(e._state.fastCoauth),Common.localStorage.setItem("pe-settings-showsnaplines",e.api.get_ShowSnapLines()?1:0);var s=i.getController("Toolbar"),o=i.getController("Statusbar"),u=i.getController("DocumentHolder"),a=i.getController("Common.Controllers.Fonts"),f=i.getController("RightMenu"),l=i.getController("LeftMenu"),c=i.getController("Common.Controllers.Chat"),h=i.getController("Common.Controllers.Plugins");l.getView("LeftMenu").getMenu("file").loadDocument({doc:e.document}),l.setMode(e.appOptions).setApi(e.api).createDelayedElements(),c.setApi(this.api).setMode(this.appOptions),i.getController("Common.Controllers.ExternalDiagramEditor").setApi(this.api).loadConfig({config:this.editorConfig,customization:this.editorConfig.customization}),h.setApi(e.api),e.updatePlugins(e.plugins,!1),e.requestPlugins("../../../../plugins.json"),e.api.asc_registerCallback("asc_onPluginsInit",_.bind(e.updatePluginsList,e)),u.setApi(e.api),u.createDelayedElements(),o.createDelayedElements(),l.getView("LeftMenu").disableMenu("all",!1),e.appOptions.canBranding&&e.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(e.editorConfig.customization),u.getView("DocumentHolder").setApi(e.api).on("editcomplete",_.bind(e.onEditComplete,e)),i.getController("Viewport").getView("DocumentPreview").setApi(e.api).setMode(e.appOptions).on("editcomplete",_.bind(e.onEditComplete,e));if(e.appOptions.isEdit){t=Common.localStorage.getItem("pe-settings-autosave"),t===null&&e.appOptions.customization&&e.appOptions.customization.autosave===!1&&(t=0),t=!e._state.fastCoauth&&t!==null?parseInt(t):e.appOptions.canCoAuthoring?1:0,e.api.asc_setAutoSaveGap(t),e.appOptions.canForcesave&&(t=Common.localStorage.getItem("pe-settings-forcesave"),e.appOptions.forcesave=t===null?e.appOptions.canForcesave:parseInt(t)==1,e.api.asc_setIsForceSaveOnUserSave(e.appOptions.forcesave)),e.needToUpdateVersion&&Common.NotificationCenter.trigger("api:disconnect");var p=setInterval(function(){if(window.styles_loaded){clearInterval(p),s.createDelayedElements(),u.getView("DocumentHolder").createDelayedElements(),e.api.asc_registerCallback("asc_onUpdateLayout",_.bind(e.fillLayoutsStore,e)),e.updateThemeColors();var t=e.api.asc_getPropertyEditorShapes();t&&e.fillAutoShapes(t[0],t[1]),f.createDelayedElements(),e.api.asc_registerCallback("asc_onFocusObject",_.bind(e.onFocusObject,e)),e.fillTextArt(e.api.asc_getTextArtPreviews()),s.activateControls(),e.needToUpdateVersion&&s.onApiCoAuthoringDisconnect(),e.api.UpdateInterfaceState(),e.appOptions.canBrandingExt&&Common.NotificationCenter.trigger("document:ready","main")}},50)}else e.appOptions.canBrandingExt&&Common.NotificationCenter.trigger("document:ready","main");this.appOptions.canAnalytics&&!1&&Common.component.Analytics.initialize("UA-12442749-13","Presentation Editor"),Common.Gateway.on("applyeditrights",_.bind(e.onApplyEditRights,e)),Common.Gateway.on("processsaveresult",_.bind(e.onProcessSaveResult,e)),Common.Gateway.on("processrightschange",_.bind(e.onProcessRightsChange,e)),Common.Gateway.on("processmouse",_.bind(e.onProcessMouse,e)),Common.Gateway.on("downloadas",_.bind(e.onDownloadAs,e)),Common.Gateway.sendInfo({mode:e.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(e.onContextMenu,e))},onOpenDocument:function(e){var t=document.getElementById("loadmask-text"),n=(e.asc_getCurrentFont()+e.asc_getCurrentImage())/(e.asc_getFontsCount()+e.asc_getImagesCount());n=this.textLoadingDocument+": "+Math.min(Math.round(n*100),100)+"%",t?t.innerHTML=n:this.loadMask.setTitle(n)},onEditorPermissions:function(e){var t=e.asc_getLicenseType();if(this.onServerVersion(e.asc_getBuildVersion()))return;e.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.canLicense=t===Asc.c_oLicenseResult.Success||t===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=e.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canEdit=this.permissions.edit!==!1&&(this.editorConfig.canRequestEditRights||this.editorConfig.mode!=="view"),this.appOptions.isEdit=this.appOptions.canLicense&&this.appOptions.canEdit&&this.editorConfig.mode!=="view",this.appOptions.canDownload=!this.appOptions.nativeApp&&this.permissions.download!==!1,this.appOptions.canAnalytics=e.asc_getIsAnalyticsEnable(),this.appOptions.canComments=(t===Asc.c_oLicenseResult.Success||t===Asc.c_oLicenseResult.SuccessLimit)&&(typeof this.editorConfig.customization!="object"||this.editorConfig.customization.comments!==!1),this.appOptions.canChat=(t===Asc.c_oLicenseResult.Success||t===Asc.c_oLicenseResult.SuccessLimit)&&!this.appOptions.isOffline&&(typeof this.editorConfig.customization!="object"||this.editorConfig.customization.chat!==!1),this.appOptions.canPrint=this.permissions.print!==!1,this.appOptions.canRename=!!this.permissions.rename,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&typeof this.editorConfig.customization=="object"&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||typeof this.editorConfig.customization!="object"||!this.editorConfig.customization.commentAuthorOnly,this.appOptions.isTrial=e.asc_getTrial(),this._state.licenseWarning=t===Asc.c_oLicenseResult.Connections&&this.appOptions.canEdit&&this.editorConfig.mode!=="view";var n=this.getApplication().getController("Viewport").getView("Common.Views.Header");this.appOptions.canBranding=t===Asc.c_oLicenseResult.Success&&typeof this.editorConfig.customization=="object",this.appOptions.canBranding&&n.setBranding(this.editorConfig.customization),this.appOptions.canRename&&n.setCanRename(!0),this.appOptions.canBrandingExt=e.asc_getCanBranding()&&(typeof this.editorConfig.customization=="object"||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 e=Common.localStorage.getItem("pe-hidden-title");e=this.appOptions.isEdit&&e!==null&&parseInt(e)==1;var t=this.getApplication(),n=t.getController("Viewport").getView("Viewport"),r=t.getController("Viewport").getView("Common.Views.Header"),i=t.getController("Statusbar").getView("Statusbar"),s=t.getController("DocumentHolder").getView("DocumentHolder");r&&(r.setHeaderCaption(this.appOptions.isEdit?"Presentation Editor":"Presentation Viewer"),r.setVisible(!this.appOptions.nativeApp&&!e&&!this.appOptions.isDesktopApp)),n&&n.setMode(this.appOptions,!0),i&&i.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));if(this.api){var o=new Asc.asc_CChartTranslate;o.asc_setTitle(this.txtDiagramTitle),o.asc_setXAxis(this.txtXAxis),o.asc_setYAxis(this.txtYAxis),o.asc_setSeries(this.txtSeries),this.api.asc_setChartTranslate(o);var u=new Asc.asc_TextArtTranslate;u.asc_setDefaultText(this.txtArt),this.api.asc_setTextArtTranslate(u)}},applyModeEditorElements:function(e){if(this.appOptions.isEdit){var t=this,n=this.getApplication(),r=n.getController("Toolbar"),i=n.getController("RightMenu"),s=n.getController("Common.Controllers.Fonts");s&&s.setApi(t.api),r&&r.setApi(t.api);var o=n.getController("Common.Controllers.Comments");o&&(o.setMode(this.appOptions),o.setConfig({config:t.editorConfig},t.api)),i&&i.setApi(t.api);var u=this.getApplication().getController("Viewport").getView("Viewport");u.applyEditorMode();var a=r?r.getView("Toolbar"):null;_.each([a,i.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("insertchart",_.bind(t.onInsertChart,t)),a.on("inserttextart",_.bind(t.onInsertTextArt,t)));var f=Common.localStorage.getItem("pe-settings-unit");f=f!==null?parseInt(f):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(f),t.api.asc_SetDocumentUnits(f==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:f==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),f=Common.localStorage.getItem("pe-hidden-rulers"),t.api.asc_SetViewRulers&&t.api.asc_SetViewRulers(f===null||parseInt(f)===0),t.api.asc_registerCallback("asc_onChangeObjectLock",_.bind(t._onChangeObjectLock,t)),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(e){e&&e.msg&&(e.msg=e.msg.toString(),this.showTips([e.msg.charAt(0).toUpperCase()+e.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error",e.title))},onError:function(e,t,n){this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument);var r={closable:!1};switch(e){case Asc.c_oAscError.ID.Unknown:r.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:r.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:r.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:r.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:r.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:r.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:r.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:r.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.SplitCellMaxRows:r.msg=this.splitMaxRowsErrorText.replace("%1",n.get_Value());break;case Asc.c_oAscError.ID.SplitCellMaxCols:r.msg=this.splitMaxColsErrorText.replace("%1",n.get_Value());break;case Asc.c_oAscError.ID.SplitCellRowsDivider:r.msg=this.splitDividerErrorText.replace("%1",n.get_Value());break;case Asc.c_oAscError.ID.VKeyEncrypt:r.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:r.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:r.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:r.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:r.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.StockChartError:r.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:r.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.Database:r.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights){this._state.lostEditingRights=!1;return}this._state.lostEditingRights=!0,r.msg=this.errorUserDrop;break;case Asc.c_oAscError.ID.Warning:r.msg=this.errorConnectToServer;break;case Asc.c_oAscError.ID.SessionAbsolute:r.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:r.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:r.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:r.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.UplImageUrl:r.msg=this.errorBadImageUrl;break;default:r.msg=this.errorDefaultMessage.replace("%1",e)}t==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(e,r.msg),r.title=this.criticalErrorTitle,r.iconCls="error",this.appOptions.canBackToFolder&&(r.msg+="<br/><br/>"+this.criticalErrorExtText,r.fn=function(e){e=="ok"&&Common.NotificationCenter.trigger("goback")})):(r.title=this.notcriticalErrorTitle,r.iconCls="warn",r.buttons=["ok"],r.callback=_.bind(function(t){e==Asc.c_oAscError.ID.Warning&&t=="ok"&&this.appOptions.canDownload&&(Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas")),this._state.lostEditingRights=!1,this.onEditComplete()},this)),Common.UI.alert(r),Common.component.Analytics.trackEvent("Internal Error",e.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(e){function n(){var n=e.shift();n&&(n+="\n"+t.textCloseTip,r.setTitle(n),r.show())}var t=this;if(!e.length)return;typeof e!="object"&&(e=[e]),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 r=this.tooltip;r.on("tooltip:hide",function(){setTimeout(n,300)}),n()},updateWindowTitle:function(e){var t=this.api.isDocumentModified();if(this._state.isDocModified!==t||e){var n=this.defaultTitleText,r=this.getApplication().getController("Viewport").getView("Common.Views.Header");_.isEmpty(r.getDocumentCaption())||(n=r.getDocumentCaption()+" - "+n),t?(clearTimeout(this._state.timerCaption),_.isUndefined(n)||(n="* "+n,r.setDocumentCaption(r.getDocumentCaption(),!0))):this._state.fastCoauth&&this._state.usersCount>1?this._state.timerCaption=setTimeout(function(){r.setDocumentCaption(r.getDocumentCaption(),!1)},500):r.setDocumentCaption(r.getDocumentCaption(),!1),window.document.title!=n&&(window.document.title=n),Common.Gateway.setDocumentModified(t),t&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.getApplication().getController("Statusbar").setStatusCaption("",!0),this._state.isDocModified=t}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(){var e=this.api.asc_isDocumentCanSave();this._state.isDocModified!==e&&Common.Gateway.setDocumentModified(this.api.isDocumentModified()),this.updateWindowTitle();var t=this.getApplication().getController("Toolbar").getView("Toolbar");if(t){var n=$(".btn-icon",t.btnSave.cmpEl).hasClass("btn-synch"),r=this.appOptions.forcesave;t.btnSave.isDisabled()!==(!e&&!n&&!r||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!r)&&t.btnSave.setDisabled(!e&&!n&&!r||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!r)}},onDocumentCanSaveChanged:function(e){var t=this.getApplication(),n=t.getController("Toolbar"),r=n.getView("Toolbar");if(r){var i=$(".btn-icon",r.btnSave.cmpEl).hasClass("btn-synch"),s=this.appOptions.forcesave;r.btnSave.isDisabled()!==(!e&&!i&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)&&r.btnSave.setDisabled(!e&&!i&&!s||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!s)}},onContextMenu:function(e){var t=e.target.getAttribute("data-can-copy"),n=e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement;if(n&&t==="false"||!n&&t!=="true")return e.stopPropagation(),e.preventDefault(),!1},onBeforeUnload:function(){Common.localStorage.save();if(this.api.isDocumentModified()){var e=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){e.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(e){Common.Gateway.downloadAs(e)},onUpdateVersion:function(e){var t=this;t.needToUpdateVersion=!0,t.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),e&&e.call(t),t.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument)})}})},onServerVersion:function(e){return!1},fillUserStore:function(e){if(!_.isEmpty(e)){var t=this.getCommonStoreUsersStore();t&&t.add(e)}},onCollaborativeChanges:function(){if(this._state.hasCollaborativeChanges)return;this._state.hasCollaborativeChanges=!0,this.appOptions.isEdit&&this.getApplication().getController("Statusbar").setStatusCaption(this.txtNeedSynchronize,!0)},synchronizeChanges:function(){this.getApplication().getController("Statusbar").setStatusCaption(""),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],this.layoutNames=[this.txtSldLtTBlank,this.txtSldLtTChart,this.txtSldLtTChartAndTx,this.txtSldLtTClipArtAndTx,this.txtSldLtTClipArtAndVertTx,this.txtSldLtTCust,this.txtSldLtTDgm,this.txtSldLtTFourObj,this.txtSldLtTMediaAndTx,this.txtSldLtTObj,this.txtSldLtTObjAndTwoObj,this.txtSldLtTObjAndTx,this.txtSldLtTObjOnly,this.txtSldLtTObjOverTx,this.txtSldLtTObjTx,this.txtSldLtTPicTx,this.txtSldLtTSecHead,this.txtSldLtTTbl,this.txtSldLtTTitle,this.txtSldLtTTitleOnly,this.txtSldLtTTwoColTx,this.txtSldLtTTwoObj,this.txtSldLtTTwoObjAndObj,this.txtSldLtTTwoObjAndTx,this.txtSldLtTTwoObjOverTx,this.txtSldLtTTwoTxTwoObj,this.txtSldLtTTx,this.txtSldLtTTxAndChart,this.txtSldLtTTxAndClipArt,this.txtSldLtTTxAndMedia,this.txtSldLtTTxAndObj,this.txtSldLtTTxAndTwoObj,this.txtSldLtTTxOverObj,this.txtSldLtTVertTitleAndTx,this.txtSldLtTVertTitleAndTxOverChart,this.txtSldLtTVertTx]},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(e){var t=Common.localStorage.getItem("pe-settings-unit");t=t!==null?parseInt(t):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(t),this.api.asc_SetDocumentUnits(t==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:t==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit()},updateThemeColors:function(){var e=this;setTimeout(function(){e.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){e.getApplication().getController("Toolbar").updateThemeColors()},50)},onSendThemeColors:function(e,t){Common.Utils.ThemeColor.setColors(e,t),window.styles_loaded&&(this.updateThemeColors(),this.fillTextArt(this.api.asc_getTextArtPreviews()))},onFocusObject:function(e){var t=this.getApplication().getController("RightMenu");t&&t.onFocusObject.call(t,e)},_onChangeObjectLock:function(){var e=this.api.getSelectedElements();this.onFocusObject(e),this.getApplication().getController("Toolbar")._onFocusObject(e)},onThumbnailsShow:function(e){this.isThumbnailsShow=e},fillAutoShapes:function(e,t){if(_.isEmpty(t)||_.isEmpty(e)||t.length!=e.length)return;var n=this,r=[],i=this.getCollection("ShapeGroups");i.reset();var s=e.length;_.each(e,function(e,i){var s=new Backbone.Collection([],{model:PE.Models.ShapeModel}),o=t[i].length>18?7:6,u=Math.ceil(t[i].length/o)*35+3,a=30*o;_.each(t[i],function(e,t){s.add({imageUrl:e.Image,data:{shapeType:e.Type},tip:n.textShape+" "+(t+1),allowSelected:!0,selected:!1})}),r.push({groupName:n.shapeGroupNames[i],groupStore:s,groupWidth:a,groupHeight:u})}),i.add(r),setTimeout(function(){n.getApplication().getController("Toolbar").fillAutoShapes()},50)},fillLayoutsStore:function(e){var t=this;if(!_.isEmpty(e)){var n=this.getCollection("SlideLayouts");if(n){var r=[];_.each(e,function(e){var n=e.get_Name();r.push({imageUrl:e.get_Image(),title:n!==""?n:t.layoutNames[e.getType()],itemWidth:e.get_Width(),itemHeight:e.get_Height(),data:{type:e.getType(),idx:e.getIndex()},allowSelected:!0,selected:!1})}),n.reset(r)}}},fillTextArt:function(e){if(_.isEmpty(e))return;var t=this,n=[],r=this.getCollection("Common.Collections.TextArt");_.each(e,function(e,t){n.push({imageUrl:e,data:t,allowSelected:!0,selected:!1})}),r.reset(n),setTimeout(function(){t.getApplication().getController("Toolbar").fillTextArt()},50),setTimeout(function(){t.getApplication().getController("RightMenu").fillTextArt()},50)},onTryUndoInFastCollaborative:function(){var e=window.localStorage.getItem("pe-hide-try-undoredo");(!e||parseInt(e)!=1)&&Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(e,t){t&&window.localStorage.setItem("pe-hide-try-undoredo",1),e=="custom"&&(Common.localStorage.setItem("pe-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(e){var t=0;_.each(e,function(e){e.asc_getView()||t++}),this._state.usersCount=t},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var e=Common.localStorage.getItem("pe-settings-coauthmode"),t=this._state.fastCoauth;this._state.fastCoauth=e===null||parseInt(e)==1,this._state.fastCoauth&&!t&&this.synchronizeChanges()}this.appOptions.canForcesave&&(e=Common.localStorage.getItem("pe-settings-forcesave"),this.appOptions.forcesave=e===null?this.appOptions.canForcesave:parseInt(e)==1,this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(e){this.getApplication().getController("Viewport").getView("Common.Views.Header").setDocumentCaption(e),this.updateWindowTitle(!0)},onMeta:function(e){var t=this.getApplication(),n=t.getController("LeftMenu").getView("LeftMenu").getMenu("file");t.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(e.title),this.updateWindowTitle(!0),this.document.title=e.title,n.loadDocument({doc:this.document}),n.panels.info.updateInfo(this.document),Common.Gateway.metaChange(e)},onPrint:function(){if(!this.appOptions.canPrint)return;this.api&&this.api.asc_Print(Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera),Common.component.Analytics.trackEvent("Print")},onPrintUrl:function(e){this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null);if(!this.iframePrint){var t=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(){t.iframePrint.contentWindow.focus(),t.iframePrint.contentWindow.print(),t.iframePrint.contentWindow.blur(),window.focus()}}e&&(this.iframePrint.src=e)},onAdvancedOptions:function(e){var t=e.asc_getOptionId(),n=this,r;t==Asc.c_oAscAdvancedOptionsID.DRM&&(r=new Common.Views.OpenDialog({type:t,handler:function(e){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(e)),n.loadMask&&n.loadMask.show())}})),r&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),r.show())},requestPlugins:function(pluginsPath){if(!pluginsPath)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_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(e){}return null},value=_getPluginJson(pluginsPath);value&&this.updatePlugins(value,!1)},updatePlugins:function(plugins,uiCustomize){if(!plugins)return;var pluginsData=uiCustomize?plugins.UIpluginsData:plugins.pluginsData;if(!pluginsData||pluginsData.length<1)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_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(e){}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(e){e=baseUrl+e;var t=_getPluginJson(e);t&&(t.baseUrl=e.substring(0,e.lastIndexOf("config.json")),t.oldVersion=baseUrl!=="",arr.push(t))}),arr.length>0&&this.updatePluginsList({autoStartGuid:plugins.autoStartGuid,pluginsData:arr},!!uiCustomize)},updatePluginsList:function(e,t){var n=this.getApplication().getCollection("Common.Collections.Plugins"),r=this.appOptions.isEdit;if(e){var i=[],s=[];e.pluginsData.forEach(function(e){if(t!==undefined&&(n.findWhere({baseUrl:e.baseUrl})||n.findWhere({guid:e.guid})))return;var o=e.variations,u=[];o.forEach(function(t){var n=!1;for(var i=0;i<t.EditorsSupport.length;i++)if(t.EditorsSupport[i]=="slide"){n=!0;break}if(n&&(r||t.isViewer)){var o=t.icons;e.oldVersion&&(o=[],t.icons.forEach(function(e){o.push(e.substring(e.lastIndexOf("/")+1))})),e.isUICustomizer?s.push(e.baseUrl+t.url):u.push(new Common.Models.PluginVariation({description:t.description,index:u.length,url:e.oldVersion?t.url.substring(t.url.lastIndexOf("/")+1):t.url,icons:o,isViewer:t.isViewer,EditorsSupport:t.EditorsSupport,isVisual:t.isVisual,isModal:t.isModal,isInsideMode:t.isInsideMode,initDataType:t.initDataType,initData:t.initData,isUpdateOleOnResize:t.isUpdateOleOnResize,buttons:t.buttons,size:t.size,initOnSelectionChanged:t.initOnSelectionChanged}))}}),u.length>0&&!e.isUICustomizer&&i.push(new Common.Models.Plugin({name:e.name,guid:e.guid,baseUrl:e.baseUrl,variations:u,currentVariation:0}))}),t!==!1&&(this.UICustomizePlugins=s),t===undefined?(n&&n.reset(i),this.appOptions.canPlugins=n.length>0):t||(n&&n.add(i),this.appOptions.canPlugins=n.length>0)}else t||(this.appOptions.canPlugins=!1);this.appOptions.canPlugins&&(this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions),e.autoStartGuid&&this.api.asc_pluginRun(e.autoStartGuid,0,"")),t||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 Presentation Editor",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "Ok" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",saveTitleText:"Saving Document",saveTextText:"Saving document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",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.",txtSldLtTBlank:"Blank",txtSldLtTChart:"Chart",txtSldLtTChartAndTx:"Chart and Text",txtSldLtTClipArtAndTx:"Clip Art and Text",txtSldLtTClipArtAndVertTx:"Clip Art and Vertical Text",txtSldLtTCust:"Custom",txtSldLtTDgm:"Diagram",txtSldLtTFourObj:"Four Objects",txtSldLtTMediaAndTx:"Media and Text",txtSldLtTObj:"Title and Object",txtSldLtTObjAndTwoObj:"Object and Two Object",txtSldLtTObjAndTx:"Object and Text",txtSldLtTObjOnly:"Object",txtSldLtTObjOverTx:"Object over Text",txtSldLtTObjTx:"Title, Object, and Caption",txtSldLtTPicTx:"Picture and Caption",txtSldLtTSecHead:"Section Header",txtSldLtTTbl:"Table",txtSldLtTTitle:"Title",txtSldLtTTitleOnly:"Title Only",txtSldLtTTwoColTx:"Two Column Text",txtSldLtTTwoObj:"Two Objects",txtSldLtTTwoObjAndObj:"Two Objects and Object",txtSldLtTTwoObjAndTx:"Two Objects and Text",txtSldLtTTwoObjOverTx:"Two Objects over Text",txtSldLtTTwoTxTwoObj:"Two Text and Two Objects",txtSldLtTTx:"Text",txtSldLtTTxAndChart:"Text and Chart",txtSldLtTTxAndClipArt:"Text and Clip Art",txtSldLtTTxAndMedia:"Text and Media",txtSldLtTTxAndObj:"Text and Object",txtSldLtTTxAndTwoObj:"Text and Two Objects",txtSldLtTTxOverObj:"Text over Object",txtSldLtTVertTitleAndTx:"Vertical Title and Text",txtSldLtTVertTitleAndTxOverChart:"Vertical Title and Text Over Chart",txtSldLtTVertTx:"Vertical Text",textLoadingDocument:"Loading presentation",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",loadThemeTitleText:"Loading Theme",loadThemeTextText:"Loading theme...",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",txtEditingMode:"Set editing mode...",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The document is password protected.",textAnonymous:"Anonymous",txtNeedSynchronize:"You have an updates",applyChangesTitleText:"Loading Data",applyChangesTextText:"Loading data...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading presentation",loadingDocumentTextText:"Loading presentation...",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.",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",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",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"}}(),PE.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(e){var t={};_.extend(t,{title:this.textTitle,width:850,height:536,header:!0},e),this.template=['<div id="id-sharing-placeholder"></div>'].join(""),t.tpl=_.template(this.template,t),this.settingsurl=e.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var e=document.createElement("iframe");e.width="100%",e.height=500,e.align="top",e.frameBorder=0,e.scrolling="no",e.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(e),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),e.src=this.settingsurl;var t=this;this._eventfunc=function(e){t._onWindowMessage(e)},this._bindWindowEvents.call(this),this.on("close",function(e){t._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(e){if(e&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(e.data))}catch(t){}},_onMessage:function(e){e&&e.needUpdate&&this.trigger("accessrights",this,e.sharingSettings),Common.NotificationCenter.trigger("window:close",this)},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("presentationeditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog","common/main/lib/component/CheckBox"],function(){"use strict";!PE.Views.FileMenuPanels&&(PE.Views.FileMenuPanels={}),PE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:undefined,formats:[[{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"PPTX",imgCls:"pptx",type:Asc.c_oAscFileType.PPTX}]],template:_.template(["<table><tbody>","<% _.each(rows, function(row) { %>","<tr>","<% _.each(row, function(item) { %>",'<td><span class="btn-doc-format <%= item.imgCls %>" /></td>',"<% }) %>","</tr>","<% }) %>","</tbody></table>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.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.flatFormats=_.flatten(this.formats),this},onFormatClick:function(e){var t=/\s(\w+)/.exec(e.currentTarget.className);if(t){t=t[1];var n=_.findWhere(this.flatFormats,{imgCls:t});n&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,n.type])}}}),PE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:undefined,template:_.template(["<table><tbody>",'<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>",'<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 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(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.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.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.txtFitSlide},{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.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(e,t){t.value==1&&this.chAutosave.getValue()!=="checked"&&this.chAutosave.setValue(1),this.lblCoAuthMode.text(t.descValue)},this)),this.lblCoAuthMode=$("#fms-lbl-coauth-mode"),this.chAutosave=(new Common.UI.CheckBox({el:$("#fms-chb-autosave"),labelText:this.strAutosave})).on("change",_.bind(function(e,t,n,r){e.getValue()!=="checked"&&this.cmbCoAuthMode.getValue()&&(this.cmbCoAuthMode.setValue(0),this.lblCoAuthMode.text(this.strCoAuthModeDescStrict))},this)),this.lblAutosave=$("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:$("#fms-chb-forcesave"),labelText:this.strForcesave}),this.chAlignGuides=new Common.UI.CheckBox({el:$("#fms-chb-align-guides"),labelText:this.strAlignGuides}),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(e){this.mode=e,$("tr.edit",this.el)[e.isEdit?"show":"hide"](),$("tr.autosave",this.el)[e.isEdit?"show":"hide"](),this.mode.isDesktopApp&&this.mode.isOffline&&(this.chAutosave.setCaption(this.strAutoRecover),this.lblAutosave.text(this.textAutoRecover)),$("tr.forcesave",this.el)[e.canForcesave?"show":"hide"](),$("tr.coauth.changes",this.el)[e.isEdit&&!e.isOffline&&e.canCoAuthoring?"show":"hide"]()},updateSettings:function(){var e=Common.localStorage.getItem("pe-settings-inputmode");this.chInputMode.setValue(e!==null&&parseInt(e)==1),e=Common.localStorage.getItem("pe-settings-zoom"),e=e!==null?parseInt(e):this.mode.customization&&this.mode.customization.zoom?parseInt(this.mode.customization.zoom):-1;var t=this.cmbZoom.store.findWhere({value:e});this.cmbZoom.setValue(t?parseInt(t.get("value")):e>0?e+"%":100),e=Common.localStorage.getItem("pe-settings-coauthmode"),e===null&&Common.localStorage.getItem("pe-settings-autosave")===null&&this.mode.customization&&this.mode.customization.autosave===!1&&(e=0);var n=(e===null||parseInt(e)==1)&&(!this.mode.isDesktopApp||!this.mode.isOffline)&&this.mode.canCoAuthoring;t=this.cmbCoAuthMode.store.findWhere({value:parseInt(e)}),this.cmbCoAuthMode.setValue(t?t.get("value"):1),this.lblCoAuthMode.text(t?t.get("descValue"):this.strCoAuthModeDescFast),e=Common.localStorage.getItem("pe-settings-unit"),t=this.cmbUnit.store.findWhere({value:parseInt(e)}),this.cmbUnit.setValue(t?parseInt(t.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),e=Common.localStorage.getItem("pe-settings-autosave"),e===null&&this.mode.customization&&this.mode.customization.autosave===!1&&(e=0),this.chAutosave.setValue(n||(e===null?this.mode.canCoAuthoring:parseInt(e)==1)),this.mode.canForcesave&&(e=Common.localStorage.getItem("pe-settings-forcesave"),e=e===null?this.mode.canForcesave:parseInt(e)==1,this.chForcesave.setValue(e)),e=Common.localStorage.getItem("pe-settings-showsnaplines"),this.chAlignGuides.setValue(e===null||parseInt(e)==1)},applySettings:function(){Common.localStorage.setItem("pe-settings-inputmode",this.chInputMode.isChecked()?1:0),Common.localStorage.setItem("pe-settings-zoom",this.cmbZoom.getValue()),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("pe-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("pe-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("pe-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("pe-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.localStorage.setItem("pe-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))},strInputMode:"Turn on hieroglyphs",strZoom:"Default Zoom Value",okButtonText:"Apply",txtFitSlide:"Fit to Slide",txtInput:"Alternate Input",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",textAutoSave:"Autosave",strAutosave:"Turn on autosave",strShowChanges:"Realtime Collaboration Changes",txtAll:"View All",txtLast:"View Last",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",txtFitWidth:"Fit to Width",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)"},PE.Views.FileMenuPanels.Settings||{})),PE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:undefined,template:_.template(['<div id="id-recent-view" style="margin: 20px 0;"></div>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu,this.recent=e.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(e,t,n){this.menu&&this.menu.fireEvent("recent:open",[this.menu,n.get("url")])}}),PE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:undefined,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"></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(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.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(e){this.menu&&this.menu.fireEvent("create:new",[this.menu,e.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Presentation",newDescriptionText:"Create a new blank presentation 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"},PE.Views.FileMenuPanels.CreateNew||{})),PE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:undefined,initialize:function(e){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" 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>',"</table>"].join("")),this.menu=e.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.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(e){this.doc=e;if(!this.rendered)return;e=e||{},this.lblTitle.text(e.title?e.title:"-"),e.info?(e.info.author&&this.lblAuthor.text(e.info.author),this._ShowHideInfoItem("author",e.info.author!==undefined&&e.info.author!==null),e.info.created&&this.lblDate.text(e.info.created),this._ShowHideInfoItem("date",e.info.created!==undefined&&e.info.created!==null),e.info.folder&&this.lblPlacement.text(e.info.folder),this._ShowHideInfoItem("placement",e.info.folder!==undefined&&e.info.folder!==null)):this._ShowHideDocInfo(!1)},_ShowHideInfoItem:function(e,t){$("tr."+e,this.el)[t?"show":"hide"]()},_ShowHideDocInfo:function(e){this._ShowHideInfoItem("date",e),this._ShowHideInfoItem("placement",e),this._ShowHideInfoItem("author",e)},setMode:function(e){return this},txtTitle:"Document Title",txtAuthor:"Author",txtPlacement:"Placement",txtDate:"Creation Date"},PE.Views.FileMenuPanels.DocumentInfo||{})),PE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:undefined,initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">','<tr class="rights">','<td class="left" style="vertical-align: top;"><label>'+this.txtRights+"</label></td>",'<td class="right"><div id="id-info-rights"></div></td>',"</tr>",'<tr class="edit-rights">','<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary custom" style="margin-right: 10px;">'+this.txtBtnAccessRights+"</button></td>","</tr>","</table>"].join("")),this.templateRights=_.template(["<table>","<% _.each(users, function(item) { %>","<tr>",'<td><span class="userLink <% if (item.isLink) { %>sharedLink<% } %>"></span><span><%= Common.Utils.String.htmlEncode(item.user) %></span></td>',"<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>","</tr>","<% }); %>","</table>"].join("")),this.menu=e.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(e){this.doc=e;if(!this.rendered)return;e=e||{},e.info?(e.info.sharingSettings&&this.cntRights.html(this.templateRights({users:e.info.sharingSettings})),this._ShowHideInfoItem("rights",e.info.sharingSettings!==undefined&&e.info.sharingSettings!==null&&e.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&this._readonlyRights!==!0)):this._ShowHideDocInfo(!1)},_ShowHideInfoItem:function(e,t){$("tr."+e,this.el)[t?"show":"hide"]()},_ShowHideDocInfo:function(e){this._ShowHideInfoItem("rights",e),this._ShowHideInfoItem("edit-rights",e)},setMode:function(e){return this.sharingSettingsUrl=e.sharingSettingsUrl,this},changeAccessRights:function(e,t,n){if(this._docAccessDlg)return;var r=this;r._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.sharingSettingsUrl}),r._docAccessDlg.on("accessrights",function(e,t){r.doc.info.sharingSettings=t,r._ShowHideInfoItem("rights",r.doc.info.sharingSettings!==undefined&&r.doc.info.sharingSettings!==null&&r.doc.info.sharingSettings.length>0),r.cntRights.html(r.templateRights({users:r.doc.info.sharingSettings}))}).on("close",function(e){r._docAccessDlg=undefined}),r._docAccessDlg.show()},onLostEditRights:function(){this._readonlyRights=!0;if(!this.rendered)return;this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},PE.Views.FileMenuPanels.DocumentRights||{})),PE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:undefined,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(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"UsageInstructions/SetPageParameters.htm",name:"Set page parameters",headername:"Usage Instructions"},{src:"UsageInstructions/CopyPasteUndoRedo.htm",name:"Copy/paste text passages, undo/redo your actions"},{src:"UsageInstructions/LineSpacing.htm",name:"Set paragraph line spacing"},{src:"UsageInstructions/CopyClearFormatting.htm",name:"Copy/clear text formatting"},{src:"UsageInstructions/CreateLists.htm",name:"Create lists"},{src:"UsageInstructions/InsertImages.htm",name:"Insert images"},{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 e=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(e,t,n){n.has("headername")&&$(t.el).before('<div class="header-name">'+n.get("headername")+"</div>")}),this.viewHelpPicker.on("item:select",function(t,n,r){e.iFrame.src=e.urlPref+r.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(t){if(t.type=="help:hyperlink"){var n=t.data,r=e.viewHelpPicker.store.find(function(e){return n.indexOf(e.get("src"))>0});r&&(e.viewHelpPicker.selectRecord(r,!0),e.viewHelpPicker.scrollToRecord(r))}}),$("#id-help-frame").append(this.iFrame),this},setLangConfig:function(e){var t=this,n=this.viewHelpPicker.store;if(e){e=e.split("-")[0];var r={dataType:"json",error:function(){t.urlPref.indexOf("resources/help/en/")<0?(t.urlPref="resources/help/en/",n.url="resources/help/en/Contents.json",n.fetch(r)):(t.urlPref="resources/help/en/",n.reset(t.en_data))},success:function(){var e=n.at(0);t.viewHelpPicker.selectRecord(e),t.iFrame.src=t.urlPref+e.get("src")}};n.url="resources/help/"+e+"/Contents.json",n.fetch(r),this.urlPref="resources/help/"+e+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}})});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Comment",["underscore","backbone","common/main/lib/component/BaseView"],function(e,t){"use strict";Common.Models.Comment=t.Model.extend({defaults:{uid:0,userid:0,username:"Guest",date:undefined,quote:"",comment:"",resolved:!1,lock:!1,lockuserid:"",unattached:!1,id:Common.UI.getId(),time:0,showReply:!1,showReplyInPopover:!1,editText:!1,editTextInPopover:!1,last:undefined,replys:[],hideAddReply:!1,scope:null,hide:!1,hint:!1,dummy:undefined,editable:!0}}),Common.Models.Reply=t.Model.extend({defaults:{time:0,userid:0,username:"Guest",reply:"",date:undefined,id:Common.UI.getId(),editText:!1,editTextInPopover:!1,scope:null,editable:!0}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Comments",["underscore","backbone","common/main/lib/model/Comment"],function(e,t){"use strict";Common.Collections.Comments=t.Collection.extend({model:Common.Models.Comment,clearEditing:function(){this.each(function(e){e.set("editText",!1),e.set("editTextInPopover",!1),e.set("showReply",!1),e.set("showReplyInPopover",!1),e.set("hideAddReply",!1)})},getCommentsReplysCount:function(e){var t=0;return this.each(function(n){n.get("userid")==e&&t++;var r=n.get("replys");r&&r.length>0&&r.forEach(function(n){n.get("userid")==e&&t++})}),t}})});if(Common===undefined)var Common={};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 e(){return typeof Asc.asc_CCommentDataWord!="undefined"?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:undefined,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(e){return-e.get("time")}),this.popoverComments=new Common.Collections.Comments,this.popoverComments&&(this.popoverComments.comparator=function(e){return-e.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(e,t){this.setApi(t),e&&(this.currentUserId=e.config.user.id,this.currentUserName=e.config.user.fullname,this.sdkViewName=e.sdkviewname||this.sdkViewName,this.hintmode=e.hintmode||!1)},setApi:function(e){e&&(this.api=e,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(e){return this.mode=e,this.isModeChanged=!0,this},onCreateComment:function(t,n,r,i,s){if(this.api&&n&&n.length>0){var o=e();o&&(this.showPopover=!0,this.editPopover=r?!0:!1,this.hidereply=i,this.isSelectedComment=!1,this.uids=[],o.asc_putText(n),o.asc_putTime(this.utcDateToString(new Date)),o.asc_putUserId(this.currentUserId),o.asc_putUserName(this.currentUserName),o.asc_putSolved(!1),_.isUndefined(o.asc_putDocumentFlag)||o.asc_putDocumentFlag(s),this.api.asc_addComment(o),this.view.showEditContainer(!1))}this.view.txtComment.focus()},onRemoveComment:function(e){this.api&&e&&this.api.asc_removeComment(e)},onResolveComment:function(t,n){var r=this,i=null,s=null,o=e(),u=r.findComment(t,n);return _.isUndefined(t)&&(t=u.get("uid")),o&&u?(o.asc_putText(u.get("comment")),o.asc_putQuoteText(u.get("quote")),o.asc_putTime(r.utcDateToString(new Date(u.get("time")))),o.asc_putUserId(r.currentUserId),o.asc_putUserName(r.currentUserName),o.asc_putSolved(!u.get("resolved")),_.isUndefined(o.asc_putDocumentFlag)||o.asc_putDocumentFlag(u.get("unattached")),i=u.get("replys"),i&&i.length&&i.forEach(function(t){s=e(),s&&(s.asc_putText(t.get("reply")),s.asc_putTime(r.utcDateToString(new Date(t.get("time")))),s.asc_putUserId(t.get("userid")),s.asc_putUserName(t.get("username")),o.asc_addReply(s))}),r.api.asc_changeComment(t,o),!0):!1},onShowComment:function(e,t){var n=this.findComment(e,undefined);if(n)if(null!==n.get("quote")){if(this.api){if(this.hintmode){this.animate=!0;if(n.get("unattached")&&this.getPopover()){this.getPopover().hide();return}}else{var r=this.popoverComments.findWhere({uid:e});if(r)return}!_.isUndefined(t)&&this.hintmode&&(this.isSelectedComment=t),this.api.asc_selectComment(e),this._dontScrollToComment=!0,this.api.asc_showComment(e,!1)}}else this.hintmode&&this.api.asc_selectComment(e),this.getPopover()&&this.getPopover().hide(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(t,n){if(n&&n.length>0){var r=this,i=null,s=null,o=null,u=e(),a=r.findComment(t);if(a&&u)return u.asc_putText(n),u.asc_putQuoteText(a.get("quote")),u.asc_putTime(r.utcDateToString(new Date(a.get("time")))),u.asc_putUserId(r.currentUserId),u.asc_putUserName(r.currentUserName),u.asc_putSolved(a.get("resolved")),_.isUndefined(u.asc_putDocumentFlag)||u.asc_putDocumentFlag(a.get("unattached")),a.set("editTextInPopover",!1),i=r.findPopupComment(t),i&&i.set("editTextInPopover",!1),r.subEditStrings[t]&&delete r.subEditStrings[t],r.subEditStrings[t+"-R"]&&delete r.subEditStrings[t+"-R"],s=a.get("replys"),s&&s.length&&s.forEach(function(t){o=e(),o&&(o.asc_putText(t.get("reply")),o.asc_putTime(r.utcDateToString(new Date(t.get("time")))),o.asc_putUserId(t.get("userid")),o.asc_putUserName(t.get("username")),u.asc_addReply(o))}),r.api.asc_changeComment(t,u),!0}return!1},onChangeReplyComment:function(t,n,r){if(r&&r.length>0){var i=this,s=null,o=null,u=e(),a=i.findComment(t);if(u&&a)return u.asc_putText(a.get("comment")),u.asc_putQuoteText(a.get("quote")),u.asc_putTime(i.utcDateToString(new Date(a.get("time")))),u.asc_putUserId(a.get("userid")),u.asc_putUserName(a.get("username")),u.asc_putSolved(a.get("resolved")),_.isUndefined(u.asc_putDocumentFlag)||u.asc_putDocumentFlag(a.get("unattached")),s=a.get("replys"),s&&s.length&&s.forEach(function(t){o=e(),o&&(t.get("id")===n&&!_.isUndefined(r)?(o.asc_putText(r),o.asc_putUserId(i.currentUserId),o.asc_putUserName(i.currentUserName)):(o.asc_putText(t.get("reply")),o.asc_putUserId(t.get("userid")),o.asc_putUserName(t.get("username"))),o.asc_putTime(i.utcDateToString(new Date(t.get("time")))),u.asc_addReply(o))}),i.api.asc_changeComment(t,u),!0}return!1},onAddReplyComment:function(t,n){if(n.length>0){var r=this,i=null,s=null,o=null,u=e(),a=r.findComment(t);if(u&&a){i=a.get("uid"),i&&(r.subEditStrings[i]&&delete r.subEditStrings[i],r.subEditStrings[i+"-R"]&&delete r.subEditStrings[i+"-R"],a.set("showReplyInPopover",!1)),u.asc_putText(a.get("comment")),u.asc_putQuoteText(a.get("quote")),u.asc_putTime(r.utcDateToString(new Date(a.get("time")))),u.asc_putUserId(a.get("userid")),u.asc_putUserName(a.get("username")),u.asc_putSolved(a.get("resolved")),_.isUndefined(u.asc_putDocumentFlag)||u.asc_putDocumentFlag(a.get("unattached")),s=a.get("replys"),s&&s.length&&s.forEach(function(t){o=e(),o&&(o.asc_putText(t.get("reply")),o.asc_putTime(r.utcDateToString(new Date(t.get("time")))),o.asc_putUserId(t.get("userid")),o.asc_putUserName(t.get("username")),u.asc_addReply(o))}),o=e();if(o)return o.asc_putText(n),o.asc_putTime(r.utcDateToString(new Date)),o.asc_putUserId(r.currentUserId),o.asc_putUserName(r.currentUserName),u.asc_addReply(o),r.api.asc_changeComment(t,u),!0}}return!1},onRemoveReplyComment:function(t,n){if(!_.isUndefined(t)&&!_.isUndefined(n)){var r=this,i=null,s=null,o=e(),u=r.findComment(t);if(o&&u)return o.asc_putText(u.get("comment")),o.asc_putQuoteText(u.get("quote")),o.asc_putTime(r.utcDateToString(new Date(u.get("time")))),o.asc_putUserId(u.get("userid")),o.asc_putUserName(u.get("username")),o.asc_putSolved(u.get("resolved")),_.isUndefined(o.asc_putDocumentFlag)||o.asc_putDocumentFlag(u.get("unattached")),i=u.get("replys"),i&&i.length&&i.forEach(function(t){t.get("id")!==n&&(s=e(),s&&(s.asc_putText(t.get("reply")),s.asc_putTime(r.utcDateToString(new Date(t.get("time")))),s.asc_putUserId(t.get("userid")),s.asc_putUserName(t.get("username")),o.asc_addReply(s)))}),r.api.asc_changeComment(t,o),!0}return!1},onShowEditReplyComment:function(e,t,n){var r,i,s,o;if(!_.isUndefined(e)&&!_.isUndefined(t))if(n){i=this.popoverComments.findWhere({uid:e});if(i){s=i.get("replys"),o=_.clone(i.get("replys"));if(o)for(r=0;r<o.length;++r)if(t===o[r].get("id"))return o[r].set("editTextInPopover",!0),s.length=0,i.set("replys",o),!0}}else{i=this.collection.findWhere({uid:e});if(i){s=i.get("replys"),o=_.clone(i.get("replys"));if(o)for(r=0;r<o.length;++r)if(t===o[r].get("id"))return o[r].set("editText",!0),s.length=0,i.set("replys",o),!0}}return!1},onUpdateFilter:function(e,t){if(e){this.filter={property:e.property,value:e.value},t||this.getPopover()&&this.getPopover().hide();var n=this,r=null;this.collection.each(function(e){var t=e.get(n.filter.property);t&&e.set("hide",null===t.match(n.filter.value)),e.get("last")&&e.set("last",!1),e.get("hide")||(r=e)}),r&&r.set("last",!0)}},onApiAddComment:function(e,t){var n=this.readSDKComment(e,t);n&&(this.collection.push(n),this.updateComments(!0),this.showPopover&&(null!==t.asc_getQuoteText()&&(this.api.asc_selectComment(e),this._dontScrollToComment=!0,this.api.asc_showComment(e,!0)),this.showPopover=undefined,this.editPopover=!1))},onApiAddComments:function(e){for(var t=0;t<e.length;++t){var n=this.readSDKComment(e[t].asc_getId(),e[t]);this.collection.push(n)}this.updateComments(!0)},onApiRemoveComment:function(e,t){if(this.collection.length){var n=this.collection.findWhere({uid:e});n&&(this.collection.remove(n),t||this.updateComments(!0)),this.popoverComments.length&&(n=this.popoverComments.findWhere({uid:e}),n&&(this.popoverComments.remove(n),0===this.popoverComments.length&&this.getPopover()&&this.getPopover().hide()))}},onChangeComments:function(e){for(var t=0;t<e.length;++t)this.onApiChangeCommentData(e[t].Comment.Id,e[t].Comment,!0);this.updateComments(!0)},onRemoveComments:function(e){for(var t=0;t<e.length;++t)this.onApiRemoveComment(e[t],!0);this.updateComments(!0)},onApiChangeCommentData:function(e,t,n){var r=this,i=0,s=null,o=null,u=0,a=null,f=this.findComment(e);if(f){r=this,s=t.asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(t.asc_getTime())),f.set("comment",t.asc_getText()),f.set("userid",t.asc_getUserId()),f.set("username",t.asc_getUserName()),f.set("resolved",t.asc_getSolved()),f.set("quote",t.asc_getQuoteText()),f.set("time",s.getTime()),f.set("date",r.dateToLocaleTimeString(s)),o=_.clone(f.get("replys")),o.length=0,u=t.asc_getRepliesCount();for(i=0;i<u;++i)a=t.asc_getReply(i).asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(t.asc_getReply(i).asc_getTime())),o.push(new Common.Models.Reply({id:Common.UI.getId(),userid:t.asc_getReply(i).asc_getUserId(),username:t.asc_getReply(i).asc_getUserName(),date:r.dateToLocaleTimeString(a),reply:t.asc_getReply(i).asc_getText(),time:a.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:r.view,editable:r.mode.canEditComments||t.asc_getReply(i).asc_getUserId()==r.currentUserId}));o.sort(function(e,t){return e.get("time")-t.get("time")}),f.set("replys",o),n||(this.updateComments(!1,!0),this.getPopover()&&this.getPopover().isVisible()&&(this._dontScrollToComment=!0,this.api.asc_showComment(e,!0)))}},onApiLockComment:function(e,t){var n=this.findComment(e),r=null,i=null;n&&(r=this.getApplication().getCollection("Common.Collections.Users"),r&&(i=r.findWhere({id:t}),i&&(this.getPopover()&&this.getPopover().saveText(),n.set("lock",!0),n.set("lockuserid",this.view.getUserName(i.get("username"))))))},onApiUnLockComment:function(e){var t=this.findComment(e);t&&(t.set("lock",!1),this.getPopover()&&this.getPopover().loadText())},onApiShowComment:function(e,t,n,r,i,s){this.isModeChanged=!1;if(s&&this.isSelectedComment&&0===_.difference(this.uids,e).length)return;this.mode&&!this.mode.canComments&&(s=!0);if(this.getPopover()){this.clearDummyComment();if(this.isSelectedComment&&0===_.difference(this.uids,e).length){this.api&&(this.getPopover().commentsView.setFocusToTextBox(!0),this.api.asc_enableKeyEvents(!0));return}var o=0,u="",a="",f=null,l="",c=!0;this.popoverComments.reset();for(o=0;o<e.length;++o)u=e[o],a=e[o]+"-R",f=this.findComment(u),this.subEditStrings[u]&&!s?(f.set("editTextInPopover",!0),l=this.subEditStrings[u]):this.subEditStrings[a]&&!s&&(f.set("showReplyInPopover",!0),l=this.subEditStrings[a]),f.set("hint",_.isUndefined(s)?!1:s),!s&&this.hintmode&&(0===_.difference(this.uids,e).length&&this.uids.length===0&&(c=!1),this.oldUids.length&&0===_.difference(this.oldUids,e).length&&(c=!1,this.oldUids=[])),this.animate&&(c=this.animate,this.animate=!1),this.isSelectedComment=!s||!this.hintmode,this.uids=_.clone(e),this.popoverComments.push(f),this._dontScrollToComment||this.view.commentsView.scrollToRecord(f),this._dontScrollToComment=!1;this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(t,n,r),this.getPopover().show(c,!1,!0,l)}},onApiHideComment:function(e){var t=this;if(this.getPopover()){if(this.isSelectedComment&&e)return;if(e&&this.getPopover().isCommentsViewMouseOver())return;this.popoverComments.each(function(e){e.get("editTextInPopover")&&(t.subEditStrings[e.get("uid")]=t.getPopover().getEditText()),e.get("showReplyInPopover")&&(t.subEditStrings[e.get("uid")+"-R"]=t.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(e,t,n,r){var i,s=!1,o=null,u=undefined,a="",f="";if(this.getPopover()){this.getPopover().saveText(),this.getPopover().hideTips();if(n<0||this.getPopover().sdkBounds.height<n||!_.isUndefined(r)&&this.getPopover().sdkBounds.width<r)this.getPopover().hide();else{this.isModeChanged&&this.onApiShowComment(e,t,n,r);if(0===this.popoverComments.length){this.popoverComments.reset();for(i=0;i<e.length;++i)a=e[i],f=e[i]+"-R",o=this.findComment(a),this.subEditStrings[a]?(o.set("editTextInPopover",!0),u=this.subEditStrings[a]):this.subEditStrings[f]&&(o.set("showReplyInPopover",!0),u=this.subEditStrings[f]),this.popoverComments.push(o);s=!0,this.getPopover().show(s,undefined,undefined,u)}else this.getPopover().isVisible()||this.getPopover().show(!1,undefined,undefined,u);this.getPopover().setLeftTop(t,n,r,undefined,!0)}}},onDocumentPlaceChanged:function(){if(this.isDummyComment&&this.getPopover()&&this.getPopover().isVisible()){var e=this.api.asc_getAnchorPosition();e&&this.getPopover().setLeftTop(e.asc_getX()+e.asc_getWidth(),e.asc_getY(),this.hintmode?e.asc_getX():undefined)}},updateComments:function(e,t){var n=this;n.updateCommentsTime=new Date,n.timerUpdateComments===undefined&&(n.timerUpdateComments=setInterval(function(){new Date-n.updateCommentsTime>100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=undefined,n.updateCommentsView(e,t))},25))},updateCommentsView:function(e,t){var n,r=!0;_.isUndefined(t)&&this.collection.sort();if(e){for(n=this.collection.length-1;n>=0;--n)r?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),r=!1;this.onUpdateFilter(this.filter,!0),this.view.render()}this.view.update()},findComment:function(e,t){return _.isUndefined(e)?this.collection.findWhere({id:t}):this.collection.findWhere({uid:e})},findPopupComment:function(e){return this.popoverComments.findWhere({id:e})},closeEditing:function(e){var t=this;if(!_.isUndefined(e)){var n=this.findPopupComment(e);n&&(n.set("editTextInPopover",!1),n.set("showReplyInPopover",!1)),this.subEditStrings[e]&&delete this.subEditStrings[e],this.subEditStrings[e+"-R"]&&delete this.subEditStrings[e+"-R"]}this.collection.clearEditing(),this.collection.each(function(e){var t=_.clone(e.get("replys"));e.get("replys").length=0,t.forEach(function(e){e.get("editText")&&e.set("editText",!1),e.get("editTextInPopover")&&e.set("editTextInPopover",!1)}),e.set("replys",t)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(e){e&&this.mode.canComments&&(e.set("hint",!1),this.api.asc_showComment(e.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(e){this.isSelectedComment=e,e&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return this.view.getPopover(this.sdkViewName)},readSDKComment:function(e,t){var n=t.asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(t.asc_getTime())),r=new Common.Models.Comment({uid:e,userid:t.asc_getUserId(),username:t.asc_getUserName(),date:this.dateToLocaleTimeString(n),quote:t.asc_getQuoteText(),comment:t.asc_getText(),resolved:t.asc_getSolved(),unattached:_.isUndefined(t.asc_getDocumentFlag)?!1:t.asc_getDocumentFlag(),id:Common.UI.getId(),time:n.getTime(),showReply:!1,editText:!1,last:undefined,editTextInPopover:this.editPopover?!0:!1,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?this.showPopover?!0:!1:this.hidereply,scope:this.view,editable:this.mode.canEditComments||t.asc_getUserId()==this.currentUserId});if(r){var i=this.readSDKReplies(t);i.length&&r.set("replys",i)}return r},readSDKReplies:function(e){var t=0,n=[],r=null,i=e.asc_getRepliesCount();if(i){for(t=0;t<i;++t)r=e.asc_getReply(t).asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(e.asc_getReply(t).asc_getTime())),n.push(new Common.Models.Reply({id:Common.UI.getId(),userid:e.asc_getReply(t).asc_getUserId(),username:e.asc_getReply(t).asc_getUserName(),date:this.dateToLocaleTimeString(r),reply:e.asc_getReply(t).asc_getText(),time:r.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:this.view,editable:this.mode.canEditComments||e.asc_getReply(t).asc_getUserId()==this.currentUserId}));n.sort(function(e,t){return e.get("time")-t.get("time")})}return n},addDummyComment:function(){if(this.api){var e=this,t=null,n=new Date,r=this.getPopover();if(r){if(this.popoverComments.length){_.delay(function(){r.commentsView.setFocusToTextBox()},200);return}var i=new Common.Models.Comment({id:-1,time:n.getTime(),date:this.dateToLocaleTimeString(n),userid:this.currentUserId,username:this.currentUserName,editTextInPopover:!0,showReplyInPopover:!1,hideAddReply:!0,scope:this.view,dummy:!0});this.popoverComments.reset(),this.popoverComments.push(i),this.uids=[],this.isSelectedComment=!0,this.isDummyComment=!0,_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||e.api.asc_SetDocumentPlaceChangedEnabled(!0),r.handlerHide=function(){},r.isVisible()&&r.hide(),r.handlerHide=function(){e.clearDummyComment()},t=this.api.asc_getAnchorPosition(),t&&(r.setLeftTop(t.asc_getX()+t.asc_getWidth(),t.asc_getY(),this.hintmode?t.asc_getX():undefined),r.show(!0,!1,!0))}}},onAddDummyComment:function(t){if(this.api&&t&&t.length>0){var n=e();n&&(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(),n.asc_putText(t),n.asc_putTime(this.utcDateToString(new Date)),n.asc_putUserId(this.currentUserId),n.asc_putUserName(this.currentUserName),n.asc_putSolved(!1),_.isUndefined(n.asc_putDocumentFlag)||n.asc_putDocumentFlag(!1),this.api.asc_addComment(n),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 e=this.getPopover();e&&(e.handlerHide=function(){},e.isVisible()&&e.hide()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1)}},onEditComments:function(e){if(this.api){var t=0,n=this,r=null,i=this.api.asc_getAnchorPosition();if(i){this.isSelectedComment=!0,this.popoverComments.reset();for(t=0;t<e.length;++t)r=this.findComment(e[t].asc_getId()),r&&(r.set("editTextInPopover",n.mode.canEditComments),r.set("hint",!1),this.popoverComments.push(r));this.getPopover()&&this.popoverComments.length>0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i.asc_getX()+i.asc_getWidth(),i.asc_getY(),this.hintmode?i.asc_getX():undefined),this.getPopover().show(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var e=$(".new-comment-ct",this.view.el);e&&e.length&&("none"!==e.css("display")&&this.view.txtComment.focus(),this.view.update())}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:(new Date).getTimezoneOffset()*6e4,stringUtcToLocalDate:function(e){return typeof e=="string"?parseInt(e)+this.timeZoneOffsetInMs:0},utcDateToString:function(e){return Object.prototype.toString.call(e)==="[object Date]"?(e.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(e){function t(e){var t,n=e.getHours(),r=e.getMinutes(),i=n>=12?"pm":"am";return n%=12,n=n?n:12,r=r<10?"0"+r:r,t=n+":"+r+" "+i,t}return e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+t(e)}},Common.Controllers.Comments||{}))}),define("common/main/lib/model/User",["backbone"],function(e){"use strict";Common.Models=Common.Models||{},Common.Models.User=e.Model.extend({defaults:{id:undefined,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(e){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=e.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var e=0;return this.each(function(t){t.online&&e++}),e},findUser:function(e){return this.find(function(t){return t.get("id")==e})}}),Common.Collections.HistoryUsers=e.Collection.extend({model:Common.Models.User,findUser:function(e){return this.find(function(t){return t.get("id")==e})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(e){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=e.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(e){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=e.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(e){return this.mode=e,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(e){return this.api=e,this},onUsersChanged:function(e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var t=0;for(i in e)undefined!==i&&t++;if(t>1&&this._isCoAuthoringStopped==undefined){this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect");return}}var n=this.getApplication().getCollection("Common.Collections.Users");if(n){var r=[],i,s;for(i in e)undefined!==i&&(s=e[i],s&&r.push(new Common.Models.User({id:s.asc_getId(),username:s.asc_getUserName(),online:!0,color:s.asc_getColor(),view:s.asc_getView()})));n[n.size()>0?"add":"reset"](r)}},onUserConnection:function(e){var t=this.getApplication().getCollection("Common.Collections.Users");if(t){var n=t.findUser(e.asc_getId());n?n.set({online:e.asc_getState()}):t.add(new Common.Models.User({id:e.asc_getId(),username:e.asc_getUserName(),online:e.asc_getState(),color:e.asc_getColor(),view:e.asc_getView()}))}},onReceiveMessage:function(e,t){var n=this.getApplication().getCollection("Common.Collections.ChatMessages");if(n){var r=[];e.forEach(function(e){r.push(new Common.Models.ChatMessage({userid:e.user,message:e.message,username:e.username}))}),n[n.size()<1||t?"reset":"add"](r)}},onSendMessage:function(e,t){if(t.length>0){var n=function(e,t){var n=[];while(e){if(e.length<t){n.push(e);break}n.push(e.substr(0,t)),e=e.substr(t)}return n},r=this;n(t,2048).forEach(function(e){r.api.asc_coAuthoringChatSendMessage(e)})}},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||{}))});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Plugin",["underscore","backbone","common/main/lib/component/BaseView"],function(e,t){"use strict";Common.Models.PluginVariation=t.Model.extend({defaults:function(){return{description:"",url:"",index:0,icons:undefined,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=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:"",baseUrl:"",guid:Common.UI.getId(),variations:[],currentVariation:0,pluginObj:undefined,allowSelected:!1,selected:!1}}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Plugins",["underscore","backbone","common/main/lib/model/Plugin"],function(e,t){"use strict";Common.Collections.Plugins=t.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(e){return this.api=e,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(e){e.canPlugins&&this.updatePluginsList()},onAfterRender:function(e){e.viewPluginsList.on("item:click",_.bind(this.onSelectPlugin,this)),this.bindViewEvents(this.panelPlugins,this.events);var t=this;Common.NotificationCenter.on({"layout:resizestart":function(e){if(t.panelPlugins.isVisible()){var n=t.panelPlugins.currentPluginFrame.offset();t._moveOffset={x:n.left+parseInt(t.panelPlugins.currentPluginFrame.css("padding-left")),y:n.top+parseInt(t.panelPlugins.currentPluginFrame.css("padding-top"))},t.api.asc_pluginEnableMouseEvents(!0)}},"layout:resizestop":function(e){t.panelPlugins.isVisible()&&t.api.asc_pluginEnableMouseEvents(!1)}})},updatePluginsList:function(){var e=this,t=this.getApplication().getCollection("Common.Collections.Plugins"),n=[];t.each(function(e){var t=new Asc.CPlugin;t.set_Name(e.get("name")),t.set_Guid(e.get("guid")),t.set_BaseUrl(e.get("baseUrl"));var r=e.get("variations"),i=[];r.forEach(function(e){var t=new Asc.CPluginVariation;t.set_Description(e.get("description")),t.set_Url(e.get("url")),t.set_Icons(e.get("icons")),t.set_Visual(e.get("isVisual")),t.set_Viewer(e.get("isViewer")),t.set_EditorsSupport(e.get("EditorsSupport")),t.set_Modal(e.get("isModal")),t.set_InsideMode(e.get("isInsideMode")),t.set_InitDataType(e.get("initDataType")),t.set_InitData(e.get("initData")),t.set_UpdateOleOnResize(e.get("isUpdateOleOnResize")),t.set_Buttons(e.get("buttons")),t.set_Size(e.get("size")),t.set_InitOnSelectionChanged(e.get("initOnSelectionChanged")),i.push(t)}),t.set_Variations(i),e.set("pluginObj",t),n.push(t)}),this.api.asc_pluginsRegister("",n)},onSelectPlugin:function(e,t,n,r){var i=$(r.target);if(i&&i.hasClass("plugin-caret")){var s=this.panelPlugins.pluginMenu;if(s.isVisible()){s.hide();return}var o,u=this,a=$(r.currentTarget),f=$(this.panelPlugins.el),l=a.offset(),c=f.offset();o=[l.left-c.left+a.width(),l.top-c.top+a.height()/2];if(n!=undefined){for(var h=0;h<s.items.length;h++)s.removeItem(s.items[h]),h--;s.removeAll();var p=n.get("variations");for(var h=0;h<p.length;h++){var d=p[h],v=(new Common.UI.MenuItem({caption:h>0?d.get("description"):u.panelPlugins.textStart,value:parseInt(d.get("index"))})).on("click",function(e,t){u.api&&u.api.asc_pluginRun(n.get("guid"),e.value,"")});s.addItem(v)}}var m=f.find("#menu-plugin-container");s.rendered||(m.length<1&&(m=$('<div id="menu-plugin-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',s.id),f.append(m)),s.render(m),s.cmpEl.attr({tabindex:"-1"}),s.on("show:after",function(e){e&&e.menuAlignEl&&e.menuAlignEl.toggleClass("over",!0)}).on("hide:after",function(e){e&&e.menuAlignEl&&e.menuAlignEl.toggleClass("over",!1)})),m.css({left:o[0],top:o[1]}),s.menuAlignEl=a,s.setOffset(-20,-a.height()/2-3),s.show(),_.delay(function(){s.cmpEl.focus()},10),r.stopPropagation(),r.preventDefault()}else this.api.asc_pluginRun(n.get("guid"),0,"")},onPluginShow:function(e,t){var n=e.get_Variations()[t];if(n.get_Visual()){var r=n.get_Url();r=(e.get_BaseUrl().length==0?r:e.get_BaseUrl())+r;if(n.get_InsideMode())this.panelPlugins.openInsideMode(e.get_Name(),r)||this.api.asc_pluginButtonClick(-1);else{var i=this,s=n.get_Buttons(),o={},u=n.get_Size();if(!u||u.length<2)u=[800,600];_.isArray(s)&&_.each(s,function(e,t){o[t]={text:e.text,cls:"custom"+(e.primary?" primary":"")}}),i.pluginDlg=new Common.Views.PluginDlg({title:e.get_Name(),width:u[0],height:u[1],url:r,buttons:o,toolcallback:_.bind(this.onToolClose,this)}),i.pluginDlg.on("render:after",function(e){e.getChild(".footer .dlg-btn").on("click",_.bind(i.onDlgBtnClick,i)),i.pluginContainer=i.pluginDlg.$window.find("#id-plugin-container")}).on("close",function(e){i.pluginDlg=undefined}).on("drag",function(e){i.api.asc_pluginEnableMouseEvents(e[1]=="start")}).on("resize",function(e){i.api.asc_pluginEnableMouseEvents(e[1]=="start")}),i.pluginDlg.show()}}else this.panelPlugins.openNotVisualMode(e.get_Guid())},onPluginClose:function(){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin?this.panelPlugins.closeInsideMode():this.panelPlugins.closeNotVisualMode()},onPluginResize:function(e,t,n,r){if(this.pluginDlg){var i=t&&t.length>1&&n&&n.length>1&&(n[0]>t[0]||n[1]>t[1]||n[0]==0||n[1]==0);this.pluginDlg.setResizable(i,t,n),this.pluginDlg.setInnerSize(e[0],e[1]),r&&r.call()}},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;this.api.asc_pluginButtonClick(parseInt(t))},onToolClose:function(){this.api.asc_pluginButtonClick(-1)},onPluginMouseUp:function(e,t){this.pluginDlg?(this.pluginDlg.binding.dragStop&&this.pluginDlg.binding.dragStop(),this.pluginDlg.binding.resizeStop&&this.pluginDlg.binding.resizeStop()):Common.NotificationCenter.trigger("frame:mouseup",{pageX:e*Common.Utils.zoom()+this._moveOffset.x,pageY:t*Common.Utils.zoom()+this._moveOffset.y})},onPluginMouseMove:function(e,t){if(this.pluginDlg){var n=this.pluginContainer.offset();this.pluginDlg.binding.drag&&this.pluginDlg.binding.drag({pageX:e*Common.Utils.zoom()+n.left,pageY:t*Common.Utils.zoom()+n.top}),this.pluginDlg.binding.resize&&this.pluginDlg.binding.resize({pageX:e*Common.Utils.zoom()+n.left,pageY:t*Common.Utils.zoom()+n.top})}else Common.NotificationCenter.trigger("frame:mousemove",{pageX:e*Common.Utils.zoom()+this._moveOffset.x,pageY:t*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(e){var t={};_.extend(t,{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)},e),this.template=['<div id="id-diagram-editor-container" class="box" style="height:'+(t.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(""),t.tpl=_.template(this.template,t),this.handler=t.handler,this._chartData=null,this._isNewChart=!0,Common.UI.Window.prototype.initialize.call(this,t)},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(e){this._chartData=e,this._isExternalDocReady&&this.fireEvent("setchartdata",this)},setEditMode:function(e){this._isNewChart=!e},isEditMode:function(){return!this._isNewChart},setControlsDisabled:function(e){this.btnSave.setDisabled(e),this.btnCancel.setDisabled(e),e?this.$window.find(".tool.close").addClass("disabled"):this.$window.find(".tool.close").removeClass("disabled")},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;if(this.handler&&this.handler.call(this,t))return;this.hide()},onToolClose:function(){if(this.handler&&this.handler.call(this,"cancel"))return;this.hide()},setHeight:function(e){if(e>=0){var t=parseInt(this.$window.css("min-height"));e<t&&(e=t),this.$window.height(e);var n=this.initConfig.header?parseInt(this.$window.find("> .header").css("height")):0;this.$window.find("> .body").css("height",e-n),this.$window.find("> .body > .box").css("height",e-85);var r=(Common.Utils.innerHeight()-parseInt(e))/2*.9,i=(Common.Utils.innerWidth()-parseInt(this.initConfig.width))/2;this.$window.css("left",i),this.$window.css("top",r)}},textSave:"Save & Exit",textClose:"Close",textTitle:"Chart Editor"},Common.Views.ExternalDiagramEditor||{}))});if(Common===undefined)var Common={};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 e="en",t=undefined,n="",r=null,i=function(){r=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:n,lang:e,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:t,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(e,t){r&&r.serviceCommand("window:drag",t=="start")},this),show:_.bind(function(e){var t=this.diagramEditorView.getHeight(),n=Common.Utils.innerHeight();if(n>t&&t<700||n<t)t=Math.min(n,700),this.diagramEditorView.setHeight(t);r?(r.serviceCommand("setAppDisabled",!1),this.needDisableEditing&&this.diagramEditorView._isExternalDocReady&&this.onDiagrammEditingDisabled(),r.attachMouseEvents()):i.apply(this),this.isExternalEditorVisible=!0,this.isHandlerCalled=!1},this),hide:_.bind(function(e){r&&(r.detachMouseEvents(),this.isExternalEditorVisible=!1)},this)}})},onLaunch:function(){this.diagramEditorView=this.createView("Common.Views.ExternalDiagramEditor",{handler:_.bind(this.handler,this)})},setApi:function(e){return this.api=e,this.api.asc_registerCallback("asc_onCloseChartEditor",_.bind(this.onDiagrammEditingDisabled,this)),this},handler:function(e,t){if(this.isHandlerCalled)return;return this.isHandlerCalled=!0,r&&r.serviceCommand("queryClose",{mr:e}),!0},setChartData:function(){r&&r.serviceCommand("setChartData",this.diagramEditorView._chartData),this.diagramEditorView._chartData=null},loadConfig:function(r){r&&r.config&&(r.config.lang&&(e=r.config.lang),r.config.customization&&(t=r.config.customization),r.config.targetApp&&(n=r.config.targetApp))},onDiagrammEditingDisabled:function(){if(!this.diagramEditorView.isVisible()||!this.diagramEditorView._isExternalDocReady){this.needDisableEditing=!0;return}this.diagramEditorView.setControlsDisabled(!0),Common.UI.alert({title:this.warningTitle,msg:this.warningText,iconCls:"warn",buttons:["ok"],callback:_.bind(function(e){this.setControlsDisabled(!1),this.diagramEditorView.hide()},this)}),this.needDisableEditing=!1},onInternalMessage:function(e){var t=e.data;if(this.diagramEditorView)if(t.type=="documentReady")this.diagramEditorView._isExternalDocReady=!0,this.diagramEditorView._chartData&&(r&&r.serviceCommand("setChartData",this.diagramEditorView._chartData),this.diagramEditorView._chartData=null),this.needDisableEditing&&this.onDiagrammEditingDisabled();else if(t.type=="chartDataReady")this.needDisableEditing===undefined&&this.diagramEditorView.setControlsDisabled(!1);else if(t.type=="shortcut")t.data.key=="escape"&&this.diagramEditorView.hide();else if(t.type=="canClose")t.data.answer===!0&&(r&&(r.serviceCommand("setAppDisabled",!0),r.serviceCommand(t.data.mr=="ok"?"getChartData":"clearChartData")),this.diagramEditorView.hide());else if(t.type=="processMouse"){if(t.data.event=="mouse:up")this.diagramEditorView.binding.dragStop();else if(t.data.event=="mouse:move"){var n=parseInt(this.diagramEditorView.$window.css("left"))+t.data.pagex,i=parseInt(this.diagramEditorView.$window.css("top"))+t.data.pagey+34;this.diagramEditorView.binding.drag({pageX:n,pageY:i})}}else this.diagramEditorView.fireEvent("internalmessage",this.diagramEditorView,t)},onProcessMouse:function(e){e.type=="mouseup"&&this.isExternalEditorVisible&&r&&r.serviceCommand("processmouse",e)},warningTitle:"Warning",warningText:"The object is disabled because of editing by another user.",textClose:"Close",textAnonymous:"Anonymous"}}(),Common.Controllers.ExternalDiagramEditor||{}))});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",jsziputils:"../vendor/jszip-utils/jszip-utils.min",jsrsasign:"../vendor/jsrsasign/jsrsasign-latest-all-min",allfonts:"../../sdkjs/common/AllFonts",sdk:"../../sdkjs/slide/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","jsziputils","jsrsasign"]},gateway:{deps:["jquery"]},analytics:{deps:["jquery"]}}}),require(["backbone","bootstrap","core","sdk","api","analytics","gateway","locale"],function(e,t,n){e.history.start();var r=new e.Application({nameSpace:"PE",autoCreate:!1,controllers:["Viewport","DocumentHolder","Toolbar","Statusbar","RightMenu","LeftMenu","Main","Common.Controllers.Fonts","Common.Controllers.Chat","Common.Controllers.Comments","Common.Controllers.Plugins","Common.Controllers.ExternalDiagramEditor"]});Common.Locale.apply(),require(["presentationeditor/main/app/controller/Viewport","presentationeditor/main/app/controller/DocumentHolder","presentationeditor/main/app/controller/Toolbar","presentationeditor/main/app/controller/Statusbar","presentationeditor/main/app/controller/RightMenu","presentationeditor/main/app/controller/LeftMenu","presentationeditor/main/app/controller/Main","presentationeditor/main/app/view/FileMenuPanels","presentationeditor/main/app/view/ParagraphSettings","presentationeditor/main/app/view/ImageSettings","presentationeditor/main/app/view/ShapeSettings","presentationeditor/main/app/view/SlideSettings","presentationeditor/main/app/view/TableSettings","presentationeditor/main/app/view/TextArtSettings","common/main/lib/util/utils","common/main/lib/util/LocalStorage","common/main/lib/controller/Fonts","common/main/lib/controller/Comments","common/main/lib/controller/Chat","common/main/lib/controller/Plugins","presentationeditor/main/app/view/ChartSettings","common/main/lib/controller/ExternalDiagramEditor"],function(){r.start()})},function(e){if(e.requireType=="timeout"&&!reqerr){var t=function(){var e,t=/\+/g,n=/([^&=]+)=?([^&]*)/g,r=function(e){return decodeURIComponent(e.replace(t," "))},i=window.location.search.substring(1),s={};while(e=n.exec(i))s[r(e[1])]=r(e[2]);return s},n=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")},r=(t().lang||"en").split("-")[0];r=="de"?reqerr="Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.":r=="es"?reqerr="La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.":r=="fr"?reqerr="La connexion est trop lente, certains des composants n'ons pas pu être chargé. Veuillez recharger la page.":r=="ru"?reqerr="Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.":reqerr="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/presentationeditor/main/app.js",function(){}); |